Fix mask expand creating wrong masks when the cursor is not over the mesh

This forces the mask expand modal operator to use the maximum
iteration when the cursor is not over the mesh, masking the entire
connected component.

This fixes the issue for both expanding masks and face sets.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9105
This commit is contained in:
Pablo Dobarro 2020-10-04 19:55:27 +02:00
parent 0d5ec990a9
commit 4b99ea17fb
1 changed files with 8 additions and 2 deletions

View File

@ -188,8 +188,14 @@ static int sculpt_mask_expand_modal(bContext *C, wmOperator *op, const wmEvent *
float mouse[2];
mouse[0] = event->mval[0];
mouse[1] = event->mval[1];
SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false);
mask_expand_update_it = ss->filter_cache->mask_update_it[(int)SCULPT_active_vertex_get(ss)];
if (SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false)) {
/* The cursor is over the mesh, get the update iteration from the updated active vertex. */
mask_expand_update_it = ss->filter_cache->mask_update_it[(int)SCULPT_active_vertex_get(ss)];
}
else {
/* When the cursor is outside the mesh, affect the entire connected component. */
mask_expand_update_it = ss->filter_cache->mask_update_last_it - 1;
}
}
if ((event->type == EVT_ESCKEY && event->val == KM_PRESS) ||