]> git.mxchange.org Git - simgear.git/commitdiff
Optimize empty groups from .ac models
authorTim Moore <timoore@redhat.com>
Fri, 23 Jan 2009 14:22:40 +0000 (15:22 +0100)
committerTim Moore <timoore@redhat.com>
Fri, 23 Jan 2009 15:11:23 +0000 (16:11 +0100)
The OSG optimizer seems to have changed since this work was originally done.

simgear/scene/model/ModelRegistry.cxx

index 6355acd9b3319838dc8d9ed0977b67e9acb3e4ba..315f079ea481b1eca6f288375d92fe72e4bec39c 100644 (file)
@@ -494,13 +494,14 @@ struct ACOptimizePolicy : public OptimizeModelPolicy {
     {
         ref_ptr<Node> optimized
             = OptimizeModelPolicy::optimize(node, fileName, opt);
+        Group* group = dynamic_cast<Group*>(optimized.get());
         MatrixTransform* transform
             = dynamic_cast<MatrixTransform*>(optimized.get());
-        if (transform && transform->getMatrix().isIdentity()
-            && transform->getName().empty()
-            && transform->getNumChildren() == 1) {
-            optimized = static_cast<Node*>(transform->getChild(0));
-            Group* group = dynamic_cast<Group*>(optimized.get());
+        if (((transform && transform->getMatrix().isIdentity()) || group)
+            && group->getName().empty()
+            && group->getNumChildren() == 1) {
+            optimized = static_cast<Node*>(group->getChild(0));
+            group = dynamic_cast<Group*>(optimized.get());
             if (group && group->getName().empty()
                 && group->getNumChildren() == 1)
                 optimized = static_cast<Node*>(group->getChild(0));