Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HBhvTimeline Class Reference

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

#include <HBhvTimeline.h>

List of all members.

Public Member Functions

int AddKeyframe (int t)
int AddKeyframe (int t, bool &doesExist)
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 ( HBhvAnimation animation = 0  ) 

Constructs an HBhvTimeline object.

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


Member Function Documentation

int HBhvTimeline::AddKeyframe ( int  t  ) 

Adds a new keyframe to the timeline.

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

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

Adds a new keyframe to the timeline.

Parameters:
t The keyframe time in ticks.
doesExist Pass by reference. Returns true if a keyframe time already exists in the timeline.
Returns:
The number of the newly created keyframe.

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

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

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

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

Adjusts the given keyframe time by the passed delta value.

Parameters:
time The time of the keyframe to begin the adjustment.
delta The number of ticks to offset the given time.
doall Pass true ripple the effect to all keyframes after the given time.

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:
time The time of the keyframe to begin the adjustment.
delta The number of ticks to offset the given time.

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:
tick The time in ticks to be adjusted.
Returns:
The newly adjusted time.

int HBhvTimeline::CheckKeyframe ( int  t  ) 

This method searches for keyframe based the given time.

Parameters:
t Time 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.

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:
animation Animation that the created timeline instance should reference
Returns:
The newly created timeline instance.

int HBhvTimeline::DeleteKeyframe ( int  t  ) 

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

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

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

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

Parameters:
currentTick Current Time int tps
interval Returns the keyframe interval which was closest to the currentTick.
fraction Returns 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.

HBhvAnimation* HBhvTimeline::GetAnimation (  )  [inline]

Returns:
A pointer to the associated animation object.

float HBhvTimeline::GetCurrentRelativeTick (  )  [inline]

Returns:
Current tick relative to the properties in this timeline. This value takes into account start time and looping.

float HBhvTimeline::GetCurrentTick (  )  [inline]

Returns:
The current tick for this timeline.

int HBhvTimeline::GetLastTick (  ) 

Returns:
The last time value of keyframe time array.

float HBhvTimeline::GetStartTick (  )  [inline]

Returns:
The start time for this time line.

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.

int HBhvTimeline::GetTimelineArrayLength (  )  [inline]

Returns:
The length of the timeline array. This is the number of keyframes in the timeline.

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

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

Parameters:
currentTick The time that we are searching for the closest interval.
interval Returns 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.

void HBhvTimeline::Serialize ( HUtilityXMLGenerator *  xmlgen  ) 

Write XML Data to buffer

void HBhvTimeline::SetAnimation ( HBhvAnimation animation  )  [inline]

Sets the animation that this timeline is associated with.

Parameters:
animation Pointer to Animation

void HBhvTimeline::SetCurrentRelativeTick ( float  tick  )  [inline]

Sets current relative time position.

Parameters:
tick Relative Time Position

void HBhvTimeline::SetInstancedTimeline ( HBhvTimeline timeline  )  [inline]

Sets the timeline instance.

Parameters:
timeline Instanced Timeline

void HBhvTimeline::SetStartTick ( float  starttick  )  [inline]

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

Parameters:
starttick Start Tick

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

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

Parameters:
timeline The array of ticks representing the new timeline.
length The number of entries in the passed timeline.

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: