[Bf-blender-cvs] [8de1899c331] sculpt-dev: Sculpt-dev: bugfixes

Joseph Eagar noreply at git.blender.org
Sat Nov 27 00:42:00 CET 2021


Commit: 8de1899c3319b0acba9e85ad42b4d33c5ce00861
Author: Joseph Eagar
Date:   Fri Nov 26 15:39:44 2021 -0800
Branches: sculpt-dev
https://developer.blender.org/rB8de1899c3319b0acba9e85ad42b4d33c5ce00861

Sculpt-dev: bugfixes

* Fixed PBVH_FACES vcol draw bug.
* Fixed boundary smooth being turned on
  if its temp customdata layer exists.
* Fixed unnesting of brush panels from
  last commit improperly showing up
  in the workspace tab for sculpt
  instead of the brush tab.

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/blenkernel/intern/pbvh_bmesh.c
M	source/blender/bmesh/intern/bmesh_construct.c
M	source/blender/draw/intern/draw_manager_data.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_automasking.c
M	source/blender/editors/sculpt_paint/sculpt_smooth.c
M	source/blender/gpu/intern/gpu_buffers.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 9ac5e903bae..44ba09f499f 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -453,7 +453,7 @@ class VIEW3D_PT_tools_brush_settings_channels_preview(Panel, View3DPaintBrushPan
 
 
 class VIEW3D_PT_tools_brush_settings_advanced(Panel, View3DPaintBrushPanel):
-    bl_context = ".paint_common"
+    bl_context = ".brush_editor"
     #bl_parent_id = "VIEW3D_PT_tools_brush_settings"
     bl_label = "Advanced"
     bl_options = {'DEFAULT_CLOSED'}
@@ -718,7 +718,7 @@ class VIEW3D_PT_tools_brush_display(Panel, View3DPaintBrushPanel, DisplayPanel):
 
 # TODO, move to space_view3d.py
 class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
-    bl_context = ".paint_common"
+    bl_context = ".brush_editor"
     #bl_parent_id = "VIEW3D_PT_tools_brush_settings"
     bl_label = "Texture"
     bl_options = {'DEFAULT_CLOSED'}
@@ -777,14 +777,14 @@ class VIEW3D_PT_tools_mask_texture(Panel, View3DPaintPanel, TextureMaskPanel):
 
 # TODO, move to space_view3d.py
 class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel, StrokePanel):
-    bl_context = ".paint_common"  # dot on purpose (access from topbar)
+    bl_context = ".brush_editor"  # dot on purpose (access from topbar)
     bl_label = "Stroke"
     #bl_parent_id = "VIEW3D_PT_tools_brush_settings"
     bl_options = {'DEFAULT_CLOSED'}
 
 
 class VIEW3D_PT_tools_brush_stroke_smooth_stroke(Panel, View3DPaintPanel, SmoothStrokePanel):
-    bl_context = ".paint_common"  # dot on purpose (access from topbar)
+    bl_context = ".brush_editor"  # dot on purpose (access from topbar)
     bl_label = "Stabilize Stroke"
     bl_parent_id = "VIEW3D_PT_tools_brush_stroke"
     bl_options = {'DEFAULT_CLOSED'}
@@ -825,7 +825,7 @@ class VIEW3D_PT_tools_weight_gradient(Panel, View3DPaintPanel):
 
 # TODO, move to space_view3d.py
 class VIEW3D_PT_tools_brush_falloff(Panel, View3DPaintPanel, FalloffPanel):
-    bl_context = ".paint_common"  # dot on purpose (access from topbar)
+    bl_context = ".brush_editor"  # dot on purpose (access from topbar)
     #bl_parent_id = "VIEW3D_PT_tools_brush_settings"
     bl_label = ""
     bl_options = {'DEFAULT_CLOSED'}
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 0bfc7f7aa8e..06569b596e4 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1426,6 +1426,17 @@ bool BKE_pbvh_get_color_layer(PBVH *pbvh,
       pbvh->cd_vcol_offset = cdata_bm->layers[idx].offset;
       cl = *r_cl = cdata_bm->layers + idx;
     }
