class
AnimationClip
Contains animation curves for translation/rotation/scale of scene objects/skeleton bones, as well as curves for generic property animation.
Public
Methods
~AnimationClip
GetCurves
SetCurves
A set of all curves stored in the animation.
Returned value will not be updated if the animation clip curves are added or removed, as it is a copy of clip's internal values.
GetEvents
SetEvents
A set of all events to be triggered as the animation is playing.
GetRootMotion
Returns a set of curves containing motion of the root bone.
This allows the user to evaluate the root bone animation curves manually, instead of through the normal animation process. This property is only available if animation clip was imported with root motion import enabled.
HasRootMotion
Checks if animation clip has root motion curves separate from the normal animation curves.
GetBoneMapping
Maps skeleton bone names to animation curve names, and returns a set of indices that can be easily used for locating an animation curve based on the bone index.
- skeleton
- Skeleton to create the mapping for.
- outMapping
- Pre-allocated array that will receive output animation clip indices. The array must be large enough to store an index for every bone in the . Bones that have no related animation curves will be assigned value -1.
GetCurveMapping
Attempts to find translation/rotation/scale curves with the specified name and fills the mapping structure with their indices, which can then be used for quick lookup.
- name
- Name of the curves to look up.
- outMapping
- Triple containing the translation/rotation/scale indices of the found curves. Indices will be -1 for curves that haven't been found.
GetMorphMapping
Attempts to find a generic curve with the specified name and fills output with found index, which can then be used for quick lookup.
- name
- Name of the curve to look up.
- outFrameIndex
- Index of the curve animating the morph shape frames, or -1 if not found.
- outWeightIndex
- Index of the curve animating the channel weight, or -1 if not found.
IsAdditive
Checks are the curves contained within the clip additive.
Additive clips are intended to be added on top of other clips.
GetLength
Returns the length of the animation clip, in seconds.
GetSampleRate
SetSampleRate
Number of samples per second the animation clip curves were sampled at.
This value is not used by the animation clip or curves directly since unevenly spaced keyframes are supported. But it can be of value when determining the original sample rate of an imported animation or similar.
GetVersion
Returns a version that can be used for detecting modifications on the clip by external systems.
Whenever the clip is modified the version is increased by one.
staticCreate
Creates an animation clip with no curves.
After creation make sure to register some animation curves before using it.
staticCreate
Creates an animation clip with specified curves.
- curves
- Curves to initialize the animation with.
- isAdditive
- Determines does the clip contain additive curve data. This will change the behaviour how is the clip blended with other animations.
- sampleRate
- If animation uses evenly spaced keyframes, number of samples per second. Not relevant if keyframes are unevenly spaced.
- rootMotion
- Optional set of curves that can be used for animating the root bone. Not used by the animation system directly but is instead provided to the user for manual evaluation.
staticGetRttiStatic
staticCreateEmpty
Creates an AnimationClip with no data.
You must populate its data manually followed by a call to Initialize().
Internal
Methods
staticCreatePtrInternal
Creates a new AnimationClip without initializing it.
Use create() for normal use.
Protected
Constructors
AnimationClip
AnimationClip
Methods
Initialize
Initializes all the internal data of this object.
Must be called right after construction for new objects, or after deserialization for deserialized objects. If requested, render proxy is created and queued for initialization on the render thread.
BuildNameMapping
Creates a name -> curve index mapping for quicker curve lookup by name.
CalculateLength
Calculate the length of the clip based on assigned curves.
Fields
mVersion
mCurves
Contains all the animation curves in the clip.
It's important this field is immutable so it may be used on other threads. This means any modifications to the field will require a brand new data structure to be generated and all existing data copied (plus the modification).
mRootMotion
A set of curves containing motion of the root bone.
If this is non-empty it should be true that mCurves does not contain animation curves for the root bone. Root motion will not be evaluated through normal animation process but is instead provided for the user for manual evaluation.
mNameMapping
Contains a map from curve name to curve index.
Indices are stored as specified in CurveType enum.