The HBhvTimeline class encpasulates an animation timeline. More...

#include <HBhvTimeline.h>

Public Member Functions

int AddKeyframe (int t, bool &doesExist)
 
int AddKeyframe (int t)
 
void Adjust (int time, int delta, bool doall=true)
 
void AdjustRelative (int time, int delta)
 
int CheckKeyframe (int t)
 
HBhvTimelineCreateInstance (HBhvAnimation *animation)
 
int DeleteKeyframe (int t)
 
virtual bool Evaluate (float currentTick, int &interval, float &fraction)
 
HBhvAnimationGetAnimation ()
 
float GetCurrentRelativeTick ()
 
float GetCurrentTick ()
 
int GetLastTick ()
 
float GetStartTick ()
 
int * GetTimelineArray ()
 
int GetTimelineArrayLength ()
 
bool GetTimelineInterval (int currentTick, int &interval)
 
 HBhvTimeline (HBhvAnimation *animation=0)
 
void Serialize (HUtilityXMLGenerator *xmlgen)
 
void SetAnimation (HBhvAnimation *animation)
 
void SetCurrentRelativeTick (float tick)
 
void SetInstancedTimeline (HBhvTimeline *timeline)
 
void SetStartTick (float starttick)
 
void SetTimeline (const int *timeline, int length)
 

Static Public Member Functions

static void * XMLCallback (HUtilityXMLTag *xt, bool open, void *m_pExtraData)
 

Protected Member Functions

int AddKeyframeInternal (int t, bool *doesExist)
 
float AdjustTickToTimeline (float tick)
 

Protected Attributes

float m_CurrentRelativeTick
 This is for internal use only.
 
float m_CurrentTick
 This is for internal use only.
 
HBhvAnimationm_pAnimation
 This is for internal use only.
 
HBhvTimelinem_pInstancedTimeline
 This is for internal use only.
 
VArray< int > m_pTimelineArray
 This is for internal use only.
 
float m_StartTick
 This is for internal use only.
 

Detailed Description

The HBhvTimeline class encpasulates an animation timeline.

Each animation consists of one timeline and multiple interpolators. The timeline is an array of ascending values measured in ticks with each value representing one keyframe of the animation.

Constructor & Destructor Documentation

◆ HBhvTimeline()

HBhvTimeline::HBhvTimeline ( HBhvAnimation animation = 0)

Constructs an HBhvTimeline object.

Parameters
animationA pointer to the animation that this timeline is associated with.

Member Function Documentation

◆ AddKeyframe() [1/2]

int HBhvTimeline::AddKeyframe ( int  t,
bool &  doesExist 
)

Adds a new keyframe to the timeline.

Parameters
tThe keyframe time in ticks.
doesExistPass by reference. Returns true if a keyframe time already exists in the timeline.
Returns
The number of the newly created keyframe.

◆ AddKeyframe() [2/2]

int HBhvTimeline::AddKeyframe ( int  t)

Adds a new keyframe to the timeline.

Parameters
tThe keyframe time in ticks.
Returns
The number of the newly created keyframe.

◆ AddKeyframeInternal()

int HBhvTimeline::AddKeyframeInternal ( int  t,
bool *  doesExist 
)
protected

Add keyframe interval to timeline. This method is for internal use.

Parameters
tPosition where to add interval.
doesExistReturns true if interval already exist or false if interval does not exist.
Returns
Position of the newly inserted interval.

◆ Adjust()

void HBhvTimeline::Adjust ( int  time,
int  delta,
bool  doall = true 
)

Adjusts the given keyframe time by the passed delta value.

Parameters
timeThe time of the keyframe to begin the adjustment.
deltaThe number of ticks to offset the given time.
doallPass true ripple the effect to all keyframes after the given time.

◆ AdjustRelative()

void HBhvTimeline::AdjustRelative ( int  time,
int  delta 
)

Adjust Timeline based on delta value relative to current time. In other words, the timeline will be offset by the pass delta value for all the keyframe interval at the given time and all the keyframe intervals after that time.

Parameters
timeThe time of the keyframe to begin the adjustment.
deltaThe number of ticks to offset the given time.

◆ AdjustTickToTimeline()

float HBhvTimeline::AdjustTickToTimeline ( float  tick)
protected

For the given tick, this method returns a tick that has been adjusted to for the timeline. It takes into account factors such as start time and if the animation is looped.

Parameters
tickThe time in ticks to be adjusted.
Returns
The newly adjusted time.

