From 1196f153fc97ed72ee6037e1f9f0ee9ba13572bc Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 22 Oct 2013 11:32:21 +0000 Subject: [PATCH] From Colin McDonald, "The osgt/osgb file formats output a scenegraph node with the type set to "SCENE" in the file header. But if the file is stored and then extracted again from an osga archive this header info is lost, and the resulting file is just an "OBJECT". Possibly other plugin operations would have the same effect. The osgt/osgb plugin won't then return the scenegraph contents. I have updated the osgt/osgb plugin to return a node from an "OBJECT" file." --- src/osgPlugins/osg/ReaderWriterOSG2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/osg/ReaderWriterOSG2.cpp b/src/osgPlugins/osg/ReaderWriterOSG2.cpp index da15ce459..cdf425551 100644 --- a/src/osgPlugins/osg/ReaderWriterOSG2.cpp +++ b/src/osgPlugins/osg/ReaderWriterOSG2.cpp @@ -242,7 +242,8 @@ public: if ( !ii ) return ReadResult::FILE_NOT_HANDLED; InputStream is( options ); - if ( is.start(ii.get())!=InputStream::READ_SCENE ) + osgDB::InputStream::ReadType readType = is.start(ii.get()); + if ( readType!=InputStream::READ_SCENE && readType!=InputStream::READ_OBJECT ) { CATCH_EXCEPTION(is); return ReadResult::FILE_NOT_HANDLED; @@ -250,6 +251,7 @@ public: is.decompress(); CATCH_EXCEPTION(is); osg::Node* node = dynamic_cast(is.readObject()); CATCH_EXCEPTION(is); + if ( !node ) return ReadResult::FILE_NOT_HANDLED; return node; }