Changed the KeySwichCameraManipulator::setNode() so it set all camera's
attached to it.
This commit is contained in:
@@ -32,8 +32,10 @@ static Producer::CameraConfig *BuildConfig(void)
|
||||
camera2->setOffset( -1.0, 0.0 );
|
||||
|
||||
Producer::InputArea *ia = new Producer::InputArea;
|
||||
ia->addInputRectangle( rs1, Producer::InputRectangle(0.0,0.5,0.0,1.0));
|
||||
ia->addInputRectangle( rs2, Producer::InputRectangle(0.5,1.0,0.0,1.0));
|
||||
// ia->addInputRectangle( rs1, Producer::InputRectangle(0.0,0.5,0.0,1.0));
|
||||
// ia->addInputRectangle( rs2, Producer::InputRectangle(0.5,1.0,0.0,1.0));
|
||||
ia->addInputRectangle( rs1, Producer::InputRectangle(-1.0,0.0,-1.0,1.0));
|
||||
ia->addInputRectangle( rs2, Producer::InputRectangle(0.0,1.0,-1.0,1.0));
|
||||
|
||||
|
||||
Producer::CameraConfig *cfg = new Producer::CameraConfig;
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
virtual osg::Camera * getCamera() { return _current->getCamera(); }
|
||||
|
||||
virtual void setNode(osg::Node* n) { _current->setNode(n); }
|
||||
virtual void setNode(osg::Node* n);
|
||||
|
||||
virtual const osg::Node* getNode() const { return _current->getNode(); }
|
||||
|
||||
|
||||
@@ -35,13 +35,26 @@ void KeySwitchCameraManipulator::selectCameraManipulator(unsigned int num)
|
||||
{
|
||||
if (_current.valid())
|
||||
{
|
||||
itr->second.second->setNode(_current->getNode());
|
||||
if ( !itr->second.second->getNode() ) {
|
||||
itr->second.second->setNode(_current->getNode());
|
||||
}
|
||||
itr->second.second->setCamera(_current->getCamera());
|
||||
}
|
||||
_current = itr->second.second;
|
||||
}
|
||||
}
|
||||
|
||||
void KeySwitchCameraManipulator::setNode(osg::Node* node)
|
||||
{
|
||||
for(KeyManipMap::iterator itr=_manips.begin();
|
||||
itr!=_manips.end();
|
||||
++itr)
|
||||
{
|
||||
|
||||
itr->second.second->setNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
CameraManipulator* KeySwitchCameraManipulator::getCameraManipulator(unsigned int num)
|
||||
{
|
||||
KeyManipMap::iterator itr = _manips.find(num);
|
||||
@@ -63,7 +76,9 @@ bool KeySwitchCameraManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapt
|
||||
KeyManipMap::iterator it=_manips.find(ea.getKey());
|
||||
if(it != _manips.end()){
|
||||
osg::notify(osg::INFO)<<"Switching to manipulator: "<<(*it).second.first<<std::endl;
|
||||
it->second.second->setNode(_current->getNode());
|
||||
if ( !it->second.second->getNode() ) {
|
||||
it->second.second->setNode(_current->getNode());
|
||||
}
|
||||
it->second.second->setCamera(_current->getCamera());
|
||||
it->second.second->init(ea,aa);
|
||||
_current = it->second.second;
|
||||
|
||||
@@ -839,7 +839,7 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio
|
||||
// have already been recording so switch of recording.
|
||||
viewer->setRecordingAnimationPath(false);
|
||||
|
||||
osg::notify(osg::NOTICE) << "Finished recording camera animation, press 'Z' to reply."<< std::endl;
|
||||
osg::notify(osg::NOTICE) << "To finished recording camera animation, press 'Z' to reply."<< std::endl;
|
||||
|
||||
if (viewer->getAnimationPath())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user