Commit: 656a922a652579bc9a3ebf9e97eec910f90213d0
Author: Joseph Eagar
Date:   Wed Oct 20 08:22:27 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB656a922a652579bc9a3ebf9e97eec910f90213d0

Sculpt: bugfixes

* Fixed smooth bug with seam corners.
* Fixed crash.

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

M       source/blender/blenkernel/intern/brush_engine_presets.c
M       source/blender/blenkernel/intern/dyntopo.c
M       source/blender/editors/sculpt_paint/sculpt.c
M       source/blender/editors/sculpt_paint/sculpt_face_set.c
M       source/blender/editors/sculpt_paint/sculpt_smooth.c
M       source/blender/python/bmesh/bmesh_py_types_customdata.c

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

diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index 35527d70526..4aaa5c37164 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -441,6 +441,7 @@ static BrushSettingsMap brush_settings_map[] = {
   DEF(size, radius, INT, FLOAT)
   DEF(alpha, strength, FLOAT, FLOAT)
   DEF(spacing, spacing, INT, FLOAT)
+  DEF(automasking_flags, automasking, INT, INT)
   DEF(autosmooth_factor, autosmooth, FLOAT, FLOAT)
   DEF(area_radius_factor, area_radius_factor, FLOAT, FLOAT)
   DEF(autosmooth_projection, autosmooth_projection, FLOAT, FLOAT)
@@ -1868,6 +1869,8 @@ void BKE_brush_init_toolsettings(Sculpt *sd)
     BKE_brush_channelset_free(sd->channels);
   }
 
+  sd->channels = BKE_brush_channelset_create("sd");
+
   BKE_brush_check_toolsettings(sd);
   BKE_brush_channelset_check_radius(sd->channels);
 
diff --git a/source/blender/blenkernel/intern/dyntopo.c 
b/source/blender/blenkernel/intern/dyntopo.c
index 3b25fb3f396..dd076f26bb9 100644
--- a/source/blender/blenkernel/intern/dyntopo.c
+++ b/source/blender/blenkernel/intern/dyntopo.c
@@ -606,6 +606,10 @@ BLI_INLINE void surface_smooth_v_safe(PBVH *pbvh, BMVert 
*v, float fac)
     return;
   }
 
+  if (bound1) {
+    fac *= 0.1;
+  }
+
   do {
     BMVert *v2 = e->v1 == v ? e->v2 : e->v1;
 
@@ -1485,7 +1489,7 @@ BLI_INLINE float 
calc_weighted_edge_collapse(EdgeQueueContext *eq_ctx, BMVert *v
 {
   float len_sq = len_squared_v3v3(v1->co, v2->co);
 
-#if 0  // this rule here seems to improve topology, but need to study it more
+#if 1  // this rule here seems to improve topology, but need to study it more
   MSculptVert *mv1 = BKE_PBVH_SCULPTVERT(eq_ctx->cd_sculpt_vert, v1);
   MSculptVert *mv2 = BKE_PBVH_SCULPTVERT(eq_ctx->cd_sculpt_vert, v2);
 
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 5d52a8f672f..01e25416e14 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5135,6 +5135,7 @@ bool brush_uses_commandlist(Brush *brush)
     case SCULPT_TOOL_DRAW_FACE_SETS:
     case SCULPT_TOOL_CLOTH:
     case SCULPT_TOOL_SMOOTH:
+    case SCULPT_TOOL_PINCH:
     case SCULPT_TOOL_SIMPLIFY:
     case SCULPT_TOOL_SNAKE_HOOK:
     case SCULPT_TOOL_INFLATE:
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c 
b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index 5123752e896..dda4821fbd3 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -601,7 +601,7 @@ static void do_relax_face_sets_brush_task_cb_ex(void 
*__restrict userdata,
 void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, 
int totnode)
 {
   SculptSession *ss = ob->sculpt;
-  Brush *brush = BKE_paint_brush(&sd->paint);
+  Brush *brush = ss->cache->brush ? ss->cache->brush : 
BKE_paint_brush(&sd->paint);
 
   BKE_curvemapping_init(brush->curve);
 
@@ -617,9 +617,11 @@ void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object 
*ob, PBVHNode **nodes, in
 
   /*for ctrl invert mode we have to set the automasking initial_face_set
     to the first non-current faceset that is found*/
+  int automasking_flags = SCULPT_get_int(ss, automasking, sd, brush);
+
   if (SCULPT_stroke_is_first_brush_step(ss->cache)) {
     if (ss->cache->invert && ss->cache->automasking &&
-        (brush->automasking_flags & BRUSH_AUTOMASKING_FACE_SETS)) {
+        (automasking_flags & BRUSH_AUTOMASKING_FACE_SETS)) {
       ss->cache->automasking->settings.current_face_set =
           ss->cache->automasking->settings.initial_face_set;
     }
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c 
b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index 38359a9fbb7..8ec9570536b 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -502,7 +502,7 @@ void SCULPT_neighbor_coords_average_interior(SculptSession 
*ss,
         madd_v3_v3v3fl(tmp, co, no, dot_v3v3(t, no));
         ok = true;
       }
-      else if (final_boundary) {
+      else if (final_boundary & is_boundary) {
         copy_v3_v3(tmp, co2);
         ok = true;
         do_diffuse = false;
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c 
b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 0aa92158524..9a583b7968f 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -84,6 +84,8 @@ PyDoc_STRVAR(bpy_bmlayeraccess_collection__float_doc,
              "Generic float custom-data layer.\n\ntype: 
:class:`BMLayerCollection`");
 PyDoc_STRVAR(bpy_bmlayeraccess_collection__int_doc,
              "Generic int custom-data layer.\n\ntype: 
:class:`BMLayerCollection`");
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__face_set_doc,
+             "Sculpt face set custom-data layer.\n\ntype: 
:class:`BMLayerCollection`");
 PyDoc_STRVAR(bpy_bmlayeraccess_collection__float_vector_doc,
              "Generic 3D vector with float precision custom-data 
layer.\n\ntype: "
              ":class:`BMLayerCollection`");
@@ -304,6 +306,11 @@ static PyGetSetDef bpy_bmlayeraccess_face_getseters[] = {
      (setter)NULL,
      bpy_bmlayeraccess_collection__int_doc,
      (void *)CD_PROP_INT32},
+    {"face_set",
+     (getter)bpy_bmlayeraccess_collection_get,
+     (setter)NULL,
+     bpy_bmlayeraccess_collection__face_set_doc,
+     (void *)CD_SCULPT_FACE_SETS},
     {"float_vector",
      (getter)bpy_bmlayeraccess_collection_get,
      (setter)NULL,
@@ -1131,6 +1138,7 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, 
BPy_BMLayerItem *py_layer)
       break;
     }
     case CD_PROP_INT32:
+    case CD_SCULPT_FACE_SETS:
     case CD_FACEMAP: {
       ret = PyLong_FromLong(*(int *)value);
       break;
@@ -1210,6 +1218,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, 
BPy_BMLayerItem *py_layer, PyObj
       break;
     }
     case CD_PROP_INT32:
+    case CD_SCULPT_FACE_SETS:
     case CD_FACEMAP: {
       const int tmp_val = PyC_Long_AsI32(py_value);
       if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to