From 3b43810c66a0ade3d4d3d157f2d087ddd56aa950 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 26 Feb 2010 15:40:19 +0000 Subject: [PATCH] From Paul Martz, "Regarding the osg-users thread "mergeGeodes crash", I'm submitting this for consideration as a fix for the problem with the FlattenStaticTransformsVisitor. It seems that the additional nested loop over the Transform's parent was not needed. I'm not sure why it was there, and if it really was unnecessary, then it has probably been resulting in many redundant Nodes for quite some time. Perhaps this fix will result in a cull- and draw-time performance boost." From Robert Osfield, added copying of the UserData and Descriptions from the transform to the new group. --- src/osgUtil/Optimizer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 27dd88f49..0721f4ad2 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -1076,12 +1076,11 @@ bool CollectLowestTransformsVisitor::removeTransforms(osg::Node* nodeWeCannotRem group->setDataVariance(osg::Object::STATIC); group->setNodeMask(transform->getNodeMask()); group->setStateSet(transform->getStateSet()); + group->setUserData(transform->getUserData()); + group->setDescriptions(transform->getDescriptions()); for(unsigned int i=0;igetNumChildren();++i) { - for(unsigned int j=0;jgetNumParents();++j) - { - group->addChild(transform->getChild(i)); - } + group->addChild(transform->getChild(i)); } for(int i2=transform->getNumParents()-1;i2>=0;--i2)