Hi OM,

What I have done is merged a couple of your changes to GUIEventAdapter
and GUIEventHandler and then added a few extra changes, these are:

The addition of two inline

   GUIEventHandler::handleWithCheckAgainstIgnoreHandledEventsMask(..)

methods which are now called by Viewer.cpp and CompsiteViewer.cpp.
This should allow all event handles including callbacks to function
the same w.r.t the new mask.  The body of the new methods looks like
this:

        inline bool
handleWithCheckAgainstIgnoreHandledEventsMask(const GUIEventAdapter&
ea,GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
        {
            if (!ea.getHandled() ||
                (ea.getEventType() & _ignoreHandledEventsMask)==0)
            {
                bool handled = handle(ea,aa,object,nv);
                if (handled) ea.setHandled(true);
                return handled;
            }
            else
            {
                return false;
            }
        }

I have also change the setIgnoreUsedEventsMask to
setIgnoreHandledEventsMask to keep it consistent with the rest of the
event methods i.e. handle/setHandled().

Could you let me know how you get on with these changes.

Robert.

On 9/13/07, Ole-Morten Duesund <[EMAIL PROTECTED]> wrote:
> 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
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to