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).
This commit is contained in:
Bastien Montagne 2014-07-21 17:13:48 +02:00
parent 6a43ee6e38
commit 1526620416
Notes: blender-bot 2023-02-14 10:34:12 +01:00
Referenced by issue #46937, Some instances are not rendered to scale one 0
Referenced by issue #40432, AFTER 2.71 - Scaling to zero with manipulate center points works precisely on second time
2 changed files with 11 additions and 3 deletions

View 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;
}

View 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;
}