From Philippe Renon and Robert Osfield, osgViewer::Viewer::checkNeedToDoFrame should return true when only the root node has an update callback.

Note, from Robert, I took Philippe modifications to Viewer.cpp and reformated them slightly to avoid a double check against getSceneData()!=0 and then rolled
the changes out to CompositeViewer::checkNeedToDoFrame() to ensure that both implementations work the same.
This commit is contained in:
Robert Osfield 2016-05-26 17:49:06 +01:00
parent 7bcc5d861e
commit f48b5a3fdb
2 changed files with 19 additions and 11 deletions

View File

@ -255,14 +255,18 @@ bool CompositeViewer::checkNeedToDoFrame()
osgViewer::View* view = itr->get();
if (view)
{
// If the database pager is going to update the scene the render flag is
// set so that the updates show up
// check if the database pager needs to update the scene
if (view->getDatabasePager()->requiresUpdateSceneGraph() ||
view->getDatabasePager()->getRequestsInProgress()) return true;
// if there update callbacks then we need to do frame.
// check if there are camera update callbacks
if (view->getCamera()->getUpdateCallback()) return true;
if (view->getSceneData()!=0 && view->getSceneData()->getNumChildrenRequiringUpdateTraversal()>0) return true;
// check if there are node update callbacks
if (view->getSceneData() != 0)
{
if (view->getSceneData()->getUpdateCallback() || (view->getSceneData()->getNumChildrenRequiringUpdateTraversal()>0) ) return true;
}
}
}

View File

@ -358,22 +358,26 @@ bool Viewer::isRealized() const
bool Viewer::checkNeedToDoFrame()
{
// check if any event handler has prompted a redraw
if (_requestRedraw) return true;
if (_requestContinousUpdate) return true;
// check if the database pager needs to update the scene
if (getDatabasePager()->requiresUpdateSceneGraph() || getDatabasePager()->getRequestsInProgress()) return true;
// If the database pager is going to update the scene the render flag is
// set so that the updates show up
if(getDatabasePager()->requiresUpdateSceneGraph() || getDatabasePager()->getRequestsInProgress()) return true;
// if there update callbacks then we need to do frame.
// check if there are camera update callbacks
if (_camera->getUpdateCallback()) return true;
if (getSceneData()!=0 && getSceneData()->getNumChildrenRequiringUpdateTraversal()>0) return true;
// check if there are node update callbacks
if (getSceneData() != 0)
{
if (getSceneData()->getUpdateCallback() || (getSceneData()->getNumChildrenRequiringUpdateTraversal()>0) ) return true;
}
// check if events are available and need processing
if (checkEvents()) return true;
// now check if any of the event handles have prompted a redraw.
// and check again if any event handler has prompted a redraw
if (_requestRedraw) return true;
if (_requestContinousUpdate) return true;