1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 17:53:53 +00:00

Hold on to the AnimationState being used for animating

This commit is contained in:
Chris Robinson 2013-01-05 00:03:14 -08:00
parent 6e84d4bcdd
commit 818a24cdd6
2 changed files with 6 additions and 10 deletions

View file

@ -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;
}

View file

@ -40,6 +40,7 @@ protected:
NifOgre::EntityList mEntityList;
NifOgre::TextKeyMap mTextKeys;
Ogre::AnimationState *mAnimState;
bool findGroupTimes(const std::string &groupname, GroupTimes *times);