osgDB Wrapper Associates Revision Tagging

This commit is contained in:
Julien Valentin
2016-06-14 11:43:45 +01:00
committed by Robert Osfield
parent dcac0c1611
commit 2ac8379cfc
6 changed files with 186 additions and 65 deletions

View File

@@ -905,26 +905,36 @@ osg::ref_ptr<osg::Object> InputStream::readObjectFields( const std::string& clas
<< className << std::endl;
return NULL;
}
int inputVersion = getFileVersion(wrapper->getDomain());
osg::ref_ptr<osg::Object> obj = existingObj ? existingObj : wrapper->createInstance();
_identifierMap[id] = obj;
if ( obj.valid() )
{
const StringList& associates = wrapper->getAssociates();
for ( StringList::const_iterator itr=associates.begin(); itr!=associates.end(); ++itr )
const ObjectWrapper::RevisionAssociateList& associates = wrapper->getAssociates();
for ( ObjectWrapper::RevisionAssociateList::const_iterator itr=associates.begin(); itr!=associates.end(); ++itr )
{
ObjectWrapper* assocWrapper = Registry::instance()->getObjectWrapperManager()->findWrapper(*itr);
if ( !assocWrapper )
if ( itr->_firstVersion <= inputVersion &&
inputVersion <= itr->_lastVersion)
{
OSG_WARN << "InputStream::readObject(): Unsupported associated class "
<< *itr << std::endl;
continue;
}
_fields.push_back( assocWrapper->getName() );
assocWrapper->read( *this, *obj );
if ( getException() ) return NULL;
ObjectWrapper* assocWrapper = Registry::instance()->getObjectWrapperManager()->findWrapper(itr->_name);
if ( !assocWrapper )
{
OSG_WARN << "InputStream::readObject(): Unsupported associated class "
<< itr->_name << std::endl;
continue;
}
_fields.push_back( assocWrapper->getName() );
assocWrapper->read( *this, *obj );
if ( getException() ) return NULL;
_fields.pop_back();
_fields.pop_back();
}
else
{
/* OSG_INFO << "InputStream::readObject():"<<className<<" Ignoring associated class due to version mismatch"
<< itr->_name<<"["<<itr->_firstVersion <<","<<itr->_lastVersion <<"]for version "<<inputVersion<< std::endl;*/
}
}
}
return obj;