Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HBhvAnimation.h

00001 //
00002 // Copyright (c) 2000 by Tech Soft 3D, LLC.
00003 // The information contained herein is confidential and proprietary to
00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under
00005 // civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006 // and criminal remedies in the event of unauthorized use or misappropriation
00007 // of its trade secrets.  Use of this information by anyone other than
00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a
00009 // written non-disclosure agreement, expressly prescribing the scope and
00010 // manner of such use.
00011 //
00012 // $Id: dace8013066cdbf6aae0c57075f29aa8249c94c0 $
00013 //
00014 #ifndef _H_HBhvAnimation_H
00015 #define _H_HBhvAnimation_H
00016 
00017 #ifdef H_PACK_8
00018 #pragma pack(push)
00019 #pragma pack(8)
00020 #endif
00021 
00022 #include "HTools.h"
00023 #include "HBhvUtility.h"
00024 #include "HEventListener.h"
00025 
00026 class HBhvBehaviorManager;
00027 class HBhvTimeline;
00028 class HBhvTimelineInstance;
00029 class HBhvInterpolator;
00030 class HBhvInterpolatorInstance;
00031 class HUtilityXMLGenerator;
00032 class HUtilityXMLTag;
00033 class HKeyframe;
00034 class HBhvTargetObject;
00035 class HBhvAnimationInstance;
00036 
00037 
00039 
00047 class MVO_API HBhvAnimation 
00048 {
00049 public:
00055     HBhvAnimation(const char *name, HBhvBehaviorManager * BehaviorManager, HBhvAnimation *parentanimation = 0);
00056 
00058     virtual ~HBhvAnimation();   
00059 
00061     virtual const char * GetType() { return "HBhvAnimation"; } 
00062 
00063     
00065     const char * GetName() { return m_Name; }
00066 
00068     void SetName(const char *name);
00069 
00072     virtual bool Animate(float currenttime);
00073 
00077     virtual bool Animate(float currenttime, float starttime);
00078 
00082     void DeleteKeyframe(int keyframe);
00083 
00087     void DuplicateNextOrPrevious(int keyframe, bool next);
00088 
00092     void Duplicate(int newkeyframe, int oldkeyframe);
00093 
00097     void PlotCurve(bool rotations);
00098 
00100     void AdjustToTick(int totalticks);
00101 
00103     virtual void Serialize(HUtilityXMLGenerator *xmlgen, HUtilityXMLTag *xmlt);
00105     virtual void Serialize(HUtilityXMLGenerator *xmlgen);
00106 
00110     static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData);
00111 
00113     HBhvBehaviorManager * GetBehaviorManager() { return m_pBehaviorManager; }
00114 
00116     void SetBehaviorManager(HBhvBehaviorManager *behaviourmanager) { m_pBehaviorManager = behaviourmanager; }
00117 
00119     int GetFirstTick();
00120 
00122     int GetLastTick();
00123 
00126     int GetLoop() { return m_Loop; }
00127 
00131     void SetLoop(int loop) {  m_Loop = loop; }
00132 
00134     HBhvTimeline *GetTimeline() { return m_pTimeline; }
00135 
00138     void SetTimeline( HBhvTimeline *timeline);
00139  
00143     HBhvAnimation * CreateInstance();
00144 
00146     struct vlist_s * GetInterpolatorList() { return m_InterpolatorList; }
00147 
00149     struct vlist_s * GetChildAnimationList() { return m_ChildAnimationList; }
00150 
00152     HBhvInterpolator *GetInterpolator();
00153 
00156     void AddInterpolator(HBhvInterpolator *interpolator);
00157 
00160     void AddChildAnimation(HBhvAnimation *childanimation);
00161 
00163     HBhvAnimation *GetParentAnimation() { return m_pParentAnimation; }
00164  
00167     void SetDelay(int delay) { m_Delay = delay; }
00168 
00170     int  GetDelay() { return m_Delay; }
00171 
00173     HBhvTargetObject * GetTarget() { return m_Target; } 
00174 
00176     HBhvAnimation * GetInstancedAnimation() { return m_pInstancedAnimation; }
00177 
00180     void SetInstancedAnimation(HBhvAnimation *animation) { m_pInstancedAnimation = animation; CloneAnimation(); }
00181 
00183     void Reset();
00184 
00188     void SetTargetByPath(const char *targetpath);
00189 
00194     void SetTargetByPath(const char *name, const char *targetpath);
00195 
00197     void SetTarget(HBhvTargetObject *target);
00198  
00204     bool GetInterpolator(int time, int &interval, HKeyframe **keyframe);
00205 
00209     void SetDefaultActive(bool active) { m_bDefaultActive = active; }
00210 
00213     bool GetDefaultActive() { return m_bDefaultActive; }
00214 
00217     void SetCurrentlyRunning(bool running) { m_bCurrentlyRunning = running; }
00218 
00220     bool GetCurrentlyRunning() { return m_bCurrentlyRunning; }
00221 
00223     float GetCurrentTick(); 
00224     
00232     void AdjustKeyframe(int keyframe, int delta, bool doall = true, bool relative = false);
00233     
00237     void CleanWithoutDelete();
00238 
00239 
00241     bool ExecuteOnce() { return m_bExecuteOnce; }
00246     void SetExecuteOnce(bool once) {m_bExecuteOnce = once; }
00247 
00248     void Evaluate(float currenttick, bool &hasPos, HPoint &pos, bool &hasQuat, HQuat &quat, bool &hasScale, HPoint &scale);
00249 
00250     
00251 protected:
00252 
00256     void SetInstanceOf(const char *name);
00257 
00261     virtual bool AnimateInternal(float currenttick);
00262 
00264     void CloneAnimation();
00265 
00267     virtual void SerializeTarget(HUtilityXMLTag *xmlt);
00268 
00269     HBhvAnimation*          m_pInstancedAnimation;              
00270     HBhvTimelineInstance*   m_pTimelineInstance;                
00271     char                    m_InstanceOf[BHV_MAX_NAME_LENGTH];  
00272     HBhvTargetObject*       m_Target;                           
00273     bool                    m_bCurrentlyRunning;                
00274     bool                    m_bDefaultActive;                   
00275     HBhvBehaviorManager*    m_pBehaviorManager;                 
00276     HBhvAnimation*          m_pParentAnimation;                 
00277     HBhvTimeline*           m_pTimeline;                        
00278     struct vlist_s*         m_InterpolatorList;                 
00279     struct vlist_s*         m_ChildAnimationList;               
00280     char                    m_Name[BHV_MAX_NAME_LENGTH];        
00281     int m_Loop; 
00282     int m_Delay;    
00283     bool                m_bExecuteOnce;         
00284 };
00285  
00286  
00287 
00288 #ifdef H_PACK_8
00289 #pragma pack(pop)
00290 #endif
00291 
00292 #endif
00293 
00294 
00295