Fix sculpt secondary color missing some brushes

D2841 by @uvwxyz w/ edits
This commit is contained in:
Campbell Barton 2017-10-05 12:57:24 +11:00 committed by Bastien Montagne
parent 98dc9072e5
commit 6058b651c4
4 changed files with 15 additions and 10 deletions

View File

@ -106,6 +106,8 @@ int BKE_brush_use_locked_size(const struct Scene *scene, const struct Brush *br
int BKE_brush_use_alpha_pressure(const struct Scene *scene, const struct Brush *brush);
int BKE_brush_use_size_pressure(const struct Scene *scene, const struct Brush *brush);
bool BKE_brush_sculpt_has_secondary_color(const struct Brush *brush);
/* scale unprojected radius to reflect a change in the brush's 2D size */
void BKE_brush_scale_unprojected_radius(
float *unprojected_radius,

View File

@ -844,6 +844,16 @@ int BKE_brush_use_alpha_pressure(const Scene *scene, const Brush *brush)
(brush->flag & BRUSH_ALPHA_PRESSURE);
}
bool BKE_brush_sculpt_has_secondary_color(const Brush *brush)
{
return ELEM(
brush->sculpt_tool, SCULPT_TOOL_BLOB, SCULPT_TOOL_DRAW,
SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS,
SCULPT_TOOL_PINCH, SCULPT_TOOL_CREASE, SCULPT_TOOL_LAYER,
SCULPT_TOOL_FLATTEN, SCULPT_TOOL_FILL, SCULPT_TOOL_SCRAPE,
SCULPT_TOOL_MASK);
}
void BKE_brush_unprojected_radius_set(Scene *scene, Brush *brush, float unprojected_radius)
{
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;

View File

@ -1043,11 +1043,8 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
/* check if brush is subtracting, use different color then */
/* TODO: no way currently to know state of pen flip or
* invert key modifier without starting a stroke */
if (((ups->draw_inverted == 0) ^
((brush->flag & BRUSH_DIR_IN) == 0)) &&
ELEM(brush->sculpt_tool, SCULPT_TOOL_DRAW,
SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
SCULPT_TOOL_PINCH, SCULPT_TOOL_CREASE))
if (((ups->draw_inverted == 0) ^ ((brush->flag & BRUSH_DIR_IN) == 0)) &&
BKE_brush_sculpt_has_secondary_color(brush))
{
outline_col = brush->sub_col;
}

View File

@ -223,11 +223,7 @@ static int rna_SculptToolCapabilities_has_sculpt_plane_get(PointerRNA *ptr)
static int rna_SculptToolCapabilities_has_secondary_color_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return ELEM(br->sculpt_tool,
SCULPT_TOOL_BLOB, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS,
SCULPT_TOOL_CREASE, SCULPT_TOOL_DRAW, SCULPT_TOOL_FILL,
SCULPT_TOOL_FLATTEN, SCULPT_TOOL_INFLATE, SCULPT_TOOL_PINCH,
SCULPT_TOOL_SCRAPE);
return BKE_brush_sculpt_has_secondary_color(br);
}
static int rna_SculptToolCapabilities_has_smooth_stroke_get(PointerRNA *ptr)