Added check so not intialization is down when you select the current camera manipulator

This commit is contained in:
Robert Osfield 2012-09-07 08:33:24 +00:00
parent 0b778533c8
commit 53405c118a

View File

@ -176,15 +176,19 @@ bool KeySwitchMatrixManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapt
KeyManipMap::iterator it=_manips.find(ea.getKey()); KeyManipMap::iterator it=_manips.find(ea.getKey());
if(it != _manips.end()) if(it != _manips.end())
{ {
OSG_INFO<<"Switching to manipulator: "<<(*it).second.first<<std::endl; CameraManipulator* selectedManipulator = it->second.second.get();
if ( !it->second.second->getNode() ) if (selectedManipulator!=_current)
{ {
it->second.second->setNode(_current->getNode()); OSG_INFO<<"Switching to manipulator: "<<it->second.first<<std::endl;
if ( !selectedManipulator->getNode() )
{
selectedManipulator->setNode(_current->getNode());
} }
it->second.second->setByMatrix(_current->getMatrix()); selectedManipulator->setByMatrix(_current->getMatrix());
it->second.second->init(ea,aa); selectedManipulator->init(ea,aa);
_current = it->second.second;
_current = selectedManipulator;
}
handled = true; handled = true;
} }
} }