[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42037] trunk/blender/source/blender/ editors/mesh/loopcut.c: Combined BlenderPro Brazil workshop fix + Patch 29302
Ton Roosendaal
ton at blender.org
Mon Nov 21 18:14:44 CET 2011
Revision: 42037
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42037
Author: ton
Date: 2011-11-21 17:14:44 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------
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! :)
Modified Paths:
--------------
trunk/blender/source/blender/editors/mesh/loopcut.c
Modified: trunk/blender/source/blender/editors/mesh/loopcut.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/loopcut.c 2011-11-21 17:05:27 UTC (rev 42036)
+++ trunk/blender/source/blender/editors/mesh/loopcut.c 2011-11-21 17:14:44 UTC (rev 42037)
@@ -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= 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;
}
More information about the Bf-blender-cvs
mailing list