Compositor/assorted nodes fixes:

* Auto-create compbufs for first socket of alphaover and set alpha nodes.
This allows you to eg. plug something into the second socket of an
alphaover node, and choose a solid colour in the first empty socket for
the image to be superimposed over.

Previously I had to create a bunch of extra nodes to (for example) mix
100% black over my render, just to get a black compbuf of the right size
that I could plug in. Not nice.

The Mix node already works this way, and these two should have, but
didn't.

* Allow the 'Fac' value to be used on RGB curves when there is no input
image. This lets you easily fade the changes in and out to check it
against the original, or to tone down the effect of the colour correction.
This commit is contained in:
2007-03-07 11:09:03 +00:00
parent d79f21eba7
commit 37308c01ca
2 changed files with 10 additions and 9 deletions

View File

@@ -753,7 +753,7 @@ bNode *nodeAddNodeType(bNodeTree *ntree, int type, bNodeTree *ngroup)
node->type= ntype->type;
node->flag= NODE_SELECT|ntype->flag;
node->width= ntype->width;
node->miniwidth= 15.0f; /* small value only, allows print of first chars */
node->miniwidth= 42.0f; /* small value only, allows print of first chars */
if(type==NODE_GROUP)
node->id= (ID *)ngroup;

View File

@@ -1521,10 +1521,11 @@ static void node_composit_exec_curve_rgb(void *data, bNode *node, bNodeStack **i
CompBuf *cbuf= in[1]->data;
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
if(in[0]->data)
composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL);
else
if(in[0]->vec[0] == 1.0)
composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA);
else
composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL);
out[0]->data= stackbuf;
}
@@ -1719,7 +1720,7 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in,
static bNodeType cmp_node_mix_rgb= {
/* type code */ CMP_NODE_MIX_RGB,
/* name */ "Mix",
/* width+range */ 80, 60, 120,
/* width+range */ 110, 60, 120,
/* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
/* input sock */ cmp_node_mix_rgb_in,
/* output sock */ cmp_node_mix_rgb_out,
@@ -2252,7 +2253,7 @@ static void node_composit_exec_setalpha(void *data, bNode *node, bNodeStack **in
/* stack order in: col, alpha */
/* input no image? then only color operation */
if(in[0]->data==NULL) {
if(in[0]->data==NULL && in[1]->data==NULL) {
out[0]->vec[0] = in[0]->vec[0];
out[0]->vec[1] = in[0]->vec[1];
out[0]->vec[2] = in[0]->vec[2];
@@ -2260,7 +2261,7 @@ static void node_composit_exec_setalpha(void *data, bNode *node, bNodeStack **in
}
else {
/* make output size of input image */
CompBuf *cbuf= in[0]->data;
CompBuf *cbuf= in[0]->data?in[0]->data:in[1]->data;
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
if(in[1]->data==NULL && in[1]->vec[0]==1.0f) {
@@ -2349,12 +2350,12 @@ static void node_composit_exec_alphaover(void *data, bNode *node, bNodeStack **i
return;
/* input no image? then only color operation */
if(in[1]->data==NULL) {
if(in[1]->data==NULL && in[2]->data==NULL) {
do_alphaover_premul(node, out[0]->vec, in[1]->vec, in[2]->vec, in[0]->vec);
}
else {
/* make output size of input image */
CompBuf *cbuf= in[1]->data;
CompBuf *cbuf= in[1]->data?in[1]->data:in[2]->data;
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
if(node->custom1)