Nebula
Loading...
Searching...
No Matches
Animation::AnimJob Class Reference

#include <animjob.h>

Detailed Description

Descibes a single animation sampling job in the AnimController.

AnimJob objects have a start time and a duration and are arranged in parallel tracks. The sampling results of parallel AnimJobs at a given point in time are mixed into a single resulting animation by the AnimController. Subclasses of AnimJob are used to implement specific tasks like a lookat-controller, IK, and so forth...

FIXME: the current implementation of setting an absolute evaluation time doesn't allow to manipulate the playback speed (for this, advancing the time by a relative amount would be better).

(C) 2008 Radon Labs GmbH (C) 2013-2018 Individual contributors, see AUTHORS file

Inherits Core::RefCounted.

Inherited by Animation::PlayClipJob.

Public Member Functions

 AnimJob ()
 constructor
virtual ~AnimJob ()
 destructor
void SetName (const Util::StringAtom &id)
 set human readable name (only used for debugging)
const Util::StringAtomGetName () const
 get human readable name (only used for debugging)
bool IsAttachedToSequencer () const
 return true if the job is currently attached to a sequencer
bool IsActive (Timing::Tick time) const
 return true if the job has currently playing (EvalTime within start/end time)
bool IsPending (Timing::Tick time) const
 return true if the job has been queued for playback but has not started yet
bool IsStoppingOrExpired (Timing::Tick time) const
 return true if anim job is stopping or expired
bool IsExpired (Timing::Tick time) const
 return true when the job has expired
bool IsPaused () const
 returns true if the clip is playing, but has been paused
void SetTrackIndex (IndexT trackIndex)
 set track index, defines blend priority and relationship to other jobs on same track
IndexT GetTrackIndex () const
 get track index
void SetEnqueueMode (AnimJobEnqueueMode::Code enqueueMode)
 set the enqueue behaviour of the new job (default is intercept)
AnimJobEnqueueMode::Code GetEnqueueMode () const
 get the enqueue behaviour of the new job
void SetExclusiveTag (IndexT id)
 exclusive tag (for AnimJobEnqueueMode::IgnoreIfSameExclTagActive)
IndexT GetExclusiveTag () const
 exclusive flag set?
void SetStartTime (Timing::Tick time)
 set the start time of the anim job (relative to base time)
Timing::Tick GetStartTime () const
 get the start time of the anim job (relative to base time)
void SetDuration (Timing::Tick time)
 set the duration of the anim job (0 == infinite)
Timing::Tick GetDuration () const
 get the duration of the anim job
bool IsInfinite () const
 return true if the anim job is infinite
void SetFadeInTime (Timing::Tick fadeInTime)
 set the fade-in time of the anim job
Timing::Tick GetFadeInTime () const
 get the fade-in time of the anim job
void SetFadeOutTime (Timing::Tick fadeOutTime)
 set the fade-out time of the anim job
Timing::Tick GetFadeOutTime () const
 get the fade-out time of the anim job
void SetTime (Timing::Tick time)
 jump to a specific time in the job
Timing::Tick GetTime () const
 get current time of anim job
void SetTimeFactor (float timeFactor)
 set time factor
float GetTimeFactor () const
 get time factor
void SetTimeOffset (Timing::Tick timeOffset)
 set sample time offset (if sampling should not start at the beginning)
Timing::Tick GetTimeOffset () const
 get sample time offset
void SetBlendWeight (float w)
 set blend weight of the anim job (default is 1.0)
float GetBlendWeight () const
 get blend weight of the anim job
void SetMask (const Characters::CharacterJointMask *mask)
 set joint mask
const Characters::CharacterJointMask * GetMask () const
 get joint mask
Timing::Tick GetAbsoluteStartTime () const
 get the absolute start time (BaseTime + StartTime)
Timing::Tick GetAbsoluteEndTime () const
 get the absolute end time (BaseTime + StartTime + Duration)
Timing::Tick GetAbsoluteStopTime () const
 get the absolute, computed end time ((BaseTime + StartTime + Duration) - FadeOutTime)
Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Protected Member Functions

void SetBaseTime (Timing::Tick time)
 set the base time of the anim job (set by sequencer when job is attached)
Timing::Tick GetBaseTime () const
 get the base time of the anim job
virtual void OnAttachedToSequencer (const AnimSequencer &animSequencer)
 called when attached to anim sequencer
