Hi Robert,
Working with osgIntrospection we have realized that
there is a problem with some methods (setName and addChild).
For example, if you create a Node and after that you call setName,
there isn't problems in the call.. but if you create a Group and then
you call the same method then crash.
The problem with the method addChild is similar. If you call it from
an instance of Group works perfectly but if you try to call it from
PositionAttitudeTransfom then it doesn't crash but the method doesn't
adds any child.
We are now working in a osgJava implementation, following the same
ideas of osgPython. Miguel(osgPython) and me have been debugging
and we have created a simple example in C++ showing the problem.
I would like to talk with Jose Luís(osgLua) to know if he finds the same
problem.
Notes:
- You can find attached the example and the line to compile it is
in the first line of the file ;).
- The example has been tested against osg 2.0 and with svn
version r7033 (few hours ago) and fails on both.
Rafa.
--
Rafael Gaitán Linares
Instituto de Automática e Informática Industrial http://www.ai2.upv.es
Ciudad Politécnica de la Innovación
Universidad Politécnica de Valencia
// g++ -Wl,-E -fno-strict-aliasing -g -O2 -W -Wall -fPIC -losg -losgDB -losgIntrospection -o test test.cpp
#include <iostream>
#include <osgIntrospection/Reflection>
#include <osgIntrospection/MethodInfo>
#include <osgIntrospection/Type>
#include <osgDB/DynamicLibrary>
#include <osg/ref_ptr>
// borrowed from osgDB...
std::string createLibraryNameForWrapper(const std::string& ext)
{
#if defined(WIN32)
// !! recheck evolving Cygwin DLL extension naming protocols !! NHV
#ifdef __CYGWIN__
return "cygosgwrapper_"+ext+".dll";
#elif defined(__MINGW32__)
return "libosgwrapper_"+ext+".dll";
#else
#ifdef _DEBUG
return "osgwrapper_"+ext+"d.dll";
#else
return "osgwrapper_"+ext+".dll";
#endif
#endif
#elif macintosh
return "osgwrapper_"+ext;
#elif defined(__hpux__)
// why don't we use PLUGIN_EXT from the makefiles here?
return "osgwrapper_"+ext+".sl";
#else
return "osgwrapper_"+ext+".so";
#endif
}
osgDB::DynamicLibrary *loadWrapper(const std::string &name)
{
std::cout << "loading ... " << name << std::endl;
return osgDB::DynamicLibrary::loadLibrary(
createLibraryNameForWrapper(name)
);
}
int main()
{
osg::ref_ptr<osgDB::DynamicLibrary> osg_lib = loadWrapper("osg");
osgIntrospection::ValueList vlgrp;
osgIntrospection::ValueList vlcall;
const osgIntrospection::Type &type = osgIntrospection::Reflection::getType("osg::Group");
//grp = new osg::Group();
osgIntrospection::Value grp = type.createInstance(vlgrp);
//grp->setName("test");
vlcall.push_back(osgIntrospection::Value("test"));
const osgIntrospection::MethodInfo *m = type.getCompatibleMethod("setName", vlcall, true);
if (m){
osgIntrospection::ValueList::const_iterator it;
std::string str;
// Print to screen some info
str = "Calling to: " + type.getQualifiedName() + "::setName (";
for (it=vlcall.begin(); it != vlcall.end(); ++it){
str += it->getType().getQualifiedName() + ", ";
}
str += "\b\b)";
std::cout << str << std::endl;
//Call Method
m->invoke(grp, vlcall);
}
else{
osgIntrospection::ValueList::const_iterator it;
std::string error = "Method " + type.getQualifiedName() + "::setName (";
for (it=vlcall.begin(); it != vlcall.end(); ++it){
error += it->getType().getQualifiedName() + ", ";
}
error += ") not found.";
std::cerr << "Error: " << error << std::endl;
}
return 0;
}
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/