Index: /OpenSceneGraph/trunk/include/osgDB/Serializer
===================================================================
--- /OpenSceneGraph/trunk/include/osgDB/Serializer (revision 11002)
+++ /OpenSceneGraph/trunk/include/osgDB/Serializer (revision 11018)
@@ -138,6 +138,14 @@
     {
         C& object = OBJECT_CAST<C&>(obj);
-        if ( !is.isBinary() && !is.matchString(_name) )
-            return true;
+        if ( is.isBinary() )
+        {
+            bool ok = false; is >> ok;
+            if ( !ok ) return true;
+        }
+        else
+        {
+            if ( !is.matchString(_name) )
+                return true;
+        }
         return (*_reader)(is, object);
     }
@@ -146,8 +154,14 @@
     {
         const C& object = OBJECT_CAST<const C&>(obj);
-        if ( !os.isBinary() )
-        {
-            if ( !(*_checker)(object) ) return true;
-            os << _name;
+        bool ok = (*_checker)(object);
+        if ( os.isBinary() )
+        {
+            os << ok;
+            if ( !ok ) return true;
+        }
+        else
+        {
+            if ( !ok ) return true;
+            os << PROPERTY(_name.c_str());
         }
         return (*_writer)(os, object);
@@ -159,4 +173,6 @@
     std::string _name;
     Checker _checker;
+    
+public:
     Reader _reader;
     Writer _writer;
@@ -220,5 +236,5 @@
         else if ( ParentType::_defaultValue!=(object.*_getter)() )
         {
-            os << ParentType::_name;
+            os << PROPERTY((ParentType::_name).c_str());
             if ( _useHex ) os << std::hex;
             os << (object.*_getter)();
@@ -229,7 +245,9 @@
     }
     
-protected:
+public:
     Getter _getter;
     Setter _setter;
+    
+protected:
     bool _useHex;
 };
@@ -275,10 +293,10 @@
         else if ( ParentType::_defaultValue!=(object.*_getter)() )
         {
-            os << ParentType::_name << (object.*_getter)() << std::endl;
-        }
-        return true;
-    }
-    
-protected:
+            os << PROPERTY((ParentType::_name).c_str()) << (object.*_getter)() << std::endl;
+        }
+        return true;
+    }
+    
+public:
     Getter _getter;
     Setter _setter;
@@ -324,5 +342,5 @@
         else if ( ParentType::_defaultValue!=(object.*_getter)() )
         {
-            os << ParentType::_name << (object.*_getter)() << std::endl;
+            os << PROPERTY((ParentType::_name).c_str()) << (object.*_getter)() << std::endl;
         }
         return true;
@@ -344,4 +362,5 @@
     }
     
+public:
     Getter _getter;
     Setter _setter;
@@ -386,10 +405,10 @@
         else if ( ParentType::_defaultValue!=(object.*_getter)() )
         {
-            os << ParentType::_name << GLENUM((object.*_getter)()) << std::endl;
-        }
-        return true;
-    }
-    
-protected:
+            os << PROPERTY((ParentType::_name).c_str()) << GLENUM((object.*_getter)()) << std::endl;
+        }
+        return true;
+    }
+    
+public:
     Getter _getter;
     Setter _setter;
@@ -436,5 +455,5 @@
         else if ( ParentType::_defaultValue!=(object.*_getter)() )
         {
-            os << ParentType::_name;
+            os << PROPERTY((ParentType::_name).c_str());
             os.writeWrappedString( (object.*_getter)() );
             os << std::endl;
@@ -443,5 +462,5 @@
     }
     
-protected:
+public:
     Getter _getter;
     Setter _setter;
@@ -499,5 +518,5 @@
         else if ( ParentType::_defaultValue!=(object.*_getter)() )
         {
-            os << ParentType::_name << hasObject;
+            os << PROPERTY((ParentType::_name).c_str()) << hasObject;
             if ( hasObject )
             {
@@ -511,5 +530,5 @@
     }
     
-protected:
+public:
     Getter _getter;
     Setter _setter;
@@ -567,5 +586,5 @@
         else if ( ParentType::_defaultValue!=(object.*_getter)() )
         {
-            os << ParentType::_name << hasObject;
+            os << PROPERTY((ParentType::_name).c_str()) << hasObject;
             if ( hasObject )
             {
@@ -579,5 +598,5 @@
     }
     
-protected:
+public:
     Getter _getter;
     Setter _setter;
@@ -632,12 +651,14 @@
         else if ( ParentType::_defaultValue!=(object.*_getter)() )
         {
-            os << ParentType::_name << getString((object.*_getter)()) << std::endl;
-        }
-        return true;
-    }
-    
-protected:
+            os << PROPERTY((ParentType::_name).c_str()) << getString((object.*_getter)()) << std::endl;
+        }
+        return true;
+    }
+    
+public:
     Getter _getter;
     Setter _setter;
+    
+protected:
     IntLookup _lookup;
 };
@@ -707,5 +728,5 @@
         else if ( size>0 )
         {
-            os << ParentType::_name << size << BEGIN_BRACKET << std::endl;
+            os << PROPERTY((ParentType::_name).c_str()) << size << BEGIN_BRACKET << std::endl;
             for ( ConstIterator itr=list.begin();
                   itr!=list.end(); ++itr )
@@ -718,5 +739,5 @@
     }
     
-protected:
+public:
     Getter _getter;
     Setter _setter;
@@ -846,5 +867,5 @@
 
 #define END_ENUM_SERIALIZER() \
