Fix T75662: Surface Smooth filter not checking face sets

In the main mesh filter loop vertex that do not have the active face set
are skipped, so in the following surface smooth displacement loop these
vertices were deformed using an uninitialized laplacian_disp value.
Now the main loop initializes the laplacian_disp for all vertices and
the deformation based on face sets is skipped in the second loop.

Reviewed By: jbakker

Maniphest Tasks: T75662

Differential Revision: https://developer.blender.org/D7443
This commit is contained in:
Pablo Dobarro 2020-04-15 21:09:43 +02:00
parent 35cbf3b5dc
commit 65aaa13a00
Notes: blender-bot 2023-02-14 08:38:11 +01:00
Referenced by issue #75662, Mesh Filter ► Surface Smooth + Use Face Sets sometimes messes up the mesh
1 changed files with 17 additions and 1 deletions

View File

@ -223,7 +223,16 @@ static void mesh_filter_task_cb(void *__restrict userdata,
if (ss->filter_cache->active_face_set != SCULPT_FACE_SET_NONE) {
if (!SCULPT_vertex_has_face_set(ss, vd.index, ss->filter_cache->active_face_set)) {
continue;
/* Surface Smooth can't skip the loop for this vertex as it needs to calculate its
* laplacian_disp. This value is accessed from the vertex neighbors when deforming the
* vertices, so it is needed for all vertices even if they are not going to be displaced.
*/
if (filter_type == MESH_FILTER_SURFACE_SMOOTH) {
fade = 0.0f;
}
else {
continue;
}
}
/* Skip the edges of the face set when relaxing or smoothing.
* There is a relax face set option to relax the boundaries independently. */
@ -429,6 +438,13 @@ static void mesh_filter_surface_smooth_displace_task_cb(
if (fade == 0.0f) {
continue;
}
if (ss->filter_cache->active_face_set != SCULPT_FACE_SET_NONE) {
if (!SCULPT_vertex_has_face_set(ss, vd.index, ss->filter_cache->active_face_set)) {
continue;
}
}
SCULPT_surface_smooth_displace_step(ss,
vd.co,
ss->filter_cache->surface_smooth_laplacian_disp,