Sculpt: Use capability check for dyntopo panel options

Prior to this commit, the Dyntopo panel was hardcoded to display as
faded if the current brush was the mask brush. This conflicts with the
common set of brushes which we do not support dyntopo for, which
includes many other brushes.

This commit changes the check to better indicate that certain brushes do
not support dyntopo. The scene-level settings can still be changed & the
detail flood fill operator remains functional even if the a different
brush is selected.

Additionally, the panel is no longer greyed out if the "Manual" option is
active.

Pull Request: https://projects.blender.org/blender/blender/pulls/138634
This commit is contained in:
Sean Kim
2025-05-12 23:19:01 +02:00
committed by Sean Kim
parent f2327a956b
commit 8fdaa555e8
2 changed files with 8 additions and 1 deletions

View File

@@ -1027,7 +1027,7 @@ class VIEW3D_PT_sculpt_dyntopo(Panel, View3DPaintPanel):
col.active = context.sculpt_object.use_dynamic_topology_sculpting
sub = col.column()
sub.active = (brush and brush.sculpt_tool != 'MASK')
sub.active = (brush and brush.sculpt_capabilities.has_dyntopo) or sculpt.detail_type_method == 'MANUAL'
if sculpt.detail_type_method in {'CONSTANT', 'MANUAL'}:
row = sub.row(align=True)
row.prop(sculpt, "constant_detail_resolution")

View File

@@ -569,6 +569,12 @@ static bool rna_BrushCapabilitiesSculpt_has_tilt_get(PointerRNA *ptr)
return blender::bke::brush::supports_tilt(*br);
}
static bool rna_BrushCapabilitiesSculpt_has_dyntopo_get(PointerRNA *ptr)
{
const Brush *br = static_cast<const Brush *>(ptr->data);
return blender::bke::brush::supports_dyntopo(*br);
}
static bool rna_BrushCapabilitiesImagePaint_has_accumulate_get(PointerRNA *ptr)
{
/* only support for draw brush */
@@ -1192,6 +1198,7 @@ static void rna_def_sculpt_capabilities(BlenderRNA *brna)
SCULPT_BRUSH_CAPABILITY(has_direction, "Has Direction");
SCULPT_BRUSH_CAPABILITY(has_gravity, "Has Gravity");
SCULPT_BRUSH_CAPABILITY(has_tilt, "Has Tilt");
SCULPT_BRUSH_CAPABILITY(has_dyntopo, "Has Dyntopo");
# undef SCULPT_CAPABILITY
}