diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-05 00:42:34 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-05 00:42:34 +0400 |
commit | fbe17e09a372a02c2729bd875f9d6d35e8a2f383 (patch) | |
tree | bb398a026c93245512f4c38ef6de1c710b4f0753 /source/blender | |
parent | 5ed5c7441cdb23c4f5d0efe550fc3562bdbb9cf8 (diff) |
alternative to joe's commit r36451.
loopcut now follows 'Release confirms' user preference.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/mesh/loopcut.c | 42 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 5 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 78 |
8 files changed, 53 insertions, 90 deletions
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 2e06d8385d4..0ec356a88ae 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -100,7 +100,6 @@ typedef struct tringselOpData { int extend; int do_cut; - wmTimer *timer; } tringselOpData; /* modal loop selection drawing callback */ @@ -316,13 +315,10 @@ static void ringsel_finish(bContext *C, wmOperator *op) } /* called when modal loop selection is done... */ -static void ringsel_exit(bContext *C, wmOperator *op) +static void ringsel_exit(wmOperator *op) { tringselOpData *lcd= op->customdata; - if (lcd->timer) - WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), lcd->timer); - /* deactivate the extra drawing stuff in 3D-View */ ED_region_draw_cb_exit(lcd->ar->type, lcd->draw_handle); @@ -358,10 +354,10 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut) return 1; } -static int ringcut_cancel (bContext *C, wmOperator *op) +static int ringcut_cancel (bContext *UNUSED(C), wmOperator *op) { /* this is just a wrapper around exit() */ - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_CANCELLED; } @@ -379,7 +375,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) lcd = op->customdata; if (lcd->em->selectmode == SCE_SELECT_FACE) { - ringsel_exit(C, op); + ringsel_exit(op); WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, NULL); return OPERATOR_CANCELLED; } @@ -389,7 +385,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) edge = findnearestedge(&lcd->vc, &dist); if(!edge) { - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_CANCELLED; } @@ -397,7 +393,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) ringsel_find_edge(lcd, 1); ringsel_finish(C, op); - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_FINISHED; } @@ -408,11 +404,7 @@ static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt) tringselOpData *lcd; EditEdge *edge; int dist = 75; - - /*if we're in the cut-n-slide macro, set release_confirm based on user pref*/ - if (op->opm) - RNA_boolean_set(op->next->ptr, "release_confirm", U.loopcut_finish_on_release); - + if(modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit)) BKE_report(op->reports, RPT_WARNING, "Loop cut doesn't work well on deformed edit mesh display"); @@ -445,34 +437,22 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) view3d_operator_needs_opengl(C); + switch (event->type) { case LEFTMOUSE: /* confirm */ // XXX hardcoded - if (event->val == KM_RELEASE) { + if (event->val == KM_PRESS) { /* finish */ ED_region_tag_redraw(lcd->ar); ringsel_finish(C, op); - ringsel_exit(C, op); + ringsel_exit(op); ED_area_headerprint(CTX_wm_area(C), NULL); - return OPERATOR_FINISHED|OPERATOR_ABORT_MACRO; - }else { - lcd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER2, 0.12); + return OPERATOR_FINISHED; } ED_region_tag_redraw(lcd->ar); break; - - case TIMER2: - /* finish */ - ED_region_tag_redraw(lcd->ar); - - ringsel_finish(C, op); - ringsel_exit(C, op); - - ED_area_headerprint(CTX_wm_area(C), NULL); - - return OPERATOR_FINISHED; case RIGHTMOUSE: /* abort */ // XXX hardcoded case ESCKEY: if (event->val == KM_RELEASE) { diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 6d8dd4e9a2e..282eeef906f 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -176,9 +176,8 @@ void ED_operatormacros_mesh(void) ot->description = "Cut mesh loop and slide it"; WM_operatortype_macro_define(ot, "MESH_OT_loopcut"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide"); - RNA_boolean_set(otmacro->ptr, "release_confirm", 1); - RNA_int_set(otmacro->ptr, "launch_event", LEFTMOUSE); - + RNA_struct_idprops_unset(otmacro->ptr, "release_confirm"); + ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); ot->description = "Duplicate mesh and move"; WM_operatortype_macro_define(ot, "MESH_OT_duplicate"); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 701b8affac2..614b048e0b8 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1521,9 +1521,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int t->mode = mode; t->launch_event = event ? event->type : -1; - if (RNA_property_is_set(op->ptr, "launch_event")) - t->launch_event = RNA_int_get(op->ptr, "launch_event"); - + if (t->launch_event == EVT_TWEAK_R) { t->launch_event = RIGHTMOUSE; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 565ff769ccb..4edaabb9508 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -495,11 +495,10 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) { RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", ""); } - + // Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit /*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button"); //RNA_def_property_flag(prop, PROP_HIDDEN); - RNA_def_int(ot->srna, "launch_event", 0, 0, INT_MAX, "Launch Event", "", 0, INT_MAX); } void TRANSFORM_OT_translate(struct wmOperatorType *ot) @@ -743,7 +742,7 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot) ot->poll = ED_operator_editmesh; RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f); - + Transform_Properties(ot, P_MIRROR|P_SNAP); } diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index f91c0ac26f8..1be67a4501b 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -383,13 +383,13 @@ typedef struct UserDef { short autokey_mode; /* autokeying mode */ short autokey_flag; /* flags for autokeying */ - short text_render, dsm_maxmem; /*options for text rendering*/ + short text_render, pad9; /*options for text rendering*/ float pad10; struct ColorBand coba_weight; /* from texture.h */ float sculpt_paint_overlay_col[3]; - int loopcut_finish_on_release; + int pad3; char author[80]; /* author name for file formats supporting it */ } UserDef; diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 48e585426f5..3072c2c3430 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -312,7 +312,6 @@ typedef struct wmOperator { #define OPERATOR_PASS_THROUGH 8 /* in case operator got executed outside WM code... like via fileselect */ #define OPERATOR_HANDLED 16 -#define OPERATOR_ABORT_MACRO 32 /* wmOperator flag */ #define OP_GRAB_POINTER 1 diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 421a48e68d0..a914d875490 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2676,10 +2676,6 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_enum_items(prop, view_zoom_axes); RNA_def_property_ui_text(prop, "Zoom Axis", "Axis of mouse movement to zoom in or out on"); - prop= RNA_def_property(srna, "loopcut_finish_on_release", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "loopcut_finish_on_release", 1); - RNA_def_property_ui_text(prop, "End Loopcut Slide On Release", "End Loopcut Slide On Mouse Release, a 'click-drag-and-hold' workflow"); - prop= RNA_def_property(srna, "invert_mouse_zoom", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_INVERT); RNA_def_property_ui_text(prop, "Invert Zoom Direction", "Invert the axis of mouse movement for zooming"); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7148c16faa8..63a8ecc4043 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -214,9 +214,6 @@ static int wm_macro_exec(bContext *C, wmOperator *op) } else { break; /* operator didn't finish, end macro */ } - - if (retval & OPERATOR_ABORT_MACRO) - break; } } @@ -242,9 +239,6 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event, } else { break; /* operator didn't finish, end macro */ } - - if (retval & OPERATOR_ABORT_MACRO) - break; } return wm_macro_end(op, retval); @@ -271,45 +265,43 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event) MacroData *md = op->customdata; md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */ - - if (!(retval & OPERATOR_ABORT_MACRO)) { - retval = wm_macro_invoke_internal(C, op, event, opm->next); - - /* if new operator is modal and also added its own handler */ - if (retval & OPERATOR_RUNNING_MODAL && op->opm != opm) { - wmWindow *win = CTX_wm_window(C); - wmEventHandler *handler = NULL; - - for (handler = win->modalhandlers.first; handler; handler = handler->next) { - /* first handler in list is the new one */ - if (handler->op == op) - break; - } - - if (handler) { - BLI_remlink(&win->modalhandlers, handler); - wm_event_free_handler(handler); - } - - /* if operator is blocking, grab cursor - * This may end up grabbing twice, but we don't care. - * */ - if(op->opm->type->flag & OPTYPE_BLOCKING) { - int bounds[4] = {-1,-1,-1,-1}; - int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER)); - - if(wrap) { - ARegion *ar= CTX_wm_region(C); - if(ar) { - bounds[0]= ar->winrct.xmin; - bounds[1]= ar->winrct.ymax; - bounds[2]= ar->winrct.xmax; - bounds[3]= ar->winrct.ymin; - } + + retval = wm_macro_invoke_internal(C, op, event, opm->next); + + /* if new operator is modal and also added its own handler */ + if (retval & OPERATOR_RUNNING_MODAL && op->opm != opm) { + wmWindow *win = CTX_wm_window(C); + wmEventHandler *handler = NULL; + + for (handler = win->modalhandlers.first; handler; handler = handler->next) { + /* first handler in list is the new one */ + if (handler->op == op) + break; + } + + if (handler) { + BLI_remlink(&win->modalhandlers, handler); + wm_event_free_handler(handler); + } + + /* if operator is blocking, grab cursor + * This may end up grabbing twice, but we don't care. + * */ + if(op->opm->type->flag & OPTYPE_BLOCKING) { + int bounds[4] = {-1,-1,-1,-1}; + int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER)); + + if(wrap) { + ARegion *ar= CTX_wm_region(C); + if(ar) { + bounds[0]= ar->winrct.xmin; + bounds[1]= ar->winrct.ymax; + bounds[2]= ar->winrct.xmax; + bounds[3]= ar->winrct.ymin; } - - WM_cursor_grab(CTX_wm_window(C), wrap, FALSE, bounds); } + + WM_cursor_grab(CTX_wm_window(C), wrap, FALSE, bounds); } } } |