From e1e76bde76fd441f867d20d412c9bfd2e53808aa Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 20 Jan 2013 15:39:43 -0800 Subject: [PATCH] Combine a loop into another where it's used --- apps/openmw/mwrender/animation.cpp | 38 ++++++++++++++---------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 67be0bf0c5..4884712c3a 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -67,34 +67,32 @@ void Animation::createEntityList(Ogre::SceneNode *node, const std::string &model Ogre::Skeleton::BoneIterator boneiter = skel->getBoneIterator(); while(boneiter.hasMoreElements()) { - Ogre::Bone *bone = boneiter.peekNext(); - const Ogre::Any &data = bone->getUserObjectBindings().getUserAny(NifOgre::sTextKeyExtraDataID); - if(!data.isEmpty()) - { - mTextKeys["all"] = Ogre::any_cast(data); + Ogre::Bone *bone = boneiter.getNext(); + Ogre::UserObjectBindings &bindings = bone->getUserObjectBindings(); + const Ogre::Any &data = bindings.getUserAny(NifOgre::sTextKeyExtraDataID); + if(data.isEmpty()) + continue; - mAccumRoot = skelinst->getRootBone(); - mAccumRoot->setManuallyControlled(true); - mNonAccumRoot = skelinst->getBone(bone->getHandle()); + mTextKeys["all"] = Ogre::any_cast(data); - mStartPosition = mNonAccumRoot->getPosition(); - mLastPosition = mStartPosition; - break; - } - boneiter.moveNext(); - } + mAccumRoot = skelinst->getRootBone(); + mAccumRoot->setManuallyControlled(true); + mNonAccumRoot = skelinst->getBone(bone->getHandle()); + + mStartPosition = mNonAccumRoot->getPosition(); + mLastPosition = mStartPosition; - if(boneiter.hasMoreElements()) - { asiter = aset->getAnimationStateIterator(); while(asiter.hasMoreElements()) { Ogre::AnimationState *state = asiter.getNext(); - Ogre::UserObjectBindings &bindings = boneiter.peekNext()->getUserObjectBindings(); - const Ogre::Any &data = bindings.getUserAny(std::string(NifOgre::sTextKeyExtraDataID)+"@"+state->getAnimationName()); - if(!data.isEmpty()) - mTextKeys[state->getAnimationName()] = Ogre::any_cast(data); + const Ogre::Any &groupdata = bindings.getUserAny(std::string(NifOgre::sTextKeyExtraDataID)+ + "@"+state->getAnimationName()); + if(!groupdata.isEmpty()) + mTextKeys[state->getAnimationName()] = Ogre::any_cast(groupdata); } + + break; } } }