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.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.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index ae8b78876c2..4c1b403ac96 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -200,7 +200,7 @@ int wm_gesture_evaluate(wmGesture *gesture, const wmEvent *event) /* ******************* gesture draw ******************* */ -static void wm_gesture_draw_line_active_side(rcti *rect) +static void wm_gesture_draw_line_active_side(rcti *rect, const bool flip) { GPUVertFormat *format = immVertexFormat(); uint shdr_pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -222,7 +222,9 @@ static void wm_gesture_draw_line_active_side(rcti *rect) sub_v2_v2v2(line_dir, line_end, line_start); normalize_v2(line_dir); ortho_v2_v2(gradient_dir, line_dir); - mul_v2_fl(gradient_dir, -1.0f); + if (!flip) { + mul_v2_fl(gradient_dir, -1.0f); + } mul_v2_fl(gradient_dir, gradient_length); add_v2_v2v2(gradient_point[0], line_start, gradient_dir); add_v2_v2v2(gradient_point[1], line_end, gradient_dir); @@ -252,7 +254,7 @@ static void wm_gesture_draw_line(wmGesture *gt) rcti *rect = (rcti *)gt->customdata; if (gt->draw_active_side) { - wm_gesture_draw_line_active_side(rect); + wm_gesture_draw_line_active_side(rect, gt->use_flip); } uint shdr_pos = GPU_vertformat_attr_add( |