Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HBhvAnimation.h
1 //
2 // Copyright (c) 2000 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 // $Id: dace8013066cdbf6aae0c57075f29aa8249c94c0 $
13 //
14 #ifndef _H_HBhvAnimation_H
15 #define _H_HBhvAnimation_H
16 
17 #ifdef H_PACK_8
18 #pragma pack(push)
19 #pragma pack(8)
20 #endif
21 
22 #include "HTools.h"
23 #include "HBhvUtility.h"
24 #include "HEventListener.h"
25 
27 class HBhvTimeline;
28 class HBhvTimelineInstance;
29 class HBhvInterpolator;
30 class HBhvInterpolatorInstance;
31 class HUtilityXMLGenerator;
32 class HUtilityXMLTag;
33 class HKeyframe;
34 class HBhvTargetObject;
35 class HBhvAnimationInstance;
36 
37 
39 
47 class MVO_API HBhvAnimation
48 {
49 public:
55  HBhvAnimation(const char *name, HBhvBehaviorManager * BehaviorManager, HBhvAnimation *parentanimation = 0);
56 
58  virtual ~HBhvAnimation();
59 
61  virtual const char * GetType() { return "HBhvAnimation"; }
62 
63 
65  const char * GetName() { return m_Name; }
66 
68  void SetName(const char *name);
69 
72  virtual bool Animate(float currenttime);
73 
77  virtual bool Animate(float currenttime, float starttime);
78 
82  void DeleteKeyframe(int keyframe);
83 
87  void DuplicateNextOrPrevious(int keyframe, bool next);
88 
92  void Duplicate(int newkeyframe, int oldkeyframe);
93 
97  void PlotCurve(bool rotations);
98 
100  void AdjustToTick(int totalticks);
101 
103  virtual void Serialize(HUtilityXMLGenerator *xmlgen, HUtilityXMLTag *xmlt);
105  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
106 
110  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData);
111 
113  HBhvBehaviorManager * GetBehaviorManager() { return m_pBehaviorManager; }
114 
116  void SetBehaviorManager(HBhvBehaviorManager *behaviourmanager) { m_pBehaviorManager = behaviourmanager; }
117 
119  int GetFirstTick();
120 
122  int GetLastTick();
123 
126  int GetLoop() { return m_Loop; }
127 
131  void SetLoop(int loop) { m_Loop = loop; }
132 
134  HBhvTimeline *GetTimeline() { return m_pTimeline; }
135 
138  void SetTimeline( HBhvTimeline *timeline);
139 
143  HBhvAnimation * CreateInstance();
144 
146  struct vlist_s * GetInterpolatorList() { return m_InterpolatorList; }
147 
149  struct vlist_s * GetChildAnimationList() { return m_ChildAnimationList; }
150 
152  HBhvInterpolator *GetInterpolator();
153 
156  void AddInterpolator(HBhvInterpolator *interpolator);
157 
160  void AddChildAnimation(HBhvAnimation *childanimation);
161 
163  HBhvAnimation *GetParentAnimation() { return m_pParentAnimation; }
164 
167  void SetDelay(int delay) { m_Delay = delay; }
168 
170  int GetDelay() { return m_Delay; }
171 
173  HBhvTargetObject * GetTarget() { return m_Target; }
174 
176  HBhvAnimation * GetInstancedAnimation() { return m_pInstancedAnimation; }
177 
180  void SetInstancedAnimation(HBhvAnimation *animation) { m_pInstancedAnimation = animation; CloneAnimation(); }
181 
183  void Reset();
184 
188  void SetTargetByPath(const char *targetpath);
189 
194  void SetTargetByPath(const char *name, const char *targetpath);
195 
197  void SetTarget(HBhvTargetObject *target);
198 
204  bool GetInterpolator(int time, int &interval, HKeyframe **keyframe);
205 
209  void SetDefaultActive(bool active) { m_bDefaultActive = active; }
210 
213  bool GetDefaultActive() { return m_bDefaultActive; }
214 
217  void SetCurrentlyRunning(bool running) { m_bCurrentlyRunning = running; }
218 
220  bool GetCurrentlyRunning() { return m_bCurrentlyRunning; }
221 
223  float GetCurrentTick();
224 
232  void AdjustKeyframe(int keyframe, int delta, bool doall = true, bool relative = false);
233 
237  void CleanWithoutDelete();
238 
239 
241  bool ExecuteOnce() { return m_bExecuteOnce; }
246  void SetExecuteOnce(bool once) {m_bExecuteOnce = once; }
247 
248  void Evaluate(float currenttick, bool &hasPos, HPoint &pos, bool &hasQuat, HQuat &quat, bool &hasScale, HPoint &scale);
249 
250 
251 protected:
252 
256  void SetInstanceOf(const char *name);
257 
261  virtual bool AnimateInternal(float currenttick);
262 
264  void CloneAnimation();
265 
267  virtual void SerializeTarget(HUtilityXMLTag *xmlt);
268 
270  HBhvTimelineInstance* m_pTimelineInstance;
271  char m_InstanceOf[BHV_MAX_NAME_LENGTH];
278  struct vlist_s* m_InterpolatorList;
279  struct vlist_s* m_ChildAnimationList;
280  char m_Name[BHV_MAX_NAME_LENGTH];
281  int m_Loop;
282  int m_Delay;
284 };
285 
286 
287 
288 #ifdef H_PACK_8
289 #pragma pack(pop)
290 #endif
291 
292 #endif
293 
294 
295 
void SetExecuteOnce(bool once)
Definition: HBhvAnimation.h:246
The HBhvTimeline class encpasulates an animation timeline.
Definition: HBhvTimeline.h:42
The HKeyframe class is the base class for all keyframe types.
Definition: HBhvUtility.h:260
The HQuat class defines the data type of a Quaternion.
Definition: HBhvUtility.h:86
virtual const char * GetType()
Definition: HBhvAnimation.h:61
bool ExecuteOnce()
Definition: HBhvAnimation.h:241
The HBhvBehaviorManager class stores and manages all animation related data.
Definition: HBhvBehaviorManager.h:241
struct vlist_s * m_InterpolatorList
Definition: HBhvAnimation.h:278
HBhvBehaviorManager * m_pBehaviorManager
Definition: HBhvAnimation.h:275
void SetInstancedAnimation(HBhvAnimation *animation)
Definition: HBhvAnimation.h:180
HBhvAnimation * GetInstancedAnimation()
Definition: HBhvAnimation.h:176
#define BHV_MAX_NAME_LENGTH
Maximum Length of "Names" in animations.
Definition: HBhvUtility.h:44
HBhvAnimation * m_pInstancedAnimation
Definition: HBhvAnimation.h:269
HBhvTargetObject * m_Target
Definition: HBhvAnimation.h:272
bool m_bDefaultActive
Definition: HBhvAnimation.h:274
int m_Loop
Definition: HBhvAnimation.h:281
HBhvTimelineInstance * m_pTimelineInstance
Definition: HBhvAnimation.h:270
bool GetDefaultActive()
Definition: HBhvAnimation.h:213
bool m_bCurrentlyRunning
Definition: HBhvAnimation.h:273
int GetLoop()
Definition: HBhvAnimation.h:126
struct vlist_s * GetChildAnimationList()
Definition: HBhvAnimation.h:149
HBhvAnimation * m_pParentAnimation
Definition: HBhvAnimation.h:276
The HBhvTargetObject class encapsulates various target types for animations and sensors.
Definition: HBhvBehaviorManager.h:86
void SetDefaultActive(bool active)
Definition: HBhvAnimation.h:209
The HBhvInterpolator class is the abstract base class for all interpolator types. ...
Definition: HBhvInterpolator.h:67
void SetLoop(int loop)
Definition: HBhvAnimation.h:131
void SetCurrentlyRunning(bool running)
Definition: HBhvAnimation.h:217
int GetDelay()
Definition: HBhvAnimation.h:170
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:126
HBhvAnimation * GetParentAnimation()
Definition: HBhvAnimation.h:163
struct vlist_s * GetInterpolatorList()
Definition: HBhvAnimation.h:146
HBhvBehaviorManager * GetBehaviorManager()
Definition: HBhvAnimation.h:113
HBhvTimeline * GetTimeline()
Definition: HBhvAnimation.h:134
int m_Delay
Definition: HBhvAnimation.h:282
struct vlist_s * m_ChildAnimationList
Definition: HBhvAnimation.h:279
The HBhvAnimation class defines an animation.
Definition: HBhvAnimation.h:47
void SetBehaviorManager(HBhvBehaviorManager *behaviourmanager)
Definition: HBhvAnimation.h:116
HBhvTargetObject * GetTarget()
Definition: HBhvAnimation.h:173
HBhvTimeline * m_pTimeline
Definition: HBhvAnimation.h:277
bool m_bExecuteOnce
Definition: HBhvAnimation.h:283
bool GetCurrentlyRunning()
Definition: HBhvAnimation.h:220
void SetDelay(int delay)
Definition: HBhvAnimation.h:167
const char * GetName()
Definition: HBhvAnimation.h:65