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());
if(it != _manips.end())
{
OSG_INFO<<"Switching to manipulator: "<<(*it).second.first<<std::endl;
if ( !it->second.second->getNode() )
CameraManipulator* selectedManipulator = it->second.second.get();
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());
it->second.second->init(ea,aa);
_current = it->second.second;
selectedManipulator->setByMatrix(_current->getMatrix());
selectedManipulator->init(ea,aa);
_current = selectedManipulator;
}
handled = true;
}
}