-    wrapper->addSerializer(serializer.get()); }
+    wrapper->addSerializer(serializer); }
 
 
Index: /OpenSceneGraph/trunk/include/osgDB/InputStream
===================================================================
--- /OpenSceneGraph/trunk/include/osgDB/InputStream (revision 10986)
+++ /OpenSceneGraph/trunk/include/osgDB/InputStream (revision 11018)
@@ -32,9 +32,15 @@
 {
 
-class InputException
+class InputException : public osg::Referenced
 {
 public:
-    InputException( const std::string& field, const std::string& err )
-    : _field(field), _error(err) {}
+    InputException( const std::vector<std::string>& fields, const std::string& err ) : _error(err)
+    {
+        for ( unsigned int i=0; i<fields.size(); ++i )
+        {
+            _field += fields[i];
+            _field += " ";
+        }
+    }
     
     const std::string& getField() const { return _field; }
@@ -66,23 +72,23 @@
     
     // Serialization related functions
-    InputStream& operator>>( bool& b ) { _in->readBool(b); return *this; }
-    InputStream& operator>>( char& c ) { _in->readChar(c); return *this; }
-    InputStream& operator>>( signed char& c ) { _in->readSChar(c); return *this; }
-    InputStream& operator>>( unsigned char& c ) { _in->readUChar(c); return *this; }
-    InputStream& operator>>( short& s ) { _in->readShort(s); return *this; }
-    InputStream& operator>>( unsigned short& s ) { _in->readUShort(s); return *this; }
-    InputStream& operator>>( int& i ) { _in->readInt(i); return *this; }
-    InputStream& operator>>( unsigned int& i ) { _in->readUInt(i); return *this; }
-    InputStream& operator>>( long& l ) { _in->readLong(l); return *this; }
-    InputStream& operator>>( unsigned long& l ) { _in->readULong(l); return *this; }
-    InputStream& operator>>( float& f ) { _in->readFloat(f); return *this; }
-    InputStream& operator>>( double& d ) { _in->readDouble(d); return *this; }
-    InputStream& operator>>( std::string& s ) { _in->readString(s); return *this; }
-    InputStream& operator>>( std::istream& (*fn)(std::istream&) ) { _in->readStream(fn); return *this; }
-    InputStream& operator>>( std::ios_base& (*fn)(std::ios_base&) ) { _in->readBase(fn); return *this; }
+    InputStream& operator>>( bool& b ) { _in->readBool(b); checkStream(); return *this; }
+    InputStream& operator>>( char& c ) { _in->readChar(c); checkStream(); return *this; }
+    InputStream& operator>>( signed char& c ) { _in->readSChar(c); checkStream(); return *this; }
+    InputStream& operator>>( unsigned char& c ) { _in->readUChar(c); checkStream(); return *this; }
+    InputStream& operator>>( short& s ) { _in->readShort(s); checkStream(); return *this; }
+    InputStream& operator>>( unsigned short& s ) { _in->readUShort(s); checkStream(); return *this; }
+    InputStream& operator>>( int& i ) { _in->readInt(i); checkStream(); return *this; }
+    InputStream& operator>>( unsigned int& i ) { _in->readUInt(i); checkStream(); return *this; }
+    InputStream& operator>>( long& l ) { _in->readLong(l); checkStream(); return *this; }
+    InputStream& operator>>( unsigned long& l ) { _in->readULong(l); checkStream(); return *this; }
+    InputStream& operator>>( float& f ) { _in->readFloat(f); checkStream(); return *this; }
+    InputStream& operator>>( double& d ) { _in->readDouble(d); checkStream(); return *this; }
+    InputStream& operator>>( std::string& s ) { _in->readString(s); checkStream(); return *this; }
+    InputStream& operator>>( std::istream& (*fn)(std::istream&) ) { _in->readStream(fn); checkStream(); return *this; }
+    InputStream& operator>>( std::ios_base& (*fn)(std::ios_base&) ) { _in->readBase(fn); checkStream(); return *this; }
     
-    InputStream& operator>>( ObjectGLenum& value ) { _in->readGLenum(value); return *this; }
-    InputStream& operator>>( ObjectProperty& prop ) { _in->readProperty(prop); return *this; }
-    InputStream& operator>>( ObjectMark& mark ) { _in->readMark(mark); return *this; }
+    InputStream& operator>>( ObjectGLenum& value ) { _in->readGLenum(value); checkStream(); return *this; }
+    InputStream& operator>>( ObjectProperty& prop ) { _in->readProperty(prop); checkStream(); return *this; }
+    InputStream& operator>>( ObjectMark& mark ) { _in->readMark(mark); checkStream(); return *this; }
     
     InputStream& operator>>( osg::Vec2b& v );
@@ -117,7 +123,7 @@
     
     // Convenient methods for reading
-    inline bool matchString( const std::string& str );
-    inline void advanceToCurrentEndBracket();
-    inline void readWrappedString( std::string& str );
+    bool matchString( const std::string& str );
+    void advanceToCurrentEndBracket();
+    void readWrappedString( std::string& str );
     void readCharArray( char* s, unsigned int size ) { _in->readCharArray(s, size); }
     
@@ -135,6 +141,10 @@
     void resetSchema();
     
+    // Exception handlers
+    inline void throwException( const std::string& msg );
+    const InputException* getException() const { return _exception.get(); }
+    
 protected:
-    inline void checkStream() const;
+    inline void checkStream();
     void setWrapperSchema( const std::string& name, const std::string& properties );
     
@@ -147,66 +157,20 @@
     int _byteSwap;
     bool _useFloatMatrix;
-    std::string _currentField;
-    InputIterator* _in;
+    bool _forceReadingImage;
+    std::vector<std::string> _fields;
+    osg::ref_ptr<InputIterator> _in;
+    osg::ref_ptr<InputException> _exception;
 };
 
-bool InputStream::matchString( const std::string& str )
+void InputStream::throwException( const std::string& msg )
 {
-    if ( !isBinary() )
-    {
-        std::string s; *this >> s;
-        if ( s==str ) return true;
-        else _in->getStream()->seekg( -(int)(s.length()), std::ios::cur );
-    }
-    return false;
+    _exception = new InputException(_fields, msg);
 }
 
-void InputStream::advanceToCurrentEndBracket()
+void InputStream::checkStream()
 {
-    if ( isBinary() )
-        return;
-    
-    std::string passString;
-    unsigned int blocks = 0;
-    while ( !_in->getStream()->eof() )
-    {
-        passString.clear();
-        *this >> passString;
-        
-        if ( passString=="}" )
-        {
-            if ( blocks<=0 ) return;
-            else blocks--;
-        }
-        else if ( passString=="{" )
-            blocks++;
-    }
-}
-
-void InputStream::readWrappedString( std::string& str )
-{
-    *this >> str;
-    if ( !isBinary() )
-    {
-        if ( str[0]=='\"' )
-        {
-            if ( str.size()==1 || (*str.rbegin())!='\"' )
-            {
-                char ch;
-                do
-                {
-                    _in->getStream()->get( ch ); checkStream();
-                    str.append( 1, ch );
-                } while ( ch!='\"' );
-            }
-            str = str.substr(1, str.size()-2);
-        }
-    }
-}
-
-void InputStream::checkStream() const
-{
+    _in->checkStream();
     if ( _in->isFailed() )
-        throw InputException(_currentField, "InputStream: Failed to read from stream.");
+        throwException( "InputStream: Failed to read from stream." );
 }
 
Index: /OpenSceneGraph/trunk/include/osgDB/StreamOperator
===================================================================
--- /OpenSceneGraph/trunk/include/osgDB/StreamOperator (revision 10988)
+++ /OpenSceneGraph/trunk/include/osgDB/StreamOperator (revision 11018)
@@ -9,5 +9,5 @@
 {
 
-class OSGDB_EXPORT OutputIterator
+class OSGDB_EXPORT OutputIterator : public osg::Referenced
 {
 public:
@@ -45,5 +45,5 @@
 };
 
-class OSGDB_EXPORT InputIterator
+class OSGDB_EXPORT InputIterator : public osg::Referenced
 {
 public:
@@ -55,5 +55,7 @@
     const std::istream* getStream() const { return _in; }
     
+    void checkStream() const { if (_in->rdstate()&_in->failbit) _failed = true; }
     bool isFailed() const { return _failed; }
+    
     virtual bool isBinary() const = 0;
     
@@ -80,7 +82,4 @@
     
 protected:
-    void checkStream() const
-    { if (_in->rdstate()&_in->failbit) _failed = true; }
-    
     std::istream* _in;
     mutable bool _failed;
Index: /OpenSceneGraph/trunk/include/osgDB/OutputStream
===================================================================
--- /OpenSceneGraph/trunk/include/osgDB/OutputStream (revision 10986)
+++ /OpenSceneGraph/trunk/include/osgDB/OutputStream (revision 11018)
@@ -31,9 +31,15 @@
 {
 
-class OutputException
+class OutputException : public osg::Referenced
 {
 public:
-    OutputException( const std::string& field, const std::string& err )
-    : _field(field), _error(err) {}
+    OutputException( const std::vector<std::string>& fields, const std::string& err ) : _error(err)
+    {
+        for ( unsigned int i=0; i<fields.size(); ++i )
+        {
+            _field += fields[i];
+            _field += " ";
+        }
+    }
     
     const std::string& getField() const { return _field; }
@@ -71,4 +77,5 @@
     
     bool isBinary() const { return _out->isBinary(); }
+    const std::string& getSchemaName() const { return _schemaName; }
     
     void setWriteImageHint( WriteImageHint hint ) { _writeImageHint = hint; }
@@ -126,5 +133,5 @@
     
     // Convenient methods for writing
-    inline void writeWrappedString( const std::string& str );
+    void writeWrappedString( const std::string& str );
     void writeCharArray( const char* s, unsigned int size ) { _out->writeCharArray(s, size); }
     
@@ -141,4 +148,8 @@
     void writeSchema( std::ostream& fout );
     
+    // Exception handlers
+    inline void throwException( const std::string& msg );
+    const OutputException* getException() const { return _exception.get(); }
+    
 protected:
     template<typename T>
@@ -152,19 +163,15 @@
     
     WriteImageHint _writeImageHint;
-    std::string _currentField;
+    std::vector<std::string> _fields;
+    std::string _schemaName;
     std::string _compressorName;
     std::stringstream _compressSource;
-    OutputIterator* _out;
+    osg::ref_ptr<OutputIterator> _out;
+    osg::ref_ptr<OutputException> _exception;
 };
 
-void OutputStream::writeWrappedString( const std::string& str )
+void OutputStream::throwException( const std::string& msg )
 {
-    if ( !isBinary() )
-    {
-        std::string wrappedStr = std::string("\"") + str + std::string("\"");
-        *this << wrappedStr;
-    }
-    else
-        *this << str;
+    _exception = new OutputException(_fields, msg);
 }
 
Index: /OpenSceneGraph/trunk/include/osgParticle/PrecipitationEffect
===================================================================
--- /OpenSceneGraph/trunk/include/osgParticle/PrecipitationEffect (revision 10333)
+++ /OpenSceneGraph/trunk/include/osgParticle/PrecipitationEffect (revision 11018)
@@ -48,5 +48,5 @@
         
         void setMaximumParticleDensity(float density) { if (_maximumParticleDensity==density) return;  _maximumParticleDensity = density; _dirty = true;}
-        float setMaximumParticleDensity() const { return _maximumParticleDensity; }
+        float getMaximumParticleDensity() const { return _maximumParticleDensity; }
 
         void setWind(const osg::Vec3& wind) { _wind = wind; }
Index: /OpenSceneGraph/trunk/include/osgParticle/ParticleProcessor
===================================================================
--- /OpenSceneGraph/trunk/include/osgParticle/ParticleProcessor (revision 5855)
+++ /OpenSceneGraph/trunk/include/osgParticle/ParticleProcessor (revision 11018)
@@ -59,4 +59,5 @@
         
         /// Get whether this processor is enabled or not.
+        bool getEnabled() const { return _enabled; }
         inline bool isEnabled() const;
         
@@ -77,4 +78,5 @@
         
         /// Check whether this processor is endless.
+        bool getEndless() const { return _endless; }
         inline bool isEndless() const;
         
Index: /OpenSceneGraph/trunk/include/osgParticle/ParticleSystem
===================================================================
--- /OpenSceneGraph/trunk/include/osgParticle/ParticleSystem (revision 9728)
+++ /OpenSceneGraph/trunk/include/osgParticle/ParticleSystem (revision 11018)
@@ -124,4 +124,5 @@
         
         /// Return true if the particle system is frozen.
+        bool getFrozen() const { return _frozen; }
         inline bool isFrozen() const;
         
Index: /OpenSceneGraph/trunk/src/osgPlugins/osg/BinaryStreamOperator.h
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/osg/BinaryStreamOperator.h (revision 10986)
+++ /OpenSceneGraph/trunk/src/osgPlugins/osg/BinaryStreamOperator.h (revision 11018)
@@ -79,20 +79,20 @@
     {
         char c = 0;
-        _in->read( &c, CHAR_SIZE ); checkStream();
+        _in->read( &c, CHAR_SIZE );
         b = (c!=0);
     }
     
     virtual void readChar( char& c )
-    { _in->read( &c, CHAR_SIZE ); checkStream(); }
+    { _in->read( &c, CHAR_SIZE ); }
     
     virtual void readSChar( signed char& c )
-    { _in->read( (char*)&c, CHAR_SIZE ); checkStream(); }
+    { _in->read( (char*)&c, CHAR_SIZE ); }
     
     virtual void readUChar( unsigned char& c )
-    { _in->read( (char*)&c, CHAR_SIZE ); checkStream(); }
+    { _in->read( (char*)&c, CHAR_SIZE ); }
     
     virtual void readShort( short& s )
     {
-        _in->read( (char*)&s, SHORT_SIZE ); checkStream();
+        _in->read( (char*)&s, SHORT_SIZE );
         if ( _byteSwap ) osg::swapBytes( (char*)&s, SHORT_SIZE );
     }
@@ -100,5 +100,5 @@
     virtual void readUShort( unsigned short& s )
     {
-        _in->read( (char*)&s, SHORT_SIZE ); checkStream();
+        _in->read( (char*)&s, SHORT_SIZE );
         if ( _byteSwap ) osg::swapBytes( (char*)&s, SHORT_SIZE );
     }
@@ -106,5 +106,5 @@
     virtual void readInt( int& i )
     {
-        _in->read( (char*)&i, INT_SIZE ); checkStream();
+        _in->read( (char*)&i, INT_SIZE );
         if ( _byteSwap ) osg::swapBytes( (char*)&i, INT_SIZE );
     }
@@ -112,5 +112,5 @@
     virtual void readUInt( unsigned int& i )
     {
-        _in->read( (char*)&i, INT_SIZE ); checkStream();
+        _in->read( (char*)&i, INT_SIZE );
         if ( _byteSwap ) osg::swapBytes( (char*)&i, INT_SIZE );
     }
@@ -118,5 +118,5 @@
     virtual void readLong( long& l )
     {
-        _in->read( (char*)&l, LONG_SIZE ); checkStream();
+        _in->read( (char*)&l, LONG_SIZE );
         if ( _byteSwap ) osg::swapBytes( (char*)&l, LONG_SIZE );
     }
@@ -124,5 +124,5 @@
     virtual void readULong( unsigned long& l )
     {
-        _in->read( (char*)&l, LONG_SIZE ); checkStream();
+        _in->read( (char*)&l, LONG_SIZE );
         if ( _byteSwap ) osg::swapBytes( (char*)&l, LONG_SIZE );
     }
@@ -130,5 +130,5 @@
     virtual void readFloat( float& f )
     {
-        _in->read( (char*)&f, FLOAT_SIZE ); checkStream();
+        _in->read( (char*)&f, FLOAT_SIZE );
         if ( _byteSwap ) osg::swapBytes( (char*)&f, FLOAT_SIZE );
     }
@@ -136,5 +136,5 @@
     virtual void readDouble( double& d )
     {
-        _in->read( (char*)&d, DOUBLE_SIZE ); checkStream();
+        _in->read( (char*)&d, DOUBLE_SIZE );
         if ( _byteSwap ) osg::swapBytes( (char*)&d, DOUBLE_SIZE );
     }
@@ -146,5 +146,5 @@
         {
             s.resize( size );
-            _in->read( (char*)s.c_str(), size ); checkStream();
+            _in->read( (char*)s.c_str(), size );
         }
     }
@@ -157,5 +157,5 @@
     {
         GLenum e = 0;
-        _in->read( (char*)&e, GLENUM_SIZE ); checkStream();
+        _in->read( (char*)&e, GLENUM_SIZE );
         if ( _byteSwap ) osg::swapBytes( (char*)&e, GLENUM_SIZE );
         value.set( e );
@@ -167,5 +167,5 @@
         if ( prop._mapProperty )
         {
-            _in->read( (char*)&value, INT_SIZE ); checkStream();
+            _in->read( (char*)&value, INT_SIZE );
             if ( _byteSwap ) osg::swapBytes( (char*)&value, INT_SIZE );
         }
@@ -176,5 +176,5 @@
     
     virtual void readCharArray( char* s, unsigned int size )
-    { if ( size>0 ) _in->read( s, size ); checkStream(); }
+    { if ( size>0 ) _in->read( s, size ); }
     
 protected:
Index: /OpenSceneGraph/trunk/src/osgPlugins/osg/AsciiStreamOperator.h
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/osg/AsciiStreamOperator.h (revision 10986)
+++ /OpenSceneGraph/trunk/src/osgPlugins/osg/AsciiStreamOperator.h (revision 11018)
@@ -117,5 +117,5 @@
     {
         std::string boolString;
-        *_in >> boolString; checkStream();
+        *_in >> boolString;
         if ( boolString=="TRUE" ) b = true;
         else b = false;
@@ -125,5 +125,5 @@
     {
         short s = 0;
-        *_in >> s; checkStream();
+        *_in >> s;
         c = (char)s;
     }
@@ -132,5 +132,5 @@
     {
         short s = 0;
-        *_in >> s; checkStream();
+        *_in >> s;
         c = (signed char)s;
     }
@@ -139,34 +139,34 @@
     {
         short s = 0;
-        *_in >> s; checkStream();
+        *_in >> s;
         c = (unsigned char)s;
     }
     
     virtual void readShort( short& s )
-    { *_in >> s; checkStream(); }
+    { *_in >> s; }
     
     virtual void readUShort( unsigned short& s )
-    { *_in >> s; checkStream(); }
+    { *_in >> s; }
     
     virtual void readInt( int& i )
-    { *_in >> i; checkStream(); }
+    { *_in >> i; }
     
     virtual void readUInt( unsigned int& i )
-    { *_in >> i; checkStream(); }
+    { *_in >> i; }
     
     virtual void readLong( long& l )
-    { *_in >> l; checkStream(); }
+    { *_in >> l; }
     
     virtual void readULong( unsigned long& l )
-    { *_in >> l; checkStream(); }
+    { *_in >> l; }
     
     virtual void readFloat( float& f )
-    { *_in >> f; checkStream(); }
+    { *_in >> f; }
     
     virtual void readDouble( double& d )
-    { *_in >> d; checkStream(); }
+    { *_in >> d; }
     
     virtual void readString( std::string& s )
-    { *_in >> s; checkStream(); }
+    { *_in >> s; }
     
     virtual void readStream( std::istream& (*fn)(std::istream&) )
@@ -180,5 +180,5 @@
         GLenum e = 0;
         std::string enumString;
-        *_in >> enumString; checkStream();
+        *_in >> enumString;
         e = osgDB::Registry::instance()->getObjectWrapperManager()->getValue("GL", enumString);
         value.set( e );
@@ -189,5 +189,5 @@
         int value = 0;
         std::string enumString;
-        *_in >> enumString; checkStream();
+        *_in >> enumString;
         if ( prop._mapProperty )
         {
@@ -209,5 +209,5 @@
     {
         std::string markString;
-        *_in >> markString; checkStream();
+        *_in >> markString;
     }
     
Index: /OpenSceneGraph/trunk/src/osgPlugins/osg/ReaderWriterOSG2.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/osg/ReaderWriterOSG2.cpp (revision 10986)
+++ /OpenSceneGraph/trunk/src/osgPlugins/osg/ReaderWriterOSG2.cpp (revision 11018)
@@ -22,15 +22,47 @@
 using namespace osgDB;
 
-bool checkBinary( std::istream* fin )
+#define CATCH_EXCEPTION(s) \
+    if (s.getException()) return (s.getException()->getError() + " At " + s.getException()->getField());
+
+InputIterator* readInputIterator( std::istream& fin, const Options* options )
 {
-    unsigned int headerLow = 0, headerHigh = 0;
-    fin->read( (char*)&headerLow, INT_SIZE );
-    fin->read( (char*)&headerHigh, INT_SIZE );
-    if ( headerLow!=OSG_HEADER_LOW || headerHigh!=OSG_HEADER_HIGH )
-    {
-        fin->seekg( 0, std::ios::beg );
-        return false;
-    }
-    return true;
+    bool extensionIsAscii = false;
+    if ( options && options->getOptionString().find("Ascii")!=std::string::npos )
+        extensionIsAscii = true;
+    
+    if ( !extensionIsAscii )
+    {
+        unsigned int headerLow = 0, headerHigh = 0;
+        fin.read( (char*)&headerLow, INT_SIZE );
+        fin.read( (char*)&headerHigh, INT_SIZE );
+        if ( headerLow==OSG_HEADER_LOW && headerHigh==OSG_HEADER_HIGH )
+        {
+            return new BinaryInputIterator(&fin);
+        }
+        fin.seekg( 0, std::ios::beg );
+    }
+    
+    std::string header; fin >> header;
+    if ( header=="#Ascii" )
+    {
+        return new AsciiInputIterator(&fin);
+    }
+    return NULL;
+}
+
+OutputIterator* writeInputIterator( std::ostream& fout, const Options* options )
+{
+    if ( options && options->getOptionString().find("Ascii")!=std::string::npos )
+    {
+        fout << std::string("#Ascii") << ' ';
+        return new AsciiOutputIterator(&fout);
+    }
+    else
+    {
+        unsigned int low = OSG_HEADER_LOW, high = OSG_HEADER_HIGH;
+        fout.write( (char*)&low, INT_SIZE );
+        fout.write( (char*)&high, INT_SIZE );
+        return new BinaryOutputIterator(&fout);
+    }
 }
 
@@ -44,5 +76,6 @@
         supportsExtension( "osgb", "OpenSceneGraph extendable binary format" );
         
-        supportsOption( "Ascii", "Import/Export option: Force the writer export ascii file" );
+        supportsOption( "Ascii", "Import/Export option: Force reading/writing ascii file" );
+        supportsOption( "ForceReadingImage", "Import option: Load an empty image instead if required file missed" );
         supportsOption( "SchemaFile=<file>", "Import/Export option: Use/Record a ascii schema file" );
         supportsOption( "Compressor=<name>", "Export option: Use an inbuilt or user-defined compressor" );
@@ -83,4 +116,5 @@
             static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
         local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName));
+        if ( ext=="osgt" ) local_opt->setOptionString( local_opt->getOptionString() + " Ascii" );
         
         osgDB::ifstream istream( fileName.c_str(), std::ios::out|std::ios::binary );
@@ -90,23 +124,16 @@
     virtual ReadResult readImage( std::istream& fin, const Options* options ) const
     {
-        try
-        {
-            InputStream is( options );
-            
-            InputIterator* ii = NULL;
-            if ( !checkBinary(&fin) )
-                ii = new AsciiInputIterator(&fin);
-            else
-                ii = new BinaryInputIterator(&fin);
-            
-            if ( is.start(ii)!=InputStream::READ_IMAGE )
-                return ReadResult::FILE_NOT_HANDLED;
-            is.decompress();
-            return is.readImage();
-        }
-        catch ( InputException e )
-        {
-            return e.getError() + " At " + e.getField();
-        }
+        osg::ref_ptr<InputIterator> ii = readInputIterator(fin, options);
+        if ( !ii ) return ReadResult::FILE_NOT_HANDLED;
+        
+        InputStream is( options );
+        if ( is.start(ii.get())!=InputStream::READ_IMAGE )
+        {
+            CATCH_EXCEPTION(is);
+            return ReadResult::FILE_NOT_HANDLED;
+        }
+        is.decompress(); CATCH_EXCEPTION(is);
+        osg::Image* image = is.readImage(); CATCH_EXCEPTION(is);
+        return image;
     }
     
@@ -121,4 +148,5 @@
             static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
         local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName));
+        if ( ext=="osgt" ) local_opt->setOptionString( local_opt->getOptionString() + " Ascii" );
         
         osgDB::ifstream istream( fileName.c_str(), std::ios::out|std::ios::binary );
@@ -128,23 +156,17 @@
     virtual ReadResult readNode( std::istream& fin, const Options* options ) const
     {
-        try
-        {
-            InputStream is( options );
-            
-            InputIterator* ii = NULL;
-            if ( !checkBinary(&fin) )
-                ii = new AsciiInputIterator(&fin);
-            else
-                ii = new BinaryInputIterator(&fin);
-            
-            if ( is.start(ii)!=InputStream::READ_SCENE )
-                return ReadResult::FILE_NOT_HANDLED;
-            is.decompress();
-            return dynamic_cast<osg::Node*>( is.readObject() );
-        }
-        catch ( InputException e )
-        {
-            return e.getError() + " At " + e.getField();
-        }
+        osg::ref_ptr<InputIterator> ii = readInputIterator(fin, options);
+        if ( !ii ) return ReadResult::FILE_NOT_HANDLED;
+        
+        InputStream is( options );
+        if ( is.start(ii.get())!=InputStream::READ_SCENE )
+        {
+            CATCH_EXCEPTION(is);
+            return ReadResult::FILE_NOT_HANDLED;
+        }
+        
+        is.decompress(); CATCH_EXCEPTION(is);
+        osg::Node* node = dynamic_cast<osg::Node*>(is.readObject()); CATCH_EXCEPTION(is);
+        return node;
     }
     
@@ -190,27 +212,20 @@
     virtual WriteResult writeImage( const osg::Image& image, std::ostream& fout, const Options* options ) const
     {
-        try
-        {
-            OutputStream os( options );
-            
-            osgDB::OutputIterator* oi = NULL;
-            if ( options && options->getOptionString().find("Ascii")!=std::string::npos )
-                oi = new AsciiOutputIterator(&fout);
-            else
-                oi = new BinaryOutputIterator(&fout);
-            
-            os.start( oi, OutputStream::WRITE_IMAGE );
-            os.writeImage( &image );
-            os.compress( &fout );
-            
-            if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE;
-            return WriteResult::FILE_SAVED;
-        }
-        catch ( OutputException e )
-        {
-            osg::notify(osg::WARN) << "ReaderWriterOSG2::writeImage(): " << e.getError()
-                                   << " At " << e.getField() << std::endl;
-        }
-        return WriteResult::FILE_NOT_HANDLED;
+        osg::ref_ptr<OutputIterator> oi = writeInputIterator(fout, options);
+        
+        OutputStream os( options );
+        os.start( oi.get(), OutputStream::WRITE_IMAGE ); CATCH_EXCEPTION(os);
+        os.writeImage( &image ); CATCH_EXCEPTION(os);
+        os.compress( &fout ); CATCH_EXCEPTION(os);
+        
+        if ( !os.getSchemaName().empty() )
+        {
+            osgDB::ofstream schemaStream( os.getSchemaName().c_str(), std::ios::out );
+            if ( !schemaStream.fail() ) os.writeSchema( schemaStream );
+            schemaStream.close();
+        }
+        
+        if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE;
+        return WriteResult::FILE_SAVED;
     }
     
@@ -236,27 +251,20 @@
     virtual WriteResult writeNode( const osg::Node& node, std::ostream& fout, const Options* options ) const
     {
-        try
-        {
-            OutputStream os( options );
-            
-            osgDB::OutputIterator* oi = NULL;
-            if ( options && options->getOptionString().find("Ascii")!=std::string::npos )
-                oi = new AsciiOutputIterator(&fout);
-            else
-                oi = new BinaryOutputIterator(&fout);
-            
-            os.start( oi, OutputStream::WRITE_SCENE );
-            os.writeObject( &node );
-            os.compress( &fout );
-            
-            if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE;
-            return WriteResult::FILE_SAVED;
-        }
-        catch ( OutputException e )
-        {
-            osg::notify(osg::WARN) << "ReaderWriterOSG2::writeNode(): " << e.getError()
-                                   << " At " << e.getField() << std::endl;
-        }
-        return WriteResult::FILE_NOT_HANDLED;
+        osg::ref_ptr<OutputIterator> oi = writeInputIterator(fout, options);
+        
+        OutputStream os( options );
+        os.start( oi.get(), OutputStream::WRITE_SCENE ); CATCH_EXCEPTION(os);
+        os.writeObject( &node ); CATCH_EXCEPTION(os);
+        os.compress( &fout ); CATCH_EXCEPTION(os);
+        
+        if ( !os.getSchemaName().empty() )
+        {
+            osgDB::ofstream schemaStream( os.getSchemaName().c_str(), std::ios::out );
+            if ( !schemaStream.fail() ) os.writeSchema( schemaStream );
+            schemaStream.close();
+        }
+        
+        if ( fout.fail() ) return WriteResult::ERROR_IN_WRITING_FILE;
+        return WriteResult::FILE_SAVED;
     }
 };
Index: /OpenSceneGraph/trunk/src/osgDB/InputStream.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgDB/InputStream.cpp (revision 10986)
+++ /OpenSceneGraph/trunk/src/osgDB/InputStream.cpp (revision 11018)
@@ -25,6 +25,5 @@
 
 InputStream::InputStream( const osgDB::Options* options )
-:   _byteSwap(0), _useFloatMatrix(false),
-    _in(0)
+:   _byteSwap(0), _useFloatMatrix(false), _forceReadingImage(false)
 {
     if ( !options ) return;
@@ -39,4 +38,8 @@
         {
             // Omit this
+        }
+        else if ( option=="ForceReadingImage" )
+        {
+            _forceReadingImage = true;
         }
         else
@@ -158,4 +161,75 @@
 }
 
+bool InputStream::matchString( const std::string& str )
+{
+    if ( !isBinary() )
+    {
+        std::string s; *this >> s;
+        if ( s==str ) return true;
+        else _in->getStream()->seekg( -(int)(s.length()), std::ios::cur );
+    }
+    return false;
+}
+
+void InputStream::advanceToCurrentEndBracket()
+{
+    if ( isBinary() )
+        return;
+    
+    std::string passString;
+    unsigned int blocks = 0;
+    while ( !_in->getStream()->eof() )
+    {
+        passString.clear();
+        *this >> passString;
+        
+        if ( passString=="}" )
+        {
+            if ( blocks<=0 ) return;
+            else blocks--;
+        }
+        else if ( passString=="{" )
+            blocks++;
+    }
+}
+
+void InputStream::readWrappedString( std::string& str )
+{
+    *this >> str;
+    if ( !isBinary() )
+    {
+        if ( str[0]=='\"' )
+        {
+            if ( str.size()==1 || (*str.rbegin())!='\"' )
+            {
+                char ch;
+                do
+                {
+                    _in->getStream()->get( ch ); checkStream();
+                    if ( ch=='\\' )
+                    {
+                        _in->getStream()->get( ch ); checkStream();
+                        if ( ch=='\"' )
+                        {
+                            str += ch; ch = 0;
+                        }
+                        else if ( ch=='\\' )
+                        {
+                            str += ch;
+                        }
+                        else
+                        {
+                            str += '\\'; str += ch;
+                        }
+                    }
+                    else
+                        str += ch;
+                } while ( ch!='\"' );
+            }
+            str = str.substr(1, str.size()-2);
+        }
+    }
+}
+
 osg::Array* InputStream::readArray()
 {
@@ -320,7 +394,8 @@
         break;
     default:
-        throw InputException(_currentField, "InputStream::readArray(): Unsupported array type.");
-    }
-    
+        throwException( "InputStream::readArray(): Unsupported array type." );
+    }
+    
+    if ( getException() ) return NULL;
     _arrayMap[id] = array;
     return array.release();
