[Bf-blender-cvs] [d8f4cb9] master: Fix T37965, loop multicut confirmation not happening when numeric input is used. When numerical input was active confirmation events were not getting handled.
Antony Riakiotakis
noreply at git.blender.org
Wed Jan 1 05:27:33 CET 2014
Commit: d8f4cb9b690be374ee91fe76f6f880b546aef72a
Author: Antony Riakiotakis
Date: Wed Jan 1 06:17:57 2014 +0200
https://developer.blender.org/rBd8f4cb9b690be374ee91fe76f6f880b546aef72a
Fix T37965, loop multicut confirmation not happening when numeric input
is used. When numerical input was active confirmation events were not
getting handled.
Code here seems a bit duplicated, it may be possible to simplify it, but
leaving it slightly bloated for now.
===================================================================
M source/blender/editors/mesh/editmesh_loopcut.c
===================================================================
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index fd24981..bc42819 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -526,6 +526,29 @@ static int loopcut_exec(bContext *C, wmOperator *op)
return loopcut_init(C, op, NULL);
}
+static int loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op)
+{
+ /* finish */
+ ED_region_tag_redraw(lcd->ar);
+ ED_area_headerprint(CTX_wm_area(C), NULL);
+
+ if (lcd->eed) {
+ /* set for redo */
+ BM_mesh_elem_index_ensure(lcd->em->bm, BM_EDGE);
+ RNA_int_set(op->ptr, "edge_index", BM_elem_index_get(lcd->eed));
+
+ /* execute */
+ ringsel_finish(C, op);
+ ringsel_exit(C, op);
+ }
+ else {
+ ringcut_cancel(C, op);
+ return OPERATOR_CANCELLED;
+ }
+
+ return OPERATOR_FINISHED;
+}
+
static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
float smoothness = RNA_float_get(op->ptr, "smoothness");
@@ -554,6 +577,17 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
ED_region_tag_redraw(lcd->ar);
}
+ else {
+ switch (event->type) {
+ case RETKEY:
+ case PADENTER:
+ case LEFTMOUSE: /* confirm */ // XXX hardcoded
+ return loopcut_finish(lcd, C, op);
+ default:
+ /* do nothing */;
+ break;
+ }
+ }
}
else {
bool handled = false;
@@ -561,27 +595,8 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
case RETKEY:
case PADENTER:
case LEFTMOUSE: /* confirm */ // XXX hardcoded
- if (event->val == KM_PRESS) {
- /* finish */
- ED_region_tag_redraw(lcd->ar);
- ED_area_headerprint(CTX_wm_area(C), NULL);
-
- if (lcd->eed) {
- /* set for redo */
- BM_mesh_elem_index_ensure(lcd->em->bm, BM_EDGE);
- RNA_int_set(op->ptr, "edge_index", BM_elem_index_get(lcd->eed));
-
- /* execute */
- ringsel_finish(C, op);
- ringsel_exit(C, op);
- }
- else {
- ringcut_cancel(C, op);
- return OPERATOR_CANCELLED;
- }
-
- return OPERATOR_FINISHED;
- }
+ if (event->val == KM_PRESS)
+ return loopcut_finish(lcd, C, op);
ED_region_tag_redraw(lcd->ar);
handled = true;
More information about the Bf-blender-cvs
mailing list