HI Riccardo,

On 15 February 2012 15:38, Riccardo Corsi <[email protected]> wrote:
> while checking the code related to event handling,
> I've noticed that node callbacks receives a NodeVisitor in their handle()
> callback, and can then extract the frameStamp if needed.
>
> The same does not apply to the GUIEventHandler added directly to the
> osgViewer classes, as thy are invoked this way:
> (*hitr)->handleWithCheckAgainstIgnoreHandledEventsMask( *event, *this, 0,
> 0); //no visitor passed in as argument

Curious, and surprising - as far as I recall you're the first to spot
this difference.  Thinking back I suspect I did this many years when
transitioning from old osgProducer based viewer before there was an
EventVisitor and this limitation just carried forward.


> Being able to get the frame stamp could be quite useful, for instance if one
> has to reset some information at every frame,
> and doesn't want to place a dummy node somewhere in the scenegraph.
>
> There are workarounds based on event timing,
> but I think it would be more robust if the viewer passed this info to the
> handler.
> A simple solution could be to pass the same _eventVisitor used for the
> scenegraph as an argument to the viewer's handlers, like
> (*hitr)->handleWithCheckAgainstIgnoreHandledEventsMask( *event, *this, 0,
> _eventVisitor); //no visitor passed in as argument
>
> Robert, do you think it's a viable solution?
> If so I will make a submission.

I think this would be fine, I've just checked CompositeViewer.cpp and
Viewer.cpp's use of the handleWithCheckAgainstIgnoreHandledEventsMask
method and it looks to me like passing in the _eventVisitor as you
have suggested would be fine.  So go ahead and make the change and
send it into osg-submissions.

Cheers,
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to