diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index d4e48e1fd2..669d0d8a16 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "../mwbase/world.hpp" @@ -109,6 +110,8 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot) osg::ref_ptr node = mResourceSystem->getSceneManager()->getInstance(item.getClass().getModel(item)); osg::ref_ptr attached = SceneUtil::attach(node, mObjectRoot, bonename, bonename); mResourceSystem->getSceneManager()->notifyAttached(attached); + if (mSkeleton) + mSkeleton->markDirty(); scene.reset(new PartHolder(attached)); diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index e44e2fb302..b1f506e116 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include // TextKeyMapHolder @@ -666,6 +667,8 @@ PartHolderPtr NpcAnimation::insertBoundedPart(const std::string& model, const st { osg::ref_ptr instance = mResourceSystem->getSceneManager()->getInstance(model); osg::ref_ptr attached = SceneUtil::attach(instance, mObjectRoot, bonefilter, bonename); + if (mSkeleton) + mSkeleton->markDirty(); mResourceSystem->getSceneManager()->notifyAttached(attached); if (enchantedGlow) addGlow(attached, *glowColor); diff --git a/components/sceneutil/skeleton.cpp b/components/sceneutil/skeleton.cpp index 08ac72e91e..390a8e8235 100644 --- a/components/sceneutil/skeleton.cpp +++ b/components/sceneutil/skeleton.cpp @@ -144,6 +144,12 @@ bool Skeleton::getActive() const return mActive; } +void Skeleton::markDirty() +{ + mTraversedEvenFrame = false; + mTraversedOddFrame = false; +} + void Skeleton::traverse(osg::NodeVisitor& nv) { if (!getActive() && nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR diff --git a/components/sceneutil/skeleton.hpp b/components/sceneutil/skeleton.hpp index 835ab6617a..764b7f6459 100644 --- a/components/sceneutil/skeleton.hpp +++ b/components/sceneutil/skeleton.hpp @@ -53,6 +53,9 @@ namespace SceneUtil bool getActive() const; + /// If a new RigGeometry is added after the Skeleton has already been rendered, you must call markDirty(). + void markDirty(); + void traverse(osg::NodeVisitor& nv); private: