From 7267221715d8431bd1aaaaa3ace4f8c0ce151627 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 30 Oct 2013 23:08:53 +0000 Subject: remove return argument from wmOperatorType->cancel, was only ever returning OPERATOR_CANCELLED. --- intern/rigidbody/CMakeLists.txt | 3 +- .../scripts/templates_py/operator_modal_timer.py | 1 - source/blender/editors/animation/anim_markers.c | 4 +- .../blender/editors/armature/editarmature_sketch.c | 10 ++--- source/blender/editors/armature/pose_lib.c | 3 +- source/blender/editors/armature/pose_slide.c | 3 +- source/blender/editors/curve/editfont.c | 3 +- source/blender/editors/gpencil/gpencil_paint.c | 3 +- .../editors/interface/interface_eyedropper.c | 12 +++--- source/blender/editors/interface/view2d_ops.c | 11 ++---- source/blender/editors/mesh/editmesh_bevel.c | 3 +- source/blender/editors/mesh/editmesh_inset.c | 3 +- source/blender/editors/mesh/editmesh_knife.c | 3 +- source/blender/editors/mesh/editmesh_loopcut.c | 9 +++-- source/blender/editors/physics/particle_edit.c | 4 +- source/blender/editors/render/render_internal.c | 4 +- source/blender/editors/render/render_opengl.c | 4 +- source/blender/editors/screen/screen_ops.c | 39 ++++++++------------ source/blender/editors/screen/screendump.c | 3 +- source/blender/editors/sculpt_paint/paint_image.c | 3 +- source/blender/editors/sculpt_paint/paint_intern.h | 2 +- source/blender/editors/sculpt_paint/paint_ops.c | 3 +- source/blender/editors/sculpt_paint/paint_stroke.c | 14 ++++--- source/blender/editors/sculpt_paint/paint_vertex.c | 8 +--- source/blender/editors/sculpt_paint/sculpt.c | 4 +- source/blender/editors/sound/sound_ops.c | 3 +- source/blender/editors/space_buttons/buttons_ops.c | 4 +- source/blender/editors/space_clip/clip_ops.c | 16 +++----- source/blender/editors/space_console/console_ops.c | 3 +- source/blender/editors/space_image/image_ops.c | 30 ++++++--------- source/blender/editors/space_node/node_edit.c | 10 ++--- .../editors/space_node/node_relationships.c | 4 +- source/blender/editors/space_node/node_view.c | 7 +--- .../editors/space_sequencer/sequencer_view.c | 4 +- .../blender/editors/space_text/text_autocomplete.c | 3 +- source/blender/editors/space_text/text_ops.c | 10 ++--- source/blender/editors/space_view3d/view3d_edit.c | 20 +++------- source/blender/editors/space_view3d/view3d_fly.c | 4 +- source/blender/editors/space_view3d/view3d_ruler.c | 4 +- source/blender/editors/transform/transform_ops.c | 4 +- .../blender/editors/uvedit/uvedit_smart_stitch.c | 43 ++++++++++++++-------- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 28 +++++++------- source/blender/makesrna/intern/rna_wm.c | 9 +---- source/blender/makesrna/intern/rna_wm_api.c | 4 -- source/blender/windowmanager/WM_api.h | 10 ++--- source/blender/windowmanager/WM_types.h | 2 +- source/blender/windowmanager/intern/wm_operators.c | 28 ++++---------- 47 files changed, 156 insertions(+), 253 deletions(-) diff --git a/intern/rigidbody/CMakeLists.txt b/intern/rigidbody/CMakeLists.txt index bea3075f6be..3a2edba39bc 100644 --- a/intern/rigidbody/CMakeLists.txt +++ b/intern/rigidbody/CMakeLists.txt @@ -23,11 +23,10 @@ set(INC . - ../../extern/bullet2/src ) set(INC_SYS - + ../../extern/bullet2/src ) set(SRC diff --git a/release/scripts/templates_py/operator_modal_timer.py b/release/scripts/templates_py/operator_modal_timer.py index b8211126daf..4d36860b9e3 100644 --- a/release/scripts/templates_py/operator_modal_timer.py +++ b/release/scripts/templates_py/operator_modal_timer.py @@ -29,7 +29,6 @@ class ModalTimerOperator(bpy.types.Operator): def cancel(self, context): wm = context.window_manager wm.event_timer_remove(self._timer) - return {'CANCELLED'} def register(): diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 1e8f2bfc038..b057ea239f0 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -711,13 +711,11 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op) } /* only for modal */ -static int ed_marker_move_cancel(bContext *C, wmOperator *op) +static void ed_marker_move_cancel(bContext *C, wmOperator *op) { RNA_int_set(op->ptr, "frames", 0); ed_marker_move_apply(C, op); ed_marker_move_exit(C, op); - - return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 8ae1b9557ee..36999c15665 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -2339,7 +2339,7 @@ static int sketch_convert(bContext *C, wmOperator *UNUSED(op), const wmEvent *UN return OPERATOR_FINISHED; } -static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) +static int sketch_cancel_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) { @@ -2374,12 +2374,11 @@ static int sketch_select(bContext *C, wmOperator *UNUSED(op), const wmEvent *eve return OPERATOR_FINISHED; } -static int sketch_draw_stroke_cancel(bContext *C, wmOperator *op) +static void sketch_draw_stroke_cancel(bContext *C, wmOperator *op) { SK_Sketch *sketch = contextSketch(C, 1); /* create just to be sure */ sk_cancelStroke(sketch); MEM_freeN(op->customdata); - return OPERATOR_CANCELLED; } static int sketch_draw_stroke(bContext *C, wmOperator *op, const wmEvent *event) @@ -2400,12 +2399,11 @@ static int sketch_draw_stroke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int sketch_draw_gesture_cancel(bContext *C, wmOperator *op) +static void sketch_draw_gesture_cancel(bContext *C, wmOperator *op) { SK_Sketch *sketch = contextSketch(C, 1); /* create just to be sure */ sk_cancelStroke(sketch); MEM_freeN(op->customdata); - return OPERATOR_CANCELLED; } static int sketch_draw_gesture(bContext *C, wmOperator *op, const wmEvent *event) @@ -2622,7 +2620,7 @@ void SKETCH_OT_cancel_stroke(wmOperatorType *ot) ot->description = "Cancel the current sketch stroke"; /* api callbacks */ - ot->invoke = sketch_cancel; + ot->invoke = sketch_cancel_invoke; ot->poll = ED_operator_sketch_mode_active_stroke; diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 182f94b3693..4a40eff204a 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -1532,10 +1532,9 @@ static int poselib_preview_exit(bContext *C, wmOperator *op) } /* Cancel previewing operation (called when exiting Blender) */ -static int poselib_preview_cancel(bContext *C, wmOperator *op) +static void poselib_preview_cancel(bContext *C, wmOperator *op) { poselib_preview_exit(C, op); - return OPERATOR_CANCELLED; } /* main modal status check */ diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index d0e1b15064a..82652702fe7 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -682,11 +682,10 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* common code for cancel() */ -static int pose_slide_cancel(bContext *UNUSED(C), wmOperator *op) +static void pose_slide_cancel(bContext *UNUSED(C), wmOperator *op) { /* cleanup and done */ pose_slide_exit(op); - return OPERATOR_CANCELLED; } /* common code for exec() methods */ diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index ac9c338e431..dc58e84415c 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1613,11 +1613,10 @@ static void font_ui_template_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int font_open_cancel(bContext *UNUSED(C), wmOperator *op) +static void font_open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata = NULL; - return OPERATOR_CANCELLED; } static int font_open_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 98fff3d65ce..44917375d43 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1456,11 +1456,10 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op) op->customdata = NULL; } -static int gpencil_draw_cancel(bContext *C, wmOperator *op) +static void gpencil_draw_cancel(bContext *C, wmOperator *op) { /* this is just a wrapper around exit() */ gpencil_draw_exit(C, op); - return OPERATOR_CANCELLED; } /* ------------------------------- */ diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 783a777a2fe..01e53d5e721 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -122,10 +122,9 @@ static void eyedropper_exit(bContext *C, wmOperator *op) } } -static int eyedropper_cancel(bContext *C, wmOperator *op) +static void eyedropper_cancel(bContext *C, wmOperator *op) { eyedropper_exit(C, op); - return OPERATOR_CANCELLED; } /* *** eyedropper_color_ helper functions *** */ @@ -243,7 +242,8 @@ static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { case ESCKEY: case RIGHTMOUSE: - return eyedropper_cancel(C, op); + eyedropper_cancel(C, op); + return OPERATOR_CANCELLED; case LEFTMOUSE: if (event->val == KM_RELEASE) { if (eye->accum_tot == 0) { @@ -447,10 +447,9 @@ static void datadropper_exit(bContext *C, wmOperator *op) } } -static int datadropper_cancel(bContext *C, wmOperator *op) +static void datadropper_cancel(bContext *C, wmOperator *op) { datadropper_exit(C, op); - return OPERATOR_CANCELLED; } /* *** datadropper id helper functions *** */ @@ -552,7 +551,8 @@ static int datadropper_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { case ESCKEY: case RIGHTMOUSE: - return datadropper_cancel(C, op); + datadropper_cancel(C, op); + return OPERATOR_CANCELLED; case LEFTMOUSE: if (event->val == KM_RELEASE) { bool success; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 00113666872..c5c9b1c8ce4 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -284,10 +284,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op) +static void view_pan_cancel(bContext *UNUSED(C), wmOperator *op) { view_pan_exit(op); - return OPERATOR_CANCELLED; } static void VIEW2D_OT_pan(wmOperatorType *ot) @@ -906,11 +905,9 @@ static void view_zoomdrag_exit(bContext *C, wmOperator *op) } } -static int view_zoomdrag_cancel(bContext *C, wmOperator *op) +static void view_zoomdrag_cancel(bContext *C, wmOperator *op) { view_zoomdrag_exit(C, op); - - return OPERATOR_CANCELLED; } /* for 'redo' only, with no user input */ @@ -1579,11 +1576,9 @@ static void scroller_activate_exit(bContext *C, wmOperator *op) } } -static int scroller_activate_cancel(bContext *C, wmOperator *op) +static void scroller_activate_cancel(bContext *C, wmOperator *op) { scroller_activate_exit(C, op); - - return OPERATOR_CANCELLED; } /* apply transform to view (i.e. adjust 'cur' rect) */ diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 97da0047793..dd3aacb2d67 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -185,7 +185,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op) op->customdata = NULL; } -static int edbm_bevel_cancel(bContext *C, wmOperator *op) +static void edbm_bevel_cancel(bContext *C, wmOperator *op) { BevelData *opdata = op->customdata; if (opdata->is_modal) { @@ -197,7 +197,6 @@ static int edbm_bevel_cancel(bContext *C, wmOperator *op) /* need to force redisplay or we may still view the modified result */ ED_region_tag_redraw(CTX_wm_region(C)); - return OPERATOR_CANCELLED; } /* bevel! yay!!*/ diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index eb66cf50a1e..137554459ce 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -166,7 +166,7 @@ static void edbm_inset_exit(bContext *C, wmOperator *op) MEM_freeN(op->customdata); } -static int edbm_inset_cancel(bContext *C, wmOperator *op) +static void edbm_inset_cancel(bContext *C, wmOperator *op) { InsetData *opdata; @@ -180,7 +180,6 @@ static int edbm_inset_cancel(bContext *C, wmOperator *op) /* need to force redisplay or we may still view the modified result */ ED_region_tag_redraw(CTX_wm_region(C)); - return OPERATOR_CANCELLED; } static bool edbm_inset_calc(wmOperator *op) diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 5d8851640e0..306aedaa9ec 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -3195,11 +3195,10 @@ static void knifetool_init(bContext *C, KnifeTool_OpData *kcd, } } -static int knifetool_cancel(bContext *C, wmOperator *op) +static void knifetool_cancel(bContext *C, wmOperator *op) { /* this is just a wrapper around exit() */ knifetool_exit(C, op); - return OPERATOR_CANCELLED; } static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event) diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 3066fb86bf8..9223f6d9450 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -418,11 +418,10 @@ static int ringsel_init(bContext *C, wmOperator *op, bool do_cut) return 1; } -static int ringcut_cancel(bContext *C, wmOperator *op) +static void ringcut_cancel(bContext *C, wmOperator *op) { /* this is just a wrapper around exit() */ ringsel_exit(C, op); - return OPERATOR_CANCELLED; } static void loopcut_update_edge(RingSelOpData *lcd, BMEdge *e, const int previewlines) @@ -549,7 +548,8 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) ringsel_exit(C, op); } else { - return ringcut_cancel(C, op); + ringcut_cancel(C, op); + return OPERATOR_CANCELLED; } return OPERATOR_FINISHED; @@ -569,7 +569,8 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) ED_region_tag_redraw(lcd->ar); ED_area_headerprint(CTX_wm_area(C), NULL); - return ringcut_cancel(C, op); + ringcut_cancel(C, op); + return OPERATOR_CANCELLED; } ED_region_tag_redraw(lcd->ar); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index b0e19d04e35..65a3e5b558e 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3880,11 +3880,9 @@ static int brush_edit_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int brush_edit_cancel(bContext *UNUSED(C), wmOperator *op) +static void brush_edit_cancel(bContext *UNUSED(C), wmOperator *op) { brush_edit_exit(op); - - return OPERATOR_CANCELLED; } void PARTICLE_OT_brush_edit(wmOperatorType *ot) diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index df8d5ec4e84..a47235024dd 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -564,15 +564,13 @@ static int screen_render_modal(bContext *C, wmOperator *op, const wmEvent *event return OPERATOR_PASS_THROUGH; } -static int screen_render_cancel(bContext *C, wmOperator *op) +static void screen_render_cancel(bContext *C, wmOperator *op) { wmWindowManager *wm = CTX_wm_manager(C); Scene *scene = (Scene *) op->customdata; /* kill on cancel, because job is using op->reports */ WM_jobs_kill_type(wm, scene, WM_JOB_TYPE_RENDER); - - return OPERATOR_CANCELLED; } /* using context, starts job */ diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 21074bdc47c..107674babdd 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -485,11 +485,9 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) MEM_freeN(oglrender); } -static int screen_opengl_render_cancel(bContext *C, wmOperator *op) +static void screen_opengl_render_cancel(bContext *C, wmOperator *op) { screen_opengl_render_end(C, op->customdata); - - return OPERATOR_CANCELLED; } /* share between invoke and exec */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 3cecbbb767d..b226104a356 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -750,11 +750,9 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int actionzone_cancel(bContext *UNUSED(C), wmOperator *op) +static void actionzone_cancel(bContext *UNUSED(C), wmOperator *op) { actionzone_exit(op); - - return OPERATOR_CANCELLED; } static void SCREEN_OT_actionzone(wmOperatorType *ot) @@ -825,10 +823,9 @@ static void area_swap_exit(bContext *C, wmOperator *op) op->customdata = NULL; } -static int area_swap_cancel(bContext *C, wmOperator *op) +static void area_swap_cancel(bContext *C, wmOperator *op) { area_swap_exit(C, op); - return OPERATOR_CANCELLED; } static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -857,8 +854,8 @@ static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event) case LEFTMOUSE: /* release LMB */ if (event->val == KM_RELEASE) { if (!sad->sa2 || sad->sa1 == sad->sa2) { - - return area_swap_cancel(C, op); + area_swap_cancel(C, op); + return OPERATOR_CANCELLED; } ED_area_tag_redraw(sad->sa1); @@ -875,7 +872,8 @@ static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event) break; case ESCKEY: - return area_swap_cancel(C, op); + area_swap_cancel(C, op); + return OPERATOR_CANCELLED; } return OPERATOR_RUNNING_MODAL; } @@ -1148,14 +1146,12 @@ static int area_move_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int area_move_cancel(bContext *C, wmOperator *op) +static void area_move_cancel(bContext *C, wmOperator *op) { RNA_int_set(op->ptr, "delta", 0); area_move_apply(C, op); area_move_exit(C, op); - - return OPERATOR_CANCELLED; } /* modal callback for while moving edges */ @@ -1186,7 +1182,8 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; case KM_MODAL_CANCEL: - return area_move_cancel(C, op); + area_move_cancel(C, op); + return OPERATOR_CANCELLED; case KM_MODAL_STEP10: md->step = 10; @@ -1530,7 +1527,7 @@ static int area_split_exec(bContext *C, wmOperator *op) } -static int area_split_cancel(bContext *C, wmOperator *op) +static void area_split_cancel(bContext *C, wmOperator *op) { sAreaSplitData *sd = (sAreaSplitData *)op->customdata; @@ -1546,8 +1543,6 @@ static int area_split_cancel(bContext *C, wmOperator *op) } } area_split_exit(C, op); - - return OPERATOR_CANCELLED; } static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) @@ -1640,7 +1635,8 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) case RIGHTMOUSE: /* cancel operation */ case ESCKEY: - return area_split_cancel(C, op); + area_split_cancel(C, op); + return OPERATOR_CANCELLED; } return OPERATOR_RUNNING_MODAL; @@ -1915,12 +1911,10 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int region_scale_cancel(bContext *UNUSED(C), wmOperator *op) +static void region_scale_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata = NULL; - - return OPERATOR_CANCELLED; } static void SCREEN_OT_region_scale(wmOperatorType *ot) @@ -2449,7 +2443,7 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int area_join_cancel(bContext *C, wmOperator *op) +static void area_join_cancel(bContext *C, wmOperator *op) { sAreaJoinData *jd = (sAreaJoinData *)op->customdata; @@ -2465,8 +2459,6 @@ static int area_join_cancel(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_WINDOW, NULL); area_join_exit(C, op); - - return OPERATOR_CANCELLED; } /* modal callback while selecting area (space) that will be removed */ @@ -2554,7 +2546,8 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) case RIGHTMOUSE: case ESCKEY: - return area_join_cancel(C, op); + area_join_cancel(C, op); + return OPERATOR_CANCELLED; } return OPERATOR_RUNNING_MODAL; diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 06581fb3c11..0153d609adb 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -237,10 +237,9 @@ static bool screenshot_check(bContext *UNUSED(C), wmOperator *op) return WM_operator_filesel_ensure_ext_imtype(op, &scd->im_format); } -static int screenshot_cancel(bContext *UNUSED(C), wmOperator *op) +static void screenshot_cancel(bContext *UNUSED(C), wmOperator *op) { screenshot_data_free(op); - return OPERATOR_CANCELLED; } static bool screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 9e8a8fd3ecc..003db8a9c43 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -898,10 +898,9 @@ static int grab_clone_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int grab_clone_cancel(bContext *UNUSED(C), wmOperator *op) +static void grab_clone_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); - return OPERATOR_CANCELLED; } void PAINT_OT_grab_clone(wmOperatorType *ot) diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index f276e6823e2..5fff02f016b 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -80,7 +80,7 @@ bool paint_supports_jitter(enum PaintMode mode); struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf); int paint_stroke_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int paint_stroke_exec(struct bContext *C, struct wmOperator *op); -int paint_stroke_cancel(struct bContext *C, struct wmOperator *op); +void paint_stroke_cancel(struct bContext *C, struct wmOperator *op); struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke); void *paint_stroke_mode_data(struct PaintStroke *stroke); void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 03c063692c6..55ea0363b7a 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -613,13 +613,12 @@ static void stencil_restore(StencilControlData *scd) *scd->rot_target = scd->init_rot; } -static int stencil_control_cancel(bContext *UNUSED(C), wmOperator *op) +static void stencil_control_cancel(bContext *UNUSED(C), wmOperator *op) { StencilControlData *scd = op->customdata; stencil_restore(scd); MEM_freeN(op->customdata); - return OPERATOR_CANCELLED; } static void stencil_control_calculate(StencilControlData *scd, const int mval[2]) diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index b00b1c3ecff..397baeae4c9 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -718,10 +718,13 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) /* Cancel */ if (event->type == EVT_MODAL_MAP && event->val == PAINT_STROKE_MODAL_CANCEL) { - if (op->type->cancel) - return op->type->cancel(C, op); - else - return paint_stroke_cancel(C, op); + if (op->type->cancel) { + op->type->cancel(C, op); + } + else { + paint_stroke_cancel(C, op); + } + return OPERATOR_CANCELLED; } if (event->type == stroke->event_type && event->val == KM_RELEASE && !first_modal) { @@ -787,10 +790,9 @@ int paint_stroke_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -int paint_stroke_cancel(bContext *C, wmOperator *op) +void paint_stroke_cancel(bContext *C, wmOperator *op) { stroke_done(C, op); - return OPERATOR_CANCELLED; } ViewContext *paint_stroke_view_context(PaintStroke *stroke) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 1c3caf5d8bc..db71ca1a93e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2593,11 +2593,9 @@ static int wpaint_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int wpaint_cancel(bContext *C, wmOperator *op) +static void wpaint_cancel(bContext *C, wmOperator *op) { paint_stroke_cancel(C, op); - - return OPERATOR_CANCELLED; } void PAINT_OT_weight_paint(wmOperatorType *ot) @@ -3144,11 +3142,9 @@ static int vpaint_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int vpaint_cancel(bContext *C, wmOperator *op) +static void vpaint_cancel(bContext *C, wmOperator *op) { paint_stroke_cancel(C, op); - - return OPERATOR_CANCELLED; } void PAINT_OT_vertex_paint(wmOperatorType *ot) diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 488504b71f8..6bd935af436 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4567,7 +4567,7 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sculpt_brush_stroke_cancel(bContext *C, wmOperator *op) +static void sculpt_brush_stroke_cancel(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; @@ -4585,8 +4585,6 @@ static int sculpt_brush_stroke_cancel(bContext *C, wmOperator *op) } sculpt_brush_exit_tex(sd); - - return OPERATOR_CANCELLED; } static void SCULPT_OT_brush_stroke(wmOperatorType *ot) diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index a2189f6237c..81b0992c878 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -77,11 +77,10 @@ /******************** open sound operator ********************/ -static int sound_open_cancel(bContext *UNUSED(C), wmOperator *op) +static void sound_open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata = NULL; - return OPERATOR_CANCELLED; } static void sound_open_init(bContext *C, wmOperator *op) diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index cf277957e70..4fbf5aa5fb7 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -158,12 +158,10 @@ static int file_browse_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int file_browse_cancel(bContext *UNUSED(C), wmOperator *op) +static void file_browse_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata = NULL; - - return OPERATOR_CANCELLED; } static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event) diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index a76f4364492..9aa6eab7fc8 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -159,12 +159,10 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *UNUSED(C), wmOperator *op) +static void open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata = NULL; - - return OPERATOR_CANCELLED; } static int open_exec(bContext *C, wmOperator *op) @@ -444,11 +442,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int view_pan_cancel(bContext *C, wmOperator *op) +static void view_pan_cancel(bContext *C, wmOperator *op) { - view_pan_exit(C, op, 1); - - return OPERATOR_CANCELLED; + view_pan_exit(C, op, true); } void CLIP_OT_view_pan(wmOperatorType *ot) @@ -578,11 +574,9 @@ static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int view_zoom_cancel(bContext *C, wmOperator *op) +static void view_zoom_cancel(bContext *C, wmOperator *op) { - view_zoom_exit(C, op, 1); - - return OPERATOR_CANCELLED; + view_zoom_exit(C, op, true); } void CLIP_OT_view_zoom(wmOperatorType *ot) diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 289986d7fba..f24a204912e 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -1123,10 +1123,9 @@ static int console_modal_select(bContext *C, wmOperator *op, const wmEvent *even return OPERATOR_RUNNING_MODAL; } -static int console_modal_select_cancel(bContext *C, wmOperator *op) +static void console_modal_select_cancel(bContext *C, wmOperator *op) { console_cursor_set_exit(C, op); - return OPERATOR_FINISHED; } void CONSOLE_OT_select_set(wmOperatorType *ot) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 710d5c8cd81..ebcc8c2ebee 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -256,7 +256,7 @@ static void image_view_pan_init(bContext *C, wmOperator *op, const wmEvent *even WM_event_add_modal_handler(C, op); } -static void image_view_pan_exit(bContext *C, wmOperator *op, int cancel) +static void image_view_pan_exit(bContext *C, wmOperator *op, bool cancel) { SpaceImage *sima = CTX_wm_space_image(C); ViewPanData *vpd = op->customdata; @@ -330,7 +330,7 @@ static int image_view_pan_modal(bContext *C, wmOperator *op, const wmEvent *even break; default: if (event->type == vpd->event_type && event->val == KM_RELEASE) { - image_view_pan_exit(C, op, 0); + image_view_pan_exit(C, op, false); return OPERATOR_FINISHED; } break; @@ -339,10 +339,9 @@ static int image_view_pan_modal(bContext *C, wmOperator *op, const wmEvent *even return OPERATOR_RUNNING_MODAL; } -static int image_view_pan_cancel(bContext *C, wmOperator *op) +static void image_view_pan_cancel(bContext *C, wmOperator *op) { - image_view_pan_exit(C, op, 1); - return OPERATOR_CANCELLED; + image_view_pan_exit(C, op, true); } void IMAGE_OT_view_pan(wmOperatorType *ot) @@ -412,7 +411,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve WM_event_add_modal_handler(C, op); } -static void image_view_zoom_exit(bContext *C, wmOperator *op, int cancel) +static void image_view_zoom_exit(bContext *C, wmOperator *op, bool cancel) { SpaceImage *sima = CTX_wm_space_image(C); ViewZoomData *vpd = op->customdata; @@ -547,17 +546,16 @@ static int image_view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *eve image_zoom_apply(vpd, op, event->x, event->y, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0); } else if (event_code == VIEW_CONFIRM) { - image_view_zoom_exit(C, op, 0); + image_view_zoom_exit(C, op, false); return OPERATOR_FINISHED; } return OPERATOR_RUNNING_MODAL; } -static int image_view_zoom_cancel(bContext *C, wmOperator *op) +static void image_view_zoom_cancel(bContext *C, wmOperator *op) { - image_view_zoom_exit(C, op, 1); - return OPERATOR_CANCELLED; + image_view_zoom_exit(C, op, true); } void IMAGE_OT_view_zoom(wmOperatorType *ot) @@ -921,11 +919,10 @@ static void image_open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int image_open_cancel(bContext *UNUSED(C), wmOperator *op) +static void image_open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata = NULL; - return OPERATOR_CANCELLED; } static int image_open_exec(bContext *C, wmOperator *op) @@ -1505,11 +1502,9 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS return OPERATOR_RUNNING_MODAL; } -static int image_save_as_cancel(bContext *UNUSED(C), wmOperator *op) +static void image_save_as_cancel(bContext *UNUSED(C), wmOperator *op) { image_save_as_free(op); - - return OPERATOR_CANCELLED; } static bool image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) @@ -2358,10 +2353,9 @@ static int image_sample_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int image_sample_cancel(bContext *C, wmOperator *op) +static void image_sample_cancel(bContext *C, wmOperator *op) { image_sample_exit(C, op); - return OPERATOR_CANCELLED; } void IMAGE_OT_sample(wmOperatorType *ot) @@ -2625,7 +2619,7 @@ static int image_record_composite_modal(bContext *C, wmOperator *op, const wmEve return OPERATOR_RUNNING_MODAL; } -static int image_record_composite_cancel(bContext *C, wmOperator *op) +static void image_record_composite_cancel(bContext *C, wmOperator *op) { image_record_composite_exit(C, op); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 1d93fe65c09..f58bc83e5d2 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -859,7 +859,7 @@ static void node_resize_init(bContext *C, wmOperator *op, const wmEvent *UNUSED( WM_event_add_modal_handler(C, op); } -static void node_resize_exit(bContext *C, wmOperator *op, int UNUSED(cancel)) +static void node_resize_exit(bContext *C, wmOperator *op, bool UNUSED(cancel)) { WM_cursor_modal_restore(CTX_wm_window(C)); @@ -961,7 +961,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event) case MIDDLEMOUSE: case RIGHTMOUSE: - node_resize_exit(C, op, 0); + node_resize_exit(C, op, false); ED_node_post_apply_transform(C, snode->edittree); return OPERATOR_FINISHED; @@ -990,11 +990,9 @@ static int node_resize_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } -static int node_resize_cancel(bContext *C, wmOperator *op) +static void node_resize_cancel(bContext *C, wmOperator *op) { - node_resize_exit(C, op, 1); - - return OPERATOR_CANCELLED; + node_resize_exit(C, op, true); } void NODE_OT_resize(wmOperatorType *ot) diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 4b5cc9e42b6..8c4050766af 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -669,7 +669,7 @@ static int node_link_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } -static int node_link_cancel(bContext *C, wmOperator *op) +static void node_link_cancel(bContext *C, wmOperator *op) { SpaceNode *snode = CTX_wm_space_node(C); bNodeLinkDrag *nldrag = op->customdata; @@ -678,8 +678,6 @@ static int node_link_cancel(bContext *C, wmOperator *op) BLI_freelistN(&nldrag->links); MEM_freeN(nldrag); - - return OPERATOR_CANCELLED; } void NODE_OT_link(wmOperatorType *ot) diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index f889a8ec97b..5ea6f8b0caf 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -273,12 +273,10 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent * return OPERATOR_RUNNING_MODAL; } -static int snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op) +static void snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata = NULL; - - return OPERATOR_CANCELLED; } void NODE_OT_backimage_move(wmOperatorType *ot) @@ -612,10 +610,9 @@ static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int sample_cancel(bContext *C, wmOperator *op) +static void sample_cancel(bContext *C, wmOperator *op) { sample_exit(C, op); - return OPERATOR_CANCELLED; } void NODE_OT_backimage_sample(wmOperatorType *ot) diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index deb37f8d943..f39b30adf37 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -211,11 +211,9 @@ static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int sample_cancel(bContext *C, wmOperator *op) +static void sample_cancel(bContext *C, wmOperator *op) { sample_exit(C, op); - - return OPERATOR_CANCELLED; } static int sample_poll(bContext *C) diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index eaba537c0a8..692cefd3ee9 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -529,10 +529,9 @@ static void text_autocomplete_free(bContext *C, wmOperator *op) } } -static int text_autocomplete_cancel(bContext *C, wmOperator *op) +static void text_autocomplete_cancel(bContext *C, wmOperator *op) { text_autocomplete_free(C, op); - return OPERATOR_CANCELLED; } void TEXT_OT_autocomplete(wmOperatorType *ot) diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 4f53d033029..dd5e282587d 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -214,10 +214,9 @@ static void text_open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int text_open_cancel(bContext *UNUSED(C), wmOperator *op) +static void text_open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); - return OPERATOR_CANCELLED; } static int text_open_exec(bContext *C, wmOperator *op) @@ -2231,11 +2230,9 @@ static int text_scroll_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int text_scroll_cancel(bContext *C, wmOperator *op) +static void text_scroll_cancel(bContext *C, wmOperator *op) { scroll_exit(C, op); - - return OPERATOR_CANCELLED; } static int text_scroll_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -2706,10 +2703,9 @@ static int text_set_selection_modal(bContext *C, wmOperator *op, const wmEvent * return OPERATOR_RUNNING_MODAL; } -static int text_set_selection_cancel(bContext *C, wmOperator *op) +static void text_set_selection_cancel(bContext *C, wmOperator *op) { text_cursor_set_exit(C, op); - return OPERATOR_FINISHED; } void TEXT_OT_selection_set(wmOperatorType *ot) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index bb41e727d90..80e5d194d45 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1062,11 +1062,9 @@ static int view3d_lock_poll(bContext *C) return false; } -static int viewrotate_cancel(bContext *C, wmOperator *op) +static void viewrotate_cancel(bContext *C, wmOperator *op) { viewops_data_free(C, op); - - return OPERATOR_CANCELLED; } void VIEW3D_OT_rotate(wmOperatorType *ot) @@ -1699,11 +1697,9 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event) } } -static int viewmove_cancel(bContext *C, wmOperator *op) +static void viewmove_cancel(bContext *C, wmOperator *op) { viewops_data_free(C, op); - - return OPERATOR_CANCELLED; } void VIEW3D_OT_move(wmOperatorType *ot) @@ -2091,11 +2087,9 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } -static int viewzoom_cancel(bContext *C, wmOperator *op) +static void viewzoom_cancel(bContext *C, wmOperator *op) { viewops_data_free(C, op); - - return OPERATOR_CANCELLED; } void VIEW3D_OT_zoom(wmOperatorType *ot) @@ -2332,11 +2326,9 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } -static int viewdolly_cancel(bContext *C, wmOperator *op) +static void viewdolly_cancel(bContext *C, wmOperator *op) { viewops_data_free(C, op); - - return OPERATOR_CANCELLED; } void VIEW3D_OT_dolly(wmOperatorType *ot) @@ -3772,11 +3764,9 @@ static int viewroll_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } -static int viewroll_cancel(bContext *C, wmOperator *op) +static void viewroll_cancel(bContext *C, wmOperator *op) { viewops_data_free(C, op); - - return OPERATOR_CANCELLED; } void VIEW3D_OT_view_roll(wmOperatorType *ot) diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 9341ea9d3e6..6d04b9b8826 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -1254,15 +1254,13 @@ static int fly_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int fly_cancel(bContext *C, wmOperator *op) +static void fly_cancel(bContext *C, wmOperator *op) { FlyInfo *fly = op->customdata; fly->state = FLY_CANCEL; flyEnd(C, fly); op->customdata = NULL; - - return OPERATOR_CANCELLED; } static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event) diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index bca162d156b..288ada3f852 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -809,15 +809,13 @@ static int view3d_ruler_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE return OPERATOR_RUNNING_MODAL; } -static int view3d_ruler_cancel(bContext *C, wmOperator *op) +static void view3d_ruler_cancel(bContext *C, wmOperator *op) { RulerInfo *ruler_info = op->customdata; view3d_ruler_end(C, ruler_info); view3d_ruler_free(ruler_info); op->customdata = NULL; - - return OPERATOR_CANCELLED; } static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event) diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 2904b37c2e5..4b5ae8963d5 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -426,15 +426,13 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event) return exit_code; } -static int transform_cancel(bContext *C, wmOperator *op) +static void transform_cancel(bContext *C, wmOperator *op) { TransInfo *t = op->customdata; t->state = TRANS_CANCEL; transformEnd(C, t); transformops_exit(C, op); - - return OPERATOR_CANCELLED; } static int transform_exec(bContext *C, wmOperator *op) 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) diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index dd338713d3e..09451599ce5 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1042,15 +1042,13 @@ static void operator_draw(bContext *C, wmOperator *op) } /* same as exec(), but call cancel */ -static int operator_cancel(bContext *C, wmOperator *op) +static void operator_cancel(bContext *C, wmOperator *op) { extern FunctionRNA rna_Operator_cancel_func; PointerRNA opr; ParameterList list; FunctionRNA *func; - void *ret; - int result; RNA_pointer_create(NULL, op->type->ext.srna, op, &opr); func = &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */ @@ -1059,12 +1057,7 @@ static int operator_cancel(bContext *C, wmOperator *op) RNA_parameter_set_lookup(&list, "context", &C); op->type->ext.call(C, &opr, func, &list); - RNA_parameter_get_lookup(&list, "result", &ret); - result = *(int *)ret; - RNA_parameter_list_free(&list); - - return result; } void operator_wrapper(wmOperatorType *ot, void *userdata); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index eb84bb61e1f..91cddd28be0 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -539,10 +539,6 @@ void RNA_api_operator(StructRNA *srna) RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); - - /* better name? */ - parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); - RNA_def_function_return(func, parm); } void RNA_api_macro(StructRNA *srna) diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index c338d49fe17..9bc12d04b02 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -294,20 +294,20 @@ void WM_menutype_free(void); /* default operator callbacks for border/circle/lasso */ int WM_border_select_invoke (struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int WM_border_select_modal (struct bContext *C, struct wmOperator *op, const struct wmEvent *event); -int WM_border_select_cancel(struct bContext *C, struct wmOperator *op); +void WM_border_select_cancel(struct bContext *C, struct wmOperator *op); int WM_gesture_circle_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int WM_gesture_circle_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); -int WM_gesture_circle_cancel(struct bContext *C, struct wmOperator *op); +void WM_gesture_circle_cancel(struct bContext *C, struct wmOperator *op); int WM_gesture_lines_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int WM_gesture_lines_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); -int WM_gesture_lines_cancel(struct bContext *C, struct wmOperator *op); +void WM_gesture_lines_cancel(struct bContext *C, struct wmOperator *op); int WM_gesture_lasso_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int WM_gesture_lasso_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); -int WM_gesture_lasso_cancel(struct bContext *C, struct wmOperator *op); +void WM_gesture_lasso_cancel(struct bContext *C, struct wmOperator *op); const int (*WM_gesture_lasso_path_to_array(struct bContext *C, struct wmOperator *op, int *mcords_tot))[2]; int WM_gesture_straightline_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int WM_gesture_straightline_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); -int WM_gesture_straightline_cancel(struct bContext *C, struct wmOperator *op); +void WM_gesture_straightline_cancel(struct bContext *C, struct wmOperator *op); /* Gesture manager API */ struct wmGesture *WM_gesture_new(struct bContext *C, const struct wmEvent *event, int type); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index ac9af832671..6538272a43c 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -535,7 +535,7 @@ typedef struct wmOperatorType { * canceled due to some external reason, cancel is called * - see defines below for return values */ int (*invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT; - int (*cancel)(struct bContext *, struct wmOperator *); + void (*cancel)(struct bContext *, struct wmOperator *); int (*modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT; /* verify if the operator can be executed in the current context, note diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 6091ec4a371..acc26f6f065 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -341,14 +341,14 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event) return wm_macro_end(op, retval); } -static int wm_macro_cancel(bContext *C, wmOperator *op) +static void wm_macro_cancel(bContext *C, wmOperator *op) { /* call cancel on the current modal operator, if any */ if (op->opm && op->opm->type->cancel) { op->opm->type->cancel(C, op->opm); } - return wm_macro_end(op, OPERATOR_CANCELLED); + wm_macro_end(op, OPERATOR_CANCELLED); } /* Names have to be static for now */ @@ -2844,11 +2844,9 @@ int WM_border_select_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -int WM_border_select_cancel(bContext *C, wmOperator *op) +void WM_border_select_cancel(bContext *C, wmOperator *op) { wm_gesture_end(C, op); - - return OPERATOR_CANCELLED; } /* **************** circle gesture *************** */ @@ -2961,11 +2959,9 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -int WM_gesture_circle_cancel(bContext *C, wmOperator *op) +void WM_gesture_circle_cancel(bContext *C, wmOperator *op) { wm_gesture_end(C, op); - - return OPERATOR_CANCELLED; } #if 0 @@ -3188,18 +3184,14 @@ int WM_gesture_lines_modal(bContext *C, wmOperator *op, const wmEvent *event) return WM_gesture_lasso_modal(C, op, event); } -int WM_gesture_lasso_cancel(bContext *C, wmOperator *op) +void WM_gesture_lasso_cancel(bContext *C, wmOperator *op) { wm_gesture_end(C, op); - - return OPERATOR_CANCELLED; } -int WM_gesture_lines_cancel(bContext *C, wmOperator *op) +void WM_gesture_lines_cancel(bContext *C, wmOperator *op) { wm_gesture_end(C, op); - - return OPERATOR_CANCELLED; } /** @@ -3365,11 +3357,9 @@ int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *ev return OPERATOR_RUNNING_MODAL; } -int WM_gesture_straightline_cancel(bContext *C, wmOperator *op) +void WM_gesture_straightline_cancel(bContext *C, wmOperator *op) { wm_gesture_end(C, op); - - return OPERATOR_CANCELLED; } #if 0 @@ -3803,7 +3793,7 @@ static void radial_control_set_value(RadialControl *rc, float val) } } -static int radial_control_cancel(bContext *C, wmOperator *op) +static void radial_control_cancel(bContext *C, wmOperator *op) { RadialControl *rc = op->customdata; wmWindowManager *wm = CTX_wm_manager(C); @@ -3821,8 +3811,6 @@ static int radial_control_cancel(bContext *C, wmOperator *op) glDeleteTextures(1, &rc->gltex); MEM_freeN(rc); - - return OPERATOR_CANCELLED; } static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *event) -- cgit v1.2.3