Added initial Widget wrapper

This commit is contained in:
Robert Osfield
2014-02-07 10:46:16 +00:00
parent 4016aed62d
commit 6f5e5c23df
3 changed files with 36 additions and 2 deletions

View File

@@ -29,7 +29,7 @@ class OSGUI_EXPORT Widget : public osg::Group
public:
Widget();
Widget(const Widget& tfw, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Node(osgUI, Widget);
META_Node(osgGA, Widget);
virtual void traverse(osg::NodeVisitor& nv);
virtual void traverseImplementation(osg::NodeVisitor& nv);

View File

@@ -51,7 +51,6 @@ struct GroupGetChild : public osgDB::MethodObject
if (inputParameters.empty()) return false;
osg::Object* indexObject = inputParameters[0].get();
OSG_NOTICE<<"GroupGetChild "<<indexObject->className()<<std::endl;
unsigned int index = 0;
osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);

View File

@@ -0,0 +1,35 @@
#include <osgGA/Widget>
#include <osg/ValueObject>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
struct CreateGraphics : public osgDB::MethodObject
{
virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
{
osgGA::Widget* widget = reinterpret_cast<osgGA::Widget*>(objectPtr);
widget->createGraphics();
return true;
}
};
struct CreateGraphicsImplementation : public osgDB::MethodObject
{
virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
{
osgGA::Widget* widget = reinterpret_cast<osgGA::Widget*>(objectPtr);
widget->createGraphicsImplementation();
return true;
}
};
REGISTER_OBJECT_WRAPPER( Widget,
new osgGA::Widget,
osgGA::Widget,
"osg::Object osg::Node osg::Group osgGA::Widget" )
{
ADD_METHOD_OBJECT( "createGraphics", CreateGraphics );
ADD_METHOD_OBJECT( "createGraphicsImplementation", CreateGraphicsImplementation );
}