Fix T75985: Texture paint brush gradients results in wrong color

A Colorband's CBData color **is not** considered `PROP_COLOR_GAMMA`.
A Brushes color **is** considered `PROP_COLOR_GAMMA`.
(PROP_COLOR_GAMMA is used for colors which would be color managed before
display, could be renamed to something better once...)

This leads to different rgb values in ColorBand.CBData of br->gradient
and brush->rgb for seemingly identical colors. (this is because color
pickers do differently in case block->is_color_gamma_picker/
ui_but_is_color_gamma)

Now it looks like `paint_brush_color_get` is expected to return a color
in sRGB (according to @jbakker this is for legacy reasons) so we need to
run the colorband colors through linear -> sRGB.

It might very well be the case that a much deeper cleanup in this area
is needed, this is just a fix to get gradient brush colors
consistent again...

Maniphest Tasks: T75985

Differential Revision: https://developer.blender.org/D7501
This commit is contained in:
Philipp Oeser 2020-04-22 18:53:47 +02:00
parent cd833d8879
commit 2b094be949
Notes: blender-bot 2023-02-14 06:45:14 +01:00
Referenced by issue #75985, Texture paint brush gradients results in wrong color.
1 changed files with 4 additions and 0 deletions

View File

@ -388,6 +388,10 @@ void paint_brush_color_get(struct Scene *scene,
break;
}
}
/* Gradient / Colorband colors are not considered PROP_COLOR_GAMMA.
* Brush colors are expected to be in sRGB though. */
IMB_colormanagement_scene_linear_to_srgb_v3(color_gr);
copy_v3_v3(color, color_gr);
}
else {