while looking into [#27057] noticed when the view and the transform center are 0...
[blender-staging.git] / source / blender / editors / transform / transform_constraints.c
index 0012334cf929876d3c3d989001e09ca733488889..e5e31a8e319adfc301ec145260a01445dec652ca 100644 (file)
@@ -243,7 +243,13 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
                        
                        sub_v3_v3v3(v, i2, v);
        
-                       sub_v3_v3v3(out, i1, t->con.center);
+                       sub_v3_v3v3(out, i1,  t->con.center);
+
+                       /* possible some values become nan when
+                        * viewpoint and object are both zero */
+                       if(!finite(out[0])) out[0]= 0.0f;
+                       if(!finite(out[1])) out[1]= 0.0f;
+                       if(!finite(out[2])) out[2]= 0.0f;
                }
        }
 }