@@ -402,6 +477,8 @@
         break;
     default:
-        throw InputException(_currentField, "InputStream::readPrimitiveSet(): Unsupported array type.");
-    }
+        throwException( "InputStream::readPrimitiveSet(): Unsupported array type." );
+    }
+    
+    if ( getException() ) return NULL;
     return primitive.release();
 }
@@ -413,4 +490,5 @@
     *this >> PROPERTY("FileName"); readWrappedString(name);
     *this >> PROPERTY("WriteHint") >> writeHint >> decision;
+    if ( getException() ) return NULL;
     
     osg::ref_ptr<osg::Image> image = NULL;
@@ -437,5 +515,7 @@
                 char* data = new char[size];
                 if ( !data )
-                    throw InputException(_currentField, "InputStream::readImage() Out of memory.");
+                    throwException( "InputStream::readImage() Out of memory." );
+                if ( getException() ) return NULL;
+                
                 readCharArray( data, size );
                 image->setOrigin( (osg::Image::Origin)origin );
@@ -464,5 +544,6 @@
                 char* data = new char[size];
                 if ( !data )
-                    throw InputException(_currentField, "InputStream::readImage(): Out of memory.");
+                    throwException( "InputStream::readImage(): Out of memory." );
+                if ( getException() ) return NULL;
                 readCharArray( data, size );
                 
