diff options
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 43 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 28 |
2 files changed, 40 insertions, 31 deletions
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 4b5d6d55aa0..c234d1769b3 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1998,10 +1998,9 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished) } -static int stitch_cancel(bContext *C, wmOperator *op) +static void stitch_cancel(bContext *C, wmOperator *op) { stitch_exit(C, op, 0); - return OPERATOR_CANCELLED; } @@ -2016,7 +2015,8 @@ static int stitch_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } else { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } } @@ -2067,8 +2067,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) /* Cancel */ case ESCKEY: - return stitch_cancel(C, op); - + stitch_cancel(C, op); + return OPERATOR_CANCELLED; case LEFTMOUSE: if (event->shift && (U.flag & USER_LMOUSESELECT)) { @@ -2076,7 +2076,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) stitch_select(C, scene, event, state); if (!stitch_process_data(state, scene, FALSE)) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } } break; @@ -2089,7 +2090,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } else { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } } else { @@ -2101,7 +2103,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) if (event->val == KM_PRESS && event->alt) { state->limit_dist += 0.01f; if (!stitch_process_data(state, scene, FALSE)) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } break; } @@ -2115,7 +2118,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) state->limit_dist -= 0.01f; state->limit_dist = MAX2(0.01f, state->limit_dist); if (!stitch_process_data(state, scene, FALSE)) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } break; } @@ -2128,7 +2132,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) if (event->val == KM_PRESS) { state->use_limit = !state->use_limit; if (!stitch_process_data(state, scene, FALSE)) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } break; } @@ -2140,7 +2145,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) state->static_island %= state->element_map->totalIslands; if (!stitch_process_data(state, scene, FALSE)) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } break; } @@ -2150,7 +2156,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) if (event->val == KM_PRESS) { state->midpoints = !state->midpoints; if (!stitch_process_data(state, scene, FALSE)) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } } break; @@ -2158,13 +2165,15 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) /* Select geometry*/ case RIGHTMOUSE: if (!event->shift) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } if (event->val == KM_PRESS && !(U.flag & USER_LMOUSESELECT)) { stitch_select(C, scene, event, state); if (!stitch_process_data(state, scene, FALSE)) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } break; } @@ -2175,7 +2184,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) if (event->val == KM_PRESS) { state->snap_islands = !state->snap_islands; if (!stitch_process_data(state, scene, FALSE)) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } break; } @@ -2189,7 +2199,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) stitch_switch_selection_mode(state); if (!stitch_process_data(state, scene, FALSE)) { - return stitch_cancel(C, op); + stitch_cancel(C, op); + return OPERATOR_CANCELLED; } } break; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 06ffdea96bf..d6bd6f466b9 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -542,7 +542,7 @@ static bool minimize_stretch_init(bContext *C, wmOperator *op) return true; } -static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interactive) +static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool interactive) { MinStretch *ms = op->customdata; ScrArea *sa = CTX_wm_area(C); @@ -570,7 +570,7 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interact } } -static void minimize_stretch_exit(bContext *C, wmOperator *op, int cancel) +static void minimize_stretch_exit(bContext *C, wmOperator *op, bool cancel) { MinStretch *ms = op->customdata; ScrArea *sa = CTX_wm_area(C); @@ -604,8 +604,8 @@ static int minimize_stretch_exec(bContext *C, wmOperator *op) iterations = RNA_int_get(op->ptr, "iterations"); for (i = 0; i < iterations; i++) - minimize_stretch_iteration(C, op, 0); - minimize_stretch_exit(C, op, 0); + minimize_stretch_iteration(C, op, false); + minimize_stretch_exit(C, op, false); return OPERATOR_FINISHED; } @@ -617,7 +617,7 @@ static int minimize_stretch_invoke(bContext *C, wmOperator *op, const wmEvent *U if (!minimize_stretch_init(C, op)) return OPERATOR_CANCELLED; - minimize_stretch_iteration(C, op, 1); + minimize_stretch_iteration(C, op, true); ms = op->customdata; WM_event_add_modal_handler(C, op); @@ -633,12 +633,12 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev switch (event->type) { case ESCKEY: case RIGHTMOUSE: - minimize_stretch_exit(C, op, 1); + minimize_stretch_exit(C, op, true); return OPERATOR_CANCELLED; case RETKEY: case PADENTER: case LEFTMOUSE: - minimize_stretch_exit(C, op, 0); + minimize_stretch_exit(C, op, false); return OPERATOR_FINISHED; case PADPLUSKEY: case WHEELUPMOUSE: @@ -647,7 +647,7 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev ms->blend += 0.1f; ms->lasttime = 0.0f; RNA_float_set(op->ptr, "blend", ms->blend); - minimize_stretch_iteration(C, op, 1); + minimize_stretch_iteration(C, op, true); } } break; @@ -658,7 +658,7 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev ms->blend -= 0.1f; ms->lasttime = 0.0f; RNA_float_set(op->ptr, "blend", ms->blend); - minimize_stretch_iteration(C, op, 1); + minimize_stretch_iteration(C, op, true); } } break; @@ -667,25 +667,23 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev double start = PIL_check_seconds_timer(); do { - minimize_stretch_iteration(C, op, 1); + minimize_stretch_iteration(C, op, true); } while (PIL_check_seconds_timer() - start < 0.01); } break; } if (ms->iterations && ms->i >= ms->iterations) { - minimize_stretch_exit(C, op, 0); + minimize_stretch_exit(C, op, false); return OPERATOR_FINISHED; } return OPERATOR_RUNNING_MODAL; } -static int minimize_stretch_cancel(bContext *C, wmOperator *op) +static void minimize_stretch_cancel(bContext *C, wmOperator *op) { - minimize_stretch_exit(C, op, 1); - - return OPERATOR_CANCELLED; + minimize_stretch_exit(C, op, true); } void UV_OT_minimize_stretch(wmOperatorType *ot) |