From Farshid Lashkari, "The ProxyNode serializer was not correctly reading the "Children" field. It conditionally writes the begin/end brackets, depending on whether it has children. However, during input it unconditionally attempts to read the begin/end brackets. I've modified the code to only read the brackets if it has children."

This commit is contained in:
Robert Osfield
2013-09-02 10:56:48 +00:00
parent b9ecec6452
commit f5deda56a6

View File

@@ -44,13 +44,17 @@ static bool checkChildren( const osg::ProxyNode& node )
static bool readChildren( osgDB::InputStream& is, osg::ProxyNode& node )
{
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
unsigned int size = 0; is >> size;
if (size > 0)
{
osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() );
if ( child ) node.addChild( child );
is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() );
if ( child ) node.addChild( child );
}
is >> is.END_BRACKET;
}
is >> is.END_BRACKET;
return true;
}