@@ -501,5 +582,8 @@
     
     if ( readFromExternal )
+    {
         image = osgDB::readImageFile( name );
+        if ( !image && _forceReadingImage ) image = new osg::Image;
+    }
     if ( image.valid() )
     {
@@ -517,4 +601,5 @@
     unsigned int id = 0;
     *this >> className >> BEGIN_BRACKET >> PROPERTY("UniqueID") >> id;
+    if ( getException() ) return NULL;
     
     IdentifierMap::iterator itr = _identifierMap.find( id );
@@ -533,4 +618,6 @@
         return NULL;
     }
+    _fields.push_back( className );
+    
     osg::ref_ptr<osg::Object> obj = existingObj ? existingObj : wrapper->getProto()->cloneType();
     if ( obj.valid() )
@@ -548,10 +635,14 @@
                 continue;
             }
+            _fields.push_back( assocWrapper->getName() );
             
-            _currentField = assocWrapper->getName();
             assocWrapper->read( *this, *obj );
+            if ( getException() ) return NULL;
+            
+            _fields.pop_back();
         }
     }
     advanceToCurrentEndBracket();
+    _fields.pop_back();
     return obj.release();
 }
@@ -576,9 +667,12 @@
 InputStream::ReadType InputStream::start( InputIterator* inIterator )
 {
+    _fields.clear();
+    _fields.push_back( "Start" );
+    
     ReadType type = READ_UNKNOWN;
-    _currentField = "Header";
     _in = inIterator;
     if ( !_in )
-        throw InputException(_currentField, "InputStream: Null stream specified.");
+        throwException( "InputStream: Null stream specified." );
+    if ( getException() ) return type;
     
     // Check OSG header information
@@ -596,7 +690,4 @@
     if ( !isBinary() )
     {
-        DEF_PROPERTY("#Ascii", header); *this >> header;
-        if ( header._name!="#Ascii" ) return READ_UNKNOWN;
-        
         std::string typeString; *this >> typeString;
         if ( typeString=="Scene" ) type = READ_SCENE;
@@ -615,4 +706,5 @@
                                << PLUGIN_VERSION << std::endl;
     }
+    _fields.pop_back();
     return type;
 }
@@ -620,5 +712,6 @@
 void InputStream::decompress()
 {
-    _currentField = "Decompression";
+    _fields.clear();
+    _fields.push_back( "Decompression" );
     if ( !isBinary() ) return;
     
@@ -635,6 +728,9 @@
     std::string data;
     if ( !compressor->decompress(*(_in->getStream()), data) )
-        throw InputException(_currentField, "InputStream: Failed to decompress stream.");
+        throwException( "InputStream: Failed to decompress stream." );
+    if ( getException() ) return;
+    
     _in->setStream( new std::stringstream(data) );
+    _fields.pop_back();
 }
 
Index: /OpenSceneGraph/trunk/src/osgDB/ObjectWrapper.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgDB/ObjectWrapper.cpp (revision 10982)
+++ /OpenSceneGraph/trunk/src/osgDB/ObjectWrapper.cpp (revision 11018)
@@ -449,5 +449,9 @@
             return findWrapper(name);
 
-        std::string pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(libName);
+        std::string pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(std::string("serializers_")+libName);
+        if ( osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED )
+            return findWrapper(name);
+
+        pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(libName);
         if ( osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED )
             return findWrapper(name);
@@ -492,7 +496,11 @@
             return findCompressor(name);
 
-        std::string pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(libName);
+        std::string pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(std::string("compressor_")+libName);
         if ( osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED )
             return findCompressor(name);