◆ CheckKeyframe()

int HBhvTimeline::CheckKeyframe ( int  t)

This method searches for keyframe based the given time.

Parameters
tTime in ticks of the keyframe to be searched for.
Returns
The position of the keyframe associated with the given time or -1 if no keyframe could be found.

◆ CreateInstance()

HBhvTimeline* HBhvTimeline::CreateInstance ( HBhvAnimation animation)

In special cases, you might want to reference this timeline without changing it. To create a new timeline that references this timeline, use this method and pass a pointer to the animation you want associated with the new timeline.

Parameters
animationAnimation that the created timeline instance should reference
Returns
The newly created timeline instance.

◆ DeleteKeyframe()

int HBhvTimeline::DeleteKeyframe ( int  t)

This method deletes the keyframe associated with the given time t from the timeline.

Parameters
tTime in ticks of the keyframe to delete.
Returns
The position of the deleted keyframe or -1 if no keyframe was found and deleted.

◆ Evaluate()

virtual bool HBhvTimeline::Evaluate ( float  currentTick,
int &  interval,
float &  fraction 
)
virtual

Calculates the keyframe position and fraction value based on the current time.

Parameters
currentTickCurrent Time int tps
intervalReturns the keyframe interval which was closest to the currentTick.
fractionReturns fraction to next keyframe which will be a value between 0 and 1.
Returns
True if a valid keyframe interval was found and false if no valid keyframe was found.

◆ GetAnimation()

HBhvAnimation* HBhvTimeline::GetAnimation ( )
inline
Returns
A pointer to the associated animation object.

◆ GetCurrentRelativeTick()

float HBhvTimeline::GetCurrentRelativeTick ( )
inline
Returns
Current tick relative to the properties in this timeline. This value takes into account start time and looping.

◆ GetCurrentTick()

float HBhvTimeline::GetCurrentTick ( )
inline
Returns
The current tick for this timeline.

◆ GetLastTick()

int HBhvTimeline::GetLastTick ( )
Returns
The last time value of keyframe time array.

◆ GetStartTick()

float HBhvTimeline::GetStartTick ( )
inline
Returns
The start time for this time line.

◆ GetTimelineArray()

int* HBhvTimeline::GetTimelineArray ( )
inline
Returns
The timeline array which contains a list of the keyframe times. Note this is for read-only purposes. If you want to modify the timeline, use the methods provided by this class.

◆ GetTimelineArrayLength()

int HBhvTimeline::GetTimelineArrayLength ( )
inline
Returns
The length of the timeline array. This is the number of keyframes in the timeline.

◆ GetTimelineInterval()

bool HBhvTimeline::GetTimelineInterval ( int  currentTick,
int &  interval 
)

This method find the keyframe interval that is closet to the current time.

Parameters
currentTickThe time that we are searching for the closest interval.
intervalReturns interval that is closet to the current time.
Returns
True if the currentTick is inside the timeline's range and false if the currentTick is outside the timeline's range.

◆ Serialize()

void HBhvTimeline::Serialize ( HUtilityXMLGenerator *  xmlgen)

Write XML Data to buffer

◆ SetAnimation()

void HBhvTimeline::SetAnimation ( HBhvAnimation animation)
inline

Sets the animation that this timeline is associated with.

Parameters
animationPointer to Animation

◆ SetCurrentRelativeTick()

void HBhvTimeline::SetCurrentRelativeTick ( float  tick)
inline

Sets current relative time position.

Parameters
tickRelative Time Position

◆ SetInstancedTimeline()

void HBhvTimeline::SetInstancedTimeline ( HBhvTimeline timeline)
inline

Sets the timeline instance.

Parameters
timelineInstanced Timeline

◆ SetStartTick()

void HBhvTimeline::SetStartTick ( float  starttick)
inline

Set the start time for the timeline. All keyframes are evaluated based on the start time.

Parameters
starttickStart Tick

◆ SetTimeline()

void HBhvTimeline::SetTimeline ( const int *  timeline,
int  length 
)

This method replaces a timeline array with array of integer values.

Parameters
timelineThe array of ticks representing the new timeline.
lengthThe number of entries in the passed timeline.

◆ XMLCallback()

static void* HBhvTimeline::XMLCallback ( HUtilityXMLTag *  xt,
bool  open,
void *  m_pExtraData 
)
static

This is XML read callback which parses XML data and then populates the member variables with the associated values.


The documentation for this class was generated from the following file: