Fix issues with last commit. Also, simplify brush now

uses dyntopo local overrides to always enable collapse instead
of being hardcoded.
This commit is contained in:
Joseph Eagar 2021-04-11 12:27:02 -07:00
parent fe67ca56d6
commit 7dbb4c9b2d
3 changed files with 22 additions and 15 deletions

View File

@ -780,21 +780,25 @@ class VIEW3D_PT_sculpt_dyntopo_advanced(Panel, View3DPaintPanel):
brush = settings.brush
col = layout.column()
print(dir(col))
col.label(text="Local Brush Settings")
row = col.row()
row.prop(brush.dyntopo, "disabled", text="Disable Dyntopo")
col.label(text="Overrides")
inherit_all = "ALL" in brush.dyntopo.inherit
col.prop_enum(brush.dyntopo, "inherit", value="ALL", text="All Scene Defaults", icon="LOCKED" if inherit_all else "UNLOCKED");
col.prop_enum(brush.dyntopo, "inherit", value="ALL", text="Use All Defaults", icon="LOCKED" if inherit_all else "UNLOCKED")
def do_prop(key):
row = col.row()
if key.upper() in brush.dyntopo.inherit:
icon = "LOCKED"
else:
icon = "UNLOCKED"
else:
icon = "LOCKED"
row.prop_enum(brush.dyntopo, "inherit", value=key.upper(), icon=icon, text="");
row.prop_enum(brush.dyntopo, "inherit", value=key.upper(), icon=icon, text="")
row2 = row.row()
row2.prop(brush.dyntopo, key)
@ -806,12 +810,12 @@ class VIEW3D_PT_sculpt_dyntopo_advanced(Panel, View3DPaintPanel):
row.enabled = False
col = layout.column()
do_prop("subdivide");
do_prop("collapse");
do_prop("spacing");
do_prop("detail_range");
do_prop("detail_percent");
do_prop("constant_detail");
do_prop("subdivide")
do_prop("collapse")
do_prop("spacing")
do_prop("detail_range")
do_prop("detail_percent")
do_prop("constant_detail")
do_prop("mode")
# TODO, move to space_view3d.py

View File

@ -1950,8 +1950,10 @@ void BKE_brush_sculpt_reset(Brush *br)
br->sub_col[2] = 0.005f;
break;
case SCULPT_TOOL_VCOL_BOUNDARY:
case SCULPT_TOOL_SIMPLIFY:
br->dyntopo.inherit = ((1<<17)-1) & ~(DYNTOPO_INHERIT_ALL|DYNTOPO_SUBDIVIDE|DYNTOPO_COLLAPSE);
br->dyntopo.flag |= DYNTOPO_COLLAPSE|DYNTOPO_SUBDIVIDE;
case SCULPT_TOOL_VCOL_BOUNDARY:
case SCULPT_TOOL_PAINT:
case SCULPT_TOOL_MASK:
case SCULPT_TOOL_DRAW_FACE_SETS:

View File

@ -6345,12 +6345,13 @@ static void sculpt_topology_update(Sculpt *sd,
PBVHTopologyUpdateMode mode = 0;
float location[3];
if (!(sd->flags & SCULPT_DYNTOPO_DETAIL_MANUAL)) {
if (sd->flags & SCULPT_DYNTOPO_SUBDIVIDE) {
if (brush->cached_dyntopo.mode != DYNTOPO_DETAIL_MANUAL) {
if (brush->cached_dyntopo.flag & DYNTOPO_SUBDIVIDE) {
mode |= PBVH_Subdivide;
}
if ((sd->flags & SCULPT_DYNTOPO_COLLAPSE) || (brush->sculpt_tool == SCULPT_TOOL_SIMPLIFY)) {
if ((brush->cached_dyntopo.flag & DYNTOPO_COLLAPSE)
/*||(brush->sculpt_tool == SCULPT_TOOL_SIMPLIFY)*/) {
mode |= PBVH_Collapse;
}
}