Changeset 11903 for OpenSceneGraph/trunk/src/osgDB/ObjectWrapper.cpp
- Timestamp:
- 11/09/10 14:23:43 (3 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgDB/ObjectWrapper.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgDB/ObjectWrapper.cpp
r11902 r11903 92 92 } 93 93 94 void ObjectWrapper::addSerializer( BaseSerializer* s, BaseSerializer::Type t ) 95 { 96 s->_firstVersion = _version; 97 _serializers.push_back(s); 98 _typeList.push_back(static_cast<int>(t)); 99 } 100 94 101 void ObjectWrapper::markSerializerAsRemoved( const std::string& name ) 95 102 { … … 100 107 // will thus ignore it according to the sign and value of the _version variable. 101 108 if ( (*itr)->getName()==name ) 102 (*itr)->_ version = -_version;109 (*itr)->_lastVersion = _version-1; 103 110 } 104 111 } … … 139 146 itr!=_serializers.end(); ++itr ) 140 147 { 141 int serializerVersion = (*itr)->_version; 142 if ( serializerVersion!=0 ) 143 { 144 if ( serializerVersion<0 ) 148 BaseSerializer* serializer = itr->get(); 149 if ( serializer->_firstVersion <= is.getFileVersion() && 150 is.getFileVersion() <= serializer->_lastVersion) 151 { 152 if ( !serializer->read(is, obj) ) 145 153 { 146 serializerVersion = -serializerVersion; 147 148 // The serializer is removed from a specified version, 149 // and the file in reading is at the same or higher version, ignore it. 150 if ( is.getFileVersion()>=serializerVersion ) continue; 154 OSG_WARN << "ObjectWrapper::read(): Error reading property " 155 << _name << "::" << (*itr)->getName() << std::endl; 156 readOK = false; 151 157 } 152 else 153 { 154 // The serializer is added at a specified version, 155 // but the file in reading is at a lower version, ignore it. 156 if ( is.getFileVersion()<serializerVersion ) continue; 157 } 158 } 159 160 if ( (*itr)->read(is, obj) ) continue; 161 OSG_WARN << "ObjectWrapper::read(): Error reading property " 162 << _name << "::" << (*itr)->getName() << std::endl; 163 readOK = false; 158 } 159 else 160 { 161 // OSG_NOTICE<<"Ignoring serializer due to version mismatch"<<std::endl; 162 } 164 163 } 165 164
