From 054ef3113a8c28fd3cd59c19a60309d4cd1098ea Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 5 Feb 2013 17:15:40 -0800 Subject: [PATCH] Check existing skeleton sources if the current one has no animation root --- apps/openmw/mwrender/animation.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 63bd07beea..baca70e37d 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -108,10 +108,28 @@ void Animation::createEntityList(Ogre::SceneNode *node, const std::string &model boneiter.getNext()->setManuallyControlled(true); Ogre::Bone *bone = insertSkeletonSource(skelinst->getName()); + if(!bone) + { + for(std::vector::const_iterator iter(mSkeletonSources.begin()); + !bone && iter != mSkeletonSources.end();iter++) + { + Ogre::Skeleton::BoneIterator boneiter = (*iter)->getBoneIterator(); + while(boneiter.hasMoreElements()) + { + bone = boneiter.getNext(); + Ogre::UserObjectBindings &bindings = bone->getUserObjectBindings(); + const Ogre::Any &data = bindings.getUserAny(NifOgre::sTextKeyExtraDataID); + if(!data.isEmpty() && Ogre::any_cast(data)) + break; + + bone = NULL; + } + } + } if(bone) { mAccumRoot = mInsert; - mNonAccumRoot = skelinst->getBone(bone->getHandle()); + mNonAccumRoot = skelinst->getBone(bone->getName()); mStartPosition = mNonAccumRoot->getInitialPosition(); mLastPosition = mStartPosition;