From 2f10db8f11798eac03af7c6ddea62fa0cff6e977 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 27 Aug 2014 15:08:48 +0000 Subject: [PATCH] Changed the osgUI behaviour so that events are set to be handled by Widgets that have focus even if they don't directly use them. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14425 16af8721-9629-0410-8352-f15c8da7e697 --- .../deprecated/SlideShowConstructor.cpp | 11 ++++----- src/osgUI/Widget.cpp | 4 +++- src/osgVolume/Property.cpp | 2 ++ .../osgVolume/SampleRatioProperty.cpp | 24 +++++++++++++++++++ 4 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 src/osgWrappers/serializers/osgVolume/SampleRatioProperty.cpp diff --git a/src/osgPresentation/deprecated/SlideShowConstructor.cpp b/src/osgPresentation/deprecated/SlideShowConstructor.cpp index ea668a145..d2c8e58f1 100644 --- a/src/osgPresentation/deprecated/SlideShowConstructor.cpp +++ b/src/osgPresentation/deprecated/SlideShowConstructor.cpp @@ -3092,16 +3092,11 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position } - - - ModelData modelData; - addModel(model.get(), positionData, modelData, scriptData); - #if 1 osgUI::Widget* widget = vs.valid() ? osgDB::readFile("ui/VolumeSettings.lua") : 0; if (widget) { - OSG_NOTICE<<"Addig widget"<setVisible(false); vs->setName("VolumeSettings"); @@ -3129,6 +3124,10 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position #endif } #endif + + + ModelData modelData; + addModel(model.get(), positionData, modelData, scriptData); } bool SlideShowConstructor::attachTexMat(osg::StateSet* stateset, const ImageData& imageData, float s, float t, bool textureRectangle) diff --git a/src/osgUI/Widget.cpp b/src/osgUI/Widget.cpp index 764672d05..ff3d7d724 100644 --- a/src/osgUI/Widget.cpp +++ b/src/osgUI/Widget.cpp @@ -214,12 +214,14 @@ void Widget::traverseImplementation(osg::NodeVisitor& nv) // signify that event has been taken by widget with focus + bool widgetsWithFocusSetHandled = getHasEventFocus(); + osgGA::EventQueue::Events& events = ev->getEvents(); for(osgGA::EventQueue::Events::iterator itr = events.begin(); itr != events.end(); ++itr) { - if (handle(ev, itr->get())) + if (handle(ev, itr->get()) || widgetsWithFocusSetHandled) { (*itr)->setHandled(true); ev->setEventHandled(true); diff --git a/src/osgVolume/Property.cpp b/src/osgVolume/Property.cpp index f4b19a298..f4cbc0949 100644 --- a/src/osgVolume/Property.cpp +++ b/src/osgVolume/Property.cpp @@ -391,6 +391,8 @@ PropertyAdjustmentCallback::PropertyAdjustmentCallback(const PropertyAdjustmentC bool PropertyAdjustmentCallback::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&, osg::Object* object, osg::NodeVisitor*) { + if (ea.getHandled()) return false; + osgVolume::VolumeTile* tile = dynamic_cast(object); osgVolume::Layer* layer = tile ? tile->getLayer() : 0; osgVolume::Property* property = layer ? layer->getProperty() : 0; diff --git a/src/osgWrappers/serializers/osgVolume/SampleRatioProperty.cpp b/src/osgWrappers/serializers/osgVolume/SampleRatioProperty.cpp new file mode 100644 index 000000000..372062272 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/SampleRatioProperty.cpp @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +namespace osgVolume_SampleRatioProperty +{ + REGISTER_OBJECT_WRAPPER( osgVolume_SampleRatioProperty, + new osgVolume::SampleRatioProperty, + osgVolume::SampleRatioProperty, + "osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::SampleRatioProperty" ) + { + } +} + +namespace osgVolume_SampleRatioWhenMovingProperty +{ + REGISTER_OBJECT_WRAPPER( osgVolume_SampleRatioWhenMovingProperty, + new osgVolume::SampleRatioWhenMovingProperty, + osgVolume::SampleRatioWhenMovingProperty, + "osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::SampleRatioWhenMovingProperty" ) + { + } +}