Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-10-21 18:44:00 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-10-21 18:55:17 +0300
commit9216b8d6cb0be1bd83f5d3aaaccde6e2f209f580 (patch)
treec881f0fff38c2c51dd4cbde9a2df7d6a0f139e8d /source/blender/editors
parent15cebd8565d093e141a1ca0332eee372fd4ba89e (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/editors')
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index f130c2ee685..305347b46a7 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -248,6 +248,7 @@ typedef struct LassoGestureData {
typedef struct LineGestureData {
float true_plane[4];
float plane[4];
+ bool flip;
} LineGestureData;
struct SculptGestureOperation;
@@ -461,6 +462,8 @@ static SculptGestureContext *sculpt_gesture_init_from_line(bContext *C, wmOperat
line_points[1][0] = RNA_int_get(op->ptr, "xend");
line_points[1][1] = RNA_int_get(op->ptr, "yend");
+ sgcontext->line.flip = RNA_boolean_get(op->ptr, "flip");
+
float depth_point[3];
float plane_points[3][3];
@@ -481,6 +484,12 @@ static SculptGestureContext *sculpt_gesture_init_from_line(bContext *C, wmOperat
if (!sgcontext->vc.rv3d->is_persp) {
mul_v3_fl(normal, -1.0f);
}
+
+ /* Apply flip. */
+ if (sgcontext->line.flip) {
+ mul_v3_fl(normal, -1.0f);
+ }
+
mul_v3_mat3_m4v3(normal, sgcontext->vc.obact->imat, normal);
float plane_point_object_space[3];
mul_v3_m4v3(plane_point_object_space, sgcontext->vc.obact->imat, plane_points[0]);