virtual void OnRemoveFromSequencer ()
 called when removed from sequencer
float ComputeBlendWeight (Timing::Tick relEvalTime) const
 compute current blend weight, this should take fade-in into account
void FixFadeTimes ()
 fix fade-in/fade-out times if the sum is bigger then the play duration
virtual Ptr< Jobs::Job > CreateEvaluationJob (Timing::Tick time, const Ptr< CoreAnimation::AnimSampleBuffer > &mixIn, const Ptr< CoreAnimation::AnimSampleBuffer > &result)
 create evaluation job for asynchronous evaluation
virtual Util::Array< AnimEventInfoEmitAnimEvents (Timing::Tick startTime, Timing::Tick endTime, const Util::String &optionalCatgeory)
 emit anim events inside given time range
virtual void UpdateTimes (Timing::Tick time)
 compute sample time for next evaluation, always done, also if character isn't visible and no evaluation takes place
virtual void Stop (Timing::Tick time)
 stop the anim job at the given time
virtual void Pause (bool pause)
 pause the anim job at the given time
Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)

Protected Attributes

const AnimSequenceranimSequencer
const Characters::CharacterJointMask * mask
Util::StringAtom name
AnimJobEnqueueMode::Code enqueueMode
IndexT trackIndex
IndexT exclusiveTag
Timing::Tick baseTime
Timing::Tick startTime
Timing::Tick duration
Timing::Tick fadeInTime
Timing::Tick fadeOutTime
Timing::Tick curRelEvalTime
Timing::Tick lastRelEvalTime
Timing::Tick curSampleTime
Timing::Tick lastSampleTime
Timing::Tick timeOffset
float timeFactor
float blendWeight
bool isPaused

Private Member Functions

 __DeclareClass (AnimJob)

Friends

class AnimSequencer

Additional Inherited Members

Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)

Constructor & Destructor Documentation

◆ AnimJob()

Animation::AnimJob::AnimJob ( )

constructor

◆ ~AnimJob()

Animation::AnimJob::~AnimJob ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Animation::AnimJob::__DeclareClass ( AnimJob )
private

◆ ComputeBlendWeight()

float Animation::AnimJob::ComputeBlendWeight ( Timing::Tick relEvalTime) const
protected

compute current blend weight, this should take fade-in into account

This is a helper method for subclasses and returns the current blend weight for the current relative evaluation time, taking the fade-in and fade-out phases into account.

◆ CreateEvaluationJob()

Ptr< Job > Animation::AnimJob::CreateEvaluationJob ( Timing::Tick time,
const Ptr< CoreAnimation::AnimSampleBuffer > & mixIn,
const Ptr< CoreAnimation::AnimSampleBuffer > & result )
protectedvirtual

create evaluation job for asynchronous evaluation

This method is called by the AnimSequencer when this job is active (the current eval time is between the start and end time of the job).

