diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-10 11:10:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-10 11:10:39 +0400 |
commit | 4effdf4aff29e9aa078f5d3c077fac7259be0225 (patch) | |
tree | 04126e148aaea3e1da92398541c34d4783b4e3bc /source/blender/editors | |
parent | caba2601eaf942d092a9cb10aefdf958c90c87f8 (diff) |
fix [#31382] Loop Cut and Slide numpad (-)
investigation lead to finding 3 bugs here...
- transform key input handling didnt ignore minus key on an unsigned value as it should.
- not being able to set numcuts to 0 made typing in numbers not very useful.
- backspace would set the cuts to an unsigned value.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 9 | ||||
-rw-r--r-- | source/blender/editors/util/numinput.c | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 0b65cce20d7..7298153791e 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -492,7 +492,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_RELEASE) break; - cuts = MAX2(cuts - 1, 1); + cuts = MAX2(cuts - 1, 0); RNA_int_set(op->ptr, "number_cuts", cuts); ringsel_find_edge(lcd, cuts); show_cuts = TRUE; @@ -519,12 +519,15 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event) /* using the keyboard to input the number of cuts */ if (event->val == KM_PRESS) { - float value; + /* init as zero so backspace clears */ + float value = 0.0f; if (handleNumInput(&lcd->num, event)) { applyNumInput(&lcd->num, &value); - cuts = CLAMPIS(value, 1, 130); + /* allow zero so you can backspace and type in a value + * otherwise 1 as minimum would make more sense */ + cuts = CLAMPIS(value, 0, 130); RNA_int_set(op->ptr, "number_cuts", cuts); ringsel_find_edge(lcd, cuts); diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index 1f1d5a0c0c0..91290829662 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -221,7 +221,7 @@ char handleNumInput(NumInput *n, wmEvent *event) break; case MINUSKEY: if (n->flag & NUM_NO_NEGATIVE) - break; + return 0; if (n->ctrl[idx]) { n->ctrl[idx] *= -1; |