diff --git a/include/osgGA/GUIActionAdapter b/include/osgGA/GUIActionAdapter index 4548024e7..964036bf3 100644 --- a/include/osgGA/GUIActionAdapter +++ b/include/osgGA/GUIActionAdapter @@ -15,6 +15,7 @@ #define OSGGA_GUIACTIONADAPTER 1 #include +#include namespace osgGA{ @@ -56,6 +57,10 @@ class GUIActionAdapter public: virtual ~GUIActionAdapter() {} + /** Provide a mechanism for getting the osg::View assocaited with this GUIActionAdapter. + * One would use this to case view to osgViewer::View(er) if supported by the subclass.*/ + virtual osg::View* asView() { return 0; } + /** requestRedraw() requests a single redraw. */ diff --git a/include/osgViewer/View b/include/osgViewer/View index f9475511e..cd2ac0f03 100644 --- a/include/osgViewer/View +++ b/include/osgViewer/View @@ -41,6 +41,13 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter META_Object(osgViewer,View); + /** Provide a mechanism for getting the osg::View assocaited from the GUIActionAdapter. + * One would use this to case view to osgViewer::View(er) if supported by the subclass.*/ + virtual osg::View* asView() { return this; } + + /** Provide a mechanism for getting the viewer object from this osgViewer::View. + * In the case of a osgViewer::Viewer the ViewerBase will effectively point to this object as Viewer subclasses from View. + * In the case of a osgViewer::CompsoiteViewer the ViewerBase will point to the CompositeViewer that owns this View. */ ViewerBase* getViewerBase() { return _viewerBase.get(); } /** Take all the settings, Camera and Slaves from the passed in view, leaving it empty. */ diff --git a/src/osgWrappers/osgGA/GUIActionAdapter.cpp b/src/osgWrappers/osgGA/GUIActionAdapter.cpp index 932ddffcc..bbaf3b88a 100644 --- a/src/osgWrappers/osgGA/GUIActionAdapter.cpp +++ b/src/osgWrappers/osgGA/GUIActionAdapter.cpp @@ -10,6 +10,7 @@ #include #include +#include #include // Must undefine IN and OUT macros defined in Windows headers @@ -25,6 +26,11 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgGA::GUIActionAdapter) I_Constructor0(____GUIActionAdapter, "", ""); + I_Method0(osg::View *, asView, + Properties::VIRTUAL, + __osg_View_P1__asView, + "Provide a mechanism for getting the osg::View assocaited with this GUIActionAdapter. ", + "One would use this to case view to osgViewer::View(er) if supported by the subclass. "); I_Method0(void, requestRedraw, Properties::PURE_VIRTUAL, __void__requestRedraw, diff --git a/src/osgWrappers/osgViewer/View.cpp b/src/osgWrappers/osgViewer/View.cpp index 368820a0d..fb8550bd6 100644 --- a/src/osgWrappers/osgViewer/View.cpp +++ b/src/osgWrappers/osgViewer/View.cpp @@ -75,11 +75,16 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::View) __C5_char_P1__className, "return the name of the object's class type. ", "Must be defined by derived classes. "); + I_Method0(osg::View *, asView, + Properties::VIRTUAL, + __osg_View_P1__asView, + "Provide a mechanism for getting the osg::View assocaited from the GUIActionAdapter. ", + "One would use this to case view to osgViewer::View(er) if supported by the subclass. "); I_Method0(osgViewer::ViewerBase *, getViewerBase, Properties::NON_VIRTUAL, __ViewerBase_P1__getViewerBase, - "", - ""); + "Provide a mechanism for getting the viewer object from this osgViewer::View. ", + "In the case of a osgViewer::Viewer the ViewerBase will effectively point to this object as Viewer subclasses from View. In the case of a osgViewer::CompsoiteViewer the ViewerBase will point to the CompositeViewer that owns this View. "); I_Method1(void, take, IN, osg::View &, rhs, Properties::VIRTUAL, __void__take__osg_View_R1,