osgDB Wrapper Associates Revision Tagging
This commit is contained in:
committed by
Robert Osfield
parent
dcac0c1611
commit
2ac8379cfc
@@ -645,44 +645,54 @@ void OutputStream::writeObjectFields( const osg::Object* obj, const std::string&
|
||||
<< name << std::endl;
|
||||
return;
|
||||
}
|
||||
int outputVersion = getFileVersion(wrapper->getDomain());
|
||||
|
||||
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 )
|
||||
{
|
||||
const std::string& assocName = *itr;
|
||||
ObjectWrapper* assocWrapper = Registry::instance()->getObjectWrapperManager()->findWrapper(assocName);
|
||||
if ( !assocWrapper )
|
||||
if ( itr->_firstVersion <= outputVersion &&
|
||||
outputVersion <= itr->_lastVersion)
|
||||
{
|
||||
OSG_WARN << "OutputStream::writeObject(): Unsupported associated class "
|
||||
<< assocName << std::endl;
|
||||
continue;
|
||||
}
|
||||
else if ( _useSchemaData )
|
||||
{
|
||||
if ( _inbuiltSchemaMap.find(assocName)==_inbuiltSchemaMap.end() )
|
||||
const std::string& assocName = itr->_name;
|
||||
ObjectWrapper* assocWrapper = Registry::instance()->getObjectWrapperManager()->findWrapper(assocName);
|
||||
if ( !assocWrapper )
|
||||
{
|
||||
StringList properties;
|
||||
ObjectWrapper::TypeList types;
|
||||
assocWrapper->writeSchema( properties, types );
|
||||
|
||||
unsigned int size = osg::minimum( properties.size(), types.size() );
|
||||
if ( size>0 )
|
||||
OSG_WARN << "OutputStream::writeObject(): Unsupported associated class "
|
||||
<< assocName << std::endl;
|
||||
continue;
|
||||
}
|
||||
else if ( _useSchemaData )
|
||||
{
|
||||
if ( _inbuiltSchemaMap.find(assocName)==_inbuiltSchemaMap.end() )
|
||||
{
|
||||
std::stringstream propertiesStream;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
StringList properties;
|
||||
ObjectWrapper::TypeList types;
|
||||
assocWrapper->writeSchema( properties, types );
|
||||
|
||||
unsigned int size = osg::minimum( properties.size(), types.size() );
|
||||
if ( size>0 )
|
||||
{
|
||||
propertiesStream << properties[i] << ":" << types[i] << " ";
|
||||
std::stringstream propertiesStream;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
propertiesStream << properties[i] << ":" << types[i] << " ";
|
||||
}
|
||||
_inbuiltSchemaMap[assocName] = propertiesStream.str();
|
||||
}
|
||||
_inbuiltSchemaMap[assocName] = propertiesStream.str();
|
||||
}
|
||||
}
|
||||
_fields.push_back( assocWrapper->getName() );
|
||||
|
||||
assocWrapper->write( *this, *obj );
|
||||
if ( getException() ) return;
|
||||
|
||||
_fields.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
/*OSG_INFO << "OutputStream::writeObject():"<<name<<" Ignoring associated class due to version mismatch "
|
||||
<< itr->_name<<"["<<itr->_firstVersion <<","<<itr->_lastVersion <<"]for output version "<<outputVersion<< std::endl;*/
|
||||
}
|
||||
_fields.push_back( assocWrapper->getName() );
|
||||
|
||||
assocWrapper->write( *this, *obj );
|
||||
if ( getException() ) return;
|
||||
|
||||
_fields.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user