Hi Jose,

2006/8/31, Jose Luis Hidalgo Valiño <[EMAIL PROTECTED]>:
Hi all,

     Is there any way to access global functions using
osgIntrospection? seems that osgIntrospection only reflects
classes. For example, how do you access to osgDB::readNodeFile using
osgIntrospection?


      they are no way to access global function ... not yet ... but you can add it ... :-)


Looking at the implementation:
     ReaderWriter::ReadResult rr = Registry::instance()->readNode
(filename,options);

another question, how do you create a Registry instance using
osgIntrospection? (I know it is a singleton, so how do you call
Registry::instance?)

To call osgDB::Registry::instance()

// ** load osg and osgDB wrapper

osg::ref_ptr<osgDB::DynamicLibrary> osg_reflectors = osgDB::DynamicLibrary::loadLibrary(createLibraryNameForWrapper("osg"));
osg::ref_ptr<osgDB::DynamicLibrary> osg_reflectors = osgDB::DynamicLibrary::loadLibrary(createLibraryNameForWrapper("osgDB"));


// ** get the osgDB::Registry Type
const osgIntrospection::Type& t = osgIntrospection::Reflection::getType("osgDB::Registry");

// ** get the instance method of osgDB::Registry
osgIntrospection::ParameterInfoList params;
const osgIntrospection::MethodInfo* method = t.getMethod("instance", params, false);

// ** call the osgDB::Registry::instance() and get the osgDB::Registry instance
osgIntrospection::Value osgDB_Registry_instance = method->invoke();

Get a look to the doxygen of osgIntrospection, the class osgIntrospection::methodInfo have some invoke(...) function without the "osgIntrospection::Value& instance" parameter, there functions is for static method member.

David

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to