diff --git a/src/osgGA/Widget.cpp b/src/osgGA/Widget.cpp index 140f95862..7756b482e 100644 --- a/src/osgGA/Widget.cpp +++ b/src/osgGA/Widget.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -228,9 +229,10 @@ void Widget::traverseImplementation(osg::NodeVisitor& nv) itr != events.end(); ++itr) { - handle(ev, itr->get()); - - (*itr)->setHandled(true); + if (handle(ev, itr->get())) + { + (*itr)->setHandled(true); + } } } } @@ -255,7 +257,19 @@ bool Widget::handle(osgGA::EventVisitor* ev, osgGA::Event* event) osg::Parameters inputParameters, outputParameters; inputParameters.push_back(ev); inputParameters.push_back(event); - return co->run(this, inputParameters, outputParameters) && outputParameters.size()>=1; + if (co->run(this, inputParameters, outputParameters)) + { + if (outputParameters.size()>=1) + { + osg::BoolValueObject* bvo = dynamic_cast(outputParameters[0].get()); + if (bvo) + { + return bvo->getValue(); + } + return false; + } + } + return false; } else { diff --git a/src/osgPresentation/deprecated/SlideEventHandler.cpp b/src/osgPresentation/deprecated/SlideEventHandler.cpp index 74d41d683..843476c42 100644 --- a/src/osgPresentation/deprecated/SlideEventHandler.cpp +++ b/src/osgPresentation/deprecated/SlideEventHandler.cpp @@ -1592,7 +1592,6 @@ void SlideEventHandler::dispatchEvent(osgGA::Event* event) } eq->addEvent(event); - } void SlideEventHandler::dispatchEvent(const KeyPosition& keyPosition) diff --git a/src/osgWrappers/serializers/osgPresentation/PresentationInterface.cpp b/src/osgWrappers/serializers/osgPresentation/PresentationInterface.cpp index 788e774a5..835316d15 100644 --- a/src/osgWrappers/serializers/osgPresentation/PresentationInterface.cpp +++ b/src/osgWrappers/serializers/osgPresentation/PresentationInterface.cpp @@ -14,6 +14,26 @@ struct PresentationInterfaceGetSlideEventHandler : public osgDB::MethodObject } }; +struct PresentationInterfaceGetViewer : public osgDB::MethodObject +{ + virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const + { + osgPresentation::PresentationInterface* pi = reinterpret_cast(objectPtr); + outputParameters.push_back(pi->getViewer()); + return true; + } +}; + +struct PresentationInterfaceGetPresentation : public osgDB::MethodObject +{ + virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const + { + osgPresentation::PresentationInterface* pi = reinterpret_cast(objectPtr); + outputParameters.push_back(pi->getPresentation()); + return true; + } +}; + struct PresentationInterfaceSendEventToViewer : public osgDB::MethodObject { virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const @@ -27,7 +47,6 @@ struct PresentationInterfaceSendEventToViewer : public osgDB::MethodObject { osgGA::Event* event = dynamic_cast(itr->get()); osgPresentation::KeyPosition* kp = dynamic_cast(itr->get()); - OSG_NOTICE<<"Dispatch event "<sendEventToViewer(kp); else if (event) pi->sendEventToViewer(event); } @@ -48,7 +67,6 @@ struct PresentationInterfaceSendEventToDevices : public osgDB::MethodObject ++itr) { osgGA::Event* event = dynamic_cast(itr->get()); - OSG_NOTICE<<"forward event "<sendEventToDevices(event); } @@ -62,6 +80,8 @@ REGISTER_OBJECT_WRAPPER( osgPresentation_PresentationInterface, "osg::Object osgPresentation::PresentationInterface" ) { ADD_METHOD_OBJECT( "getSlideEventHandler", PresentationInterfaceGetSlideEventHandler ); + ADD_METHOD_OBJECT( "getViewer", PresentationInterfaceGetViewer ); + ADD_METHOD_OBJECT( "getPresentation", PresentationInterfaceGetPresentation ); ADD_METHOD_OBJECT( "sendEventToViewer", PresentationInterfaceSendEventToViewer ); ADD_METHOD_OBJECT( "sendEventToDevices", PresentationInterfaceSendEventToDevices ); }