[Bf-blender-cvs] [65aaa13a000] blender-v2.83-release: Fix T75662: Surface Smooth filter not checking face sets

Pablo Dobarro noreply at git.blender.org
Mon Apr 20 02:11:12 CEST 2020


Commit: 65aaa13a0001610e9d8727b916e413c4c0d9761e
Author: Pablo Dobarro
Date:   Wed Apr 15 21:09:43 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB65aaa13a0001610e9d8727b916e413c4c0d9761e

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

===================================================================

M	source/blender/editors/sculpt_paint/sculpt_filter_mesh.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index 4f22ad6a9b0..94b6e0eb864 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -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,



More information about the Bf-blender-cvs mailing list