Fix sculpt secondary color missing some brushes
authorCampbell Barton <ideasman42@gmail.com>
Thu, 5 Oct 2017 01:57:24 +0000 (12:57 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 5 Oct 2017 01:59:22 +0000 (12:59 +1100)
D2841 by @uvwxyz w/ edits

source/blender/blenkernel/BKE_brush.h
source/blender/blenkernel/intern/brush.c
source/blender/editors/sculpt_paint/paint_cursor.c
source/blender/makesrna/intern/rna_brush.c

index bf30173d5174568f75a283fdf85a384ad73f7f01..7c2873046d5ce9671e8be2f3ce03310c76a298de 100644 (file)
@@ -107,6 +107,8 @@ bool BKE_brush_use_locked_size(const struct Scene *scene, const struct Brush *br
 bool BKE_brush_use_alpha_pressure(const struct Scene *scene, const struct Brush *brush);
 bool 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,
index 0f0a6d54025eba32f73cb580892ee8ee60bc7100..aeaead578a15ffea4ac04bf42b33d261911a56c0 100644 (file)
@@ -848,6 +848,16 @@ bool 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;
index 53c11e2a6a962ba26dc877a4c7f7cf50c0f499a8..6145c549e9b9f63819ffd8e7221f6ada391d7647 100644 (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;
                }
index fe8e1bb7e6e81bb36c2f10f71569822b2881e659..0923fc92567196fa0b59ee8ff96204e128ea372e 100644 (file)
@@ -238,11 +238,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)