31SSequenceAnimationTrack::SSequenceAnimationTrack(
const std::string& animationTrackName,
SSequenceAnimation* animation,
const unsigned short& trackAnimationId) :
SAnimTrack(animationTrackName, animation,
SAnimTrack::SO3_SEQUENCE_TRACK)
40 SAnimSequenceKeyList::const_iterator it = keylistCpy.begin();
41 while (it != keylistCpy.end())
48SSequenceAnimationTrack::SSequenceAnimationTrack() :
SAnimTrack(
"", 0,
SAnimTrack::SO3_NODE_TRACK)
64 keyList.push_back(key);
68void SSequenceAnimationTrack::UpdateTrackTime()
71 SAnimSequenceKeyList::iterator it = keyList.begin();
73 while (it != keyList.end())
75 SAnim* anim = (*it)->GetAnim();
77 float decaltime = (*it)->GetDecalTime();
78 float transtime = (*it)->GetTransitionTime();
79 (*it)->SetPosition(length - transtime + decaltime);
80 length = length + klength - transtime + decaltime;
94 if (reset && key->
IsUsed())
109 SAnimSequenceKeyList::iterator it = std::find(keyList.begin(), keyList.end(), key);
110 if (it != keyList.end())
113 SO3_SAFE_DELETE(key);
131 if (((
int)(keyList.size()) - 1) < (
int)index)
134 return keyList.at(index);
139 if (((keyList.size() - 1) < index) || ((keyList.size() - 1) < newindex) || (index == newindex))
143 keyList[newindex] = keyList.at(index);
144 keyList[index] = mvkey;
154 SAnimSequenceKeyList::iterator it = keyList.begin();
155 while (it != keyList.end())
157 if ((*it)->GetAnim() == anim)
168 SAnimSequenceKeyList::const_iterator it = keylistCpy.begin();
169 while (it != keylistCpy.end())
171 if ((*it)->GetAnim() == anim)
189 SAnimSequenceKeyList::iterator ikey = keyList.begin();
190 while (ikey != keyList.end())
192 SAnim* anim = (*ikey)->GetAnim();
193 if (!enable && ((*ikey)->IsUsed() ==
true))
196 (*ikey)->SetUsed(
false);
213 return (
unsigned short)keyList.size();
218 float postime = 0.0f;
243 SAnimSequenceKeyList::const_iterator it = keylistCpy.begin();
244 while (it != keylistCpy.end())
254 bool stopIterate =
false;
260 SAnimSequenceKeyList::reverse_iterator nextKeyIt = keyList.rbegin();
261 while ((nextKeyIt != keyList.rend()) && !stopIterate)
263 SAnim* anim = (*nextKeyIt)->GetAnim();
264 float spos = (*nextKeyIt)->GetPosition();
265 float klength = (*nextKeyIt)->
GetLength();
266 if ((spos > pos) && (spos < lastPos))
274 (*nextKeyIt)->SetUsed(
false);
285 else if (spos <= pos)
293 (*nextKeyIt)->SetUsed(
false);
310 else if (pos > lastPos)
312 SAnimSequenceKeyList::iterator prevKeyIt = keyList.begin();
313 while ((prevKeyIt != keyList.end()) && !stopIterate)
315 SAnim* anim = (*prevKeyIt)->GetAnim();
316 float spos = (*prevKeyIt)->GetPosition();
317 float klength = (*prevKeyIt)->
GetLength();
318 if (((spos + klength) > lastPos) && ((spos + klength) < pos))
323 if ((prevKeyIt + 1) != keyList.end())
335 anim->
Apply(klength);
340 (*prevKeyIt)->SetUsed(
false);
351 else if ((spos + klength) >= pos)
359 (*prevKeyIt)->SetUsed(
false);
377 SAnimSequenceKeyList::iterator keyIt = keyList.begin();
378 while ((keyIt != keyList.end()) && !stopIterate)
380 SAnim* anim = (*keyIt)->GetAnim();
381 float spos = (*keyIt)->GetPosition();
383 float transtime = (*keyIt)->GetTransitionTime();
384 float endpos = spos + klength;
385 float updpos = pos - spos;
386 float transStep = 1.0f;
388 if ((pos >= spos) && (pos <= endpos))
390 if ((*keyIt)->IsUsed() ==
false)
393 (*keyIt)->SetUsed(
true);
400 if (((pos - spos) < transtime) && (transtime != 0.0f))
402 transStep = (pos - spos) / transtime;
405 if (keyIt != keyList.begin())
422 else if (spos + klength > pos)
SScene * GetParentScene()
virtual void SetTimePosition(const float &timePosition)
virtual void SetWeight(const float &weight)
void Apply(const float &timePosition)
void SetLoop(const bool &loop)
virtual void SetEnable(const bool &enable)
virtual float GetWeight()
void SetSequenceUpdated(const bool &value)
SAnim * GetParentAnimation()
void SetUsed(const bool &state)
void SetLength(const float &length)
void SetTransitionTime(const float &transtime)
void SetDecalTime(const float &decaltime)
float GetTransitionTime()
~SSequenceAnimationTrack()
virtual float GetKeyPositionTime(const unsigned int &keyIndex)
SSequenceAnimationKey * GetKeyFromIndex(const unsigned int &index)
void EnableTrackKeys(const bool &enable)
void RemoveKey(SSequenceAnimationKey *key, const bool &reset)
SAnimSequenceKeyList GetKeysFromAnim(SAnim *anim)
SSequenceAnimationKey * AddKey(SAnim *anim, const float &length, const float &transition, const float &decaltime)
virtual void Update(const float &pos)
void RemoveKeysWithAnim(SAnim *anim, const bool &reset)
bool MoveKeyFromIndex(const unsigned int &index, const unsigned int &newindex)
virtual void RemoveAllKeyFrames()
void SetLength(const float &length)
virtual unsigned short GetNumKeyFrames()
void SetKey(const unsigned int &index, const float &length, const float &transition, const float &decaltime)
std::vector< SSequenceAnimationKey * > SAnimSequenceKeyList