Hi J-S,

The serializers uses the library name and the class name to look up
the wrappers to read and write the objects.  If the library name and
class name are different from osg and Group then it won't invoke the
Group wrappers.  To have .osg support for them you'll need to provide
a wrapper, or modify the names so that they aren't modified locally.

Robert.

On Tue, Nov 30, 2010 at 8:06 PM, Jean-Sébastien Guay
<jean-sebastien.g...@cm-labs.com> wrote:
> Hello all,
>
> I noticed when doing osgDB::writeNodeFile to .osg file with an
> osgOcean::OceanScene in the graph, the written graph stops at that node,
> i.e. that node and all its children (it is a subclass of osg::Group) are not
> in the file.
>
> I would think that even if no wrapper / serializer exists for this node
> type, it should be writable as its base class type (osg::Group)... Is this
> not what's supposed to happen?
>
> Initially, the OceanScene class didn't use the META_Node(library, class)
> macro, and I thought that was why it couldn't be saved even as its base
> class type (or any node type). But I changed the header to use the macro,
> and it still isn't written.
>
> I know the best thing would be to provide a serializer / osgdb_osgOcean
> plugin to be able to write and read the exact type and its members from .osg
> files (and other types). But what is the minimum I need to do so that at
> least, the writeNodeFile() traversal will traverse it as an osg::Group and
> write its children?
>
> Is there a way to write a callback that would be called for unknown node
> types, and from which I could static_cast<osg::Group*> and then traverse
> that, which would resolve the base class type correctly?
>
> I even checked the OceanScene::traverse() method, and it is written as:
>
> void OceanScene::traverse( osg::NodeVisitor& nv )
> {
>    if( nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR )
>    {
>        //...
>    }
>    else if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
>    {
>        //...
>    }
>    else
>        osg::Group::traverse(nv);
> }
>
> So I would have thought that would let the writeNodeFile() do its work as if
> it were an osg::Group...
>
> Thanks in advance,
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
>                               http://www.cm-labs.com/
>                        http://whitestar02.webhop.org/
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to