void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos, F32 duration, bool continuePlay) { // make sure all transforms on all detail levels are accurate sortThreads(); animateNodeSubtrees(); thread->transitionToSequence(seq,pos,duration,continuePlay); setDirty(AllDirtyMask); mGroundThread = NULL; if (mScaleCurrentlyAnimated && !thread->getSequence()->animatesScale()) checkScaleCurrentlyAnimated(); else if (!mScaleCurrentlyAnimated && thread->getSequence()->animatesScale()) mScaleCurrentlyAnimated=true; mTransitionRotationNodes.overlap(thread->transitionData.oldRotationNodes); mTransitionRotationNodes.overlap(thread->getSequence()->rotationMatters); mTransitionTranslationNodes.overlap(thread->transitionData.oldTranslationNodes); mTransitionTranslationNodes.overlap(thread->getSequence()->translationMatters); mTransitionScaleNodes.overlap(thread->transitionData.oldScaleNodes); mTransitionScaleNodes.overlap(thread->getSequence()->scaleMatters); // if we aren't already in the list of transition threads, add us now S32 i; for (i=0; i<mTransitionThreads.size(); i++) if (mTransitionThreads[i]==thread) break; if (i==mTransitionThreads.size()) mTransitionThreads.push_back(thread); updateTransitions(); }
void TSShapeInstance::destroyThread(TSThread * thread) { if (!thread) return; clearTransition(thread); S32 i; for (i=0; i<mThreadList.size(); i++) if (thread==mThreadList[i]) break; AssertFatal(i<mThreadList.size(),"TSShapeInstance::destroyThread was requested to destroy a thread that this instance doesn't own!"); delete mThreadList[i]; mThreadList.erase(i); setDirty(AllDirtyMask); checkScaleCurrentlyAnimated(); }
void TSShapeInstance::setSequence(TSThread * thread, S32 seq, F32 pos) { if ( (thread->transitionData.inTransition && mTransitionThreads.size()>1) || mTransitionThreads.size()>0) { // if we have transitions, make sure transforms are up to date... sortThreads(); animateNodeSubtrees(); } thread->setSequence(seq,pos); setDirty(AllDirtyMask); mGroundThread = NULL; if (mScaleCurrentlyAnimated && !thread->getSequence()->animatesScale()) checkScaleCurrentlyAnimated(); else if (!mScaleCurrentlyAnimated && thread->getSequence()->animatesScale()) mScaleCurrentlyAnimated=true; updateTransitions(); }