HBhvTimeline.h
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
10 #ifndef _H_HBhvTimeline_H
11 #define _H_HBhvTimeline_H
12 
13 #ifdef H_PACK_8
14 #pragma pack(push)
15 #pragma pack(8)
16 #endif
17 
18 #include "HTools.h"
19 #include "varray.h"
20 
21 
22 class HBhvTimelineInstance;
23 class HUtilityXMLGenerator;
24 class HUtilityXMLTag;
25 class HBhvAnimation;
26 
27 
28 #ifdef WINDOWS_SYSTEM
29 template class MVO_API VArray< int >;
30 #endif
31 
33 
38 class MVO_API HBhvTimeline
39 {
40 public:
45  HBhvTimeline(HBhvAnimation *animation = 0);
46  virtual ~HBhvTimeline() { };
47 
53  void SetTimeline(const int *timeline, int length);
54 
59  void SetAnimation(HBhvAnimation *animation) { m_pAnimation = animation; }
60 
69 
72  int * GetTimelineArray() { return &m_pTimelineArray[0]; }
73 
75  int GetTimelineArrayLength() { return (int)m_pTimelineArray.Count(); }
76 
83  int AddKeyframe(int t, bool &doesExist);
89  int AddKeyframe(int t);
95  int DeleteKeyframe(int t);
96 
102  int CheckKeyframe(int t);
103 
107  void Serialize(HUtilityXMLGenerator *xmlgen);
108 
112  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData);
113 
115  int GetLastTick();
116 
124  bool GetTimelineInterval(int currentTick, int &interval);
125 
130  void SetStartTick(float starttick) { m_StartTick = starttick; }
131 
133  float GetStartTick() { return m_StartTick; }
134 
142  virtual bool Evaluate (float currentTick, int &interval, float &fraction);
143 
145  HBhvAnimation *GetAnimation() { return m_pAnimation; }
146 
148  float GetCurrentTick() { return m_CurrentTick; }
149 
154  void SetInstancedTimeline(HBhvTimeline *timeline) { m_pInstancedTimeline = timeline; }
155 
162  void Adjust(int time, int delta, bool doall = true);
170  void AdjustRelative(int time, int delta);
171 
174  float GetCurrentRelativeTick() { return m_CurrentRelativeTick; }
175 
180  void SetCurrentRelativeTick(float tick) { m_CurrentRelativeTick = tick; }
181 
182 
183 
184 protected:
191  int AddKeyframeInternal(int t, bool *doesExist);
198  float AdjustTickToTimeline(float tick);
199  VArray< int > m_pTimelineArray;
200 
203 
204  float m_StartTick;
207  private:
208 };
209 
210 
211 
212 #ifdef H_PACK_8
213 #pragma pack(pop)
214 #endif
215 
216 #endif
217 
218 
219 
The HBhvTimeline class encpasulates an animation timeline.
Definition: HBhvTimeline.h:38
void SetAnimation(HBhvAnimation *animation)
Definition: HBhvTimeline.h:59
void SetInstancedTimeline(HBhvTimeline *timeline)
Definition: HBhvTimeline.h:154
float GetCurrentTick()
Definition: HBhvTimeline.h:148
void DeleteKeyframe(int keyframe)
void SetCurrentRelativeTick(float tick)
Definition: HBhvTimeline.h:180
VArray< int > m_pTimelineArray
This is for internal use only.
Definition: HBhvTimeline.h:199
int GetTimelineArrayLength()
Definition: HBhvTimeline.h:75
float GetCurrentRelativeTick()
Definition: HBhvTimeline.h:174
float GetStartTick()
Definition: HBhvTimeline.h:133
HBhvAnimation * CreateInstance()
int * GetTimelineArray()
Definition: HBhvTimeline.h:72
virtual void Serialize(HUtilityXMLGenerator *xmlgen, HUtilityXMLTag *xmlt)
The HBhvAnimation class defines an animation.
Definition: HBhvAnimation.h:43
HBhvAnimation * GetAnimation()
Definition: HBhvTimeline.h:145
float m_CurrentRelativeTick
This is for internal use only.
Definition: HBhvTimeline.h:206
HBhvTimeline * m_pInstancedTimeline
This is for internal use only.
Definition: HBhvTimeline.h:202
static void * XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData)
void SetStartTick(float starttick)
Definition: HBhvTimeline.h:130
float m_CurrentTick
This is for internal use only.
Definition: HBhvTimeline.h:205
HBhvAnimation * m_pAnimation
This is for internal use only.
Definition: HBhvTimeline.h:201
float m_StartTick
This is for internal use only.
Definition: HBhvTimeline.h:204
void SetTimeline(HBhvTimeline *timeline)