AnimationClip
A complete animation clip (e.g. "Walk", "Run", "Idle")
- Module
- Animation
- Header
#include "Animation/AnimationClip.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
AnimationClip() = default | AnimationClip |
Public functions
| Returns | Name | Description |
|---|---|---|
const std::string& | GetName | |
void | SetName | |
const std::string& | GetAssetId | The id of the AnimSequence package the clip was read from, empty for a clip that came out of a model's render data. |
void | SetAssetId | |
int32_t | FindIndex | The clip a reference names among clips: the AnimSequence package id first — whatever the clip is called and wherever the model lists it — then the name. |
float | GetDuration | |
void | SetDuration | |
float | GetTicksPerSecond | |
void | SetTicksPerSecond | |
void | AddChannel | |
const std::vector<AnimationChannel>& | GetChannels | |
std::vector<AnimationChannel>& | GetChannels | |
FAnimCompressionStats | CompressTracks | Quantize every track into the compressed representation the sampler decodes from. |
FAnimCompressionStats | CompressTracks | |
bool | HasCompressedTracks | |
const std::vector<FCompressedAnimChannel>& | GetCompressedChannels | |
const std::vector<uint8_t>& | GetCompressedBlob | |
uint64_t | GetCompressedBytes | |
void | SetCompressedTracks | Adopt an already-encoded clip (the .mmodel cook path). |
void | DecompressTracks | Rebuild float keys from the compressed tracks and drop the compressed form. |
void | AddMorphChannel | |
const std::vector<MorphChannel>& | GetMorphChannels | |
std::vector<MorphChannel>& | GetMorphChannels | |
bool | HasMorphChannels | |
float | SampleMorphChannel | |
void | AddCurve | |
const std::vector<FAnimCurve>& | GetCurves | |
std::vector<FAnimCurve>& | GetCurves | |
bool | HasCurves | |
float | EvaluateCurve | Linear sample of a named curve; fallback when the clip has no such track. |
float | SampleCurveKeys | |
void | AddEvent | |
const std::vector<AnimationEvent>& | GetEvents | |
std::vector<AnimationEvent>& | GetEvents | |
const std::vector<AnimSyncMarker>& | GetSyncMarkers | Sync markers, kept sorted by time (AddSyncMarker inserts in order). |
std::vector<AnimSyncMarker>& | GetSyncMarkers | |
void | AddSyncMarker | |
bool | HasSyncMarkers | |
bool | FindMarkerSegment | Which marker segment timeTicks falls in. |
bool | ResolveMarkerSegment | The inverse: the time in THIS clip at the same position in the same named segment. |
void | AddNotify | |
const std::vector<AnimNotify>& | GetNotifies | |
std::vector<AnimNotify>& | GetNotifies | |
void | AddNotifyState | |
const std::vector<AnimNotifyState>& | GetNotifyStates | |
std::vector<AnimNotifyState>& | GetNotifyStates | |
void | GetFiredNotifies | Notifies whose time is crossed between prevTime and currTime (ticks), handling loop wrapping — same rule as GetFiredEvents. |
void | GetFiredNotifyStateEdges | Begin/end edges of ranged notify states crossed this frame. |
void | GetActiveNotifyStates | Every notify state whose [begin,end) window contains timeTicks — the per-frame Tick phase, so a window-shaped notify (trace sweep, timed buff) can act continuously between its Begin and End edges. |
const std::vector<FMotionWarpWindow>& | GetWarpWindows | |
std::vector<FMotionWarpWindow>& | GetWarpWindows | |
void | GetFiredEvents | Get events that fire between prevTime and currTime (in ticks), handling loop wrapping |
void | BindToSkeleton | Resolve bone indices from skeleton bone names |
Function details
AnimationClip
AnimationClip() = defaultGetName
const std::string& GetName() constSetName
void SetName(const std::string& name)GetAssetId
const std::string& GetAssetId() constThe id of the AnimSequence package the clip was read from, empty for a clip that came out of a model's render data. A controller state that names this id finds the clip whatever its name or position.
SetAssetId
void SetAssetId(const std::string& id)FindIndex
static int32_t FindIndex(const std::vector<Ref<AnimationClip>>& clips, const std::string& id, const std::string& name)The clip a reference names among clips: the AnimSequence package id first — whatever the clip is called and wherever the model lists it — then the name. -1 when neither resolves. An index is not a reference: a reimport or a shared skeleton reorders the list.
GetDuration
float GetDuration() constSetDuration
void SetDuration(float duration)GetTicksPerSecond
float GetTicksPerSecond() constSetTicksPerSecond
void SetTicksPerSecond(float tps)AddChannel
void AddChannel(AnimationChannel&& channel)GetChannels
const std::vector<AnimationChannel>& GetChannels() constGetChannels
std::vector<AnimationChannel>& GetChannels()CompressTracks
FAnimCompressionStats CompressTracks(const FAnimCompressionSettings& settings, bool discardRawKeys)Quantize every track into the compressed representation the sampler decodes from. discardRawKeys frees the float key arrays afterwards — that is where the runtime memory actually goes; the channel list itself stays so bone names, bone indices and channel identity survive. Anything that still needs float keys (key reduction, DDC hashing over source data, tooling) must run BEFORE this, or call DecompressTracks.
CompressTracks
FAnimCompressionStats CompressTracks()HasCompressedTracks
bool HasCompressedTracks() constGetCompressedChannels
const std::vector<FCompressedAnimChannel>& GetCompressedChannels() constGetCompressedBlob
const std::vector<uint8_t>& GetCompressedBlob() constGetCompressedBytes
uint64_t GetCompressedBytes() constSetCompressedTracks
void SetCompressedTracks(std::vector<FCompressedAnimChannel>&& channels, std::vector<uint8_t>&& blob)Adopt an already-encoded clip (the .mmodel cook path). The channel list must already be sized to match, since bone identity lives there.
DecompressTracks
void DecompressTracks()Rebuild float keys from the compressed tracks and drop the compressed form. Lossless only for tracks that fell back to Raw; a quantized track comes back within its authored tolerance, not bit-exact.
AddMorphChannel
void AddMorphChannel(MorphChannel&& channel)GetMorphChannels
const std::vector<MorphChannel>& GetMorphChannels() constGetMorphChannels
std::vector<MorphChannel>& GetMorphChannels()HasMorphChannels
bool HasMorphChannels() constSampleMorphChannel
static float SampleMorphChannel(const MorphChannel& channel, float timeInTicks)AddCurve
void AddCurve(FAnimCurve&& curve)GetCurves
const std::vector<FAnimCurve>& GetCurves() constGetCurves
std::vector<FAnimCurve>& GetCurves()HasCurves
bool HasCurves() constEvaluateCurve
float EvaluateCurve(const std::string& name, float timeInTicks, float fallback = 0.0f) constLinear sample of a named curve; fallback when the clip has no such track. Same key interpolation as morph channels.
SampleCurveKeys
static float SampleCurveKeys(const std::vector<MorphKey>& keys, float timeInTicks)AddEvent
void AddEvent(const AnimationEvent& event)GetEvents
const std::vector<AnimationEvent>& GetEvents() constGetEvents
std::vector<AnimationEvent>& GetEvents()GetSyncMarkers
const std::vector<AnimSyncMarker>& GetSyncMarkers() constSync markers, kept sorted by time (AddSyncMarker inserts in order).
GetSyncMarkers
std::vector<AnimSyncMarker>& GetSyncMarkers()AddSyncMarker
void AddSyncMarker(const AnimSyncMarker& marker)HasSyncMarkers
bool HasSyncMarkers() constFindMarkerSegment
bool FindMarkerSegment(float timeTicks, AnimMarkerSegment& out) constWhich marker segment timeTicks falls in. The last marker wraps to the first ACROSS the loop point, so a time before the first marker or after the last is inside that wrapping segment rather than outside every one. False when the clip carries fewer than two markers.
ResolveMarkerSegment
bool ResolveMarkerSegment(const AnimMarkerSegment& segment, float& outTimeTicks) constThe inverse: the time in THIS clip at the same position in the same named segment. False when this clip has no such pair — the caller then falls back to phase sync rather than snapping to an unrelated marker.
AddNotify
void AddNotify(const AnimNotify& notify)GetNotifies
const std::vector<AnimNotify>& GetNotifies() constGetNotifies
std::vector<AnimNotify>& GetNotifies()AddNotifyState
void AddNotifyState(const AnimNotifyState& state)GetNotifyStates
const std::vector<AnimNotifyState>& GetNotifyStates() constGetNotifyStates
std::vector<AnimNotifyState>& GetNotifyStates()GetFiredNotifies
void GetFiredNotifies(float prevTimeTicks, float currTimeTicks, bool looping, std::vector<const AnimNotify*>& outNotifies) constNotifies whose time is crossed between prevTime and currTime (ticks), handling loop wrapping — same rule as GetFiredEvents.
GetFiredNotifyStateEdges
void GetFiredNotifyStateEdges(float prevTimeTicks, float currTimeTicks, bool looping, std::vector<FFiredNotifyStateEdge>& outEdges) constBegin/end edges of ranged notify states crossed this frame.
GetActiveNotifyStates
void GetActiveNotifyStates(float timeTicks, std::vector<const AnimNotifyState*>& outActive) constEvery notify state whose [begin,end) window contains timeTicks — the per-frame Tick phase, so a window-shaped notify (trace sweep, timed buff) can act continuously between its Begin and End edges.
GetWarpWindows
const std::vector<FMotionWarpWindow>& GetWarpWindows() constGetWarpWindows
std::vector<FMotionWarpWindow>& GetWarpWindows()GetFiredEvents
void GetFiredEvents(float prevTimeTicks, float currTimeTicks, bool looping, std::vector<const AnimationEvent*>& outEvents) constGet events that fire between prevTime and currTime (in ticks), handling loop wrapping
BindToSkeleton
void BindToSkeleton(const class Skeleton& skeleton)Resolve bone indices from skeleton bone names