From 87871d7d54260b4df53a0f3fc99c46cdcda5f041 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 29 Feb 2016 20:23:19 +0100 Subject: [PATCH] Don't add RotateController to an uncontrolled node --- apps/openmw/mwrender/animation.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 0418e34fd..7f7183b9e 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1353,9 +1353,24 @@ namespace MWRender if (found != getNodeMap().end()) { osg::MatrixTransform* node = found->second; - mHeadController = new RotateController(mObjectRoot.get()); - node->addUpdateCallback(mHeadController); - mActiveControllers.insert(std::make_pair(node, mHeadController)); + + bool foundKeyframeCtrl = false; + osg::Callback* cb = node->getUpdateCallback(); + while (cb) + { + if (dynamic_cast(cb)) + { + foundKeyframeCtrl = true; + break; + } + } + + if (foundKeyframeCtrl) + { + mHeadController = new RotateController(mObjectRoot.get()); + node->addUpdateCallback(mHeadController); + mActiveControllers.insert(std::make_pair(node, mHeadController)); + } } } }