00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 00010 #ifndef _H_HBhvTimeline_H 00011 #define _H_HBhvTimeline_H 00012 00013 #ifdef H_PACK_8 00014 #pragma pack(push) 00015 #pragma pack(8) 00016 #endif 00017 00018 #include "HTools.h" 00019 #include "varray.h" 00020 00021 00022 class HBhvTimelineInstance; 00023 class HUtilityXMLGenerator; 00024 class HUtilityXMLTag; 00025 class HBhvAnimation; 00026 00027 00028 #ifdef WINDOWS_SYSTEM 00029 template class MVO_API VArray< int >; 00030 #endif 00031 00033 00038 class MVO_API HBhvTimeline 00039 { 00040 public: 00045 HBhvTimeline(HBhvAnimation *animation = 0); 00046 virtual ~HBhvTimeline() { }; 00047 00053 void SetTimeline(const int *timeline, int length); 00054 00059 void SetAnimation(HBhvAnimation *animation) { m_pAnimation = animation; } 00060 00068 HBhvTimeline * CreateInstance(HBhvAnimation *animation); 00069 00072 int * GetTimelineArray() { return &m_pTimelineArray[0]; } 00073 00075 int GetTimelineArrayLength() { return (int)m_pTimelineArray.Count(); } 00076 00083 int AddKeyframe(int t, bool &doesExist); 00089 int AddKeyframe(int t); 00095 int DeleteKeyframe(int t); 00096 00102 int CheckKeyframe(int t); 00103 00107 void Serialize(HUtilityXMLGenerator *xmlgen); 00108 00112 static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData); 00113 00115 int GetLastTick(); 00116 00124 bool GetTimelineInterval(int currentTick, int &interval); 00125 00130 void SetStartTick(float starttick) { m_StartTick = starttick; } 00131 00133 float GetStartTick() { return m_StartTick; } 00134 00142 virtual bool Evaluate (float currentTick, int &interval, float &fraction); 00143 00145 HBhvAnimation *GetAnimation() { return m_pAnimation; } 00146 00148 float GetCurrentTick() { return m_CurrentTick; } 00149 00154 void SetInstancedTimeline(HBhvTimeline *timeline) { m_pInstancedTimeline = timeline; } 00155 00162 void Adjust(int time, int delta, bool doall = true); 00170 void AdjustRelative(int time, int delta); 00171 00174 float GetCurrentRelativeTick() { return m_CurrentRelativeTick; } 00175 00180 void SetCurrentRelativeTick(float tick) { m_CurrentRelativeTick = tick; } 00181 00182 00183 00184 protected: 00191 int AddKeyframeInternal(int t, bool *doesExist); 00198 float AdjustTickToTimeline(float tick); 00199 VArray< int > m_pTimelineArray; 00200 00201 HBhvAnimation* m_pAnimation; 00202 HBhvTimeline * m_pInstancedTimeline; 00203 00204 float m_StartTick; 00205 float m_CurrentTick; 00206 float m_CurrentRelativeTick; 00207 private: 00208 }; 00209 00210 00211 00212 #ifdef H_PACK_8 00213 #pragma pack(pop) 00214 #endif 00215 00216 #endif 00217 00218 00219