diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-10-16 13:58:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-10-16 14:21:46 +0300 |
commit | 870b4b673511094cf0beaeaf07305407ccdda47a (patch) | |
tree | fb91f7c424f1971c35d537e520c519117e38f9d9 /source/blender/editors/interface/view2d_ops.c | |
parent | 6d8f63a8343a6c0b44318f0a856dcd0fd0206131 (diff) |
WM: refactor gestures for use as tools
Border and circle select wait for input by default.
This commit uses bool properties on the operators instead of
magic number (called "gesture_mode").
Keymaps that define 'deselect' for border/circle select
begin immediately, exiting when on button release.
Diffstat (limited to 'source/blender/editors/interface/view2d_ops.c')
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index ab8ec60696b..b271b0b5bc6 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1223,7 +1223,6 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) View2D *v2d = &ar->v2d; rctf rect; rctf cur_new = v2d->cur; - int gesture_mode; const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); /* convert coordinates of rect to 'tot' rect coordinates */ @@ -1231,9 +1230,9 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) UI_view2d_region_to_view_rctf(v2d, &rect, &rect); /* check if zooming in/out view */ - gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); + const bool zoom_in = !RNA_boolean_get(op->ptr, "zoom_out"); - if (gesture_mode == GESTURE_MODAL_IN) { + if (zoom_in) { /* zoom in: * - 'cur' rect will be defined by the coordinates of the border region * - just set the 'cur' rect to have the same coordinates as the border region @@ -1248,8 +1247,7 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) cur_new.ymax = rect.ymax; } } - else { /* if (gesture_mode == GESTURE_MODAL_OUT) */ - + else { /* zoom out: * - the current 'cur' rect coordinates are going to end up where the 'rect' ones are, * but the 'cur' rect coordinates will need to be adjusted to take in more of the view @@ -1297,7 +1295,7 @@ static void VIEW2D_OT_zoom_border(wmOperatorType *ot) ot->poll = view_zoom_poll; /* rna */ - WM_operator_properties_gesture_border(ot, false); + WM_operator_properties_gesture_border_zoom(ot); } #ifdef WITH_INPUT_NDOF @@ -1545,7 +1543,7 @@ static void VIEW2D_OT_smoothview(wmOperatorType *ot) ot->flag = OPTYPE_INTERNAL; /* rna */ - WM_operator_properties_gesture_border(ot, false); + WM_operator_properties_gesture_border(ot); } /* ********************************************************* */ |