Fixed support for update and event callbacks on StateSet/Uniform/StateAttributes on View(er) Cameras.

This commit is contained in:
Robert Osfield 2018-05-14 09:34:04 +01:00
parent 71f3bad57a
commit 4fbaca7878
2 changed files with 8 additions and 8 deletions

View File

@ -1278,13 +1278,13 @@ void CompositeViewer::eventTraversal()
osg::NodeVisitor::TraversalMode tm = _eventVisitor->getTraversalMode(); osg::NodeVisitor::TraversalMode tm = _eventVisitor->getTraversalMode();
_eventVisitor->setTraversalMode(osg::NodeVisitor::TRAVERSE_NONE); _eventVisitor->setTraversalMode(osg::NodeVisitor::TRAVERSE_NONE);
if (view->getCamera() && view->getCamera()->getEventCallback()) view->getCamera()->accept(*_eventVisitor); if (view->getCamera()) view->getCamera()->accept(*_eventVisitor);
for(unsigned int i=0; i<view->getNumSlaves(); ++i) for(unsigned int i=0; i<view->getNumSlaves(); ++i)
{ {
osg::View::Slave& slave = view->getSlave(i); osg::View::Slave& slave = view->getSlave(i);
osg::Camera* camera = view->getSlave(i)._camera.get(); osg::Camera* camera = view->getSlave(i)._camera.get();
if (camera && slave._useMastersSceneData && camera->getEventCallback()) if (camera && slave._useMastersSceneData)
{ {
camera->accept(*_eventVisitor); camera->accept(*_eventVisitor);
} }
@ -1412,13 +1412,13 @@ void CompositeViewer::updateTraversal()
osg::NodeVisitor::TraversalMode tm = _updateVisitor->getTraversalMode(); osg::NodeVisitor::TraversalMode tm = _updateVisitor->getTraversalMode();
_updateVisitor->setTraversalMode(osg::NodeVisitor::TRAVERSE_NONE); _updateVisitor->setTraversalMode(osg::NodeVisitor::TRAVERSE_NONE);
if (view->getCamera() && view->getCamera()->getUpdateCallback()) view->getCamera()->accept(*_updateVisitor); if (view->getCamera()) view->getCamera()->accept(*_updateVisitor);
for(unsigned int i=0; i<view->getNumSlaves(); ++i) for(unsigned int i=0; i<view->getNumSlaves(); ++i)
{ {
osg::View::Slave& slave = view->getSlave(i); osg::View::Slave& slave = view->getSlave(i);
osg::Camera* camera = slave._camera.get(); osg::Camera* camera = slave._camera.get();
if (camera && slave._useMastersSceneData && camera->getUpdateCallback()) if (camera && slave._useMastersSceneData)
{ {
camera->accept(*_updateVisitor); camera->accept(*_updateVisitor);
} }

View File

@ -1083,13 +1083,13 @@ void Viewer::eventTraversal()
osg::NodeVisitor::TraversalMode tm = _eventVisitor->getTraversalMode(); osg::NodeVisitor::TraversalMode tm = _eventVisitor->getTraversalMode();
_eventVisitor->setTraversalMode(osg::NodeVisitor::TRAVERSE_NONE); _eventVisitor->setTraversalMode(osg::NodeVisitor::TRAVERSE_NONE);
if (_camera.valid() && _camera->getEventCallback()) _camera->accept(*_eventVisitor); if (_camera.valid()) _camera->accept(*_eventVisitor);
for(unsigned int i=0; i<getNumSlaves(); ++i) for(unsigned int i=0; i<getNumSlaves(); ++i)
{ {
osg::View::Slave& slave = getSlave(i); osg::View::Slave& slave = getSlave(i);
osg::Camera* camera = slave._camera.get(); osg::Camera* camera = slave._camera.get();
if (camera && slave._useMastersSceneData && camera->getEventCallback()) if (camera && slave._useMastersSceneData)
{ {
camera->accept(*_eventVisitor); camera->accept(*_eventVisitor);
} }
@ -1189,13 +1189,13 @@ void Viewer::updateTraversal()
osg::NodeVisitor::TraversalMode tm = _updateVisitor->getTraversalMode(); osg::NodeVisitor::TraversalMode tm = _updateVisitor->getTraversalMode();
_updateVisitor->setTraversalMode(osg::NodeVisitor::TRAVERSE_NONE); _updateVisitor->setTraversalMode(osg::NodeVisitor::TRAVERSE_NONE);
if (_camera.valid() && _camera->getUpdateCallback()) _camera->accept(*_updateVisitor); if (_camera.valid()) _camera->accept(*_updateVisitor);
for(unsigned int i=0; i<getNumSlaves(); ++i) for(unsigned int i=0; i<getNumSlaves(); ++i)
{ {
osg::View::Slave& slave = getSlave(i); osg::View::Slave& slave = getSlave(i);
osg::Camera* camera = slave._camera.get(); osg::Camera* camera = slave._camera.get();
if (camera && slave._useMastersSceneData && camera->getUpdateCallback()) if (camera && slave._useMastersSceneData)
{ {
camera->accept(*_updateVisitor); camera->accept(*_updateVisitor);
} }