[Bf-blender-cvs] [3fc97727df6] blender-v2.91-release: CustomData color copying: use interpolated alpha

Philipp Oeser noreply at git.blender.org
Thu Oct 29 09:44:47 CET 2020


Commit: 3fc97727df6d09636072ca884ab90cb3d9bca6f6
Author: Philipp Oeser
Date:   Tue Oct 27 13:55:10 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rB3fc97727df6d09636072ca884ab90cb3d9bca6f6

CustomData color copying: use interpolated alpha

The alpha of the first layer was always used
here since introduction in rBee4453f08369 and was not updated when
customdata support for alpha was added.

Now also use the interpolated alpha.

thx @brecht noticing!

ref T81914

Reviewers: brecht, mont29

Maniphest Tasks: T81914

Differential Revision: https://developer.blender.org/D9358

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

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

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

diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 466a0115a9d..d762b1b0604 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -751,6 +751,7 @@ static void layerCopyValue_mloopcol(const void *source,
     m2->r = m1->r;
     m2->g = m1->g;
     m2->b = m1->b;
+    m2->a = m1->a;
   }
   else { /* Modes that support 'real' mix factor. */
     unsigned char src[4] = {m1->r, m1->g, m1->b, m1->a};
@@ -771,13 +772,14 @@ static void layerCopyValue_mloopcol(const void *source,
     else {
       memcpy(tmp_col, src, sizeof(tmp_col));
     }
+
     blend_color_interpolate_byte(dst, dst, tmp_col, mixfactor);
 
     m2->r = (char)dst[0];
     m2->g = (char)dst[1];
     m2->b = (char)dst[2];
+    m2->a = (char)dst[3];
   }
-  m2->a = m1->a;
 }
 
 static bool layerEqual_mloopcol(const void *data1, const void *data2)
@@ -1281,7 +1283,7 @@ static void layerCopyValue_propcol(const void *source,
         return; /* Do Nothing! */
       }
     }
-    copy_v3_v3(m2->color, m1->color);
+    copy_v4_v4(m2->color, m1->color);
   }
   else { /* Modes that support 'real' mix factor. */
     if (mixmode == CDT_MIX_MIX) {
@@ -1301,9 +1303,8 @@ static void layerCopyValue_propcol(const void *source,
     }
     blend_color_interpolate_float(m2->color, m2->color, tmp_col, mixfactor);
 
-    copy_v3_v3(m2->color, m1->color);
+    copy_v4_v4(m2->color, m1->color);
   }
-  m2->color[3] = m1->color[3];
 }
 
 static bool layerEqual_propcol(const void *data1, const void *data2)



More information about the Bf-blender-cvs mailing list