Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2011-11-21 21:14:44 +0400
committerTon Roosendaal <ton@blender.org>2011-11-21 21:14:44 +0400
commiteba317dbd731197b22abca4a8121480a05198b63 (patch)
treebcc2e981814561fd865553cd30ed87b1519725cc /source/blender/editors/mesh
parent697e4d2ca77436d020763b3eb0a66baa3072a4e6 (diff)
Combined BlenderPro Brazil workshop fix + Patch 29302
Loopcut operator now has two extra features: - Pad plus/minus allows to change amount of cuts - typing numerical input works too. (Number input max is set to 32 now. The code doesn't allow editing values or backspace it away, nor does it show in header...) Thanks & congrats Daniel Macedo for his first patch! :)
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/loopcut.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c
index 9bbfea1291f..42728eb7ea1 100644
--- a/source/blender/editors/mesh/loopcut.c
+++ b/source/blender/editors/mesh/loopcut.c
@@ -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 @@ typedef struct tringselOpData {
Object *ob;
EditMesh *em;
EditEdge *eed;
+ NumInput num;
int extend;
int do_cut;
@@ -345,6 +347,11 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut)
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 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event)
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 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event)
}
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 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event)
}
}
+ /* 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= CLAMPIS(value, 1, 32);
+
+ 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;
}