From 818a24cdd6542513d7b3f4133856cdc338b23822 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 5 Jan 2013 00:03:14 -0800 Subject: [PATCH] Hold on to the AnimationState being used for animating --- apps/openmw/mwrender/animation.cpp | 15 +++++---------- apps/openmw/mwrender/animation.hpp | 1 + 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 4784771a9d..6b8a3283cb 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -14,6 +14,7 @@ Animation::Animation() : mInsert(NULL) , mTime(0.0f) , mSkipFrame(false) + , mAnimState(NULL) { } @@ -45,6 +46,8 @@ void Animation::createEntityList(Ogre::SceneNode *node, const std::string &model Ogre::AnimationState *state = as.getNext(); state->setEnabled(true); state->setLoop(false); + if(!mAnimState) + mAnimState = state; } } } @@ -155,16 +158,8 @@ void Animation::runAnimation(float timepassed) } } - if(mEntityList.mSkelBase) - { - Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates(); - Ogre::AnimationStateIterator as = aset->getAnimationStateIterator(); - while(as.hasMoreElements()) - { - Ogre::AnimationState *state = as.getNext(); - state->setTimePosition(mTime); - } - } + if(mAnimState) + mAnimState->setTimePosition(mTime); } mSkipFrame = false; } diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index ebbfb2a7ac..de4778d876 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -40,6 +40,7 @@ protected: NifOgre::EntityList mEntityList; NifOgre::TextKeyMap mTextKeys; + Ogre::AnimationState *mAnimState; bool findGroupTimes(const std::string &groupname, GroupTimes *times);