forked from mirror/openmw-tes3mp
Clear the Skeleton's bone cache when a node is added/removed (Fixes #3663)
This commit is contained in:
parent
b5e8c98b40
commit
f2f0e9f1e7
4 changed files with 16 additions and 6 deletions
|
@ -110,8 +110,6 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot)
|
||||||
osg::ref_ptr<osg::Node> node = mResourceSystem->getSceneManager()->getInstance(item.getClass().getModel(item));
|
osg::ref_ptr<osg::Node> node = mResourceSystem->getSceneManager()->getInstance(item.getClass().getModel(item));
|
||||||
osg::ref_ptr<osg::Node> attached = SceneUtil::attach(node, mObjectRoot, bonename, bonename);
|
osg::ref_ptr<osg::Node> attached = SceneUtil::attach(node, mObjectRoot, bonename, bonename);
|
||||||
mResourceSystem->getSceneManager()->notifyAttached(attached);
|
mResourceSystem->getSceneManager()->notifyAttached(attached);
|
||||||
if (mSkeleton)
|
|
||||||
mSkeleton->markDirty();
|
|
||||||
|
|
||||||
scene.reset(new PartHolder(attached));
|
scene.reset(new PartHolder(attached));
|
||||||
|
|
||||||
|
|
|
@ -671,8 +671,6 @@ PartHolderPtr NpcAnimation::insertBoundedPart(const std::string& model, const st
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> instance = mResourceSystem->getSceneManager()->getInstance(model);
|
osg::ref_ptr<osg::Node> instance = mResourceSystem->getSceneManager()->getInstance(model);
|
||||||
osg::ref_ptr<osg::Node> attached = SceneUtil::attach(instance, mObjectRoot, bonefilter, bonename);
|
osg::ref_ptr<osg::Node> attached = SceneUtil::attach(instance, mObjectRoot, bonefilter, bonename);
|
||||||
if (mSkeleton)
|
|
||||||
mSkeleton->markDirty();
|
|
||||||
mResourceSystem->getSceneManager()->notifyAttached(attached);
|
mResourceSystem->getSceneManager()->notifyAttached(attached);
|
||||||
if (enchantedGlow)
|
if (enchantedGlow)
|
||||||
addGlow(attached, *glowColor);
|
addGlow(attached, *glowColor);
|
||||||
|
|
|
@ -148,6 +148,8 @@ void Skeleton::markDirty()
|
||||||
{
|
{
|
||||||
mTraversedEvenFrame = false;
|
mTraversedEvenFrame = false;
|
||||||
mTraversedOddFrame = false;
|
mTraversedOddFrame = false;
|
||||||
|
mBoneCache.clear();
|
||||||
|
mBoneCacheInit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skeleton::traverse(osg::NodeVisitor& nv)
|
void Skeleton::traverse(osg::NodeVisitor& nv)
|
||||||
|
@ -160,6 +162,16 @@ void Skeleton::traverse(osg::NodeVisitor& nv)
|
||||||
osg::Group::traverse(nv);
|
osg::Group::traverse(nv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Skeleton::childInserted(unsigned int)
|
||||||
|
{
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Skeleton::childRemoved(unsigned int, unsigned int)
|
||||||
|
{
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
Bone::Bone()
|
Bone::Bone()
|
||||||
: mNode(NULL)
|
: mNode(NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,10 +53,12 @@ namespace SceneUtil
|
||||||
|
|
||||||
bool getActive() const;
|
bool getActive() const;
|
||||||
|
|
||||||
/// If a new RigGeometry is added after the Skeleton has already been rendered, you must call markDirty().
|
void traverse(osg::NodeVisitor& nv);
|
||||||
|
|
||||||
void markDirty();
|
void markDirty();
|
||||||
|
|
||||||
void traverse(osg::NodeVisitor& nv);
|
virtual void childInserted(unsigned int);
|
||||||
|
virtual void childRemoved(unsigned int, unsigned int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The root bone is not a "real" bone, it has no corresponding node in the scene graph.
|
// The root bone is not a "real" bone, it has no corresponding node in the scene graph.
|
||||||
|
|
Loading…
Reference in a new issue