diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-11-13 01:01:51 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-11-26 00:22:12 +0300 |
commit | 05c4efc9b1993f4d11a7d749fe4a9e9d80cc1f2e (patch) | |
tree | ecd94269869a6bb5486774fe0ddbf734e286b1c2 /source/blender/editors/sculpt_paint/sculpt_face_set.c | |
parent | 8b9b3d98e015d49e3dbb587e4f4886f458f106a8 (diff) |
Fix Edit Face Set operator not being cancelled when the cursor is not over the mesh
If the cursor is not over the mesh, the operator was still using the
last Face Set ID updated by the drawing cursor code when the cursor was
over the mesh.
This now cancels the operator instead of modifying a Face Set that will
look random to the user.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D9545
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_face_set.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_face_set.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c index f67c8f701f7..7c8a4c5a857 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.c +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c @@ -1306,7 +1306,10 @@ static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEven * tool without brush cursor. */ SculptCursorGeometryInfo sgi; const float mouse[2] = {event->mval[0], event->mval[1]}; - SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false); + if (!SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false)) { + /* The cursor is not over the mesh. Cancel to avoid editing the last updated Face Set ID. */ + return OPERATOR_CANCELLED; + } const int active_face_set = SCULPT_active_face_set_get(ss); switch (mode) { |