+    else if (pbvh) { /* check if pbvh is using its own customdata layout */
+      CustomData *cdata = domain == ATTR_DOMAIN_POINT ? pbvh->vdata : pbvh->ldata;
+
+      if (cdata) {
+        int idx = CustomData_get_named_layer_index(cdata, cl->type, cl->name);
+
+        if (idx != -1) {
+          *r_cl = cdata->layers + idx;
+        }
+      }
+    }
 
     if (pbvh) {
       pbvh->vcol_domain = domain;
@@ -4394,7 +4405,7 @@ void BKE_pbvh_update_vert_boundary_grids(PBVH *pbvh,
   mv->flag &= ~SCULPTVERT_NEED_VALENCE;
 }
 
-ATTR_NO_OPT void BKE_pbvh_update_vert_boundary_faces(int *face_sets,
+void BKE_pbvh_update_vert_boundary_faces(int *face_sets,
                                          MVert *mvert,
                                          MEdge *medge,
                                          MLoop *mloop,
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 3ccdf3d444a..4805d5b785c 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -66,9 +66,9 @@ Topology rake:
 
 #include "GPU_buffers.h"
 
+#include "atomic_ops.h"
 #include "bmesh.h"
 #include "pbvh_intern.h"
-#include "atomic_ops.h"
 
 #include <math.h>
 #include <stdio.h>
@@ -76,7 +76,7 @@ Topology rake:
 
 #include <stdarg.h>
 
-ATTR_NO_OPT static void _debugprint(const char *fmt, ...)
+static void _debugprint(const char *fmt, ...)
 {
   va_list args;
   va_start(args, fmt);
@@ -127,7 +127,7 @@ ATTR_NO_OPT void pbvh_bmesh_check_nodes(PBVH *pbvh)
 
     if (ni >= 0 && (!v->e || !v->e->l)) {
       _debugprint("wire vert had node reference: %p (type %d)\n", v, v->head.htype);
-      //BM_ELEM_CD_SET_INT(v, pbvh->cd_vert_node_offset, DYNTOPO_NODE_NONE);
+      // BM_ELEM_CD_SET_INT(v, pbvh->cd_vert_node_offset, DYNTOPO_NODE_NONE);
     }
 
     if (ni < -1 || ni >= pbvh->totnode) {
@@ -1576,13 +1576,13 @@ static void pbvh_bmesh_create_leaf_fast_task_cb(void *__restrict userdata,
     do {
       BMVert *v = l_iter->v;
 
-      int old = BM_ELEM_CD_GET_INT(
-          v, pbvh->cd_vert_node_offset);
+      int old = BM_ELEM_CD_GET_INT(v, pbvh->cd_vert_node_offset);
 
       char *ptr = (char *)v;
       ptr += pbvh->cd_vert_node_offset;
 
-      if (old == DYNTOPO_NODE_NONE && atomic_cas_int32((int32_t*)ptr, DYNTOPO_NODE_NONE, node_index) == DYNTOPO_NODE_NONE) {
+      if (old == DYNTOPO_NODE_NONE &&
+          atomic_cas_int32((int32_t *)ptr, DYNTOPO_NODE_NONE, node_index) == DYNTOPO_NODE_NONE) {
         BLI_table_gset_insert(n->bm_unique_verts, v);
       }
       else {
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index 4bcbc5d73f6..74f9dac9239 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -91,7 +91,7 @@ static uint bm_id_freelist_pop(BMesh *bm)
 
 void bm_free_ids_check(BMesh *bm, uint id)
 {
-  if (id >> 2UL >= (uint)bm->idmap.free_ids_size) {
+  if (!bm->idmap.free_ids || id >> 2UL >= (uint)bm->idmap.free_ids_size) {
     size_t size = (size_t)(id >> 2) + 2ULL;
     size += size >> 1ULL;
 
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index 4582256ed34..00fddf1e5db 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -971,7 +971,8 @@ static void sculpt_draw_cb(DRWSculptCallbackData *scd, GPU_PBVH_Buffers *buffers
     if (SCULPT_DEBUG_BUFFERS) {
       /* Color each buffers in different colors. Only work in solid/Xray mode. */
       shgrp = DRW_shgroup_create_sub(shgrp);
-      DRW_shgroup_uniform_vec3(shgrp, "materialDiffuseColor", SCULPT_DEBUG_COLOR(scd->debug_node_nr++), 1);
+      DRW_shgroup_uniform_vec3(
+          shgrp, "materialDiffuseColor", SCULPT_DEBUG_COLOR(scd->debug_node_nr++), 1);
     }
 #if 0
     float extramat[4][4], mat[4][4];
@@ -1091,7 +1092,7 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd)
     update_only_visible = true;
   }
 
-  Mesh *mesh = scd->ob->data;
+  Mesh *mesh = BKE_object_get_original_mesh(scd->ob);
   BKE_pbvh_update_normals(pbvh, mesh->runtime.subdiv_ccg);
 
   BKE_pbvh_draw_cb(pbvh,
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 954dc10bcd5..c5e9f839136 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1731,7 +1731,7 @@ static bool sculpt_check_unique_face_set_for_edge_in_base_mesh(const SculptSessi
   return true;
 }
 
-ATTR_NO_OPT bool SCULPT_vertex_has_unique_face_set(const SculptSession *ss, SculptVertRef vertex)
+bool SCULPT_vertex_has_unique_face_set(const SculptSession *ss, SculptVertRef vertex)
 {
   return !SCULPT_vertex_is_boundary(ss, vertex, SCULPT_BOUNDARY_FACE_SET);
 }
@@ -2422,8 +2422,7 @@ static void grids_update_boundary_flags(const SculptSession *ss, SculptVertRef v
   }
 }
 
-ATTR_NO_OPT static void faces_update_boundary_flags(const SculptSession *ss,
-                                                    const SculptVertRef vertex)
+static void faces_update_boundary_flags(const SculptSession *ss, const SculptVertRef vertex)
 {
   BKE_pbvh_update_vert_boundary_faces(ss->face_sets,
                                       ss->mvert,
@@ -2523,9 +2522,9 @@ SculptCornerType SCULPT_vertex_is_corner(const SculptSession *ss,
   return ret;
 }
 
-ATTR_NO_OPT SculptBoundaryType SCULPT_vertex_is_boundary(const SculptSession *ss,
-                                                         const SculptVertRef vertex,
-                                                         SculptBoundaryType boundary_types)
+SculptBoundaryType SCULPT_vertex_is_boundary(const SculptSession *ss,
+                                             const SculptVertRef vertex,
+                                             SculptBoundaryType boundary_types)
 {
   MSculptVert *mv = NULL;
 
diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.c b/source/blender/editors/sculpt_paint/sculpt_automasking.c
index d2829bd70b5..693a7c81bb1 100644
--- a/source/blender/editors/sculpt_paint/sculpt_automasking.c
+++ b/source/blender/editors/sculpt_paint/sculpt_automasking.c
@@ -324,7 +324,7 @@ static void sculpt_face_sets_automasking_init(Sculpt *sd,
 
 #define EDGE_DISTANCE_INF -1
 
-ATTR_NO_OPT void SCULPT_boundary_automasking_init(Object *ob,
+void SCULPT_boundary_automasking_init(Object *ob,
                                       eBoundaryAutomaskMode mode,
                                       int propagation_steps,
                                       SculptCustomLayer *factorlayer)
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index 18ea47b9e0e..fd798a43654 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -150,7 +150,7 @@ void SCULPT_reproject_cdata(SculptSession *ss,
   bool bad = false;
 
   for (int i = 0; i < totuv; i++) {
-    snapuvs[i] = true; //!(mv->flag & SCULPTVERT_UV_BOUNDARY);
+    snapuvs[i] = true;  //!(mv->flag & SCULPTVERT_UV_BOUNDARY);
   }
 
   do {
@@ -209,7 +209,7 @@ void SCULPT_reproject_cdata(SculptSession *ss,
         break;
       }
     } while ((l = l->radial_next) != e->l);
-    
+
     if (bad) {
       break;
     }
@@ -333,8 +333,8 @@ void SCULPT_reproject_cdata(SculptSession *ss,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list