Don't updateBoneTree for non-skinned parts (Fixes #2124)

report
scrawl 10 years ago
parent b650338d69
commit 75b0da5dce

@ -60,6 +60,21 @@ std::string getVampireHead(const std::string& race, bool female)
return "meshes\\" + sVampireMapping[thisCombination]->mModel;
}
bool isSkinned (NifOgre::ObjectScenePtr scene)
{
if (scene->mSkelBase == NULL)
return false;
for(size_t j = 0; j < scene->mEntities.size(); j++)
{
Ogre::Entity *ent = scene->mEntities[j];
if(scene->mSkelBase != ent && ent->hasSkeleton())
{
return true;
}
}
return false;
}
}
@ -611,10 +626,11 @@ Ogre::Vector3 NpcAnimation::runAnimation(float timepassed)
for(;ctrl != mObjectParts[i]->mControllers.end();++ctrl)
ctrl->update();
Ogre::Entity *ent = mObjectParts[i]->mSkelBase;
if(!ent) continue;
updateSkeletonInstance(baseinst, ent->getSkeleton());
ent->getAllAnimationStates()->_notifyDirty();
if (!isSkinned(mObjectParts[i]))
continue;
updateSkeletonInstance(baseinst, mObjectParts[i]->mSkelBase->getSkeleton());
mObjectParts[i]->mSkelBase->getAllAnimationStates()->_notifyDirty();
}
return ret;
@ -697,7 +713,8 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
}
}
updateSkeletonInstance(mSkelBase->getSkeleton(), skel);
if (isSkinned(mObjectParts[type]))
updateSkeletonInstance(mSkelBase->getSkeleton(), skel);
}
std::vector<Ogre::Controller<Ogre::Real> >::iterator ctrl(mObjectParts[type]->mControllers.begin());

Loading…
Cancel
Save