[osg-users] Bug in 3.4.0 when exporting .osgx file?

Robert Osfield robert.osfield at gmail.com
Tue Mar 21 08:46:06 PDT 2017


Hi Werner,

As I explained in my previous post, the method should find the
wrappers if the plugin has been already loaded, so it shouldn't be
trying to reload a plugin as there would be no beneft - the code will
have already checked all the possible wrappers.

You haven't provided any guidance on how we might reproduce the issue
so I can't say what might be wrong.  The code you are looking at is
likely of symptom of a problem elsewhere.

Another avenue you could try is to look at the OSG master to see if
fixes elsewhere in the OSG have addressed this issue.

Robert.

On 21 March 2017 at 14:54, Werner Modenbach <Werner.Modenbach at texion.eu> wrote:
> Hi Robert,
>
> the problem is here:
>
> if
> (osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED)
>
>     return findWrapper(name);
>
> return NULL;
>
> The loadLibrary() returns PREVIOUSLY_LOADED and not LOADED.
> So NULL gets returned instead of a wrapper pointer and thus the node doesn't
> get exported.
> Or am I on the wrong search path?
>
> I try exporting my scene into an .osgx file by calling:
>     osg::ref_ptr<osgDB::ReaderWriter> rw =
> osgDB::Registry::instance()->getReaderWriterForExtension(
>
> osgDB::getLowerCaseFileExtension(_filename.toStdString()));
>     if (!rw.valid())
>         return false;
>     osgDB::ReaderWriter::WriteResult result = rw->writeNode(_node,
> _filename.toStdString());
>
> result.success() is true.
> It creates a file containing only the outer xml header and no scene data.
> node is of type osg::group
>
>
> Am 21.03.2017 um 14:42 schrieb Robert Osfield:
>
> Hi Werner,
>
> I can't work out what might be wrong form the description.
>
> In general the ObjectWrapperManager::findWrapper() checks wrappers
> that have been registered with it first, then if it fails to find one
> then attempts to load plugins that may be able to provide that
> wrapper. If the code is getting to the find return then it's an
> indication that the wrapper has been found.  Given this the
> ObjectWrapperManager::findWrapper() code looks correct.
>
> This review would suggest that the issue is likely elsewhere.  What
> might be wrong is not something I can say at this stage.  Would it be
> possible create a test case that reproduces the problem so others can
> look into it?
>
> Robert.
>
>
> On 21 March 2017 at 13:15, Werner Modenbach <Werner.Modenbach at texion.eu>
> wrote:
>
> Hi Robert,
>
> I think I catched another problem in version 3.4.0.
> I try exporting my scene as .osgx file.
> But except the xml header nothing is written.
> I debuged it and found the following sequence of calls:
>
>
>         osg::ref_ptr<osgDB::ReaderWriter> rw =
> osgDB::Registry::instance()->getReaderWriterForExtension(
>
>
> osgDB::getLowerCaseFileExtension(_filename.toStdString()));
>
>     if (!rw.valid())
>
>         return false;
>
>     osgDB::ReaderWriter::WriteResult result = rw->writeNode(_node,
> _filename.toStdString());
>
> -> ReaderWriterOSG2::writeNode(...)
>
>     result = writeNode( node, fout, local_opt.get() );
>
> -> ReaderWriterOSG2::writeNode(...)
>
>         os.writeObject( &node ); CATCH_EXCEPTION(os);
>
> -> OutputStream::writeObject(...)
>
>     if (newID)
>     {
>         writeObjectFields(obj);
>     }
>
> -> OutputStream::writeObjectFields(...)
>
>     ObjectWrapper* wrapper =
> Registry::instance()->getObjectWrapperManager()->findWrapper( name );
>     if ( !wrapper )
>     {
>         OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
> "
>                                 << name << std::endl;
>         return;
>     }
>
> -> OutputStream::writeObjectFields(...)
>
>     ObjectWrapper* wrapper =
> Registry::instance()->getObjectWrapperManager()->findWrapper( name );
>     if ( !wrapper )
>     {
>         OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
> "
>                                 << name << std::endl;
>         return;
>     }
> -> ObjectWrapperManager::findWrapper(...)
>
>         pluginLib =
> osgDB::Registry::instance()->createLibraryNameForExtension(libName);
>         if (
> osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED
> )
>             return findWrapper(name);
>     }
>     return NULL;
>
> The loadLibrary(...) method returns "PREVIOUSLY_LOADED" and so NULL is
> returned and nothing gets written.
>
> I think that should be different. Am I right?
>
> - Werner -
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
> --
> TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
> Phone: +49 241 475757-0
> Fax: +49 241 475757-29
> Web: http://texion.eu
> eMail: info at texion.eu
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list