[Bf-blender-cvs] [7f14d519c0d] temp_bmesh_multires: * Dyntopo cleanup mode is now on by default. * Fixed undo bug

Joseph Eagar noreply at git.blender.org
Mon Apr 12 03:19:49 CEST 2021


Commit: 7f14d519c0d51f0a257910f96156390382d5e72b
Author: Joseph Eagar
Date:   Sun Apr 11 18:19:13 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB7f14d519c0d51f0a257910f96156390382d5e72b

* Dyntopo cleanup mode is now on by default.
* Fixed undo bug

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

M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenkernel/intern/paint.c
M	source/blender/blenkernel/intern/pbvh_bmesh.c
M	source/blender/blenloader/intern/versioning_260.c
M	source/blender/blenloader/intern/versioning_290.c
M	source/blender/makesdna/DNA_brush_enums.h

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

diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index b63e881a21c..d28c6b4d295 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1953,6 +1953,7 @@ void BKE_brush_sculpt_reset(Brush *br)
     case SCULPT_TOOL_SIMPLIFY:
       br->dyntopo.inherit = ((1<<17)-1) & ~(DYNTOPO_INHERIT_ALL|DYNTOPO_SUBDIVIDE|DYNTOPO_COLLAPSE);
       br->dyntopo.flag |= DYNTOPO_COLLAPSE|DYNTOPO_SUBDIVIDE;
+      br->autosmooth_factor = 0.02;
     case SCULPT_TOOL_VCOL_BOUNDARY:
     case SCULPT_TOOL_PAINT:
     case SCULPT_TOOL_MASK:
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index f79ebf23181..9c316483c53 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1080,7 +1080,7 @@ bool BKE_paint_ensure(ToolSettings *ts, struct Paint **r_paint)
     paint->symmetry_flags |= PAINT_SYMM_X;
 
     /* Make sure at least dyntopo subdivision is enabled */
-    data->flags |= SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE;
+    data->flags |= SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE | SCULPT_DYNTOPO_CLEANUP;
   }
   else if ((GpPaint **)r_paint == &ts->gp_paint) {
     GpPaint *data = MEM_callocN(sizeof(*data), __func__);
@@ -1908,9 +1908,12 @@ void BKE_sculpt_toolsettings_data_ensure(struct Scene *scene)
   if (!sd->detail_size) {
     sd->detail_size = 12;
   }
+
   if (!sd->detail_range) {
     sd->detail_range = 0.4f;
+    sd->flags |= SCULPT_DYNTOPO_CLEANUP; //should really do this in do_versions_290.c
   }
+
   if (!sd->detail_percent) {
     sd->detail_percent = 25;
   }
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 55995d0187e..4f5bc93923c 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -3368,6 +3368,7 @@ __attribute__((optnone)) static bool cleanup_valence_3_4(PBVH *pbvh,
       }
 
       pbvh_bmesh_vert_remove(pbvh, v);
+      BM_log_vert_removed(pbvh->bm_log, v, pbvh->cd_vert_mask_offset);
 
       BMFace *f;
       BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c
index 7c5eefa60f7..3fa8e0f0e7b 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -2407,7 +2407,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
       /* this can now be turned off */
       ToolSettings *ts = scene->toolsettings;
       if (ts->sculpt) {
-        ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE;
+        ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_CLEANUP;
       }
 
       /* 'Increment' mode disabled for nodes, use true grid snapping instead */
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index dc41cbd7f51..0add51b0f00 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -1975,9 +1975,18 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
   if (!MAIN_VERSION_ATLEAST(bmain, 293, 18)) {
     LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
       if (brush->sculpt_tool == SCULPT_TOOL_SIMPLIFY) {
-        brush->dyntopo.inherit = ((1 << 17) - 1) &
-                              ~(DYNTOPO_INHERIT_ALL | DYNTOPO_SUBDIVIDE | DYNTOPO_COLLAPSE);
-        brush->dyntopo.flag |= DYNTOPO_COLLAPSE | DYNTOPO_SUBDIVIDE;
+        brush->dyntopo.inherit = DYNTOPO_INHERIT_BITMASK &
+                                 ~(DYNTOPO_INHERIT_ALL | DYNTOPO_SUBDIVIDE | DYNTOPO_COLLAPSE);
+        brush->dyntopo.flag |= DYNTOPO_COLLAPSE | DYNTOPO_SUBDIVIDE | DYNTOPO_CLEANUP;
+      }
+    }
+
+    Scene *scene;
+    for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
+      ToolSettings *ts = scene->toolsettings;
+
+      if (ts->sculpt) {
+        ts->sculpt->flags |= SCULPT_DYNTOPO_CLEANUP;
       }
     }
   }
diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h
index 8bb1679531d..2df757dbf2d 100644
--- a/source/blender/makesdna/DNA_brush_enums.h
+++ b/source/blender/makesdna/DNA_brush_enums.h
@@ -632,8 +632,12 @@ enum {
   DYNTOPO_INHERIT_MODE = 1<<13,
   DYNTOPO_INHERIT_CONSTANT_DETAIL = 1<<14,
   DYNTOPO_INHERIT_SPACING = 1<<15
+  //make sure to update DYNTOPO_INHERIT_BITMASK when adding flags here
 };
 
+//represents all possible inherit flags
+#define DYNTOPO_INHERIT_BITMASK ((1<<16)-1)
+
 //dyntopo mode
 enum {
   DYNTOPO_DETAIL_RELATIVE = 0,



More information about the Bf-blender-cvs mailing list