+
+        pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(libName);
+        if ( osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED )
+            return findCompressor(name);
     }
     return NULL;
Index: /OpenSceneGraph/trunk/src/osgDB/OutputStream.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgDB/OutputStream.cpp (revision 10986)
+++ /OpenSceneGraph/trunk/src/osgDB/OutputStream.cpp (revision 11018)
@@ -23,6 +23,5 @@
 
 OutputStream::OutputStream( const osgDB::Options* options )
-:   _writeImageHint(WRITE_USE_IMAGE_HINT),
-    _out(0)
+:   _writeImageHint(WRITE_USE_IMAGE_HINT)
 {
     if ( !options ) return;
@@ -44,9 +43,5 @@
             
             if ( keyAndValues[0]=="SchemaFile" )
-            {
-                osgDB::ofstream schemaStream( keyAndValues[1].c_str(), std::ios::out );
-                if ( !schemaStream.fail() ) writeSchema( schemaStream );
-                schemaStream.close();
-            }
+                _schemaName = keyAndValues[1];
             else if ( keyAndValues[0]=="Compressor" )
                 _compressorName = keyAndValues[1];
@@ -137,4 +132,26 @@
 }
 
+void OutputStream::writeWrappedString( const std::string& str )
+{
+    if ( !isBinary() )
+    {
+        std::string wrappedStr;
+        unsigned int size = str.size();
+        for ( unsigned int i=0; i<size; ++i )
+        {
+            char ch = str[i];
+            if ( ch=='\"' ) wrappedStr += '\\';
+            else if ( ch=='\\' ) wrappedStr += '\\';
+            wrappedStr += ch;
+        }
+        
+        wrappedStr.insert( 0, 1, '\"' );
+        wrappedStr += '\"';
+        *this << wrappedStr;
+    }
+    else
+        *this << str;
+}
+
 void OutputStream::writeArray( const osg::Array* a )
 {
@@ -236,5 +253,5 @@
         break;
     default:
-        throw OutputException(_currentField, "OutputStream::writeArray(): Unsupported array type.");
+        throwException( "OutputStream::writeArray(): Unsupported array type." );
     }
 }
