[Bf-blender-cvs] [2b094be9493] blender-v2.83-release: Fix T75985: Texture paint brush gradients results in wrong color

Philipp Oeser noreply at git.blender.org
Thu Apr 30 09:55:06 CEST 2020


Commit: 2b094be9493dd1022a5f07ed1a1cde69670474d8
Author: Philipp Oeser
Date:   Wed Apr 22 18:53:47 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB2b094be9493dd1022a5f07ed1a1cde69670474d8

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

===================================================================

M	source/blender/editors/sculpt_paint/paint_image.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index d913bc2e242..e227db1c644 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -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 {



More information about the Bf-blender-cvs mailing list