Robert Osfield wrote:
> Hi Ole-Morten,
> 
> As of 1.9.x onwards all EventHandlers including CameraManipulators get
> all events whether handled or not, in keeping with the Chain of
> Responsibility Design Pattern.

And I certainly see the point in this.

> The reason for passing on all events is that it permits a fuller range
> of usage models the blanket ignoring of events would deny, as the OSG
> is a general purpose toolkit this capability is important and not one
> I'm about to throw away on a whim.

I know, which is why I wasn't suggesting a change to the the Viewer 
without a discussion.

> Now I do roughly understand the problem you are trying to tackle, but
> doing a blanket reject even for just a single manipulator is the wrong
> way to do it, if users want to ignore already handled events in an
> event handler then this should be optional, and even then possibly in
> a limited way.  For instance your event handler might still want to
> get frame events, but not already handled mouse events, in these case
> the check should be local to the event switch case.  Even this more
> limited scope still should be optional for most camera manipulators.
> 
> Might I suggest considering adding an option to discard already handle
> events, and to local the use of this to just events that make sense to
> ignore in this case.  Feel free to code this up.

I'd really like to be able to use any of the already existing 
manipulators interchangeably - without having to maintain my own version 
of OSG so I'm more than open to a more generic approach.

Doing a selective enable/disable would be fairly easy if 
GUIEventAdapter::EventType could be used as a mask instead of just a 
sequencial enum.
That way the user could set an enable/disable mask with a default to 
all. And the cameramanipulators would just have to do a quick and 
between the mask and the event-type to know if they should return early. 
For instance :
   manipulator->setIgnoreUsedEventsMask(DRAG | MOVE)
would do the obvious, but still be able to react to other events, even 
if they're already handled.

This, along with the possibility to set a default ignore-mask would 
solve at least my problems.

As far as I can see this would require changes to 
GUIEventAdapter::EventType, adding get/setIgnoreUsedEventsMask() and 
get/setDefaultIgnoreUsedEventsMask() to MatrixManipulator. As well as a 
quick check either in all the CameraManipulators or in 
Viewer::eventTraversal().

If EventType can't be changed, it should rather be an on/off thing 
instead since I can't see any sensible way to selectively switch on/off 
the various events in this case.

I'll be happy to provide the code or suggestions on how to do it 
differently.

- OM
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to