@@ -287,5 +304,5 @@
         break;
     default:
-        throw OutputException(_currentField, "OutputStream::writePrimitiveSet(): Unsupported primitive type.");
+        throwException( "OutputStream::writePrimitiveSet(): Unsupported primitive type." );
     }
 }
@@ -297,4 +314,5 @@
     *this << PROPERTY("FileName"); writeWrappedString(img->getFileName()); *this << std::endl;
     *this << PROPERTY("WriteHint") << (int)img->getWriteHint();
+    if ( getException() ) return;
     
     int decision = IMAGE_EXTERNAL;
@@ -368,5 +386,7 @@
                     char* data = new char[size];
                     if ( !data )
-                        throw OutputException(_currentField, "OutputStream::writeImage(): Out of memory.");
+                        throwException( "OutputStream::writeImage(): Out of memory." );
+                    if ( getException() ) return;
+                    
                     infile.seekg( 0, std::ios::beg );
                     infile.read( data, size );
@@ -389,5 +409,4 @@
         break;
     }
-    
     writeObject( img );
 }
@@ -403,4 +422,5 @@
     *this << name << BEGIN_BRACKET << std::endl;       // Write object name
     *this << PROPERTY("UniqueID") << id << std::endl;  // Write object ID
+    if ( getException() ) return;
     
     // Check whether this is a shared object or not
@@ -415,4 +435,5 @@
             return;
         }
+        _fields.push_back( name );
         
         const StringList& associates = wrapper->getAssociates();
@@ -426,8 +447,12 @@
                 continue;
             }
+            _fields.push_back( assocWrapper->getName() );
             
-            _currentField = assocWrapper->getName();
             assocWrapper->write( *this, *obj );
-        }
+            if ( getException() ) return;
+            
+            _fields.pop_back();
+        }
+        _fields.pop_back();
     }
     *this << END_BRACKET << std::endl;
@@ -436,13 +461,15 @@
 void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType type )
 {
-    _currentField = "Header";
+    _fields.clear();
+    _fields.push_back( "Start" );
+    
     _out = outIterator;
     if ( !_out )
-        throw OutputException(_currentField, "OutputStream: Null stream specified.");
+        throwException( "OutputStream: Null stream specified." );
+    if ( getException() ) return;
     
     if ( isBinary() )
     {
-        *this << (unsigned int)OSG_HEADER_LOW << (unsigned int)OSG_HEADER_HIGH
-              << (unsigned int)type << (unsigned int)PLUGIN_VERSION;
+        *this << (unsigned int)type << (unsigned int)PLUGIN_VERSION;
         
         if ( sizeof(osg::Matrix::value_type)==FLOAT_SIZE ) *this << (unsigned int)0;
@@ -477,5 +504,5 @@
         }
         
-        *this << PROPERTY("#Ascii") << typeString << std::endl;
+        *this << typeString << std::endl;
         *this << PROPERTY("#Version") << (unsigned int)PLUGIN_VERSION << std::endl;
         *this << PROPERTY("#Generator") << std::string("OpenSceneGraph")
@@ -483,9 +510,11 @@
         *this << std::endl;
     }
