Play scripted animations even if SkipAnim is used

0.6.3
Andrei Kortunov 7 years ago
parent 25bb7c1826
commit f299be8158

@ -2035,7 +2035,8 @@ void CharacterController::update(float duration)
world->queueMovement(mPtr, osg::Vec3f(0.f, 0.f, 0.f));
}
osg::Vec3f moved = mAnimation->runAnimation(mSkipAnim ? 0.f : duration);
bool isPersist = isPersistentAnimPlaying();
osg::Vec3f moved = mAnimation->runAnimation(mSkipAnim && !isPersist ? 0.f : duration);
if(duration > 0.0f)
moved /= duration;
else

@ -1089,11 +1089,28 @@ namespace MWRender
osg::Vec3f Animation::runAnimation(float duration)
{
// If we have scripted animations, play only them
bool hasScriptedAnims = false;
for (AnimStateMap::iterator stateiter = mStates.begin(); stateiter != mStates.end(); stateiter++)
{
if (stateiter->second.mPriority.contains(int(MWMechanics::Priority_Persistent)) && stateiter->second.mPlaying)
{
hasScriptedAnims = true;
break;
}
}
osg::Vec3f movement(0.f, 0.f, 0.f);
AnimStateMap::iterator stateiter = mStates.begin();
while(stateiter != mStates.end())
{
AnimState &state = stateiter->second;
if (hasScriptedAnims && !state.mPriority.contains(int(MWMechanics::Priority_Persistent)))
{
++stateiter;
continue;
}
const NifOsg::TextKeyMap &textkeys = state.mSource->getTextKeys();
NifOsg::TextKeyMap::const_iterator textkey(textkeys.upper_bound(state.getTime()));

Loading…
Cancel
Save