class
Animation
Handles animation playback.
Takes one or multiple animation clips as input and evaluates them every animation update tick depending on set properties. The evaluated data is used by the render thread for skeletal animation, by the main thread for updating attached scene objects and bones (if skeleton is attached), or the data is made available for manual queries in the case of generic animation.
Public
Constructors
Animation
Methods
SetDefaultClip
Determines the default clip to play as soon as the component is enabled.
GetDefaultClip
SetWrapMode
Determines the wrap mode for all active animations.
Wrap mode determines what happens when animation reaches the first or last frame.
GetWrapMode
SetSpeed
Determines the speed for all animations.
The default value is 1.0f. Use negative values to play-back in reverse.
GetSpeed
Play
Plays the specified animation clip.
BlendAdditive
Plays the specified animation clip on top of the animation currently playing in the main layer.
Multiple such clips can be playing at once, as long as you ensure each is given its own layer. Each animation can also have a weight that determines how much it influences the main animation.
- clip
- Clip to additively blend. Must contain additive animation curves.
- weight
- Determines how much of an effect will the blended animation have on the final output. In range [0, 1].
- fadeLength
- Applies the blend over a specified time period, increasing the weight as the time passes. Set to zero to blend immediately. In seconds.
- layer
- Layer to play the clip in. Multiple additive clips can be playing at once in separate layers and each layer has its own weight.
Blend1D
Blend multiple animation clips between each other using linear interpolation.
Unlike normal animations these animations are not advanced with the progress of time, and is instead expected the user manually changes the
parameter.
- info
- Information about the clips to blend. Clip positions must be sorted from lowest to highest.
- alpha
- Parameter that controls the blending. Range depends on the positions of the provided animation clips.
Blend2D
Blend four animation clips between each other using bilinear interpolation.
Unlike normal animations these animations are not advanced with the progress of time, and is instead expected the user manually changes the
parameter.
- info
- Information about the clips to blend.
- alpha
- Parameter that controls the blending, in range [(0, 0), (1, 1)]. alpha = (0, 0) means top left animation has full influence, alpha = (1, 0) means top right animation has full influence, alpha = (0, 1) means bottom left animation has full influence, alpha = (1, 1) means bottom right animation has full influence.
CrossFade
Fades the specified animation clip in, while fading other playing animation out, over the specified time period.
- clip
- Clip to fade in.
- fadeLength
- Determines the time period over which the fade occurs. In seconds.
Sample
Samples an animation clip at the specified time, displaying only that particular frame without further playback.
Stop
Stops playing all animations on the provided layer.
Specify ~0u to stop animation on the main layer (non-additive animations).
StopAll
Stops playing all animations.
IsPlaying
Checks if any animation clips are currently playing.
GetState
Retrieves detailed information about a currently playing animation clip.
- clip
- Clip to retrieve the information for.
- outState
- Animation clip state containing the requested information. Only valid if the method returns true.
Returns: True if the state was found (animation clip is playing), false otherwise.
SetState
Changes the state of a playing animation clip.
If animation clip is not currently playing the playback is started for the clip.
- clip
- Clip to change the state for.
- state
- New state of the animation (e.g. changing the time for seeking).
SetMorphChannelWeight
Changes a weight of a single morph channel, determining how much of it to apply on top of the base mesh.
- name
- Name of the morph channel to modify. This depends on the mesh the animation is currently animating.
- weight
- Weight that determines how much of the channel to apply to the mesh, in range [0, 1].
SetCustomBounds
Determines bounds that will be used for animation and mesh culling.
Only relevant if SetUseCustomBounds() is set to true.
GetCustomBounds
SetUseCustomBounds
Determines should animation bounds be used for visibility determination (culling).
If false the bounds of the mesh attached to the relevant Renderable component will be used instead.
GetUseCustomBounds
SetEnableCull
Enables or disables culling of the animation when out of view.
Culled animation will not be evaluated.
GetEnableCull
Checks whether the animation will be evaluated when it is out of view.
GetClipCount
Returns the total number of animation clips influencing this animation.
GetClip
Returns one of the animation clips influencing this animation.
- index
- Sequential index of the animation clip to retrieve.
Returns: Animation clip at the specified index, or null if the index is out of range.
staticGetRttiStatic
Fields
OnEventTriggered
Triggered whenever an animation event is reached.
Internal
Methods
GetAnimationId
Returns the unique ID for this animation object.
SetSkeleton
Changes the skeleton which will the translation/rotation/scale animation values manipulate.
If no skeleton is set the animation will only evaluate the generic curves, and the root translation/rotation/scale curves.
SetMorphShapes
Sets morph shapes that can be used for per-vertex blending animation.
After they're set call setMorphShapeWeight() to apply morph shapes.
SetMask
Sets a mask that allows certain bones from the skeleton to be disabled.
Caller must ensure that the mask matches the skeleton assigned to the animation.
AddBone
Registers a new bone component, creating a new transform mapping from the bone name to the scene object the component is attached to.
RemoveBone
Unregisters a bone component, removing the bone -> scene object mapping.
NotifyBoneNameChanged
Called whenever the bone name the Bone component points to changes.
GetAnimatesRoot
Checks if any currently set animation clips perform animation of the root bone.
RegisterRenderable
Registers a Renderable component with the animation, should be called whenever a Renderable component is added to the same scene object as this component.
UnregisterRenderable
Removes renderable from the animation component.
Should be called when a Renderable component is removed from this scene object.
UpdateBounds
Re-applies the bounds to the internal animation object, and the relevant renderable object if one exists.
RefreshClipMappingsInternal
Rebuilds internal curve -> property mapping about the currently playing animation clip.
This mapping allows the animation component to know which property to assign which values from an animation curve. This should be called whenever playback for a new clip starts, or when clip curves change.
GetGenericCurveValueInternal
Retrieves an evaluated value for a generic curve with the specified index.
- curveIndex
- The curve index referencing a set of curves from the first playing animation clip. Generic curves from all other clips are ignored.
- outValue
- Value of the generic curve. Only valid if the method return true.
Returns: True if the value was retrieved successfully. The method might fail if animation update didn't yet have a chance to execute and values are not yet available, or if the animation clip changed since the last frame (the last problem can be avoided by ensuring to read the curve values before changing the clip).
TogglePreviewModeInternal
Preview mode allows certain operations on the component to be allowed (like basic animation playback), even when the component is not actively running.
This is intended for use primarily by the animation editor. Preview mode ends automatically when the component is enabled (i.e. starts running normally), or when explicitly disabled. Returns true if the preview mode was enabled (which could fail if the component is currently running). When previewing, you can only run the animation using Sample() or directly by setting state, all other playback commands will be ignored.
Fields
ScriptRebuildFloatPropertiesInternal
Triggered when the list of properties animated via generic animation curves needs to be recreated (script only).
ScriptUpdateFloatPropertiesInternal
Triggered when generic animation curves values need be applied to the properties they effect (script only).
ScriptOnEventTriggeredInternal
Triggers a callback in script code when animation event is triggered (script only).
Protected
Constructors
Animation
Methods
OnDestroyed
Called once just before the component is destroyed.
Called regardless of the state the component is in.
Update
Called once per frame.
Only called if the component is in Running state.
OnDisabled
Called every time a component is placed into the Stopped state.
This includes component destruction if component wasn't already in Stopped state during destruction. When called during destruction it is called before OnDestroyed.
OnEnabled
Called every time a component leaves the Stopped state, if the component is enabled.
This includes component creation if requirements for leaving the Stopped state are met. When called during creation it is called after OnBeginPlay.
OnTransformChanged
Called when the component's parent scene object has changed.
Not called if the component is in Stopped state. Also only called if necessary notify flags are set via SetNotifyFlagsInternal().
CreateAnimationProxy
Creates the internal animation proxy and registers it with the animation scene.
Animation without a proxy cannot be played.
DestroyAnimationProxy
Destroys the internal animation proxy.
Animation without a proxy cannot be played.
IsAnimationProxyValid
Returns true if the animation proxy is created and registered with the animation scene.
If false, animation cannot play.
NotifyAnimationEventTriggered
Callback triggered whenever an animation event is triggered.
RebuildBoneMappings
Finds any scene objects that are mapped to bone transforms.
Such object's transforms will be affected by skeleton bone animation.
RebuildGenericMappings
Finds any curves that affect a transform of a specific scene object, and ensures that animation properly updates those transforms.
This does not include curves referencing bones.
FindChildBones
Searches child scene objects for Bone components and returns any found ones.
TriggerEvents
Triggers any events between the last frame and current one.
- timeDelta
- Time elapsed since the last call to this method.
UpdateAnimationProxy
Updates the animation proxy object based on the currently set skeleton, playing clips and dirty flags.
- timeDelta
- Seconds passed since the last call to this method.
UpdateFromProxy
Applies any outputs stored in the animation proxy (as written by the animation thread), and uses them to update the animation state on the main thread.
Caller must ensure that the animation thread has finished with the animation proxy.
GetOrCreateClipInfo
Registers a new animation in the specified layer, or returns an existing animation clip info if the animation is already registered.
If is true any existing animations in the layer will be stopped. Layout will be marked as dirty if any changes were made.
GetListenerResources
Retrieves all the resources that the class depends on.
NotifyResourceLoaded
Called when a resource has been fully loaded.
NotifyResourceChanged
Called when the internal resource the resource handle is pointing to changes.