From d3e9b61f2ba32e44349828288701bb36f13f74ed Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 23 Jan 2013 17:37:26 +0000 Subject: [PATCH] From Pjotr Svetachov, "small bug which I have found in the FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor: the visitor will replace part of the tree when visiting the nodes but it does not update the current node path to reflect this. If you then have multiple nested transform nodes it will usually crash and sometimes it won't crash but the resulting mesh will miss some nodes." --- src/osgUtil/Optimizer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 924a5b8ab..90fe4b0d7 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -4631,6 +4631,8 @@ void Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor::apply( if(parent_group) { parent_group->replaceChild(&group, new_group); + // also replace the node in the nodepath + _nodePath[nodepathsize-1] = new_group; // traverse the new Group traverse(*(new_group)); } @@ -4672,6 +4674,8 @@ void Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor::apply( if(parent_group) { parent_group->replaceChild(&transform, group.get()); + // also replace the node in the nodepath + _nodePath[nodepathsize-1] = group; // traverse the new Group traverse(*(group.get())); } @@ -4706,7 +4710,8 @@ void Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor::apply( if(parent_group) { parent_group->replaceChild(&lod, new_lod.get()); - + // also replace the node in the nodepath + _nodePath[nodepathsize-1] = new_lod; // move center point if(!_matrixStack.empty()) new_lod->setCenter(new_lod->getCenter() * _matrixStack.back());