From Stephan Huber, Follows is required to prevent unidented cloning of shared arrays :

"I added some calls to isOperationPermissibleForObject() so I can permit the flattten-pass with my specialized objects in my own code."
This commit is contained in:
Robert Osfield 2006-11-14 12:49:53 +00:00
parent 7cb1bcbd7d
commit b5bb541cca

View File

@ -1097,7 +1097,7 @@ void Optimizer::FlattenStaticTransformsVisitor::apply(osg::Geode& geode)
for(unsigned int i=0;i<geode.getNumDrawables();++i) for(unsigned int i=0;i<geode.getNumDrawables();++i)
{ {
osg::Geometry *geometry = geode.getDrawable(i)->asGeometry(); osg::Geometry *geometry = geode.getDrawable(i)->asGeometry();
if(geometry) if((geometry) && (isOperationPermissibleForObject(&geode)) && (isOperationPermissibleForObject(geometry)))
{ {
if(geometry->getVertexArray() && geometry->getVertexArray()->referenceCount() > 1) { if(geometry->getVertexArray() && geometry->getVertexArray()->referenceCount() > 1) {
geometry->setVertexArray(dynamic_cast<osg::Array*>(geometry->getVertexArray()->clone(osg::CopyOp::DEEP_COPY_ALL))); geometry->setVertexArray(dynamic_cast<osg::Array*>(geometry->getVertexArray()->clone(osg::CopyOp::DEEP_COPY_ALL)));