[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37051] trunk/blender/source/blender/nodes /intern/CMP_nodes/CMP_colorMatte.c: fix [#27514] Fix Bug 27510 Color key hue flipping error (composite node)

Campbell Barton ideasman42 at gmail.com
Tue May 31 16:06:29 CEST 2011


Revision: 37051
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37051
Author:   campbellbarton
Date:     2011-05-31 14:06:29 +0000 (Tue, 31 May 2011)
Log Message:
-----------
fix [#27514] Fix Bug 27510 Color key hue flipping error (composite node)

Modified Paths:
--------------
    trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c

Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c	2011-05-31 12:49:14 UTC (rev 37050)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c	2011-05-31 14:06:29 UTC (rev 37051)
@@ -49,16 +49,24 @@
 
 static void do_color_key(bNode *node, float *out, float *in)
 {
+	float h_wrap;
 	NodeChroma *c;
 	c=node->storage;
 
 
 	VECCOPY(out, in);
 
-	if(fabs(in[0]-c->key[0]) < c->t1 &&
-	   fabs(in[1]-c->key[1]) < c->t2 &&
-	   fabs(in[2]-c->key[2]) < c->t3)
-	{
+	if(
+	/* do hue last because it needs to wrap, and does some more checks  */
+
+	/* sat */	(fabs(in[1]-c->key[1]) < c->t2) &&
+	/* val */	(fabs(in[2]-c->key[2]) < c->t3) &&
+
+	/* multiply by 2 because it wraps on both sides of the hue,
+	 * otherwise 0.5 would key all hue's */
+
+	/* hue */	((h_wrap= 2.0f * fabs(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1)
+	) {
 		out[3]=0.0; /*make transparent*/
 	}
 




More information about the Bf-blender-cvs mailing list