From 5caf53b6a3b68c8fdf30ea8cd507eeb9aad0c3c8 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 26 Feb 2017 03:23:49 +0100 Subject: [PATCH] optimizer: avoid reordering nodes Fixes an osgParticle cloning issue. (Fixes #3773) --- components/sceneutil/optimizer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/sceneutil/optimizer.cpp b/components/sceneutil/optimizer.cpp index 1aadc19d6a..99f7ae122c 100644 --- a/components/sceneutil/optimizer.cpp +++ b/components/sceneutil/optimizer.cpp @@ -847,10 +847,11 @@ void Optimizer::RemoveRedundantNodesVisitor::removeRedundantNodes() pitr!=parents.end(); ++pitr) { + unsigned int childIndex = (*pitr)->getChildIndex(group); for (unsigned int i=0; igetNumChildren(); ++i) { osg::Node* child = group->getChild(i); - (*pitr)->addChild(child); + (*pitr)->insertChild(childIndex++, child); } (*pitr)->removeChild(group);