[Bf-blender-cvs] [039429faeb4] master: Sculpt: fix missing nullptr check in pbvh draw

Joseph Eagar noreply at git.blender.org
Thu Sep 29 10:25:53 CEST 2022


Commit: 039429faeb4160cc26b283c7309c9cb9d87ee7c0
Author: Joseph Eagar
Date:   Thu Sep 29 01:25:28 2022 -0700
Branches: master
https://developer.blender.org/rB039429faeb4160cc26b283c7309c9cb9d87ee7c0

Sculpt: fix missing nullptr check in pbvh draw

This time it was face sets.

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

M	source/blender/draw/intern/draw_pbvh.cc
M	source/blender/editors/sculpt_paint/sculpt_face_set.cc

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

diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc
index 81550d368a6..2f325f7cf62 100644
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@ -550,27 +550,40 @@ struct PBVHBatches {
       }
       case CD_PBVH_FSET_TYPE: {
         int *face_sets = static_cast<int *>(
-            CustomData_get_layer(args->pdata, CD_SCULPT_FACE_SETS));
-        int last_poly = -1;
-        uchar fset_color[3] = {255, 255, 255};
+            CustomData_get_layer_named(args->pdata, CD_PROP_INT32, ".sculpt_face_set"));
 
-        foreach_faces([&](int /*buffer_i*/, int /*tri_i*/, int /*vertex_i*/, const MLoopTri *tri) {
-          if (last_poly != tri->poly && args->face_sets) {
-            last_poly = tri->poly;
+        if (face_sets) {
+          int last_poly = -1;
+          uchar fset_color[3] = {255, 255, 255};
 
-            const int fset = abs(face_sets[tri->poly]);
+          foreach_faces(
+              [&](int /*buffer_i*/, int /*tri_i*/, int /*vertex_i*/, const MLoopTri *tri) {
+                if (last_poly != tri->poly && args->face_sets) {
+                  last_poly = tri->poly;
 
-            if (fset != args->face_sets_color_default) {
-              BKE_paint_face_set_overlay_color_get(fset, args->face_sets_color_seed, fset_color);
-            }
-            else {
-              /* Skip for the default color face set to render it white. */
-              fset_color[0] = fset_color[1] = fset_color[2] = 255;
-            }
-          }
+                  const int fset = abs(face_sets[tri->poly]);
 
-          *static_cast<uchar3 *>(GPU_vertbuf_raw_step(&access)) = fset_color;
-        });
+                  if (fset != args->face_sets_color_default) {
+                    BKE_paint_face_set_overlay_color_get(
+                        fset, args->face_sets_color_seed, fset_color);
+                  }
+                  else {
+                    /* Skip for the default color face set to render it white. */
+                    fset_color[0] = fset_color[1] = fset_color[2] = 255;
+                  }
+                }
+
+                *static_cast<uchar3 *>(GPU_vertbuf_raw_step(&access)) = fset_color;
+              });
+        }
+        else {
+          uchar fset_color[3] = {255, 255, 255};
+
+          foreach_faces(
+              [&](int /*buffer_i*/, int /*tri_i*/, int /*vertex_i*/, const MLoopTri *tri) {
+                *static_cast<uchar3 *>(GPU_vertbuf_raw_step(&access)) = fset_color;
+              });
+        }
 
         break;
       }
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
index be52aaf0aa7..1327f40f95a 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
@@ -134,6 +134,8 @@ static void do_draw_face_sets_brush_task_cb_ex(void *__restrict userdata,
       data->ob, ss, ss->cache->automasking, &automask_data, data->nodes[n]);
 
   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
+    SCULPT_automasking_node_update(ss, &automask_data, &vd);
+
     if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
       MeshElemMap *vert_map = &ss->pmap[vd.index];
       for (int j = 0; j < ss->pmap[vd.index].count; j++) {



More information about the Bf-blender-cvs mailing list