* Dyntopo cleanup mode is now on by default.

* Fixed undo bug
This commit is contained in:
Joseph Eagar 2021-04-11 18:19:13 -07:00
parent 64337d087d
commit 7f14d519c0
6 changed files with 23 additions and 5 deletions

View File

@ -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:

View File

@ -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;
}

View File

@ -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) {

View File

@ -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 */

View File

@ -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;
}
}
}

View File

@ -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,