Fix T40432: Scaling to zero with manipulate center points works precisely on second...
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 21 Jul 2014 15:13:48 +0000 (17:13 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 21 Jul 2014 15:13:48 +0000 (17:13 +0200)
Commented out the 'no zero' protection of scaling transforms for numinput.

Issue is, once an axis has null scale, you can't regrow it from transform code
(you have to directly edit the scale property). This is not ideal, but getting
good behavior in this case is hairy...

Yet, when using numinput, you type precise values, so if you want to set it to zero,
set it to zero. User is assumed responsible, we should avoid too much 'invisible magic'
when handling precise inputs. ;)

Note: an idea for possible future feature would be to have an 'absolute' mode for numinput
(allowing to type in real value, not factors).

source/blender/editors/transform/transform.c
source/blender/editors/util/numinput.c

index bc721af231ec1715a7540d761c17fbe24b11e543..09e9894dd2d8b766ee62bead0ca85a2023f92496 100644 (file)
@@ -3113,9 +3113,11 @@ static void initResize(TransInfo *t)
        t->num.flag |= NUM_AFFECT_ALL;
        if (!t->obedit) {
                t->flag |= T_NO_ZERO;
+#if 0  /* Disabling, since when you type you know what you are doing, and being able to set it to zero is handy. */
                t->num.val_flag[0] |= NUM_NO_ZERO;
                t->num.val_flag[1] |= NUM_NO_ZERO;
                t->num.val_flag[2] |= NUM_NO_ZERO;
+#endif
        }
        
        t->idx_max = 2;
@@ -3405,9 +3407,11 @@ static void initSkinResize(TransInfo *t)
        t->num.flag |= NUM_AFFECT_ALL;
        if (!t->obedit) {
                t->flag |= T_NO_ZERO;
+#if 0  /* Disabling, since when you type you know what you are doing, and being able to set it to zero is handy. */
                t->num.val_flag[0] |= NUM_NO_ZERO;
                t->num.val_flag[1] |= NUM_NO_ZERO;
                t->num.val_flag[2] |= NUM_NO_ZERO;
+#endif
        }
        
        t->idx_max = 2;
@@ -4515,7 +4519,9 @@ static void initCurveShrinkFatten(TransInfo *t)
        t->num.unit_type[0] = B_UNIT_NONE;
 
        t->flag |= T_NO_ZERO;
+#if 0  /* Disabling, since when you type you know what you are doing, and being able to set it to zero is handy. */
        t->num.val_flag[0] |= NUM_NO_ZERO;
+#endif
 
        t->flag |= T_NO_CONSTRAINT;
 }
@@ -4590,7 +4596,9 @@ static void initMaskShrinkFatten(TransInfo *t)
        t->num.unit_type[0] = B_UNIT_NONE;
 
        t->flag |= T_NO_ZERO;
+#if 0  /* Disabling, since when you type you know what you are doing, and being able to set it to zero is handy. */
        t->num.val_flag[0] |= NUM_NO_ZERO;
+#endif
 
        t->flag |= T_NO_CONSTRAINT;
 }
index 2c3dff5ea6a5783740eedce740277ad74592e7ad..fd8f16f5d02031b0fee29e9542b2abbe3ecd2cb2 100644 (file)
@@ -189,15 +189,15 @@ bool applyNumInput(NumInput *n, float *vec)
                                if (n->val_flag[i] & NUM_NO_NEGATIVE && val < 0.0f) {
                                        val = 0.0f;
                                }
-                               if (n->val_flag[i] & NUM_NO_ZERO && val == 0.0f) {
-                                       val = 0.0001f;
-                               }
                                if (n->val_flag[i] & NUM_NO_FRACTION && val != floorf(val)) {
                                        val = floorf(val + 0.5f);
                                        if (n->val_flag[i] & NUM_NO_ZERO && val == 0.0f) {
                                                val = 1.0f;
                                        }
                                }
+                               else if (n->val_flag[i] & NUM_NO_ZERO && val == 0.0f) {
+                                       val = 0.0001f;
+                               }
                        }
                        vec[j] = val;
                }