+    _fields.pop_back();
 }
 
 void OutputStream::compress( std::ostream* ostream )
 {
-    _currentField = "Compression";
+    _fields.clear();
+    _fields.push_back( "Compression" );
     if ( _compressorName.empty() || !isBinary() ) return;
     
@@ -494,8 +523,7 @@
     
     if ( !compressor->compress(*ostream, _compressSource.str()) )
-        throw OutputException(_currentField, "OutputStream: Failed to compress stream.");
-}
-
-// PROTECTED METHODS
+        throwException( "OutputStream: Failed to compress stream." );
+    _fields.pop_back();
+}
 
 void OutputStream::writeSchema( std::ostream& fout )
@@ -522,4 +550,6 @@
 }
 
+// PROTECTED METHODS
+
 template<typename T>
 void OutputStream::writeArrayImplementation( const T* a, int writeSize, unsigned int numInRow )
Index: /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/HeightField.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/HeightField.cpp (revision 10976)
+++ /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/HeightField.cpp (revision 11018)
@@ -32,7 +32,4 @@
 static bool readHeights( osgDB::InputStream& is, osg::HeightField& shape )
 {
-    bool hasArray; is >> hasArray;
-    if ( !hasArray ) return true;
-    
     osg::FloatArray* array = dynamic_cast<osg::FloatArray*>( is.readArray() );
     if ( array )
@@ -53,5 +50,4 @@
 static bool writeHeights( osgDB::OutputStream& os, const osg::HeightField& shape )
 {
-    os << (shape.getFloatArray()!=NULL);
     os.writeArray( shape.getFloatArray() );
     return true;
Index: /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/Drawable.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/Drawable.cpp (revision 10976)
+++ /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/Drawable.cpp (revision 11018)
@@ -11,12 +11,10 @@
 static bool readInitialBound( osgDB::InputStream& is, osg::Drawable& drawable )
 {
-    bool valid = false; is >> valid;
-    if ( valid )
-    {
-        osg::Vec3d min, max;
-        is >> osgDB::BEGIN_BRACKET >> osgDB::PROPERTY("Minimum") >> min;
-        is >> osgDB::PROPERTY("Maximum") >> max >> osgDB::END_BRACKET;
-        drawable.setInitialBound( osg::BoundingBox(min, max) );
-    }
+    osg::Vec3d min, max;
+    is >> osgDB::BEGIN_BRACKET;
+    is >> osgDB::PROPERTY("Minimum") >> min;
+    is >> osgDB::PROPERTY("Maximum") >> max;
+    is >> osgDB::END_BRACKET;
+    drawable.setInitialBound( osg::BoundingBox(min, max) );
     return true;
 }
@@ -25,12 +23,8 @@
 {
     const osg::BoundingBox& bb = drawable.getInitialBound();
-    os << bb.valid();
-    if ( bb.valid() )
-    {
-        os << osgDB::BEGIN_BRACKET << std::endl;
-        os << osgDB::PROPERTY("Minimum") << osg::Vec3d(bb._min) << std::endl;
-        os << osgDB::PROPERTY("Maximum") << osg::Vec3d(bb._max) << std::endl;
-        os << osgDB::END_BRACKET;
-    }
+    os << osgDB::BEGIN_BRACKET << std::endl;
+    os << osgDB::PROPERTY("Minimum") << osg::Vec3d(bb._min) << std::endl;
+    os << osgDB::PROPERTY("Maximum") << osg::Vec3d(bb._max) << std::endl;
+    os << osgDB::END_BRACKET;
     os << std::endl;
     return true;
Index: /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/TextureCubeMap.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/TextureCubeMap.cpp (revision 10976)
+++ /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/TextureCubeMap.cpp (revision 11018)
@@ -19,6 +19,7 @@
         if ( image!=NULL ) { \
             os << osgDB::BEGIN_BRACKET << std::endl << image; \
-            os << osgDB::END_BRACKET << std::endl; \
+            os << osgDB::END_BRACKET; \
         } \
+        os << std::endl; \
         return true; \
     }
Index: /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/BlendFunc.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/BlendFunc.cpp (revision 10976)
+++ /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/BlendFunc.cpp (revision 11018)
@@ -9,7 +9,7 @@
                          "osg::Object osg::StateAttribute osg::BlendFunc" )
 {
-    ADD_GLENUM_SERIALIZER( SourceRGB, GLenum, GL_ONE );  // _source_factor
-    ADD_GLENUM_SERIALIZER( SourceAlpha, GLenum, GL_ONE );  // _source_factor_alpha
-    ADD_GLENUM_SERIALIZER( DestinationRGB, GLenum, GL_ONE );  // _destination_factor
-    ADD_GLENUM_SERIALIZER( DestinationAlpha, GLenum, GL_ONE );  // _destination_factor_alpha
+    ADD_GLENUM_SERIALIZER( SourceRGB, GLenum, GL_NONE );  // _source_factor
+    ADD_GLENUM_SERIALIZER( SourceAlpha, GLenum, GL_NONE );  // _source_factor_alpha
+    ADD_GLENUM_SERIALIZER( DestinationRGB, GLenum, GL_NONE );  // _destination_factor
+    ADD_GLENUM_SERIALIZER( DestinationAlpha, GLenum, GL_NONE );  // _destination_factor_alpha
 }
Index: /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/Node.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/Node.cpp (revision 10976)
+++ /OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/Node.cpp (revision 11018)
@@ -14,8 +14,8 @@
     osg::Vec3d center;
     double radius;
-    bool valid;
-    is >> valid >> osgDB::BEGIN_BRACKET;
+    is >> osgDB::BEGIN_BRACKET;
     is >> osgDB::PROPERTY("Center") >> center;
-    is >> osgDB::PROPERTY("Radius") >> radius >> osgDB::END_BRACKET;
+    is >> osgDB::PROPERTY("Radius") >> radius;
+    is >> osgDB::END_BRACKET;
     node.setInitialBound( osg::BoundingSphere(center, radius) );
     return true;
@@ -25,5 +25,5 @@
 {
     const osg::BoundingSphere& bs = node.getInitialBound();
-    os << bs.valid() << osgDB::BEGIN_BRACKET << std::endl;
+    os << osgDB::BEGIN_BRACKET << std::endl;
     os << osgDB::PROPERTY("Center") << osg::Vec3d(bs.center()) << std::endl;
     os << osgDB::PROPERTY("Radius") << double(bs.radius()) << std::endl;
Index: /OpenSceneGraph/trunk/src/osgWrappers/serializers/CMakeLists.txt
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/serializers/CMakeLists.txt (revision 10976)
+++ /OpenSceneGraph/trunk/src/osgWrappers/serializers/CMakeLists.txt (revision 11018)
@@ -34,3 +34,4 @@
 
 ADD_SUBDIRECTORY(osg)
+ADD_SUBDIRECTORY(osgParticle)
 
