Fixed chroma key to use tanf instead of tan (float vs double). Fixed input/output checking to prevent running the node if nothing is connected. Drawnode.c in error. will fix in a second.

This commit is contained in:
Robert Holcomb
2007-02-07 18:24:51 +00:00
parent 6c6a9f42b2
commit 9e83e0edd2
2 changed files with 28 additions and 4 deletions

View File

@@ -4708,7 +4708,7 @@ static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in)
out[3]=in[3];
}
static void do_normalized_ycca_to_rgba(bNode *node, float *out, float *in)
static void do_ycca_to_rgba_normalized(bNode *node, float *out, float *in)
{
/*un-normalize the normalize from above */
in[0]=(in[0]*255.0)+16;
@@ -4740,7 +4740,7 @@ static void do_chroma_key(bNode *node, float *out, float *in)
angle=c->t1*M_PI/180.0; /* convert to radians */
/* if kfg is <0 then the pixel is outside of the key color */
kfg=x-(fabsf(z)/tan(angle/2.0));
kfg=x-(fabsf(z)/tanf(angle/2.0));
if(kfg>0.0) { /* found a pixel that is within key color */
@@ -4785,8 +4785,9 @@ static void node_composit_exec_chroma(void *data, bNode *node, bNodeStack **in,
CompBuf *chromabuf;
NodeChroma *c;
if(out[0]->hasoutput==0 || in[0]->hasinput==0) return;
if(in[0]->hasinput==0) return;
if(in[0]->data==NULL) return;
if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
@@ -4803,7 +4804,7 @@ static void node_composit_exec_chroma(void *data, bNode *node, bNodeStack **in,
composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_chroma_key, CB_RGBA);
/*convert back*/
composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_normalized_ycca_to_rgba, CB_RGBA);
composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_ycca_to_rgba_normalized, CB_RGBA);
out[0]->data= chromabuf;
if(out[1]->hasoutput)

View File

@@ -1391,6 +1391,26 @@ static int node_composit_buts_luma_matte(uiBlock *block, bNodeTree *ntree, bNode
return 40;
}
static int node_composit_buts_view_levels(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
if(block) {
short sx= (butr->xmax-butr->xmin)/5;
/*channel space selectors*/
uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"C",
butr->xmin,butr->ymin,sx,20,&node->custom1,1,1, 0, 0, "All Channels");
uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"R",
butr->xmin+sx,butr->ymin,sx,20,&node->custom1,1,2, 0, 0, "Red Channel");
uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"G",
butr->xmin+2*sx,butr->ymin,sx,20,&node->custom1,1,3, 0, 0, "Green Channel");
uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"B",
butr->xmin+3*sx,butr->ymin,sx,20,&node->custom1,1,4, 0, 0, "Blue Channel");
uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"Y",
butr->xmin+4*sx,butr->ymin,sx,20,&node->custom1,1,5, 0, 0, "Luminence Channel");
}
return 20;
}
static int node_composit_buts_map_uv(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
@@ -1608,6 +1628,9 @@ static void node_composit_set_butfunc(bNodeType *ntype)
case CMP_NODE_MATH:
ntype->butfunc= node_buts_math;
break;
case CMP_NODE_VIEW_LEVELS:
ntype->butfunc=node_composit_buts_view_levels;
break;
default:
ntype->butfunc= NULL;
}