From 53405c118a5cc7bbb2e1682f7b5b532816784dbe Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 7 Sep 2012 08:33:24 +0000 Subject: [PATCH] Added check so not intialization is down when you select the current camera manipulator --- src/osgGA/KeySwitchMatrixManipulator.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/osgGA/KeySwitchMatrixManipulator.cpp b/src/osgGA/KeySwitchMatrixManipulator.cpp index 644699aa2..cf08daaf3 100644 --- a/src/osgGA/KeySwitchMatrixManipulator.cpp +++ b/src/osgGA/KeySwitchMatrixManipulator.cpp @@ -176,15 +176,19 @@ bool KeySwitchMatrixManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapt KeyManipMap::iterator it=_manips.find(ea.getKey()); if(it != _manips.end()) { - OSG_INFO<<"Switching to manipulator: "<<(*it).second.first<second.second->getNode() ) - { - it->second.second->setNode(_current->getNode()); + CameraManipulator* selectedManipulator = it->second.second.get(); + if (selectedManipulator!=_current) + { + OSG_INFO<<"Switching to manipulator: "<second.first<getNode() ) + { + selectedManipulator->setNode(_current->getNode()); + } + selectedManipulator->setByMatrix(_current->getMatrix()); + selectedManipulator->init(ea,aa); + + _current = selectedManipulator; } - it->second.second->setByMatrix(_current->getMatrix()); - it->second.second->init(ea,aa); - _current = it->second.second; - handled = true; } }