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: 413cef47c03b60eacbbba6baac1ab16fefec0389 $ 00013 // 00014 #ifndef _H_HBhvTimeline_H 00015 #define _H_HBhvTimeline_H 00016 00017 #ifdef H_PACK_8 00018 #pragma pack(push) 00019 #pragma pack(8) 00020 #endif 00021 00022 #include "HTools.h" 00023 #include "varray.h" 00024 00025 00026 class HBhvTimelineInstance; 00027 class HUtilityXMLGenerator; 00028 class HUtilityXMLTag; 00029 class HBhvAnimation; 00030 00031 00032 #ifdef WINDOWS_SYSTEM 00033 template class MVO_API VArray< int >; 00034 #endif 00035 00037 00042 class MVO_API HBhvTimeline 00043 { 00044 public: 00049 HBhvTimeline(HBhvAnimation *animation = 0); 00050 virtual ~HBhvTimeline() { }; 00051 00057 void SetTimeline(const int *timeline, int length); 00058 00063 void SetAnimation(HBhvAnimation *animation) { m_pAnimation = animation; } 00064 00072 HBhvTimeline * CreateInstance(HBhvAnimation *animation); 00073 00076 int * GetTimelineArray() { return &m_pTimelineArray[0]; } 00077 00079 int GetTimelineArrayLength() { return m_pTimelineArray.Count(); } 00080 00087 int AddKeyframe(int t, bool &doesExist); 00093 int AddKeyframe(int t); 00099 int DeleteKeyframe(int t); 00100 00106 int CheckKeyframe(int t); 00107 00111 void Serialize(HUtilityXMLGenerator *xmlgen); 00112 00116 static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData); 00117 00119 int GetLastTick(); 00120 00128 bool GetTimelineInterval(int currentTick, int &interval); 00129 00134 void SetStartTick(float starttick) { m_StartTick = starttick; } 00135 00137 float GetStartTick() { return m_StartTick; } 00138 00146 virtual bool Evaluate (float currentTick, int &interval, float &fraction); 00147 00149 HBhvAnimation *GetAnimation() { return m_pAnimation; } 00150 00152 float GetCurrentTick() { return m_CurrentTick; } 00153 00158 void SetInstancedTimeline(HBhvTimeline *timeline) { m_pInstancedTimeline = timeline; } 00159 00166 void Adjust(int time, int delta, bool doall = true); 00174 void AdjustRelative(int time, int delta); 00175 00178 float GetCurrentRelativeTick() { return m_CurrentRelativeTick; } 00179 00184 void SetCurrentRelativeTick(float tick) { m_CurrentRelativeTick = tick; } 00185 00186 00187 00188 protected: 00195 int AddKeyframeInternal(int t, bool *doesExist); 00202 float AdjustTickToTimeline(float tick); 00203 VArray< int > m_pTimelineArray; 00204 00205 HBhvAnimation* m_pAnimation; 00206 HBhvTimeline * m_pInstancedTimeline; 00207 00208 float m_StartTick; 00209 float m_CurrentTick; 00210 float m_CurrentRelativeTick; 00211 private: 00212 }; 00213 00214 00215 00216 #ifdef H_PACK_8 00217 #pragma pack(pop) 00218 #endif 00219 00220 #endif 00221 00222 00223