On Sat, 2011-09-03 at 13:01 +0200, Joel Graff wrote:
> Hi,
> 
> I have a graph that I serialize with a simple call to osgDB::writeNodeFile(), 
> but it contains a node that is auto-generated when the application starts.  
> Is there a way to exclude that node from serialization?  I'm familiar with 
> the setNodeMask() / setTraversalMask() mechanism used in visitor classes, but 
> wasn't finding something similiar for serialization - nothing jumped out at 
> me in the ReaderWriter docs, anyway.

It is really mind-boggling-ly easy to write a serializer wrapper. Here,
I'll show you (this file is generally called LibraryWrapper.cpp):

----------------------------------------------

#include <osgDB/Registry>
#include <osgDB/ObjectWrapper>

extern "C" void wrapper_serializer_library_myLibrary(void) {
}

REGISTER_OBJECT_WRAPPER(
        myLibrary_Object,
        new myLibrary::Object(),
        myLibrary::Object,
        "osg::Object osg::MatrixTransform myLibrary::Object"
) {
}

---------------------------------------------

As long as your object can be built after construction this will be a
suitable workaround. If you want to actually serialize members, well,
that's also incredibly easy (depending on what type of data they are).

You can find some examples here:

http://code.google.com/p/osgpango/source/browse/#svn%2Ftrunk%2Fsrc%
2Fserializers

...or all throughout the code in $OSG/src/osgWrappers/serializers/

> ... 
> 
> Thank you!
> 
> Cheers,
> Joel
> 
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=42403#42403
> 
> 
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to