Index: source/blender/editors/mesh/loopcut.c =================================================================== --- source/blender/editors/mesh/loopcut.c (revision 41972) +++ source/blender/editors/mesh/loopcut.c (working copy) @@ -69,6 +69,7 @@ #include "ED_space_api.h" #include "ED_view3d.h" #include "ED_mesh.h" +#include "ED_numinput.h" #include "RNA_access.h" #include "RNA_define.h" @@ -95,6 +96,7 @@ Object *ob; EditMesh *em; EditEdge *eed; + NumInput num; int extend; int do_cut; @@ -345,6 +347,11 @@ lcd->em= BKE_mesh_get_editmesh((Mesh *)lcd->ob->data); lcd->extend = do_cut ? 0 : RNA_boolean_get(op->ptr, "extend"); lcd->do_cut = do_cut; + + initNumInput(&lcd->num); + lcd->num.idx_max = 0; + lcd->num.flag |= NUM_NO_NEGATIVE | NUM_NO_FRACTION; + em_setup_viewcontext(C, &lcd->vc); ED_region_tag_redraw(lcd->ar); @@ -464,6 +471,7 @@ ED_region_tag_redraw(lcd->ar); break; case WHEELUPMOUSE: /* change number of cuts */ + case PADPLUSKEY: case PAGEUPKEY: if (event->val == KM_PRESS) { cuts++; @@ -474,6 +482,7 @@ } break; case WHEELDOWNMOUSE: /* change number of cuts */ + case PADMINUS: case PAGEDOWNKEY: if (event->val == KM_PRESS) { cuts=MAX2(cuts-1,1); @@ -501,6 +510,23 @@ } } + /* using the keyboard to input the number of cuts */ + if (event->val==KM_PRESS) { + float value; + + if (handleNumInput(&lcd->num, event)) + { + applyNumInput(&lcd->num, &value); + + cuts=MAX2(value,1); + + RNA_int_set(op->ptr,"number_cuts",cuts); + ringsel_find_edge(lcd, cuts); + + ED_region_tag_redraw(lcd->ar); + } + } + /* keep going until the user confirms */ return OPERATOR_RUNNING_MODAL; }