mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 10:53:54 +00:00
Only reset the animation time if a new state was set
This commit is contained in:
parent
fc0f9e2159
commit
fef6284f15
1 changed files with 4 additions and 6 deletions
|
@ -187,24 +187,22 @@ float Animation::findStart(const std::string &groupname, const std::string &star
|
||||||
|
|
||||||
void Animation::play(const std::string &groupname, const std::string &start)
|
void Animation::play(const std::string &groupname, const std::string &start)
|
||||||
{
|
{
|
||||||
float time = 0.0f;
|
|
||||||
try {
|
try {
|
||||||
if(!mEntityList.mSkelBase)
|
if(!mEntityList.mSkelBase)
|
||||||
throw std::runtime_error("Attempting to animate an inanimate object");
|
throw std::runtime_error("Attempting to animate an inanimate object");
|
||||||
|
|
||||||
|
Ogre::AnimationState *newstate = mEntityList.mSkelBase->getAnimationState(groupname);
|
||||||
if(mAnimState)
|
if(mAnimState)
|
||||||
mAnimState->setEnabled(false);
|
mAnimState->setEnabled(false);
|
||||||
mAnimState = mEntityList.mSkelBase->getAnimationState(groupname);
|
mAnimState = newstate;
|
||||||
mCurrentKeys = &mTextKeys[groupname];
|
|
||||||
mAnimState->setEnabled(true);
|
mAnimState->setEnabled(true);
|
||||||
|
mCurrentKeys = &mTextKeys[groupname];
|
||||||
|
|
||||||
time = findStart(groupname, start);
|
resetPosition(findStart(groupname, start));
|
||||||
}
|
}
|
||||||
catch(std::exception &e) {
|
catch(std::exception &e) {
|
||||||
std::cerr<< e.what() <<std::endl;
|
std::cerr<< e.what() <<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetPosition(time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::runAnimation(float timepassed)
|
void Animation::runAnimation(float timepassed)
|
||||||
|
|
Loading…
Reference in a new issue