diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_paint_color.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_paint_color.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c index cb178b23008..c494c71f1eb 100644 --- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c @@ -17,6 +17,7 @@ #include "DNA_meshdata_types.h" #include "BKE_brush.h" +#include "BKE_colorband.h" #include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_mesh.h" @@ -117,11 +118,31 @@ static void do_paint_brush_task_cb_ex(void *__restrict userdata, const int thread_id = BLI_task_parallel_thread_id(tls); float brush_color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + copy_v3_v3(brush_color, ss->cache->invert ? BKE_brush_secondary_color_get(ss->scene, brush) : BKE_brush_color_get(ss->scene, brush)); + IMB_colormanagement_srgb_to_scene_linear_v3(brush_color, brush_color); + if (brush->flag & BRUSH_USE_GRADIENT) { + switch (brush->gradient_stroke_mode) { + case BRUSH_GRADIENT_PRESSURE: + BKE_colorband_evaluate(brush->gradient, ss->cache->pressure, brush_color); + break; + case BRUSH_GRADIENT_SPACING_REPEAT: { + float coord = fmod(ss->cache->stroke_distance / brush->gradient_spacing, 1.0); + BKE_colorband_evaluate(brush->gradient, coord, brush_color); + break; + } + case BRUSH_GRADIENT_SPACING_CLAMP: { + BKE_colorband_evaluate( + brush->gradient, ss->cache->stroke_distance / brush->gradient_spacing, brush_color); + break; + } + } + } + BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { SCULPT_orig_vert_data_update(&orig_data, &vd); |