Fixed the readObject method so it could handle reading from a file contains any valid type of osg::Object

This commit is contained in:
Robert Osfield 2010-11-30 14:36:37 +00:00
parent 55749eda59
commit e9cd13f120

View File

@ -159,12 +159,15 @@ public:
if ( !ii ) return ReadResult::FILE_NOT_HANDLED; if ( !ii ) return ReadResult::FILE_NOT_HANDLED;
InputStream is( options ); InputStream is( options );
if ( is.start(ii.get())!=InputStream::READ_OBJECT )
osgDB::InputStream::ReadType readType = is.start(ii.get());
if ( readType==InputStream::READ_UNKNOWN )
{ {
CATCH_EXCEPTION(is); CATCH_EXCEPTION(is);
return ReadResult::FILE_NOT_HANDLED; return ReadResult::FILE_NOT_HANDLED;
} }
is.decompress(); CATCH_EXCEPTION(is); is.decompress(); CATCH_EXCEPTION(is);
osg::Object* obj = is.readObject(); CATCH_EXCEPTION(is); osg::Object* obj = is.readObject(); CATCH_EXCEPTION(is);
return obj; return obj;
} }