Minor change collada export; don't even run the parentinv-test when ob->parent is...
authorJuha Mäki-Kanto <ih5235252@gmail.com>
Sat, 18 Feb 2012 15:41:09 +0000 (15:41 +0000)
committerJuha Mäki-Kanto <ih5235252@gmail.com>
Sat, 18 Feb 2012 15:41:09 +0000 (15:41 +0000)
source/blender/collada/TransformWriter.cpp

index c806cd4..0cf26a0 100644 (file)
@@ -95,20 +95,24 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
        */
 
        /* Using parentinv should allow use of existing curves */
-       // If parentinv is identity don't add it.
-       bool add_parinv = false;
-       for(int i = 0; i < 16; ++i)
+       if(ob->parent)
        {
-               float f = (i%4 == i/4) ? 1.0f : 0.0f ;
-               if(ob->parentinv[i%4][i/4] != f) add_parinv = true;
-       }
-
-       if(add_parinv && ob->parent)
-       {
-               double dmat[4][4];
-               UnitConverter converter;
-               converter.mat4_to_dae_double(dmat, ob->parentinv);
-               node.addMatrix("parentinverse", dmat);
+               // If parentinv is identity don't add it.
+               bool add_parinv = false;
+
+               for(int i = 0; i < 16; ++i)
+               {
+                       float f = (i%4 == i/4) ? 1.0f : 0.0f ;
+                       add_parinv |= (ob->parentinv[i%4][i/4] != f);
+               }
+
+               if(add_parinv)
+               {
+                       double dmat[4][4];
+                       UnitConverter converter;
+                       converter.mat4_to_dae_double(dmat, ob->parentinv);
+                       node.addMatrix("parentinverse", dmat);
+               }
        }
 
        add_transform(node, ob->loc, ob->rot, ob->size);