1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 07:53:52 +00:00

Check existing skeleton sources if the current one has no animation root

This commit is contained in:
Chris Robinson 2013-02-05 17:15:40 -08:00
parent 16933e3926
commit 054ef3113a

View file

@ -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<Ogre::SkeletonPtr>::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<bool>(data))
break;
bone = NULL;
}
}
}
if(bone)
{
mAccumRoot = mInsert;
mNonAccumRoot = skelinst->getBone(bone->getHandle());
mNonAccumRoot = skelinst->getBone(bone->getName());
mStartPosition = mNonAccumRoot->getInitialPosition();
mLastPosition = mStartPosition;