diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-10-21 18:44:00 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-10-21 18:55:17 +0300 |
commit | 9216b8d6cb0be1bd83f5d3aaaccde6e2f209f580 (patch) | |
tree | c881f0fff38c2c51dd4cbde9a2df7d6a0f139e8d /source/blender/windowmanager/intern/wm_gesture_ops.c | |
parent | 15cebd8565d093e141a1ca0332eee372fd4ba89e (diff) |
UI: Allow changing the active side of line gestures
Line gesture use always the right side of the line as active (the area
of the mesh that is going to be modified) by default.
This adds the ability to change the active side when the line gesture is
active by pressing the F key.
This allows more freedom to position the line after starting the
gestures, as it won't be required to cancel the operation or undo if the
line was used in the wrong direction.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D9301
Diffstat (limited to 'source/blender/windowmanager/intern/wm_gesture_ops.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture_ops.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c index 00112e82771..edf9a3bc693 100644 --- a/source/blender/windowmanager/intern/wm_gesture_ops.c +++ b/source/blender/windowmanager/intern/wm_gesture_ops.c @@ -851,6 +851,7 @@ static bool gesture_straightline_apply(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "ystart", rect->ymin); RNA_int_set(op->ptr, "xend", rect->xmax); RNA_int_set(op->ptr, "yend", rect->ymax); + RNA_boolean_set(op->ptr, "flip", gesture->use_flip); if (op->type->exec) { int retval = op->type->exec(C, op); @@ -892,6 +893,7 @@ int WM_gesture_straightline_active_side_invoke(bContext *C, wmOperator *op, cons WM_gesture_straightline_invoke(C, op, event); wmGesture *gesture = op->customdata; gesture->draw_active_side = true; + gesture->use_flip = false; return OPERATOR_RUNNING_MODAL; } @@ -950,6 +952,11 @@ int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *ev gesture->use_snap = !gesture->use_snap; break; } + case GESTURE_MODAL_FLIP: { + /* Toggle snapping on/off. */ + gesture->use_flip = !gesture->use_flip; + break; + } case GESTURE_MODAL_SELECT: { if (gesture_straightline_apply(C, op)) { gesture_modal_end(C, op); @@ -1029,6 +1036,11 @@ int WM_gesture_straightline_oneshot_modal(bContext *C, wmOperator *op, const wmE gesture->use_snap = !gesture->use_snap; break; } + case GESTURE_MODAL_FLIP: { + /* Toggle flip on/off. */ + gesture->use_flip = !gesture->use_flip; + break; + } case GESTURE_MODAL_SELECT: case GESTURE_MODAL_DESELECT: case GESTURE_MODAL_IN: |