From a37dee09e2f074a76ce1b2c38c1473b3a3e03334 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 18 Sep 2015 21:29:32 +0200 Subject: [PATCH] Fix invisibility effect disappearing after a view mode switch --- apps/openmw/mwrender/animation.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 24d540e20..37ec4c213 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -935,8 +935,10 @@ namespace MWRender void Animation::setObjectRoot(const std::string &model, bool forceskeleton, bool baseonly, bool isCreature) { + osg::ref_ptr previousStateset; if (mObjectRoot) { + previousStateset = mObjectRoot->getStateSet(); mObjectRoot->getParent(0)->removeChild(mObjectRoot); } mObjectRoot = NULL; @@ -961,6 +963,9 @@ namespace MWRender mObjectRoot = newObjectRoot; } + if (previousStateset) + mObjectRoot->setStateSet(previousStateset); + if (baseonly) { RemoveDrawableVisitor removeDrawableVisitor;