From 8fdaa555e83fcbdc0bc6acbe6426a1cf8badbfbe Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Mon, 12 May 2025 23:19:01 +0200 Subject: [PATCH] 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 --- scripts/startup/bl_ui/space_view3d_toolbar.py | 2 +- source/blender/makesrna/intern/rna_brush.cc | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/startup/bl_ui/space_view3d_toolbar.py b/scripts/startup/bl_ui/space_view3d_toolbar.py index ed0a7fb2df6..ba3a2d53081 100644 --- a/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -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") diff --git a/source/blender/makesrna/intern/rna_brush.cc b/source/blender/makesrna/intern/rna_brush.cc index 4d8dd65934f..be4a6641c83 100644 --- a/source/blender/makesrna/intern/rna_brush.cc +++ b/source/blender/makesrna/intern/rna_brush.cc @@ -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(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 }