[Bf-blender-cvs] [afc72974ce0] greasepencil-object: GPencil: Remove color conversion when convert curve

Antonio Vazquez noreply at git.blender.org
Mon Aug 10 13:51:11 CEST 2020


Commit: afc72974ce0ca4ba06dc5fe061aa2131ae64c98f
Author: Antonio Vazquez
Date:   Mon Aug 10 13:51:02 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rBafc72974ce0ca4ba06dc5fe061aa2131ae64c98f

GPencil: Remove color conversion when convert curve

In previous versions, grease pencil used sRGB and a color conversion was needed, but now all is Linear and the conversion changes the color wrongly.

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

M	source/blender/blenkernel/intern/gpencil_curve.c

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

diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index e64369d74cb..d02eeae0edb 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -54,7 +54,8 @@ static int gpencil_check_same_material_color(Object *ob_gp, const float color[4]
 {
   Material *ma = NULL;
   float color_cu[4];
-  linearrgb_to_srgb_v3_v3(color_cu, color);
+  copy_v4_v4(color_cu, color);
+
   float hsv1[4];
   rgb_to_hsv_v(color_cu, hsv1);
   hsv1[3] = color[3];
@@ -95,12 +96,12 @@ static Material *gpencil_add_from_curve_material(Main *bmain,
     gp_style->flag |= GP_MATERIAL_STROKE_SHOW;
   }
   else {
-    linearrgb_to_srgb_v4(gp_style->stroke_rgba, cu_color);
+    copy_v4_v4(mat_gp->gp_style->stroke_rgba, cu_color);
     gp_style->flag &= ~GP_MATERIAL_STROKE_SHOW;
   }
 
   /* Fill color. */
-  linearrgb_to_srgb_v4(gp_style->fill_rgba, cu_color);
+  copy_v4_v4(mat_gp->gp_style->fill_rgba, cu_color);
   /* Fill is false if the original curve hasn't material assigned, so enable it. */
   if (fill) {
     gp_style->flag |= GP_MATERIAL_FILL_SHOW;
@@ -249,8 +250,7 @@ static void gpencil_convert_spline(Main *bmain,
     if ((!only_stroke) && (ob_cu->totcol > 1) && (BKE_object_material_get(ob_cu, 2))) {
       mat_curve = BKE_object_material_get(ob_cu, 2);
       if (mat_curve) {
-        linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &mat_curve->r);
-        mat_gp->gp_style->stroke_rgba[3] = mat_curve->a;
+        copy_v4_v4(mat_gp->gp_style->stroke_rgba, &mat_curve->r);
       }
     }
     else if ((only_stroke) || (do_stroke)) {



More information about the Bf-blender-cvs mailing list