2
#include <osgDB/ObjectWrapper>
3
#include <osgDB/InputStream>
4
#include <osgDB/OutputStream>
6
static bool checkChildren( const osg::Group& node )
8
return node.getNumChildren()>0;
11
static bool readChildren( osgDB::InputStream& is, osg::Group& node )
13
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
14
for ( unsigned int i=0; i<size; ++i )
16
osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() );
17
if ( child ) node.addChild( child );
19
is >> osgDB::END_BRACKET;
23
static bool writeChildren( osgDB::OutputStream& os, const osg::Group& node )
25
unsigned int size = node.getNumChildren();
26
os << size << osgDB::BEGIN_BRACKET << std::endl;
27
for ( unsigned int i=0; i<size; ++i )
29
os << node.getChild(i);
31
os << osgDB::END_BRACKET << std::endl;
35
REGISTER_OBJECT_WRAPPER( Group,
38
"osg::Object osg::Node osg::Group" )
40
ADD_USER_SERIALIZER( Children ); // _children