From be0635bfd3b9cfdc4b6d5e7bc2be500344517818 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Fri, 23 Jan 2009 15:22:40 +0100 Subject: [PATCH] Optimize empty groups from .ac models The OSG optimizer seems to have changed since this work was originally done. --- simgear/scene/model/ModelRegistry.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/simgear/scene/model/ModelRegistry.cxx b/simgear/scene/model/ModelRegistry.cxx index 6355acd9..315f079e 100644 --- a/simgear/scene/model/ModelRegistry.cxx +++ b/simgear/scene/model/ModelRegistry.cxx @@ -494,13 +494,14 @@ struct ACOptimizePolicy : public OptimizeModelPolicy { { ref_ptr optimized = OptimizeModelPolicy::optimize(node, fileName, opt); + Group* group = dynamic_cast(optimized.get()); MatrixTransform* transform = dynamic_cast(optimized.get()); - if (transform && transform->getMatrix().isIdentity() - && transform->getName().empty() - && transform->getNumChildren() == 1) { - optimized = static_cast(transform->getChild(0)); - Group* group = dynamic_cast(optimized.get()); + if (((transform && transform->getMatrix().isIdentity()) || group) + && group->getName().empty() + && group->getNumChildren() == 1) { + optimized = static_cast(group->getChild(0)); + group = dynamic_cast(optimized.get()); if (group && group->getName().empty() && group->getNumChildren() == 1) optimized = static_cast(group->getChild(0)); -- 2.39.5