mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 15:23:58 +00:00
Hold on to the AnimationState being used for animating
This commit is contained in:
parent
6e84d4bcdd
commit
818a24cdd6
2 changed files with 6 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ protected:
|
|||
|
||||
NifOgre::EntityList mEntityList;
|
||||
NifOgre::TextKeyMap mTextKeys;
|
||||
Ogre::AnimationState *mAnimState;
|
||||
|
||||
bool findGroupTimes(const std::string &groupname, GroupTimes *times);
|
||||
|
||||
|
|
Loading…
Reference in a new issue