The AnimJob object is expected to fill the provided AnimSampleBuffer with a result (sampled keys and sample counts, the sample counts indicate whether a given sample contributes to the final blended result. If the mixIn pointer is valid, the method must perform animation mixing as well.

This method is usually implemented by subclasses.

Reimplemented in Animation::PlayClipJob.

◆ EmitAnimEvents()

Util::Array< AnimEventInfo > Animation::AnimJob::EmitAnimEvents ( Timing::Tick startTime,
Timing::Tick endTime,
const Util::String & optionalCatgeory )
protectedvirtual

emit anim events inside given time range

Reimplemented in Animation::PlayClipJob.

◆ FixFadeTimes()

void Animation::AnimJob::FixFadeTimes ( )
protected

fix fade-in/fade-out times if the sum is bigger then the play duration

This method checks if the fade-in plus the fade-out times would be bigger then the play-duration, if yes it will fix the fade times in order to prevent "blend-popping".

◆ GetAbsoluteEndTime()

Timing::Tick Animation::AnimJob::GetAbsoluteEndTime ( ) const

get the absolute end time (BaseTime + StartTime + Duration)

Return the absolute end time (BaseTime + StartTime + Duration).

Method fails hard if AnimJob is infinite.

◆ GetAbsoluteStartTime()

Timing::Tick Animation::AnimJob::GetAbsoluteStartTime ( ) const

get the absolute start time (BaseTime + StartTime)

Returns the absolute start time (BaseTime + StartTime).

◆ GetAbsoluteStopTime()

Timing::Tick Animation::AnimJob::GetAbsoluteStopTime ( ) const

get the absolute, computed end time ((BaseTime + StartTime + Duration) - FadeOutTime)

Returns the absolute end time before the fadeout-phase starts ((BaseTime + StartTime + Duration) - FadeOut).

◆ GetBaseTime()

Timing::Tick Animation::AnimJob::GetBaseTime ( ) const
inlineprotected

get the base time of the anim job

◆ GetBlendWeight()

float Animation::AnimJob::GetBlendWeight ( ) const
inline

get blend weight of the anim job

◆ GetDuration()

Timing::Tick Animation::AnimJob::GetDuration ( ) const
inline

get the duration of the anim job

◆ GetEnqueueMode()

AnimJobEnqueueMode::Code Animation::AnimJob::GetEnqueueMode ( ) const
inline

get the enqueue behaviour of the new job

◆ GetExclusiveTag()

IndexT Animation::AnimJob::GetExclusiveTag ( ) const
inline

exclusive flag set?

◆ GetFadeInTime()

Timing::Tick Animation::AnimJob::GetFadeInTime ( ) const
inline

get the fade-in time of the anim job

◆ GetFadeOutTime()

Timing::Tick Animation::AnimJob::GetFadeOutTime ( ) const
inline

get the fade-out time of the anim job

◆ GetMask()

const Characters::CharacterJointMask * Animation::AnimJob::GetMask ( ) const
inline

get joint mask

◆ GetName()

const Util::StringAtom & Animation::AnimJob::GetName ( ) const
inline

get human readable name (only used for debugging)

◆ GetStartTime()

Timing::Tick Animation::AnimJob::GetStartTime ( ) const
inline

get the start time of the anim job (relative to base time)

◆ GetTime()

Timing::Tick Animation::AnimJob::GetTime ( ) const
inline

get current time of anim job

◆ GetTimeFactor()

float Animation::AnimJob::GetTimeFactor ( ) const
inline

get time factor

◆ GetTimeOffset()

Timing::Tick Animation::AnimJob::GetTimeOffset ( ) const
inline

get sample time offset

◆ GetTrackIndex()

IndexT Animation::AnimJob::GetTrackIndex ( ) const
inline

get track index

◆ IsActive()

bool Animation::AnimJob::IsActive ( Timing::Tick time) const

return true if the job has currently playing (EvalTime within start/end time)

This method will return true if the current eval time is between the start time and end time of the anim job.

◆ IsAttachedToSequencer()

bool Animation::AnimJob::IsAttachedToSequencer ( ) const

return true if the job is currently attached to a sequencer

◆ IsExpired()

bool Animation::AnimJob::IsExpired ( Timing::Tick time) const

return true when the job has expired

This method will return true if the current eval time is greater then the end time of the job.

◆ IsInfinite()

bool Animation::AnimJob::IsInfinite ( ) const
inline

return true if the anim job is infinite

◆ IsPaused()

bool Animation::AnimJob::IsPaused ( ) const
inline

returns true if the clip is playing, but has been paused

◆ IsPending()

bool Animation::AnimJob::IsPending ( Timing::Tick time) const

return true if the job has been queued for playback but has not started yet

This method will return true as long as the current eval time is before the start time (the job hasn't started yet).

◆ IsStoppingOrExpired()

bool Animation::AnimJob::IsStoppingOrExpired ( Timing::Tick time) const

return true if anim job is stopping or expired

Return true if the anim job is currently in or after the fade-out phase.

◆ OnAttachedToSequencer()

void Animation::AnimJob::OnAttachedToSequencer ( const AnimSequencer & animSequencer)
protectedvirtual

called when attached to anim sequencer

Reimplemented in Animation::PlayClipJob.

◆ OnRemoveFromSequencer()

void Animation::AnimJob::OnRemoveFromSequencer ( )
protectedvirtual

called when removed from sequencer

◆ Pause()

void Animation::AnimJob::Pause ( bool pause)
protectedvirtual

pause the anim job at the given time

Pause the anim job at the given time.

Unpauses if already paused.

◆ SetBaseTime()

void Animation::AnimJob::SetBaseTime ( Timing::Tick time)
inlineprotected

set the base time of the anim job (set by sequencer when job is attached)

◆ SetBlendWeight()

void Animation::AnimJob::SetBlendWeight ( float w)
inline

set blend weight of the anim job (default is 1.0)

◆ SetDuration()

void Animation::AnimJob::SetDuration ( Timing::Tick time)
inline

set the duration of the anim job (0 == infinite)

◆ SetEnqueueMode()

void Animation::AnimJob::SetEnqueueMode ( AnimJobEnqueueMode::Code enqueueMode)
inline

set the enqueue behaviour of the new job (default is intercept)

◆ SetExclusiveTag()

void Animation::AnimJob::SetExclusiveTag ( IndexT id)
inline

◆ SetFadeInTime()

void Animation::AnimJob::SetFadeInTime ( Timing::Tick fadeInTime)
inline

set the fade-in time of the anim job

◆ SetFadeOutTime()

void Animation::AnimJob::SetFadeOutTime ( Timing::Tick fadeOutTime)
inline

set the fade-out time of the anim job

◆ SetMask()

void Animation::AnimJob::SetMask ( const Characters::CharacterJointMask * mask)
inline

set joint mask

◆ SetName()

void Animation::AnimJob::SetName ( const Util::StringAtom & id)
inline

set human readable name (only used for debugging)

◆ SetStartTime()

void Animation::AnimJob::SetStartTime ( Timing::Tick time)
inline

set the start time of the anim job (relative to base time)

◆ SetTime()

void Animation::AnimJob::SetTime ( Timing::Tick time)
inline

jump to a specific time in the job

◆ SetTimeFactor()

void Animation::AnimJob::SetTimeFactor ( float timeFactor)
inline

set time factor

◆ SetTimeOffset()

void Animation::AnimJob::SetTimeOffset ( Timing::Tick timeOffset)
inline

set sample time offset (if sampling should not start at the beginning)

◆ SetTrackIndex()

void Animation::AnimJob::SetTrackIndex ( IndexT trackIndex)
inline

set track index, defines blend priority and relationship to other jobs on same track

◆ Stop()

void Animation::AnimJob::Stop ( Timing::Tick time)
protectedvirtual

stop the anim job at the given time

Stop the anim job at the given time.

This will just update the duration member.

◆ UpdateTimes()

void Animation::AnimJob::UpdateTimes ( Timing::Tick time)
protectedvirtual

compute sample time for next evaluation, always done, also if character isn't visible and no evaluation takes place

Updates evaluation times.

Must be done every frame, even if character is not visible and so animjob is not evaluated.

◆ AnimSequencer

friend class AnimSequencer
friend

Member Data Documentation

◆ animSequencer

const AnimSequencer* Animation::AnimJob::animSequencer
protected

◆ baseTime

Timing::Tick Animation::AnimJob::baseTime
protected

◆ blendWeight

float Animation::AnimJob::blendWeight
protected

◆ curRelEvalTime

Timing::Tick Animation::AnimJob::curRelEvalTime
protected

◆ curSampleTime

Timing::Tick Animation::AnimJob::curSampleTime
protected

◆ duration

Timing::Tick Animation::AnimJob::duration
protected

◆ enqueueMode

AnimJobEnqueueMode::Code Animation::AnimJob::enqueueMode
protected

◆ exclusiveTag

IndexT Animation::AnimJob::exclusiveTag
protected

◆ fadeInTime

Timing::Tick Animation::AnimJob::fadeInTime
protected

◆ fadeOutTime

Timing::Tick Animation::AnimJob::fadeOutTime
protected

◆ isPaused

bool Animation::AnimJob::isPaused
protected

◆ lastRelEvalTime

Timing::Tick Animation::AnimJob::lastRelEvalTime
protected

◆ lastSampleTime

Timing::Tick Animation::AnimJob::lastSampleTime
protected

◆ mask

const Characters::CharacterJointMask* Animation::AnimJob::mask
protected

◆ name

Util::StringAtom Animation::AnimJob::name
protected

◆ startTime

Timing::Tick Animation::AnimJob::startTime
protected

◆ timeFactor

float Animation::AnimJob::timeFactor
protected

◆ timeOffset

Timing::Tick Animation::AnimJob::timeOffset
protected

◆ trackIndex

IndexT Animation::AnimJob::trackIndex
protected

The documentation for this class was generated from the following files:
  • /github/workspace/code/render/animation/animjob.h
  • /github/workspace/code/render/animation/animjob.cc