[osg-submissions] Selectively ignoring handled events
Ole-Morten Duesund
olemd+osg-submissions at glemt.net
Thu Sep 13 10:32:48 PDT 2007
Robert Osfield wrote:
> Hi OM,
>
> The event mask would be an interesting approach that be worth
> experimenting with. I don't have the available time to go try this
> out, so could you have a tinker and see how you get on.
Ok, turns out this was even easier than expected.
This will break any code that depends on the absolute values of
osgGA::GUIEvent::EventType, but I'd consider that kind of code broken
anyway.
This changes osgGA::GUIEvent::EventType so I can use them in a bitmask.
I also added the ability to set/get the mask in osgGA::GUIEventHandler
and changed osgViewer::Viewer to consider the mask when delivering
handled events to cameraManipulators. The same could easily be done for
the generic case of eventHandlers if that should be of interest.
This will let the cameraManipulators signal to the osgViewer::Viewer
which handled events they're willing to ignore.
Simplest testcase I could come up with was to use the
NodeTrackerManipulator and setting the mask to
osgGA::GUIEventHandler::DRAG while having an eventhandler that returns
true for DRAG events. This basically stops the NodeTrackManipulator from
working. Setting the mask to NONE (which is the default) brings back the
normal behaviour.
- OM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ignoreEvents.tar.gz
Type: application/x-gzip
Size: 20706 bytes
Desc: not available
Url : http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20070913/65dd0f7b/attachment-0001.bin
More information about the osg-submissions
mailing list