[Bf-blender-cvs] [1526620] master: Fix T40432: Scaling to zero with manipulate center points works precisely on second time

Bastien Montagne noreply at git.blender.org
Mon Jul 21 17:19:17 CEST 2014


Commit: 15266204164fe94074a1a4867d9ff01d71d02e0d
Author: Bastien Montagne
Date:   Mon Jul 21 17:13:48 2014 +0200
Branches: master
https://developer.blender.org/rB15266204164fe94074a1a4867d9ff01d71d02e0d

Fix T40432: Scaling to zero with manipulate center points works precisely on second time

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).

===================================================================

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

===================================================================

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index bc721af..09e9894 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -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;
 }
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 2c3dff5..fd8f16f 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -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;
 		}




More information about the Bf-blender-cvs mailing list