Commit: 21b6d78cd282826aeee2d99417e4dc366eae9818 Author: Joseph Eagar Date: Thu Sep 2 11:02:44 2021 -0700 Branches: temp_bmesh_multires https://developer.blender.org/rB21b6d78cd282826aeee2d99417e4dc366eae9818
Sculpt dyntopo: change brush defaults and fix bug * Changed brush defaults a bit. New defaults are for organic modeling. * autosmooth_fset_slide now defaults to 1, so face set boundaries are smoothed but stick to mesh surface (if 0 they would function as hard edges). * Weight by area smooth mode is on by default for all brushes. * Cleaned up versioning code and made it kick in at 3.00:21, with some simple checks to try and detect existing data from beta testers. * Also fixed a small crash bug. =================================================================== M source/blender/blenkernel/intern/brush.c M source/blender/blenkernel/intern/paint.c M source/blender/blenloader/intern/versioning_290.c M source/blender/blenloader/intern/versioning_300.c M source/blender/editors/sculpt_paint/sculpt.c =================================================================== diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index c0c7a5d2aa6..0942cc10994 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -1715,6 +1715,10 @@ void BKE_brush_sculpt_reset(Brush *br) bool disable_dyntopo = false; + // basic face set setup for all organic brushes + br->autosmooth_fset_slide = 1.0f; + br->flag2 |= BRUSH_SMOOTH_PRESERVE_FACE_SETS | BRUSH_SMOOTH_USE_AREA_WEIGHT; + /* Brush settings */ switch (br->sculpt_tool) { case SCULPT_TOOL_DRAW_SHARP: @@ -2653,7 +2657,7 @@ void BKE_brush_get_dyntopo(Brush *brush, Sculpt *sd, DynTopoSettings *out) } else if (!out->detail_size) { brush->dyntopo.inherit |= DYNTOPO_INHERIT_DETAIL_SIZE; - brush->dyntopo.detail_size = 12.0; + brush->dyntopo.detail_size = 8.0f; } int inherit = out->inherit; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 2c3ab2fa561..ea98ab2a5fe 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1943,7 +1943,7 @@ void BKE_sculpt_toolsettings_data_ensure(struct Scene *scene) Sculpt *sd = scene->toolsettings->sculpt; if (!sd->detail_size) { - sd->detail_size = 12; + sd->detail_size = 8.0f; } if (!sd->detail_range || !sd->dyntopo_spacing) { diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index d6dcefc20ac..5860d60537f 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -1437,16 +1437,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 0)) { - for (Brush *br = bmain->brushes.first; br; br = br->id.next) { - if (br->sculpt_tool == SCULPT_TOOL_VCOL_BOUNDARY) { - if (br->vcol_boundary_exponent == 0.0f) { - br->vcol_boundary_exponent = 1.0f; - } - } - } - } - if (!MAIN_VERSION_ATLEAST(bmain, 292, 5)) { /* Initialize the opacity of the overlay wireframe */ if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "wireframe_opacity")) { @@ -1963,44 +1953,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 17)) { - LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { - if (brush->dyntopo.detail_range == 0.0f) { - Brush defbrush = *brush; - - BKE_brush_sculpt_reset(&defbrush); - brush->dyntopo = defbrush.dyntopo; - } - } - } - - if (!MAIN_VERSION_ATLEAST(bmain, 293, 18)) { - LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { - if (brush->sculpt_tool == SCULPT_TOOL_SIMPLIFY) { - 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; - } - } - } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 14)) { - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - ToolSettings *ts = scene->toolsettings; - if (ts && ts->sculpt) { - ts->sculpt->detail_range = 0.4f; - } - } - if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "diff_fac")) { LISTBASE_FOREACH (Light *, light, &bmain->lights) { light->diff_fac = 1.0f; diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 13577164f20..29be6fd89e1 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -46,6 +46,7 @@ #include "BKE_action.h" #include "BKE_animsys.h" #include "BKE_asset.h" +#include "BKE_brush.h" #include "BKE_collection.h" #include "BKE_deform.h" #include "BKE_fcurve.h" @@ -1111,6 +1112,59 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 300, 21)) { + LISTBASE_FOREACH (Brush *, br, &bmain->brushes) { + if (br->autosmooth_fset_slide == 0.0f) { + Brush defbrush = *br; + + BKE_brush_sculpt_reset(&defbrush); + br->dyntopo = defbrush.dyntopo; + + br->flag2 |= defbrush.flag2 & (BRUSH_SMOOTH_PRESERVE_FACE_SETS | + BRUSH_SMOOTH_USE_AREA_WEIGHT | BRUSH_CURVATURE_RAKE); + + br->autosmooth_fset_slide = defbrush.autosmooth_fset_slide; + br->boundary_smooth_factor = defbrush.boundary_smooth_factor; + br->autosmooth_spacing = defbrush.autosmooth_spacing; + br->autosmooth_radius_factor = defbrush.autosmooth_radius_factor; + br->topology_rake_radius_factor = defbrush.topology_rake_radius_factor; + br->topology_rake_projection = defbrush.topology_rake_projection; + br->topology_rake_spacing = defbrush.topology_rake_spacing; + + if (br->autosmooth_projection == 0.0f) { + br->autosmooth_projection = defbrush.autosmooth_projection; + } + } + + if (br->sculpt_tool == SCULPT_TOOL_VCOL_BOUNDARY) { + if (br->vcol_boundary_exponent == 0.0f) { + br->vcol_boundary_exponent = 1.0f; + } + } + else if (br->sculpt_tool == SCULPT_TOOL_SIMPLIFY) { + br->dyntopo.inherit = DYNTOPO_INHERIT_BITMASK & + ~(DYNTOPO_INHERIT_ALL | DYNTOPO_SUBDIVIDE | DYNTOPO_COLLAPSE); + br->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; + } + } + + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + ToolSettings *ts = scene->toolsettings; + if (ts && ts->sculpt) { + ts->sculpt->detail_range = 0.4f; + } + } + } + /** * Versioning code until next subversion bump goes here. * diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 349fce48396..01574a6faff 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1231,7 +1231,7 @@ bool SCULPT_vertex_has_unique_face_set(const SculptSession *ss, SculptVertRef in if (mv->flag & DYNVERT_NEED_BOUNDARY) { BKE_pbvh_update_vert_boundary( - ss->cd_dyn_vert, ss->cd_faceset_offset, v, ss->cache->boundary_symmetry); + ss->cd_dyn_vert, ss->cd_faceset_offset, v, ss->boundary_symmetry); } return !(mv->flag & DYNVERT_FSET_BOUNDARY); @@ -1743,10 +1743,8 @@ SculptCornerType SCULPT_vertex_is_corner(const SculptSession *ss, MDynTopoVert *mv = BKE_PBVH_DYNVERT(ss->cd_dyn_vert, v); if (mv->flag & DYNVERT_NEED_BOUNDARY) { - BKE_pbvh_update_vert_boundary(ss->cd_dyn_vert, - ss->cd_faceset_offset, - (BMVert *)vertex.i, - ss->cache->boundary_symmetry); + BKE_pbvh_update_vert_boundary( + ss->cd_dyn_vert, ss->cd_faceset_offset, (BMVert *)vertex.i, ss->boundary_symmetry); } ret = 0; @@ -1817,10 +1815,8 @@ SculptBoundaryType SCULPT_vertex_is_boundary(const SculptSession *ss, MDynTopoVert *mv = BKE_PBVH_DYNVERT(ss->cd_dyn_vert, ((BMVert *)(vertex.i))); if (mv->flag & DYNVERT_NEED_BOUNDARY) { - BKE_pbvh_update_vert_boundary(ss->cd_dyn_vert, - ss->cd_faceset_offset, - (BMVert *)vertex.i, - ss->cache->boundary_symmetry); + BKE_pbvh_update_vert_boundary( + ss->cd_dyn_vert, ss->cd_faceset_offset, (BMVert *)vertex.i, ss->boundary_symmetry); } int flag = 0; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs