~ubuntu-branches/debian/experimental/openscenegraph/experimental

« back to all changes in this revision

Viewing changes to OpenSceneGraph/src/osgWrappers/serializers/osg/Group.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Luaces
  • Date: 2011-01-29 11:36:29 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110129113629-qisrm2kdqlurc7t3
Tags: 2.9.11-1
* Removed bug-555869-ftbfs_with_binutils_gold.dpatch since upstream has
  already taken care of the issue.
* Removed bug-528229.dpatch since the pkgconfig files are now also split
  in upstream.
* Removed explicit dependency on GLU.
* Upstream no longer includes osgIntrospection (Closes: #592420).
* Disabled zip plugin as its implementation stores an embedded copy of
  zlib.
* Enabled Qt support. Thanks James Goppert.
* Enabled SVG and PDF plugins. Thanks James Goppert.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <osg/Group>
 
2
#include <osgDB/ObjectWrapper>
 
3
#include <osgDB/InputStream>
 
4
#include <osgDB/OutputStream>
 
5
 
 
6
static bool checkChildren( const osg::Group& node )
 
7
{
 
8
    return node.getNumChildren()>0;
 
9
}
 
10
 
 
11
static bool readChildren( osgDB::InputStream& is, osg::Group& node )
 
12
{
 
13
    unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
 
14
    for ( unsigned int i=0; i<size; ++i )
 
15
    {
 
16
        osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() );
 
17
        if ( child ) node.addChild( child );
 
18
    }
 
19
    is >> osgDB::END_BRACKET;
 
20
    return true;
 
21
}
 
22
 
 
23
static bool writeChildren( osgDB::OutputStream& os, const osg::Group& node )
 
24
{
 
25
    unsigned int size = node.getNumChildren();
 
26
    os << size << osgDB::BEGIN_BRACKET << std::endl;
 
27
    for ( unsigned int i=0; i<size; ++i )
 
28
    {
 
29
        os << node.getChild(i);
 
30
    }
 
31
    os << osgDB::END_BRACKET << std::endl;
 
32
    return true;
 
33
}
 
34
 
 
35
REGISTER_OBJECT_WRAPPER( Group,
 
36
                         new osg::Group,
 
37
                         osg::Group,
 
38
                         "osg::Object osg::Node osg::Group" )
 
39
{
 
40
    ADD_USER_SERIALIZER( Children );  // _children
 
41
}