Cleanup: Move dyntopo brush check macro to method

Pull Request: https://projects.blender.org/blender/blender/pulls/138470
This commit is contained in:
Sean Kim
2025-05-06 03:36:39 +02:00
committed by Sean Kim
parent fd6ac498b0
commit 9747e9072d
4 changed files with 26 additions and 23 deletions

View File

@@ -195,6 +195,7 @@ void BKE_brush_debug_print_state(Brush *br);
* \{ */
namespace blender::bke::brush {
bool supports_dyntopo(const Brush &brush);
bool supports_accumulate(const Brush &brush);
bool supports_topology_rake(const Brush &brush);
bool supports_auto_smooth(const Brush &brush);

View File

@@ -1509,6 +1509,30 @@ bool BKE_brush_has_cube_tip(const Brush *brush, PaintMode paint_mode)
* \{ */
namespace blender::bke::brush {
bool supports_dyntopo(const Brush &brush)
{
return !ELEM(brush.sculpt_brush_type,
/* These brushes, as currently coded, cannot support dynamic topology */
SCULPT_BRUSH_TYPE_GRAB,
SCULPT_BRUSH_TYPE_ROTATE,
SCULPT_BRUSH_TYPE_CLOTH,
SCULPT_BRUSH_TYPE_THUMB,
SCULPT_BRUSH_TYPE_LAYER,
SCULPT_BRUSH_TYPE_DISPLACEMENT_ERASER,
SCULPT_BRUSH_TYPE_DRAW_SHARP,
SCULPT_BRUSH_TYPE_SLIDE_RELAX,
SCULPT_BRUSH_TYPE_ELASTIC_DEFORM,
SCULPT_BRUSH_TYPE_BOUNDARY,
SCULPT_BRUSH_TYPE_POSE,
SCULPT_BRUSH_TYPE_DRAW_FACE_SETS,
SCULPT_BRUSH_TYPE_PAINT,
SCULPT_BRUSH_TYPE_SMEAR,
/* These brushes could handle dynamic topology,
* but user feedback indicates it's better not to */
SCULPT_BRUSH_TYPE_SMOOTH,
SCULPT_BRUSH_TYPE_MASK);
}
bool supports_accumulate(const Brush &brush)
{
return ELEM(brush.sculpt_brush_type,

View File

@@ -859,7 +859,7 @@ bool stroke_is_dyntopo(const Object &object, const Brush &brush)
* dynamic-topology. */
!(brush.flag & BRUSH_ANCHORED) && !(brush.flag & BRUSH_DRAG_DOT) &&
SCULPT_BRUSH_TYPE_HAS_DYNTOPO(brush.sculpt_brush_type));
bke::brush::supports_dyntopo(brush));
}
} // namespace dyntopo

View File

@@ -473,28 +473,6 @@ typedef enum eBrushCurvesSculptType {
CURVES_SCULPT_BRUSH_TYPE_SLIDE = 10,
} eBrushCurvesSculptType;
#define SCULPT_BRUSH_TYPE_HAS_DYNTOPO(t) \
(ELEM(t, /* These brushes, as currently coded, cannot support dynamic topology */ \
SCULPT_BRUSH_TYPE_GRAB, \
SCULPT_BRUSH_TYPE_ROTATE, \
SCULPT_BRUSH_TYPE_CLOTH, \
SCULPT_BRUSH_TYPE_THUMB, \
SCULPT_BRUSH_TYPE_LAYER, \
SCULPT_BRUSH_TYPE_DISPLACEMENT_ERASER, \
SCULPT_BRUSH_TYPE_DRAW_SHARP, \
SCULPT_BRUSH_TYPE_SLIDE_RELAX, \
SCULPT_BRUSH_TYPE_ELASTIC_DEFORM, \
SCULPT_BRUSH_TYPE_BOUNDARY, \
SCULPT_BRUSH_TYPE_POSE, \
SCULPT_BRUSH_TYPE_DRAW_FACE_SETS, \
SCULPT_BRUSH_TYPE_PAINT, \
SCULPT_BRUSH_TYPE_SMEAR, \
\
/* These brushes could handle dynamic topology, \ \
* but user feedback indicates it's better not to */ \
SCULPT_BRUSH_TYPE_SMOOTH, \
SCULPT_BRUSH_TYPE_MASK) == 0)
/** #Brush.image_brush_type */
typedef enum eBrushImagePaintType {
IMAGE_PAINT_BRUSH_TYPE_DRAW = 0,