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() = default;
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 
118  int GetFirstTick();
119 
127  bool GetTimelineInterval(int currentTick, int &interval);
128 
133  void SetStartTick(float starttick) { m_StartTick = starttick; }
134 
136  float GetStartTick() { return m_StartTick; }
137 
145  virtual bool Evaluate (float currentTick, int &interval, float &fraction);
146 
148  HBhvAnimation *GetAnimation() { return m_pAnimation; }
149 
151  float GetCurrentTick() { return m_CurrentTick; }
152 
157  void SetInstancedTimeline(HBhvTimeline *timeline) { m_pInstancedTimeline = timeline; }
158 
165  void Adjust(int time, int delta, bool doall = true);
173  void AdjustRelative(int time, int delta);
174 
177  float GetCurrentRelativeTick() { return m_CurrentRelativeTick; }
178 
183  void SetCurrentRelativeTick(float tick) { m_CurrentRelativeTick = tick; }
184 
185 
186 
187 protected:
194  int AddKeyframeInternal(int t, bool *doesExist);
201  float AdjustTickToTimeline(float tick);
202  VArray< int > m_pTimelineArray;
203 
206 
207  float m_StartTick;
210  private:
211 };
212 
213 
214 
215 #ifdef H_PACK_8
216 #pragma pack(pop)
217 #endif
218 
219 #endif
220 
221 
222 
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:157
float GetCurrentTick()
Definition: HBhvTimeline.h:151
void DeleteKeyframe(int keyframe)
void SetCurrentRelativeTick(float tick)
Definition: HBhvTimeline.h:183
VArray< int > m_pTimelineArray
This is for internal use only.
Definition: HBhvTimeline.h:202
int GetTimelineArrayLength()
Definition: HBhvTimeline.h:75
float GetCurrentRelativeTick()
Definition: HBhvTimeline.h:177
float GetStartTick()
Definition: HBhvTimeline.h:136
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:148
float m_CurrentRelativeTick
This is for internal use only.
Definition: HBhvTimeline.h:209
HBhvTimeline * m_pInstancedTimeline
This is for internal use only.
Definition: HBhvTimeline.h:205
static void * XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData)
void SetStartTick(float starttick)
Definition: HBhvTimeline.h:133
float m_CurrentTick
This is for internal use only.
Definition: HBhvTimeline.h:208
int GetFirstTick()
HBhvAnimation * m_pAnimation
This is for internal use only.
Definition: HBhvTimeline.h:204
float m_StartTick
This is for internal use only.
Definition: HBhvTimeline.h:207
void SetTimeline(HBhvTimeline *timeline)