From 585524805f071f56bfeceaf37bb1535841ce4051 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 25 Feb 2017 21:48:07 +0100 Subject: [PATCH 1/3] Add 'tri ' variant of part filters to optimizer ignore list --- components/resource/scenemanager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 85c27cbc2..b7dda6276 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -388,6 +388,9 @@ namespace Resource "Bip01 L Hand", "Bip01 R Hand", "Bip01 Head", "Bip01 Spine1", "Bip01 Spine2", "Bip01 L Clavicle", "Bip01 R Clavicle", "bip01", "Root Bone", "Bip01 Neck", "BoneOffset", "AttachLight", "ArrowBone", "Camera"}; reservedNames = std::set(reserved, reserved + sizeof(reserved)/sizeof(reserved[0])); + + for (unsigned int i=0; i Date: Sun, 26 Feb 2017 03:15:57 +0100 Subject: [PATCH 2/3] Fix unnecessary copy of ParticleSystem in SceneUtil::CopyOp --- components/sceneutil/clone.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/sceneutil/clone.cpp b/components/sceneutil/clone.cpp index 26f3f5c7c..2c0ce98ba 100644 --- a/components/sceneutil/clone.cpp +++ b/components/sceneutil/clone.cpp @@ -38,7 +38,7 @@ namespace SceneUtil return operator()(processor); if (const osgParticle::ParticleSystemUpdater* updater = dynamic_cast(node)) { - osgParticle::ParticleSystemUpdater* cloned = osg::clone(updater, *this); + osgParticle::ParticleSystemUpdater* cloned = new osgParticle::ParticleSystemUpdater(*updater, osg::CopyOp::SHALLOW_COPY); mMap2[cloned] = updater->getParticleSystem(0); return cloned; } @@ -94,7 +94,7 @@ namespace SceneUtil osgParticle::ParticleProcessor* CopyOp::operator() (const osgParticle::ParticleProcessor* processor) const { - osgParticle::ParticleProcessor* cloned = osg::clone(processor, *this); + osgParticle::ParticleProcessor* cloned = osg::clone(processor, osg::CopyOp::SHALLOW_COPY); mMap[cloned] = processor->getParticleSystem(); return cloned; } From 5caf53b6a3b68c8fdf30ea8cd507eeb9aad0c3c8 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 26 Feb 2017 03:23:49 +0100 Subject: [PATCH 3/3] 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 1aadc19d6..99f7ae122 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);