From: Tim Moore Date: Fri, 23 Jan 2009 14:22:40 +0000 (+0100) Subject: Optimize empty groups from .ac models X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=be0635bfd3b9cfdc4b6d5e7bc2be500344517818;p=simgear.git Optimize empty groups from .ac models The OSG optimizer seems to have changed since this work was originally done. --- 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));