From 0fc65db6bbbc855d68ed10852f022d9ff0fb0b36 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 6 Mar 2016 11:34:15 +0100 Subject: [PATCH] Remove parts before setting the new object root --- apps/openmw/mwrender/animation.cpp | 3 +++ apps/openmw/mwrender/npcanimation.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 36feeb7be..4f4a49f49 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1457,6 +1457,9 @@ namespace MWRender PartHolder::~PartHolder() { + if (mNode.get() && !mNode->getNumParents()) + std::cerr << "Warning: part has no parents " << std::endl; + if (mNode.get() && mNode->getNumParents()) { if (mNode->getNumParents() > 1) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index eee23aa31..99106c920 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -422,6 +422,8 @@ int NpcAnimation::getSlot(const osg::NodePath &path) const void NpcAnimation::updateNpcBase() { clearAnimSources(); + for(size_t i = 0;i < ESM::PRT_Count;i++) + removeIndividualPart((ESM::PartReferenceType)i); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Race *race = store.get().find(mNpc->mRace); @@ -501,8 +503,6 @@ void NpcAnimation::updateNpcBase() } } - for(size_t i = 0;i < ESM::PRT_Count;i++) - removeIndividualPart((ESM::PartReferenceType)i); updateParts(); mWeaponAnimationTime->updateStartTime();