[osg-users] GUIEventHandler::handle return value never used?
Robert Osfield
robert.osfield at gmail.com
Thu Aug 25 09:09:26 PDT 2016
Hi Gianni,
The return value is not used in this particular code block simply
because there is nothing to do differently on the return value,
whether it's true or false makes no difference to the CompositeViewer,
there simply is no need to check it. Places where the return value is
relevant there will code to handle the return value.
Not quite sure what you are expecting to happen w.r.t return type.
The code is fine.
Robert.
On 25 August 2016 at 16:33, Gianni Ambrosio <g.ambrosio+osg at gmail.com> wrote:
> Hi All,
> is there anybody that can explain me please why (at least in OSG 3.4.0) in CompositeViewer.cpp, inside eventTraversal() method, the return value of GUIEventHandle::handle(...) is not used?
> Here is a code snippet:
>
>
> Code:
>
> for(ViewEventsMap::iterator veitr = viewEventsMap.begin();
> veitr != viewEventsMap.end();
> ++veitr)
> {
> View* view = veitr->first;
> _eventVisitor->setActionAdapter(view);
>
> for(osgGA::EventQueue::Events::iterator itr = veitr->second.begin();
> itr != veitr->second.end();
> ++itr)
> {
> osgGA::Event* event = itr->get();
> for(View::EventHandlers::iterator hitr = view->getEventHandlers().begin();
> hitr != view->getEventHandlers().end();
> ++hitr)
> {
> (*hitr)->handle( event, view, _eventVisitor.get());
> }
> }
> }
>
>
>
>
> Please look at the line:
> (*hitr)->handle( event, view, _eventVisitor.get());
>
> While GUIEventHandler::handle method returns bool as you can see in the following code:
>
>
> Code:
>
> bool GUIEventHandler::handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
> {
> osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
> osgGA::GUIEventAdapter* ea = event->asGUIEventAdapter();
> if (ea && ev && ev->getActionAdapter())
> {
> #if 1
> bool handled = handle(*ea, *(ev->getActionAdapter()), object, nv);
> if (handled) ea->setHandled(true);
> return handled;
> #else
>
>
>
>
> Regards,
> Gianni
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68446#68446
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
More information about the osg-users
mailing list