Introduction

Getting Started

Programming Guides

API Reference

Additional Resources

HBhvAnimation.h
1 // Copyright (c) Tech Soft 3D
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_HBhvAnimation_H
11 #define _H_HBhvAnimation_H
12 
13 #ifdef H_PACK_8
14 #pragma pack(push)
15 #pragma pack(8)
16 #endif
17 
18 #include "HTools.h"
19 #include "HBhvUtility.h"
20 #include "HEventListener.h"
21 
23 class HBhvTimeline;
24 class HBhvTimelineInstance;
25 class HBhvInterpolator;
26 class HBhvInterpolatorInstance;
27 class HUtilityXMLGenerator;
28 class HUtilityXMLTag;
29 class HKeyframe;
30 class HBhvTargetObject;
31 class HBhvAnimationInstance;
32 
33 
35 
43 class MVO_API HBhvAnimation
44 {
45 public:
51  HBhvAnimation(const char *name, HBhvBehaviorManager * BehaviorManager, HBhvAnimation *parentanimation = 0);
52 
54  virtual ~HBhvAnimation();
55 
57  virtual const char * GetType() { return "HBhvAnimation"; }
58 
59 
61  const char * GetName() { return m_Name; }
62 
64  void SetName(const char *name);
65 
68  virtual bool Animate(float currenttime);
69 
73  virtual bool Animate(float currenttime, float starttime);
74 
78  void DeleteKeyframe(int keyframe);
79 
83  void DuplicateNextOrPrevious(int keyframe, bool next);
84 
88  void Duplicate(int newkeyframe, int oldkeyframe);
89 
93  void PlotCurve(bool rotations);
94 
96  void AdjustToTick(int totalticks);
97 
99  virtual void Serialize(HUtilityXMLGenerator *xmlgen, HUtilityXMLTag *xmlt);
101  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
102 
106  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData);
107 
109  HBhvBehaviorManager * GetBehaviorManager() { return m_pBehaviorManager; }
110 
112  void SetBehaviorManager(HBhvBehaviorManager *behaviourmanager) { m_pBehaviorManager = behaviourmanager; }
113 
115  int GetFirstTick();
116 
118  int GetLastTick();
119 
122  int GetLoop() { return m_Loop; }
123 
127  void SetLoop(int loop) { m_Loop = loop; }
128 
130  HBhvTimeline *GetTimeline() { return m_pTimeline; }
131 
134  void SetTimeline( HBhvTimeline *timeline);
135 
139  HBhvAnimation * CreateInstance();
140 
142  struct vlist_s * GetInterpolatorList() { return m_InterpolatorList; }
143 
145  struct vlist_s * GetChildAnimationList() { return m_ChildAnimationList; }
146 
148  HBhvInterpolator *GetInterpolator();
149 
152  void AddInterpolator(HBhvInterpolator *interpolator);
153 
156  void AddChildAnimation(HBhvAnimation *childanimation);
157 
159  HBhvAnimation *GetParentAnimation() { return m_pParentAnimation; }
160 
163  void SetDelay(int delay) { m_Delay = delay; }
164 
166  int GetDelay() { return m_Delay; }
167 
169  HBhvTargetObject * GetTarget() { return m_Target; }
170 
172  HBhvAnimation * GetInstancedAnimation() { return m_pInstancedAnimation; }
173 
176  void SetInstancedAnimation(HBhvAnimation *animation) { m_pInstancedAnimation = animation; CloneAnimation(); }
177 
179  void Reset();
180 
184  void SetTargetByPath(const char *targetpath);
185 
190  void SetTargetByPath(const char *name, const char *targetpath);
191 
193  void SetTarget(HBhvTargetObject *target);
194 
200  bool GetInterpolator(int time, int &interval, HKeyframe **keyframe);
201 
205  void SetDefaultActive(bool active) { m_bDefaultActive = active; }
206 
209  bool GetDefaultActive() { return m_bDefaultActive; }
210 
213  void SetCurrentlyRunning(bool running) { m_bCurrentlyRunning = running; }
214 
216  bool GetCurrentlyRunning() { return m_bCurrentlyRunning; }
217 
219  float GetCurrentTick();
220 
228  void AdjustKeyframe(int keyframe, int delta, bool doall = true, bool relative = false);
229 
233  void CleanWithoutDelete();
234 
235 
237  bool ExecuteOnce() { return m_bExecuteOnce; }
242  void SetExecuteOnce(bool once) {m_bExecuteOnce = once; }
243 
244  void Evaluate(float currenttick, bool &hasPos, HPoint &pos, bool &hasQuat, HQuat &quat, bool &hasScale, HPoint &scale);
245 
247  void SetTargetScaleMatrix(float const * target_matrix);
248 
249  float * GetTargetScaleMatrix() { return m_TargetScaleMatrix; }
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  float m_TargetScaleMatrix[16];
285 };
286 
287 
288 
289 #ifdef H_PACK_8
290 #pragma pack(pop)
291 #endif
292 
293 #endif
294 
295 
296 
void SetExecuteOnce(bool once)
Definition: HBhvAnimation.h:242
The HBhvTimeline class encpasulates an animation timeline.
Definition: HBhvTimeline.h:38
The HKeyframe class is the base class for all keyframe types.
Definition: HBhvUtility.h:257
The HQuat class defines the data type of a Quaternion.
Definition: HBhvUtility.h:83
virtual const char * GetType()
Definition: HBhvAnimation.h:57
bool ExecuteOnce()
Definition: HBhvAnimation.h:237
The HBhvBehaviorManager class stores and manages all animation related data.
Definition: HBhvBehaviorManager.h:237
struct vlist_s * m_InterpolatorList
Definition: HBhvAnimation.h:278
HBhvBehaviorManager * m_pBehaviorManager
Definition: HBhvAnimation.h:275
void SetInstancedAnimation(HBhvAnimation *animation)
Definition: HBhvAnimation.h:176
HBhvAnimation * GetInstancedAnimation()
Definition: HBhvAnimation.h:172
#define BHV_MAX_NAME_LENGTH
Maximum Length of "Names" in animations.
Definition: HBhvUtility.h:41
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:209
bool m_bCurrentlyRunning
Definition: HBhvAnimation.h:273
int GetLoop()
Definition: HBhvAnimation.h:122
struct vlist_s * GetChildAnimationList()
Definition: HBhvAnimation.h:145
HBhvAnimation * m_pParentAnimation
Definition: HBhvAnimation.h:276
The HBhvTargetObject class encapsulates various target types for animations and sensors.
Definition: HBhvBehaviorManager.h:82
void SetDefaultActive(bool active)
Definition: HBhvAnimation.h:205
The HBhvInterpolator class is the abstract base class for all interpolator types. ...
Definition: HBhvInterpolator.h:64
void SetLoop(int loop)
Definition: HBhvAnimation.h:127
void SetCurrentlyRunning(bool running)
Definition: HBhvAnimation.h:213
int GetDelay()
Definition: HBhvAnimation.h:166
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
HBhvAnimation * GetParentAnimation()
Definition: HBhvAnimation.h:159
struct vlist_s * GetInterpolatorList()
Definition: HBhvAnimation.h:142
HBhvBehaviorManager * GetBehaviorManager()
Definition: HBhvAnimation.h:109
HBhvTimeline * GetTimeline()
Definition: HBhvAnimation.h:130
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:43
void SetBehaviorManager(HBhvBehaviorManager *behaviourmanager)
Definition: HBhvAnimation.h:112
HBhvTargetObject * GetTarget()
Definition: HBhvAnimation.h:169
HBhvTimeline * m_pTimeline
Definition: HBhvAnimation.h:277
bool m_bExecuteOnce
Definition: HBhvAnimation.h:283
bool GetCurrentlyRunning()
Definition: HBhvAnimation.h:216
void SetDelay(int delay)
Definition: HBhvAnimation.h:163
const char * GetName()
Definition: HBhvAnimation.h:61