From 38510a56c206520472e505c7fca24f6f3b6275e5 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 22 Nov 2015 21:19:55 +0100 Subject: [PATCH] GeomMorpherController: do not dirty the MorphGeometry unless necessary --- components/nifosg/controller.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index 4dfa4b304..93c1de89a 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -235,7 +235,12 @@ void GeomMorpherController::update(osg::NodeVisitor *nv, osg::Drawable *drawable val = interpKey((*it)->mKeys, input); val = std::max(0.f, std::min(1.f, val)); - morphGeom->setWeight(i, val); + osgAnimation::MorphGeometry::MorphTarget& target = morphGeom->getMorphTarget(i); + if (target.getWeight() != val) + { + target.setWeight(val); + morphGeom->dirty(); + } } }