forked from bartvdbraak/blender
Fix T73656: Use BKE_brush_alpha_get in texture paint
The code was using brush->alpha directly, so the alpha value from UnifiedPaintSettings was not used when eneabled. Reviewed By: brecht Maniphest Tasks: T73656 Differential Revision: https://developer.blender.org/D6804
This commit is contained in:
parent
2fb9285371
commit
35490c3ead
@ -1893,7 +1893,7 @@ void paint_2d_bucket_fill(const bContext *C,
|
||||
int x_px, y_px;
|
||||
unsigned int color_b;
|
||||
float color_f[4];
|
||||
float strength = br ? br->alpha : 1.0f;
|
||||
float strength = br ? BKE_brush_alpha_get(s->scene, br) : 1.0f;
|
||||
|
||||
bool do_float;
|
||||
|
||||
@ -2118,6 +2118,7 @@ void paint_2d_gradient_fill(
|
||||
float image_init[2], image_final[2];
|
||||
float tangent[2];
|
||||
float line_len_sq_inv, line_len;
|
||||
const float brush_alpha = BKE_brush_alpha_get(s->scene, br);
|
||||
|
||||
bool do_float;
|
||||
|
||||
@ -2179,7 +2180,7 @@ void paint_2d_gradient_fill(
|
||||
BKE_colorband_evaluate(br->gradient, f, color_f);
|
||||
/* convert to premultiplied */
|
||||
mul_v3_fl(color_f, color_f[3]);
|
||||
color_f[3] *= br->alpha;
|
||||
color_f[3] *= brush_alpha;
|
||||
IMB_blend_color_float(ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
|
||||
ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
|
||||
color_f,
|
||||
@ -2208,7 +2209,7 @@ void paint_2d_gradient_fill(
|
||||
BKE_colorband_evaluate(br->gradient, f, color_f);
|
||||
linearrgb_to_srgb_v3_v3(color_f, color_f);
|
||||
rgba_float_to_uchar((unsigned char *)&color_b, color_f);
|
||||
((unsigned char *)&color_b)[3] *= br->alpha;
|
||||
((unsigned char *)&color_b)[3] *= brush_alpha;
|
||||
IMB_blend_color_byte((unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
|
||||
(unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
|
||||
(unsigned char *)&color_b,
|
||||
|
@ -5293,7 +5293,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool),
|
||||
}
|
||||
}
|
||||
BKE_colorband_evaluate(brush->gradient, f, color_f);
|
||||
color_f[3] *= ((float)projPixel->mask) * (1.0f / 65535.0f) * brush->alpha;
|
||||
color_f[3] *= ((float)projPixel->mask) * (1.0f / 65535.0f) * brush_alpha;
|
||||
|
||||
if (is_floatbuf) {
|
||||
/* convert to premultipied */
|
||||
@ -5321,7 +5321,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool),
|
||||
else {
|
||||
if (is_floatbuf) {
|
||||
float newColor_f[4];
|
||||
newColor_f[3] = ((float)projPixel->mask) * (1.0f / 65535.0f) * brush->alpha;
|
||||
newColor_f[3] = ((float)projPixel->mask) * (1.0f / 65535.0f) * brush_alpha;
|
||||
copy_v3_v3(newColor_f, ps->paint_color_linear);
|
||||
|
||||
IMB_blend_color_float(
|
||||
@ -5329,7 +5329,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool),
|
||||
}
|
||||
else {
|
||||
float mask = ((float)projPixel->mask) * (1.0f / 65535.0f);
|
||||
projPixel->newColor.ch[3] = mask * 255 * brush->alpha;
|
||||
projPixel->newColor.ch[3] = mask * 255 * brush_alpha;
|
||||
|
||||
rgb_float_to_uchar(projPixel->newColor.ch, ps->paint_color);
|
||||
IMB_blend_color_byte(projPixel->pixel.ch_pt,
|
||||
|
Loading…
Reference in New Issue
Block a user