Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/openmw-41' into openmw-41
Browse files Browse the repository at this point in the history
  • Loading branch information
zinnschlag committed Dec 19, 2016
2 parents 9c56eca + f2f0e9f commit 3c89b03
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion apps/openmw/mwphysics/physicssystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,8 @@ namespace MWPhysics
else if (physicActor->getCollisionMode() && canMoveToWaterSurface(iter->first, waterlevel))
{
const osg::Vec3f actorPosition = physicActor->getPosition();
physicActor->setPosition(osg::Vec3f(actorPosition.x(), actorPosition.y(), waterlevel));
physicActor->setPosition(osg::Vec3f(actorPosition.x(), actorPosition.y(), waterlevel));
waterCollision = true;
}
}
physicActor->setCanWaterWalk(waterCollision);
Expand Down
2 changes: 0 additions & 2 deletions apps/openmw/mwrender/creatureanimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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> attached = SceneUtil::attach(node, mObjectRoot, bonename, bonename);
mResourceSystem->getSceneManager()->notifyAttached(attached);
if (mSkeleton)
mSkeleton->markDirty();

scene.reset(new PartHolder(attached));

Expand Down
2 changes: 0 additions & 2 deletions apps/openmw/mwrender/npcanimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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> attached = SceneUtil::attach(instance, mObjectRoot, bonefilter, bonename);
if (mSkeleton)
mSkeleton->markDirty();
mResourceSystem->getSceneManager()->notifyAttached(attached);
if (enchantedGlow)
addGlow(attached, *glowColor);
Expand Down
12 changes: 12 additions & 0 deletions components/sceneutil/skeleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ void Skeleton::markDirty()
{
mTraversedEvenFrame = false;
mTraversedOddFrame = false;
mBoneCache.clear();
mBoneCacheInit = false;
}

void Skeleton::traverse(osg::NodeVisitor& nv)
Expand All @@ -160,6 +162,16 @@ void Skeleton::traverse(osg::NodeVisitor& nv)
osg::Group::traverse(nv);
}

void Skeleton::childInserted(unsigned int)
{
markDirty();
}

void Skeleton::childRemoved(unsigned int, unsigned int)
{
markDirty();
}

Bone::Bone()
: mNode(NULL)
{
Expand Down
6 changes: 4 additions & 2 deletions components/sceneutil/skeleton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ namespace SceneUtil

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 traverse(osg::NodeVisitor& nv);
virtual void childInserted(unsigned int);
virtual void childRemoved(unsigned int, unsigned int);

private:
// The root bone is not a "real" bone, it has no corresponding node in the scene graph.
Expand Down

0 comments on commit 3c89b03

Please sign in to comment.