fix [#27514] Fix Bug 27510 Color key hue flipping error (composite node)

This commit is contained in:
Campbell Barton
2011-05-31 14:06:29 +00:00
parent a8a36f31bd
commit 8d2e4cf42f

View File

@@ -49,16 +49,24 @@ static bNodeSocketType cmp_node_color_out[]={
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*/
}