Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c39
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c35
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_blur.c238
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_brightness.c46
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c36
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c36
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c33
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_composite.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_crop.c36
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_curves.c99
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_defocus.c40
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_dilate.c31
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_displace.c47
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_filter.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_flip.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_gamma.c35
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_glare.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c35
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_idMask.c30
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_image.c129
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_invert.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_levels.c48
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c35
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_math.c49
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_normal.c33
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_normalize.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c39
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_rgb.c33
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_rotate.c37
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_scale.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c67
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c66
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c205
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c66
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c33
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c36
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_texture.c46
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_translate.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c66
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_value.c32
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c34
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_viewer.c35
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c115
-rw-r--r--source/blender/nodes/intern/CMP_nodes/Makefile47
56 files changed, 1361 insertions, 1364 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
index 37061dd7eae..f18bfb79405 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_alphaover_out[]= {
{ -1, 0, "" }
};
-static void do_alphaover_premul(bNode *node, float *out, float *src, float *over, float *fac)
+static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
{
if(over[3]<=0.0f) {
@@ -61,7 +61,7 @@ static void do_alphaover_premul(bNode *node, float *out, float *src, float *over
}
/* result will be still premul, but the over part is premulled */
-static void do_alphaover_key(bNode *node, float *out, float *src, float *over, float *fac)
+static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
{
if(over[3]<=0.0f) {
@@ -107,7 +107,7 @@ static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over,
-static void node_composit_exec_alphaover(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: col col */
/* stack order out: col */
@@ -140,22 +140,19 @@ static void node_alphaover_init(bNode* node)
node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
}
-bNodeType cmp_node_alphaover= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_ALPHAOVER,
- /* name */ "AlphaOver",
- /* width+range */ 80, 40, 120,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_alphaover_in,
- /* output sock */ cmp_node_alphaover_out,
- /* storage */ "NodeTwoFloats",
- /* execfunc */ node_composit_exec_alphaover,
- /* butfunc */ NULL,
- /* initfunc */ node_alphaover_init,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-
-};
+void register_node_type_cmp_alphaover(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_ALPHAOVER, "AlphaOver", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_alphaover_in, cmp_node_alphaover_out);
+ node_type_size(&ntype, 80, 40, 120);
+ node_type_init(&ntype, node_alphaover_init);
+ node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_alphaover);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
index 97577fa6b5e..bb677521435 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
@@ -1,4 +1,4 @@
-/**
+/*
*
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -81,7 +81,7 @@ static bNodeSocketType cmp_node_bilateralblur_out[]= {
/* code of this node was heavily inspired by the smooth function of opencv library.
The main change is an optional image input */
-static void node_composit_exec_bilateralblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
NodeBilateralBlurData *nbbd= node->storage;
CompBuf *new, *source, *img= in[0]->data , *refimg= in[1]->data;
@@ -250,20 +250,17 @@ static void node_composit_init_bilateralblur(bNode* node)
nbbd->sigma_space= 5.0;
}
-bNodeType cmp_node_bilateralblur= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_BILATERALBLUR,
- /* name */ "Bilateral Blur",
- /* width+range */ 150, 120, 200,
- /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- /* input sock */ cmp_node_bilateralblur_in,
- /* output sock */ cmp_node_bilateralblur_out,
- /* storage */ "NodeBilateralBlurData",
- /* execfunc */ node_composit_exec_bilateralblur,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_bilateralblur,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-
-};
+void register_node_type_cmp_bilateralblur(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
+ cmp_node_bilateralblur_in, cmp_node_bilateralblur_out);
+ node_type_size(&ntype, 150, 120, 200);
+ node_type_init(&ntype, node_composit_init_bilateralblur);
+ node_type_storage(&ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_bilateralblur);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
index eb8b079f341..e01d5ee29bd 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -93,109 +93,119 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
int x, y, pix= img->type;
int i, bigstep;
float *src, *dest;
-
+
/* helper image */
work= alloc_compbuf(imgx, imgy, img->type, 1); /* allocs */
-
- /* horizontal */
- rad = scale*(float)nbd->sizex;
- if(rad>imgx/2)
- rad= imgx/2;
- else if(rad<1)
- rad= 1;
- gausstab= make_gausstab(nbd->filtertype, rad);
- gausstabcent= gausstab+rad;
-
- for (y = 0; y < imgy; y++) {
- float *srcd= img->rect + pix*(y*img->x);
+ /* horizontal */
+ if(nbd->sizex == 0) {
+ memcpy(work->rect, img->rect, sizeof(float) * img->type * imgx * imgy);
+ }
+ else {
+ rad = scale*(float)nbd->sizex;
+ if(rad>imgx/2)
+ rad= imgx/2;
+ else if(rad<1)
+ rad= 1;
- dest = work->rect + pix*(y * img->x);
+ gausstab= make_gausstab(nbd->filtertype, rad);
+ gausstabcent= gausstab+rad;
- for (x = 0; x < imgx ; x++) {
- int minr= x-rad<0?-x:-rad;
- int maxr= x+rad>imgx?imgx-x:rad;
+ for (y = 0; y < imgy; y++) {
+ float *srcd= img->rect + pix*(y*img->x);
- src= srcd + pix*(x+minr);
+ dest = work->rect + pix*(y * img->x);
- sum= gval = rval= bval= aval= 0.0f;
- for (i= minr; i < maxr; i++) {
- val= gausstabcent[i];
- sum+= val;
- rval += val * (*src++);
+ for (x = 0; x < imgx ; x++) {
+ int minr= x-rad<0?-x:-rad;
+ int maxr= x+rad>imgx?imgx-x:rad;
+
+ src= srcd + pix*(x+minr);
+
+ sum= gval = rval= bval= aval= 0.0f;
+ for (i= minr; i < maxr; i++) {
+ val= gausstabcent[i];
+ sum+= val;
+ rval += val * (*src++);
+ if(pix==4) {
+ gval += val * (*src++);
+ bval += val * (*src++);
+ aval += val * (*src++);
+ }
+ }
+ sum= 1.0f/sum;
+ *dest++ = rval*sum;
if(pix==4) {
- gval += val * (*src++);
- bval += val * (*src++);
- aval += val * (*src++);
+ *dest++ = gval*sum;
+ *dest++ = bval*sum;
+ *dest++ = aval*sum;
}
}
- sum= 1.0f/sum;
- *dest++ = rval*sum;
- if(pix==4) {
- *dest++ = gval*sum;
- *dest++ = bval*sum;
- *dest++ = aval*sum;
- }
+ if(node->exec & NODE_BREAK)
+ break;
}
- if(node->exec & NODE_BREAK)
- break;
+
+ /* vertical */
+ MEM_freeN(gausstab);
}
- /* vertical */
- MEM_freeN(gausstab);
-
- rad = scale*(float)nbd->sizey;
- if(rad>imgy/2)
- rad= imgy/2;
- else if(rad<1)
- rad= 1;
-
- gausstab= make_gausstab(nbd->filtertype, rad);
- gausstabcent= gausstab+rad;
-
- bigstep = pix*imgx;
- for (x = 0; x < imgx; x++) {
- float *srcd= work->rect + pix*x;
-
- dest = new->rect + pix*x;
+ if(nbd->sizey == 0) {
+ memcpy(new->rect, work->rect, sizeof(float) * img->type * imgx * imgy);
+ }
+ else {
+ rad = scale*(float)nbd->sizey;
+ if(rad>imgy/2)
+ rad= imgy/2;
+ else if(rad<1)
+ rad= 1;
+
+ gausstab= make_gausstab(nbd->filtertype, rad);
+ gausstabcent= gausstab+rad;
- for (y = 0; y < imgy ; y++) {
- int minr= y-rad<0?-y:-rad;
- int maxr= y+rad>imgy?imgy-y:rad;
+ bigstep = pix*imgx;
+ for (x = 0; x < imgx; x++) {
+ float *srcd= work->rect + pix*x;
- src= srcd + bigstep*(y+minr);
+ dest = new->rect + pix*x;
- sum= gval = rval= bval= aval= 0.0f;
- for (i= minr; i < maxr; i++) {
- val= gausstabcent[i];
- sum+= val;
- rval += val * src[0];
+ for (y = 0; y < imgy ; y++) {
+ int minr= y-rad<0?-y:-rad;
+ int maxr= y+rad>imgy?imgy-y:rad;
+
+ src= srcd + bigstep*(y+minr);
+
+ sum= gval = rval= bval= aval= 0.0f;
+ for (i= minr; i < maxr; i++) {
+ val= gausstabcent[i];
+ sum+= val;
+ rval += val * src[0];
+ if(pix==4) {
+ gval += val * src[1];
+ bval += val * src[2];
+ aval += val * src[3];
+ }
+ src += bigstep;
+ }
+ sum= 1.0f/sum;
+ dest[0] = rval*sum;
if(pix==4) {
- gval += val * src[1];
- bval += val * src[2];
- aval += val * src[3];
+ dest[1] = gval*sum;
+ dest[2] = bval*sum;
+ dest[3] = aval*sum;
}
- src += bigstep;
+ dest+= bigstep;
}
- sum= 1.0f/sum;
- dest[0] = rval*sum;
- if(pix==4) {
- dest[1] = gval*sum;
- dest[2] = bval*sum;
- dest[3] = aval*sum;
- }
- dest+= bigstep;
+ if(node->exec & NODE_BREAK)
+ break;
}
- if(node->exec & NODE_BREAK)
- break;
+ MEM_freeN(gausstab);
}
-
+
free_compbuf(work);
- MEM_freeN(gausstab);
}
/* reference has to be mapped 0-1, and equal in size */
-static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, float fac, NodeBlurData *nbd)
+static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref), float UNUSED(fac), NodeBlurData *nbd)
{
CompBuf *wbuf;
register float val;
@@ -568,15 +578,28 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
if(out[0]->hasoutput==0) return;
if(nbd->relative) {
- nbd->sizex= (int)(nbd->percentx*nbd->image_in_width);
- nbd->sizey= (int)(nbd->percenty*nbd->image_in_height);
+ if (nbd->aspect==CMP_NODE_BLUR_ASPECT_NONE) {
+ nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width);
+ nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height);
+ }
+ else if (nbd->aspect==CMP_NODE_BLUR_ASPECT_Y) {
+ nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width);
+ nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_width);
+ }
+ else if (nbd->aspect==CMP_NODE_BLUR_ASPECT_X) {
+ nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_height);
+ nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height);
+ }
}
- if (((NodeBlurData *)node->storage)->filtertype == R_FILTER_FAST_GAUSS) {
+ if (nbd->sizex==0 && nbd->sizey==0) {
+ new= pass_on_compbuf(img);
+ out[0]->data= new;
+ }
+ else if (nbd->filtertype == R_FILTER_FAST_GAUSS) {
CompBuf *new, *img = in[0]->data;
- /*from eeshlo's original patch, removed to fit in with the existing blur node */
- /*const float sx = in[1]->vec[0], sy = in[2]->vec[0];*/
- const float sx = ((float)nbd->sizex)/2.0f, sy = ((float)nbd->sizey)/2.0f;
+ // TODO: can this be mapped with reference, too?
+ const float sx = ((float)nbd->sizex*in[1]->vec[0])/2.0f, sy = ((float)nbd->sizey*in[1]->vec[0])/2.0f;
int c;
if ((img==NULL) || (out[0]->hasoutput==0)) return;
@@ -612,6 +635,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
/* if fac input, we do it different */
if(in[1]->data) {
+ CompBuf *gammabuf;
/* make output size of input image */
new= alloc_compbuf(img->x, img->y, img->type, 1); /* allocs */
@@ -620,7 +644,18 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
new->xof = img->xof;
new->yof = img->yof;
- blur_with_reference(node, new, img, in[1]->data);
+ if(nbd->gamma) {
+ gammabuf= dupalloc_compbuf(img);
+ gamma_correct_compbuf(gammabuf, 0);
+ }
+ else gammabuf= img;
+
+ blur_with_reference(node, new, gammabuf, in[1]->data);
+
+ if(nbd->gamma) {
+ gamma_correct_compbuf(new, 1);
+ free_compbuf(gammabuf);
+ }
if(node->exec & NODE_BREAK) {
free_compbuf(new);
new= NULL;
@@ -633,7 +668,6 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
new= pass_on_compbuf(img);
}
else {
- NodeBlurData *nbd= node->storage;
CompBuf *gammabuf;
/* make output size of input image */
@@ -679,21 +713,19 @@ static void node_composit_init_blur(bNode* node)
node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data");
}
-bNodeType cmp_node_blur= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_BLUR,
- /* name */ "Blur",
- /* width+range */ 120, 80, 200,
- /* class+opts */ NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_blur_in,
- /* output sock */ cmp_node_blur_out,
- /* storage */ "NodeBlurData",
- /* execfunc */ node_composit_exec_blur,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_blur,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_blur(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_blur_in, cmp_node_blur_out);
+ node_type_size(&ntype, 120, 80, 200);
+ node_type_init(&ntype, node_composit_init_blur);
+ node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_blur);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c
index 03eed59a4c4..8d7524d71f5 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -44,15 +44,14 @@ static bNodeSocketType cmp_node_brightcontrast_out[]= {
{ -1, 0, "" }
};
-static void do_brightnesscontrast(bNode *node, float *out, float *in)
+static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, float *in_brightness, float *in_contrast)
{
float i;
int c;
- float a, b, contrast, brightness, delta, v;
- contrast = node->custom2;
- brightness = (float)(node->custom1);
- brightness = (brightness) / 100.0f;
- delta = contrast / 200.0f;
+ float a, b, v;
+ float brightness = (*in_brightness) / 100.0f;
+ float contrast = *in_contrast;
+ float delta = contrast / 200.0f;
a = 1.0f - delta * 2.0f;
/*
* The algorithm is by Werner D. Streidt
@@ -77,37 +76,30 @@ static void do_brightnesscontrast(bNode *node, float *out, float *in)
}
}
-static void node_composit_exec_brightcontrast(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
if(in[0]->data) {
CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
- node->custom1 = in[1]->vec[0];
- node->custom2 = in[2]->vec[0];
stackbuf= dupalloc_compbuf(cbuf);
- composit1_pixel_processor(node, stackbuf, cbuf, in[0]->vec, do_brightnesscontrast, CB_RGBA);
+ composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, do_brightnesscontrast, CB_RGBA, CB_VAL, CB_VAL);
out[0]->data = stackbuf;
if(cbuf != in[0]->data)
free_compbuf(cbuf);
}
}
-bNodeType cmp_node_brightcontrast= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_BRIGHTCONTRAST,
- /* name */ "Bright/Contrast",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_brightcontrast_in,
- /* output sock */ cmp_node_brightcontrast_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_brightcontrast,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copysotragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_brightcontrast(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_brightcontrast_in, cmp_node_brightcontrast_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_brightcontrast);
+
+ nodeRegisterType(lb, &ntype);
+}
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
index ca7c19cc778..ee3dfbc6e1b 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_channel_matte_out[]={
{-1,0,""}
};
-static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in)
+static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float *in)
{
/*normalize to the range 0.0 to 1.0) */
rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
@@ -52,7 +52,7 @@ static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in)
out[3]=in[3];
}
-static void do_normalized_ycca_to_rgba2(bNode *node, float *out, float *in)
+static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *in)
{
/*un-normalize the normalize from above */
in[0]=in[0]*255.0;
@@ -197,19 +197,17 @@ static void node_composit_init_channel_matte(bNode *node)
node->custom2= 2; /* Green Channel */
}
-bNodeType cmp_node_channel_matte={
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_CHANNEL_MATTE,
- /* name */ "Channel Key",
- /* width+range */ 200, 80, 250,
- /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_channel_matte_in,
- /* output sock */ cmp_node_channel_matte_out,
- /* storage */ "NodeChroma",
- /* execfunc */ node_composit_exec_channel_matte,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_channel_matte,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_channel_matte(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_channel_matte_in, cmp_node_channel_matte_out);
+ node_type_size(&ntype, 200, 80, 250);
+ node_type_init(&ntype, node_composit_init_channel_matte);
+ node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_channel_matte);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
index e502129c3d3..d028fede25f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_chroma_out[]={
{-1,0,""}
};
-static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in)
+static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *in)
{
rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
@@ -62,7 +62,7 @@ static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in)
out[3]=in[3];
}
-static void do_ycca_to_rgba_normalized(bNode *node, float *out, float *in)
+static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in)
{
/*un-normalize the normalize from above */
in[0]=(in[0]+1.0)/2.0;
@@ -184,21 +184,19 @@ static void node_composit_init_chroma_matte(bNode *node)
c->fstrength= 1.0f;
};
-bNodeType cmp_node_chroma_matte={
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_CHROMA_MATTE,
- /* name */ "Chroma Key",
- /* width+range */ 200, 80, 300,
- /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_chroma_in,
- /* output sock */ cmp_node_chroma_out,
- /* storage */ "NodeChroma",
- /* execfunc */ node_composit_exec_chroma_matte,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_chroma_matte,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_chroma_matte(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_chroma_in, cmp_node_chroma_out);
+ node_type_size(&ntype, 200, 80, 300);
+ node_type_init(&ntype, node_composit_init_chroma_matte);
+ node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_chroma_matte);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
index 8d5f4688657..5022c25819c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -112,21 +112,19 @@ static void node_composit_init_color_matte(bNode *node)
c->fstrength= 1.0f;
};
-bNodeType cmp_node_color_matte={
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_COLOR_MATTE,
- /* name */ "Color Key",
- /* width+range */ 200, 80, 300,
- /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_color_in,
- /* output sock */ cmp_node_color_out,
- /* storage */ "NodeChroma",
- /* execfunc */ node_composit_exec_color_matte,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_color_matte,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_color_matte(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_color_in, cmp_node_color_out);
+ node_type_size(&ntype, 200, 80, 300);
+ node_type_init(&ntype, node_composit_init_color_matte);
+ node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_color_matte);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
index 3191ad757a0..65d3d598c65 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -182,7 +182,7 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma
}
}
-static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/*
Originally based on the information from the book "The Art and Science of Digital Composition" and
@@ -322,19 +322,16 @@ static void node_composit_init_color_spill(bNode *node)
ncs->unspill=0; /* do not use unspill */
}
-bNodeType cmp_node_color_spill={
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_COLOR_SPILL,
- /* name */ "Color Spill",
- /* width+range */ 140, 80, 200,
- /* class+opts */ NODE_CLASS_MATTE, NODE_OPTIONS,
- /* input sock */ cmp_node_color_spill_in,
- /* output sock */ cmp_node_color_spill_out,
- /* storage */ "NodeColorspill",
- /* execfunc */ node_composit_exec_color_spill,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_color_spill,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
-};
-
+void register_node_type_cmp_color_spill(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, NODE_OPTIONS,
+ cmp_node_color_spill_in, cmp_node_color_spill_out);
+ node_type_size(&ntype, 140, 80, 200);
+ node_type_init(&ntype, node_composit_init_color_spill);
+ node_type_storage(&ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_color_spill);
+
+ nodeRegisterType(lb, &ntype);
+}
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
index 33f5680eaa9..0cecb764722 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
@@ -1,4 +1,4 @@
-/**
+/*
*
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -120,7 +120,7 @@ static void do_colorbalance_lgg_fac(bNode *node, float* out, float *in, float *f
out[3] = in[3];
}
-static void node_composit_exec_colorbalance(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *cbuf= in[1]->data;
CompBuf *stackbuf;
@@ -179,20 +179,18 @@ static void node_composit_init_colorbalance(bNode *node)
n->gain[0] = n->gain[1] = n->gain[2] = 1.0f;
}
-bNodeType cmp_node_colorbalance={
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_COLORBALANCE,
- /* name */ "Color Balance",
- /* width+range */ 400, 200, 400,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_colorbalance_in,
- /* output sock */ cmp_node_colorbalance_out,
- /* storage */ "NodeColorBalance",
- /* execfunc */ node_composit_exec_colorbalance,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_colorbalance,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_colorbalance(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_colorbalance_in, cmp_node_colorbalance_out);
+ node_type_size(&ntype, 400, 200, 400);
+ node_type_init(&ntype, node_composit_init_colorbalance);
+ node_type_storage(&ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_colorbalance);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c
index 7510a2d11d4..d54e47a5647 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_composite_in[]= {
};
/* applies to render pipeline */
-static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
/* image assigned to output */
/* stack order input sockets: col, alpha, z */
@@ -94,19 +94,15 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i
generate_preview(data, node, in[0]->data);
}
-bNodeType cmp_node_composite= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_COMPOSITE,
- /* name */ "Composite",
- /* width+range */ 80, 60, 200,
- /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW,
- /* input sock */ cmp_node_composite_in,
- /* output sock */ NULL,
- /* storage */ "",
- /* execfunc */ node_composit_exec_composite,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_composite(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW,
+ cmp_node_composite_in, NULL);
+ node_type_size(&ntype, 80, 60, 200);
+ node_type_exec(&ntype, node_composit_exec_composite);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
index 4585a9ab9a2..a07301a2cb8 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
@@ -1,4 +1,4 @@
-/**
+/*
*
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_crop_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(in[0]->data) {
NodeTwoXYs *ntxy= node->storage;
@@ -48,7 +48,7 @@ static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bN
CompBuf *stackbuf;
int x, y;
float *srcfp, *outfp;
- rcti outputrect;
+ rcti outputrect;
if(node->custom2) {
ntxy->x1= cbuf->x* ntxy->fac_x1;
@@ -108,19 +108,17 @@ static void node_composit_init_crop(bNode* node)
nxy->y2= 0;
}
-bNodeType cmp_node_crop= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_CROP,
- /* name */ "Crop",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
- /* input sock */ cmp_node_crop_in,
- /* output sock */ cmp_node_crop_out,
- /* storage */ "NodeTwoXYs",
- /* execfunc */ node_composit_exec_crop,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_crop,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_crop(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, NODE_OPTIONS,
+ cmp_node_crop_in, cmp_node_crop_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_init(&ntype, node_composit_init_crop);
+ node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_crop);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
index e4afa1922bb..3c6fc72488f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -38,7 +38,7 @@ static bNodeSocketType cmp_node_time_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
RenderData *rd= data;
/* stack order output: fac */
@@ -59,22 +59,20 @@ static void node_composit_init_curves_time(bNode* node)
node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
}
-bNodeType cmp_node_curve_time= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_TIME,
- /* name */ "Time",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS,
- /* input sock */ NULL,
- /* output sock */ cmp_node_time_out,
- /* storage */ "CurveMapping",
- /* execfunc */ node_composit_exec_curves_time,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_curves_time,
- /* freestoragefunc */ node_free_curves,
- /* copystoragefunc */ node_copy_curves,
- /* id */ NULL
-};
+void register_node_type_cmp_curve_time(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS,
+ NULL, cmp_node_time_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_init(&ntype, node_composit_init_curves_time);
+ node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
+ node_type_exec(&ntype, node_composit_exec_curves_time);
+
+ nodeRegisterType(lb, &ntype);
+}
+
@@ -89,7 +87,7 @@ static bNodeSocketType cmp_node_curve_vec_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order input: vec */
/* stack order output: vec */
@@ -102,23 +100,20 @@ static void node_composit_init_curve_vec(bNode* node)
node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
};
-bNodeType cmp_node_curve_vec= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_CURVE_VEC,
- /* name */ "Vector Curves",
- /* width+range */ 200, 140, 320,
- /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_curve_vec_in,
- /* output sock */ cmp_node_curve_vec_out,
- /* storage */ "CurveMapping",
- /* execfunc */ node_composit_exec_curve_vec,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_curve_vec,
- /* freestoragefunc */ node_free_curves,
- /* copystoragefunc */ node_copy_curves,
- /* id */ NULL
-
-};
+void register_node_type_cmp_curve_vec(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
+ cmp_node_curve_vec_in, cmp_node_curve_vec_out);
+ node_type_size(&ntype, 200, 140, 320);
+ node_type_init(&ntype, node_composit_init_curve_vec);
+ node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
+ node_type_exec(&ntype, node_composit_exec_curve_vec);
+
+ nodeRegisterType(lb, &ntype);
+}
+
/* **************** CURVE RGB ******************** */
static bNodeSocketType cmp_node_curve_rgb_in[]= {
@@ -158,7 +153,7 @@ static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
out[3]= in[3];
}
-static void node_composit_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order input: fac, image, black level, white level */
/* stack order output: image */
@@ -192,20 +187,18 @@ static void node_composit_init_curve_rgb(bNode* node)
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
};
-bNodeType cmp_node_curve_rgb= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_CURVE_RGB,
- /* name */ "RGB Curves",
- /* width+range */ 200, 140, 320,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_curve_rgb_in,
- /* output sock */ cmp_node_curve_rgb_out,
- /* storage */ "CurveMapping",
- /* execfunc */ node_composit_exec_curve_rgb,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_curve_rgb,
- /* freestoragefunc */ node_free_curves,
- /* copystoragefunc */ node_copy_curves,
- /* id */ NULL
-};
+void register_node_type_cmp_curve_rgb(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_curve_rgb_in, cmp_node_curve_rgb_out);
+ node_type_size(&ntype, 200, 140, 320);
+ node_type_init(&ntype, node_composit_init_curve_rgb);
+ node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
+ node_type_exec(&ntype, node_composit_exec_curve_rgb);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
index a93a5760842..c0168309533 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -378,7 +378,13 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
//------------------------------------------------------------------
// main loop
+#ifndef __APPLE__ /* can crash on Mac, see bug #22856, disabled for now */
+#ifdef __INTEL_COMPILER /* icc doesn't like the compound statement -- internal error: 0_1506 */
+ #pragma omp parallel for private(y) if(!nqd->preview) schedule(guided)
+#else
#pragma omp parallel for private(y) if(!nqd->preview && img->y*img->x > 16384) schedule(guided)
+#endif
+#endif
for (y=0; y<img->y; y++) {
unsigned int p, p4, zp, cp, cp4;
float *ctcol, u, v, ct_crad, cR2=0;
@@ -791,7 +797,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
}
-static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *new, *old, *zbuf_use = NULL, *img = in[0]->data, *zbuf = in[1]->data;
NodeDefocus *nqd = node->storage;
@@ -863,21 +869,19 @@ static void node_composit_init_defocus(bNode* node)
node->storage = nbd;
}
-bNodeType cmp_node_defocus = {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_DEFOCUS,
- /* name */ "Defocus",
- /* width+range */ 150, 120, 200,
- /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- /* input sock */ cmp_node_defocus_in,
- /* output sock */ cmp_node_defocus_out,
- /* storage */ "NodeDefocus",
- /* execfunc */ node_composit_exec_defocus,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_defocus,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_defocus(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
+ cmp_node_defocus_in, cmp_node_defocus_out);
+ node_type_size(&ntype, 150, 120, 200);
+ node_type_init(&ntype, node_composit_init_defocus);
+ node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_defocus);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
index 0735a369d12..2996551fff5 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -128,21 +128,19 @@ static void node_composit_init_diff_matte(bNode *node)
c->t2= 0.1f;
}
-bNodeType cmp_node_diff_matte={
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_DIFF_MATTE,
- /* name */ "Difference Key",
- /* width+range */ 200, 80, 250,
- /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_diff_matte_in,
- /* output sock */ cmp_node_diff_matte_out,
- /* storage */ "NodeChroma",
- /* execfunc */ node_composit_exec_diff_matte,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_diff_matte,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_diff_matte(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_diff_matte_in, cmp_node_diff_matte_out);
+ node_type_size(&ntype, 200, 80, 250);
+ node_type_init(&ntype, node_composit_init_diff_matte);
+ node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_diff_matte);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c
index 6c67413ea1f..8533acdd5a5 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -110,7 +110,7 @@ static void morpho_erode(CompBuf *cbuf)
}
-static void node_composit_exec_dilateerode(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: mask */
/* stack order out: mask */
@@ -143,21 +143,16 @@ static void node_composit_exec_dilateerode(void *data, bNode *node, bNodeStack *
}
}
-bNodeType cmp_node_dilateerode= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_DILATEERODE,
- /* name */ "Dilate/Erode",
- /* width+range */ 130, 100, 320,
- /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- /* input sock */ cmp_node_dilateerode_in,
- /* output sock */ cmp_node_dilateerode_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_dilateerode,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_dilateerode(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
+ cmp_node_dilateerode_in, cmp_node_dilateerode_out);
+ node_type_size(&ntype, 130, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_dilateerode);
+
+ nodeRegisterType(lb, &ntype);
+}
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c
index b0cf5559772..b00bdba768d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c
@@ -1,4 +1,4 @@
-/**
+/*
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -102,7 +102,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap,
return img;
}
-static void node_composit_exec_dblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
NodeDBlurData *ndbd= node->storage;
CompBuf *new, *img= in[0]->data;
@@ -125,19 +125,17 @@ static void node_composit_init_dblur(bNode* node)
ndbd->center_y= 0.5;
}
-bNodeType cmp_node_dblur = {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_DBLUR,
- /* name */ "Directional Blur",
- /* width+range */ 150, 120, 200,
- /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- /* input sock */ cmp_node_dblur_in,
- /* output sock */ cmp_node_dblur_out,
- /* storage */ "NodeDBlurData",
- /* execfunc */ node_composit_exec_dblur,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_dblur,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_dblur(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
+ cmp_node_dblur_in, cmp_node_dblur_out);
+ node_type_size(&ntype, 150, 120, 200);
+ node_type_init(&ntype, node_composit_init_dblur);
+ node_type_storage(&ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_dblur);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
index 7d64d4e719c..49b65ef0598 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -48,7 +48,7 @@ static bNodeSocketType cmp_node_displace_out[]= {
* in order to take effect */
#define DISPLACE_EPSILON 0.01
-static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *veccol, CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale)
+static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale)
{
ImBuf *ibuf;
int x, y;
@@ -60,7 +60,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
float vec[3], vecdx[3], vecdy[3];
float col[3];
- ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
+ ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
ibuf->rect_float= cbuf->rect;
for(y=0; y < stackbuf->y; y++) {
@@ -83,7 +83,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
p_dy = vec[1] * ys;
/* if no displacement, then just copy this pixel */
- if (p_dx < DISPLACE_EPSILON && p_dy < DISPLACE_EPSILON) {
+ if (fabsf(p_dx) < DISPLACE_EPSILON && fabsf(p_dy) < DISPLACE_EPSILON) {
qd_getPixel(cbuf, x-cbuf->xof, y-cbuf->yof, col);
qd_setPixel(stackbuf, x, y, col);
continue;
@@ -99,10 +99,13 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof+1, vecdy);
d_dx = vecdx[0] * xs;
d_dy = vecdy[0] * ys;
-
+
/* clamp derivatives to minimum displacement distance in UV space */
- dxt = MAX2(p_dx - d_dx, DISPLACE_EPSILON)/(float)stackbuf->x;
- dyt = MAX2(p_dy - d_dy, DISPLACE_EPSILON)/(float)stackbuf->y;
+ dxt = p_dx - d_dx;
+ dyt = p_dy - d_dy;
+
+ dxt = signf(dxt)*maxf(fabsf(dxt), DISPLACE_EPSILON)/(float)stackbuf->x;
+ dyt = signf(dyt)*maxf(fabsf(dyt), DISPLACE_EPSILON)/(float)stackbuf->y;
ibuf_sample(ibuf, u, v, dxt, dyt, col);
qd_setPixel(stackbuf, x, y, col);
@@ -137,7 +140,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
}
-static void node_composit_exec_displace(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_displace(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
@@ -168,20 +171,16 @@ static void node_composit_exec_displace(void *data, bNode *node, bNodeStack **in
}
}
-bNodeType cmp_node_displace= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_DISPLACE,
- /* name */ "Displace",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
- /* input sock */ cmp_node_displace_in,
- /* output sock */ cmp_node_displace_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_displace,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_displace(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS,
+ cmp_node_displace_in, cmp_node_displace_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_displace);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
index e0e595fc8f6..1d379904949 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -125,21 +125,19 @@ static void node_composit_init_distance_matte(bNode *node)
c->t2= 0.1f;
}
-bNodeType cmp_node_distance_matte={
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_DIST_MATTE,
- /* name */ "Distance Key",
- /* width+range */ 200, 80, 250,
- /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_distance_matte_in,
- /* output sock */ cmp_node_distance_matte_out,
- /* storage */ "NodeChroma",
- /* execfunc */ node_composit_exec_distance_matte,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_distance_matte,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_distance_matte(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_distance_matte_in, cmp_node_distance_matte_out);
+ node_type_size(&ntype, 200, 80, 250);
+ node_type_init(&ntype, node_composit_init_distance_matte);
+ node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_distance_matte);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
index 8f9a988c4c2..c3450f80979 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -217,22 +217,18 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in,
}
-bNodeType cmp_node_filter= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_FILTER,
- /* name */ "Filter",
- /* width+range */ 80, 40, 120,
- /* class+opts */ NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_filter_in,
- /* output sock */ cmp_node_filter_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_filter,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_filter(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_filter_in, cmp_node_filter_out);
+ node_type_size(&ntype, 80, 40, 120);
+ node_type_label(&ntype, node_filter_label);
+ node_type_exec(&ntype, node_composit_exec_filter);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c
index fbc570c4028..b1af4ac9d3c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_flip_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(in[0]->data) {
CompBuf *cbuf= in[0]->data;
@@ -85,21 +85,17 @@ static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bN
}
}
-bNodeType cmp_node_flip= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_FLIP,
- /* name */ "Flip",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
- /* input sock */ cmp_node_flip_in,
- /* output sock */ cmp_node_flip_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_flip,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_flip(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, NODE_OPTIONS,
+ cmp_node_flip_in, cmp_node_flip_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_flip);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c
index c0e524a3ae9..dfe28e881f4 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_gamma_out[]= {
{ -1, 0, "" }
};
-static void do_gamma(bNode *node, float *out, float *in, float *fac)
+static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac)
{
int i=0;
for(i=0; i<3; i++) {
@@ -51,7 +51,7 @@ static void do_gamma(bNode *node, float *out, float *in, float *fac)
}
out[3] = in[3];
}
-static void node_composit_exec_gamma(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: Fac, Image */
/* stack order out: Image */
@@ -72,21 +72,14 @@ static void node_composit_exec_gamma(void *data, bNode *node, bNodeStack **in, b
}
}
-bNodeType cmp_node_gamma= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_GAMMA,
- /* name */ "Gamma",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_gamma_in,
- /* output sock */ cmp_node_gamma_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_gamma,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copysotragefunc */ NULL,
- /* id */ NULL
-};
-
-
+void register_node_type_cmp_gamma(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_gamma_in, cmp_node_gamma_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_gamma);
+
+ nodeRegisterType(lb, &ntype);
+}
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
index 1d50acfdc26..7449b8436ea 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
@@ -1,4 +1,4 @@
-/**
+/*
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -422,7 +422,7 @@ static void fglow(NodeGlare* ndg, CompBuf* dst, CompBuf* src)
//--------------------------------------------------------------------------------------------
-static void node_composit_exec_glare(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *new, *src, *img = in[0]->data;
NodeGlare* ndg = node->storage;
@@ -484,19 +484,17 @@ static void node_composit_init_glare(bNode* node)
node->storage = ndg;
}
-bNodeType cmp_node_glare = {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_GLARE,
- /* name */ "Glare",
- /* width+range */ 150, 120, 200,
- /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- /* input sock */ cmp_node_glare_in,
- /* output sock */ cmp_node_glare_out,
- /* storage */ "NodeGlare",
- /* execfunc */ node_composit_exec_glare,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_glare,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_glare(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
+ cmp_node_glare_in, cmp_node_glare_out);
+ node_type_size(&ntype, 150, 120, 200);
+ node_type_init(&ntype, node_composit_init_glare);
+ node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_glare);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
index c274c580771..32e133c3bec 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -65,7 +65,7 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac)
}
}
-static void node_composit_exec_hue_sat(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: Fac, Image */
/* stack order out: Image */
@@ -99,22 +99,19 @@ static void node_composit_init_hue_sat(bNode* node)
nhs->val= 1.0f;
}
-bNodeType cmp_node_hue_sat= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_HUE_SAT,
- /* name */ "Hue Saturation Value",
- /* width+range */ 150, 80, 250,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_hue_sat_in,
- /* output sock */ cmp_node_hue_sat_out,
- /* storage */ "NodeHueSat",
- /* execfunc */ node_composit_exec_hue_sat,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_hue_sat,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-
-};
+void register_node_type_cmp_hue_sat(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_hue_sat_in, cmp_node_hue_sat_out);
+ node_type_size(&ntype, 150, 80, 250);
+ node_type_init(&ntype, node_composit_init_hue_sat);
+ node_type_storage(&ntype, "NodeHueSat", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_hue_sat);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
index 9eb79bb8c36..53cb5cc096d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -98,7 +98,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac)
out[3]= in[3];
}
-static void node_composit_exec_huecorrect(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *cbuf= in[1]->data;
CompBuf *stackbuf;
@@ -148,20 +148,18 @@ static void node_composit_init_huecorrect(bNode* node)
cumapping->cur = 1;
}
-bNodeType cmp_node_huecorrect= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_HUECORRECT,
- /* name */ "Hue Correct",
- /* width+range */ 320, 140, 400,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_huecorrect_in,
- /* output sock */ cmp_node_huecorrect_out,
- /* storage */ "CurveMapping",
- /* execfunc */ node_composit_exec_huecorrect,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_huecorrect,
- /* freestoragefunc */ node_free_curves,
- /* copystoragefunc */ node_copy_curves,
- /* id */ NULL
-};
+void register_node_type_cmp_huecorrect(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_huecorrect_in, cmp_node_huecorrect_out);
+ node_type_size(&ntype, 320, 140, 400);
+ node_type_init(&ntype, node_composit_init_huecorrect);
+ node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
+ node_type_exec(&ntype, node_composit_exec_huecorrect);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c
index 9b088cb3f55..eeae5fb06de 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -104,21 +104,17 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in,
}
-bNodeType cmp_node_idmask= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_ID_MASK,
- /* name */ "ID Mask",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_idmask_in,
- /* output sock */ cmp_node_idmask_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_idmask,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_idmask(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_idmask_in, cmp_node_idmask_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_idmask);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
index 0bbf9c9bf85..bb01f591512 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -62,38 +62,62 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
ImBuf *ibuf;
CompBuf *stackbuf;
int type;
-
+
+ float *rect;
+ int alloc= FALSE;
+
ibuf= BKE_image_get_ibuf(ima, iuser);
- if(ibuf==NULL)
+ if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
return NULL;
-
- if (!(rd->color_mgt_flag & R_COLOR_MANAGEMENT)) {
- int profile = IB_PROFILE_NONE;
-
- /* temporarily set profile to none to not disturb actual */
- SWAP(int, ibuf->profile, profile);
-
- if (ibuf->rect_float != NULL) {
- imb_freerectfloatImBuf(ibuf);
- }
- IMB_float_from_rect(ibuf);
-
- SWAP(int, ibuf->profile, profile);
}
-
+
if (ibuf->rect_float == NULL) {
IMB_float_from_rect(ibuf);
}
+ /* now we need a float buffer from the image
+ * with matching color management */
+ if(ibuf->channels == 4) {
+ if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
+ if(ibuf->profile != IB_PROFILE_NONE) {
+ rect= ibuf->rect_float;
+ }
+ else {
+ rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+ srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
+ alloc= TRUE;
+ }
+ }
+ else {
+ if(ibuf->profile == IB_PROFILE_NONE) {
+ rect= ibuf->rect_float;
+ }
+ else {
+ rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+ linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
+ alloc= TRUE;
+ }
+ }
+ }
+ else {
+ /* non-rgba passes can't use color profiles */
+ rect= ibuf->rect_float;
+ }
+ /* done coercing into the correct color management */
+
+
type= ibuf->channels;
if(rd->scemode & R_COMP_CROP) {
- stackbuf= get_cropped_compbuf(&rd->disprect, ibuf->rect_float, ibuf->x, ibuf->y, type);
+ stackbuf= get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type);
+ if(alloc)
+ MEM_freeN(rect);
}
else {
/* we put imbuf copy on stack, cbuf knows rect is from other ibuf when freed! */
- stackbuf= alloc_compbuf(ibuf->x, ibuf->y, type, 0);
- stackbuf->rect= ibuf->rect_float;
+ stackbuf= alloc_compbuf(ibuf->x, ibuf->y, type, FALSE);
+ stackbuf->rect= rect;
+ stackbuf->malloc= alloc;
}
/*code to respect the premul flag of images; I'm
@@ -153,7 +177,7 @@ static CompBuf *compbuf_multilayer_get(RenderData *rd, RenderLayer *rl, Image *i
return NULL;
};
-void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, Image *ima, ImageUser *iuser)
+static void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, Image *ima, ImageUser *iuser)
{
if(out[RRES_OUT_Z]->hasoutput)
out[RRES_OUT_Z]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_Z);
@@ -191,7 +215,7 @@ void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, I
};
-static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
/* image assigned to output */
@@ -273,22 +297,20 @@ static void node_composit_init_image(bNode* node)
iuser->ok= 1;
}
-bNodeType cmp_node_image= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_IMAGE,
- /* name */ "Image",
- /* width+range */ 120, 80, 300,
- /* class+opts */ NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ NULL,
- /* output sock */ cmp_node_rlayers_out,
- /* storage */ "ImageUser",
- /* execfunc */ node_composit_exec_image,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_image,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_image(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
+ NULL, cmp_node_rlayers_out);
+ node_type_size(&ntype, 120, 80, 300);
+ node_type_init(&ntype, node_composit_init_image);
+ node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_image);
+
+ nodeRegisterType(lb, &ntype);
+}
+
/* **************** RENDER RESULT ******************** */
@@ -317,7 +339,7 @@ static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, in
return NULL;
};
-void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out, int rectx, int recty)
+static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out, int rectx, int recty)
{
if(out[RRES_OUT_Z]->hasoutput)
out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_Z);
@@ -354,7 +376,7 @@ void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out
out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT);
};
-static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
Scene *sce= (Scene *)node->id;
Render *re= (sce)? RE_GetRender(sce->id.name): NULL;
@@ -404,22 +426,17 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in,
};
-bNodeType cmp_node_rlayers= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_R_LAYERS,
- /* name */ "Render Layers",
- /* width+range */ 150, 100, 300,
- /* class+opts */ NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ NULL,
- /* output sock */ cmp_node_rlayers_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_rlayers,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
+void register_node_type_cmp_rlayers(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
+ NULL, cmp_node_rlayers_out);
+ node_type_size(&ntype, 150, 100, 300);
+ node_type_exec(&ntype, node_composit_exec_rlayers);
+
+ nodeRegisterType(lb, &ntype);
+}
-};
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
index 08ae51975b9..5cf652b8af6 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -75,7 +75,7 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac)
QUATCOPY(out, col);
}
-static void node_composit_exec_invert(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: fac, Image, Image */
/* stack order out: Image */
@@ -115,20 +115,16 @@ static void node_composit_init_invert(bNode *node)
}
/* custom1 = mix type */
-bNodeType cmp_node_invert= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_INVERT,
- /* name */ "Invert",
- /* width+range */ 120, 120, 140,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_invert_in,
- /* output sock */ cmp_node_invert_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_invert,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_invert,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_invert(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_invert_in, cmp_node_invert_out);
+ node_type_size(&ntype, 120, 120, 140);
+ node_type_init(&ntype, node_composit_init_invert);
+ node_type_exec(&ntype, node_composit_exec_invert);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
index fc9045caafd..4343e043c34 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
@@ -1,4 +1,4 @@
-/**
+/*
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -147,7 +147,7 @@ static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb
}
-static void node_composit_exec_lensdist(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_lensdist(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *new, *img = in[0]->data;
NodeLensDist* nld = node->storage;
@@ -174,19 +174,17 @@ static void node_composit_init_lensdist(bNode* node)
}
-bNodeType cmp_node_lensdist = {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_LENSDIST,
- /* name */ "Lens Distortion",
- /* width+range */ 150, 120, 200,
- /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
- /* input sock */ cmp_node_lensdist_in,
- /* output sock */ cmp_node_lensdist_out,
- /* storage */ "NodeLensDist",
- /* execfunc */ node_composit_exec_lensdist,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_lensdist,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_lensdist(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS,
+ cmp_node_lensdist_in, cmp_node_lensdist_out);
+ node_type_size(&ntype, 150, 120, 200);
+ node_type_init(&ntype, node_composit_init_lensdist);
+ node_type_storage(&ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_lensdist);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c
index f550bead4cf..876ee565ec7 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -47,7 +47,7 @@ static void rgb_tobw(float r, float g, float b, float* out)
*out= r*0.35f + g*0.45f + b*0.2f;
}
-static void fill_bins(bNode* node, CompBuf* in, int* bins)
+static void fill_bins(bNode* node, CompBuf* in, int* bins, int colorcor)
{
float value[4];
int ivalue=0;
@@ -63,29 +63,39 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
if(value[3] > 0.0) { /* don't count transparent pixels */
switch(node->custom1) {
case 1: { /* all colors */
+ if(colorcor)
+ linearrgb_to_srgb_v3_v3(&value[0],&value[0]);
rgb_tobw(value[0],value[1],value[2], &value[0]);
value[0]=value[0]*255; /* scale to 0-255 range */
ivalue=(int)value[0];
break;
}
case 2: { /* red channel */
+ if(colorcor)
+ value[0]=linearrgb_to_srgb(value[0]);
value[0]=value[0]*255; /* scale to 0-255 range */
ivalue=(int)value[0];
break;
}
case 3: { /* green channel */
+ if(colorcor)
+ value[1]=linearrgb_to_srgb(value[1]);
value[1]=value[1]*255; /* scale to 0-255 range */
ivalue=(int)value[1];
break;
}
case 4: /*blue channel */
{
+ if(colorcor)
+ value[2]=linearrgb_to_srgb(value[2]);
value[2]=value[2]*255; /* scale to 0-255 range */
ivalue=(int)value[2];
break;
}
case 5: /* luminence */
{
+ if(colorcor)
+ linearrgb_to_srgb_v3_v3(&value[0],&value[0]);
rgb_to_yuv(value[0],value[1],value[2], &value[0], &value[1], &value[2]);
value[0]=value[0]*255; /* scale to 0-255 range */
ivalue=(int)value[0];
@@ -270,6 +280,7 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
{
CompBuf* cbuf;
CompBuf* histogram;
+ RenderData *rd=data;
float mean, std_dev;
int bins[256];
int x;
@@ -286,7 +297,7 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
}
/*fill bins */
- fill_bins(node, in[0]->data, bins);
+ fill_bins(node, in[0]->data, bins, rd->color_mgt_flag & R_COLOR_MANAGEMENT);
/* draw the histogram chart */
draw_histogram(node, histogram, bins);
@@ -317,21 +328,18 @@ static void node_composit_init_view_levels(bNode* node)
node->custom1=1; /*All channels*/
}
-bNodeType cmp_node_view_levels= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_VIEW_LEVELS,
- /* name */ "Levels",
- /* widthrange */ 140, 100, 320,
- /* classopts */ NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW,
- /* input sock */ cmp_node_view_levels_in,
- /* output sock */ cmp_node_view_levels_out,
- /* storage */ "ImageUser",
- /* execfunc */ node_composit_exec_view_levels,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_view_levels,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_view_levels(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW,
+ cmp_node_view_levels_in, cmp_node_view_levels_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_init(&ntype, node_composit_init_view_levels);
+ node_type_storage(&ntype, "ImageUser", NULL, NULL);
+ node_type_exec(&ntype, node_composit_exec_view_levels);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
index af198fba699..42430ffeff8 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -103,20 +103,18 @@ static void node_composit_init_luma_matte(bNode *node)
c->t2= 0.0f;
};
-bNodeType cmp_node_luma_matte={
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_LUMA_MATTE,
- /* name */ "Luminance Key",
- /* width+range */ 200, 80, 250,
- /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_luma_matte_in,
- /* output sock */ cmp_node_luma_matte_out,
- /* storage */ "NodeChroma",
- /* execfunc */ node_composit_exec_luma_matte,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_luma_matte,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_luma_matte(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_luma_matte_in, cmp_node_luma_matte_out);
+ node_type_size(&ntype, 200, 80, 250);
+ node_type_init(&ntype, node_composit_init_luma_matte);
+ node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_luma_matte);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
index 91d1aa148b2..bc294b3be79 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -51,7 +51,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
int x, y, sx, sy, row= 3*stackbuf->x;
/* ibuf needed for sampling */
- ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
+ ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
ibuf->rect_float= cbuf->rect;
/* vars for efficient looping */
@@ -134,7 +134,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
}
-static void node_composit_exec_mapuv(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
@@ -159,21 +159,17 @@ static void node_composit_exec_mapuv(void *data, bNode *node, bNodeStack **in, b
}
}
-bNodeType cmp_node_mapuv= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_MAP_UV,
- /* name */ "Map UV",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
- /* input sock */ cmp_node_mapuv_in,
- /* output sock */ cmp_node_mapuv_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_mapuv,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_mapuv(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, NODE_OPTIONS,
+ cmp_node_mapuv_in, cmp_node_mapuv_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_mapuv);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
index 357218ea937..b7da0ed578c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -52,7 +52,7 @@ static void do_map_value(bNode *node, float *out, float *src)
out[0]= texmap->max[0];
}
-static void node_composit_exec_map_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: valbuf */
/* stack order out: valbuf */
@@ -79,23 +79,20 @@ static void node_composit_init_map_value(bNode* node)
node->storage= add_mapping();
}
-bNodeType cmp_node_map_value= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_MAP_VALUE,
- /* name */ "Map Value",
- /* width+range */ 100, 60, 150,
- /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_map_value_in,
- /* output sock */ cmp_node_map_value_out,
- /* storage */ "TexMapping",
- /* execfunc */ node_composit_exec_map_value,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_map_value,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-
-};
+void register_node_type_cmp_map_value(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
+ cmp_node_map_value_in, cmp_node_map_value_out);
+ node_type_size(&ntype, 100, 60, 150);
+ node_type_init(&ntype, node_composit_init_map_value);
+ node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_map_value);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
index f663dc76b5c..86b602d4086 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -29,7 +29,6 @@
#include "../CMP_util.h"
-
/* **************** SCALAR MATH ******************** */
static bNodeSocketType cmp_node_math_in[]= {
{ SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f},
@@ -95,11 +94,18 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
break;
case 10: /* Power */
{
- /* Don't want any imaginary numbers... */
- if( in[0] >= 0 )
+ /* Only raise negative numbers by full integers */
+ if( in[0] >= 0 ) {
out[0]= pow(in[0], in2[0]);
- else
- out[0]= 0.0;
+ } else {
+ float y_mod_1 = fmod(in2[0], 1);
+ /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
+ if (y_mod_1 > 0.999 || y_mod_1 < 0.001) {
+ out[0]= pow(in[0], floor(in2[0] + 0.5));
+ } else {
+ out[0] = 0.0;
+ }
+ }
}
break;
case 11: /* Logarithm */
@@ -151,7 +157,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
}
}
-static void node_composit_exec_math(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *cbuf=in[0]->data;
CompBuf *cbuf2=in[1]->data;
@@ -181,22 +187,19 @@ static void node_composit_exec_math(void *data, bNode *node, bNodeStack **in, bN
out[0]->data= stackbuf;
}
-bNodeType cmp_node_math= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_MATH,
- /* name */ "Math",
- /* width+range */ 120, 110, 160,
- /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_math_in,
- /* output sock */ cmp_node_math_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_math,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_math(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_math_in, cmp_node_math_out);
+ node_type_size(&ntype, 120, 110, 160);
+ node_type_label(&ntype, node_math_label);
+ node_type_exec(&ntype, node_composit_exec_math);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
index 34d6713d9e3..2a7937ef1d8 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -79,20 +79,16 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in,
}
/* custom1 = mix type */
-bNodeType cmp_node_mix_rgb= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_MIX_RGB,
- /* name */ "Mix",
- /* width+range */ 110, 60, 120,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_mix_rgb_in,
- /* output sock */ cmp_node_mix_rgb_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_mix_rgb,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_mix_rgb(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_mix_rgb_in, cmp_node_mix_rgb_out);
+ node_type_size(&ntype, 110, 60, 120);
+ node_type_label(&ntype, node_blend_label);
+ node_type_exec(&ntype, node_composit_exec_mix_rgb);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c
index c57caf180ad..920a99f1b93 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -52,7 +52,7 @@ static void do_normal(bNode *node, float *out, float *in)
}
/* generates normal, does dot product */
-static void node_composit_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
/* stack order input: normal */
@@ -77,21 +77,16 @@ static void node_composit_exec_normal(void *data, bNode *node, bNodeStack **in,
}
-bNodeType cmp_node_normal= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_NORMAL,
- /* name */ "Normal",
- /* width+range */ 100, 60, 200,
- /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_normal_in,
- /* output sock */ cmp_node_normal_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_normal,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_normal(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
+ cmp_node_normal_in, cmp_node_normal_out);
+ node_type_size(&ntype, 100, 60, 200);
+ node_type_exec(&ntype, node_composit_exec_normal);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c
index 64855ba5cf3..b9a4dd4ab8a 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_normalize_out[]= {
{ -1, 0, "" }
};
-static void do_normalize(bNode *node, float *out, float *src, float *min, float *mult)
+static void do_normalize(bNode *UNUSED(node), float *out, float *src, float *min, float *mult)
{
float res;
res = (src[0] - min[0]) * mult[0];
@@ -58,7 +58,7 @@ static void do_normalize(bNode *node, float *out, float *src, float *min, float
/* The code below assumes all data is inside range +- this, and that input buffer is single channel */
#define BLENDER_ZMAX 10000.0f
-static void node_composit_exec_normalize(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: valbuf */
/* stack order out: valbuf */
@@ -98,19 +98,15 @@ static void node_composit_exec_normalize(void *data, bNode *node, bNodeStack **i
}
}
-bNodeType cmp_node_normalize= {
- /* *next, *prev*/ NULL, NULL,
- /* type code */ CMP_NODE_NORMALIZE,
- /* name */ "Normalize",
- /* width+range */ 100, 60, 150,
- /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_normalize_in,
- /* output sock */ cmp_node_normalize_out,
- /* storage */ "TexMapping",
- /* execfunc */ node_composit_exec_normalize,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_normalize(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
+ cmp_node_normalize_in, cmp_node_normalize_out);
+ node_type_size(&ntype, 100, 60, 150);
+ node_type_exec(&ntype, node_composit_exec_normalize);
+ node_type_storage(&ntype, "TexMapping", NULL, NULL);
+
+ nodeRegisterType(lb, &ntype);
+}
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
index 6f29548fcc3..3cb342aa5ff 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_output_file_in[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
/* image assigned to output */
/* stack order input sockets: col, alpha */
@@ -54,7 +54,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
return;
} else {
CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
- ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
+ ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
char string[256];
ibuf->rect_float= cbuf->rect;
@@ -71,7 +71,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
}
}
- BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION));
+ BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION), TRUE);
if(0 == BKE_write_ibuf((Scene *)node->id, ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality))
printf("Cannot save Node File Output to %s\n", string);
@@ -104,22 +104,19 @@ static void node_composit_init_output_file(bNode *node)
}
}
-bNodeType cmp_node_output_file= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_OUTPUT_FILE,
- /* name */ "File Output",
- /* width+range */ 140, 80, 300,
- /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_output_file_in,
- /* output sock */ NULL,
- /* storage */ "NodeImageFile",
- /* execfunc */ node_composit_exec_output_file,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_output_file,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-
-};
+void register_node_type_cmp_output_file(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_output_file_in, NULL);
+ node_type_size(&ntype, 140, 80, 300);
+ node_type_init(&ntype, node_composit_init_output_file);
+ node_type_storage(&ntype, "NodeImageFile", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_output_file);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c
index 5058fa51c11..5bf3af8e5cb 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_premulkey_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_premulkey(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
@@ -58,20 +58,16 @@ static void node_composit_exec_premulkey(void *data, bNode *node, bNodeStack **i
}
}
-bNodeType cmp_node_premulkey= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_PREMULKEY,
- /* name */ "Alpha Convert",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_premulkey_in,
- /* output sock */ cmp_node_premulkey_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_premulkey,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copysotragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_premulkey(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_premulkey_in, cmp_node_premulkey_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_premulkey);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c
index 3b9b993d5f8..1d8db72584e 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -36,29 +36,24 @@ static bNodeSocketType cmp_node_rgb_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
VECCOPY(out[0]->vec, sock->ns.vec);
}
-bNodeType cmp_node_rgb= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_RGB,
- /* name */ "RGB",
- /* width+range */ 140, 80, 140,
- /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS,
- /* input sock */ NULL,
- /* output sock */ cmp_node_rgb_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_rgb,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_rgb(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS,
+ NULL, cmp_node_rgb_out);
+ node_type_size(&ntype, 140, 80, 140);
+ node_type_exec(&ntype, node_composit_exec_rgb);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
index ccb1d8abfd9..17d22d41543 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_rotate_out[]= {
};
/* only supports RGBA nodes now */
-static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
@@ -68,8 +68,8 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in,
maxy= -centy + (float)cbuf->y;
- ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
- obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0, 0);
+ ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
+ obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
if(ibuf && obuf){
ibuf->rect_float=cbuf->rect;
@@ -120,19 +120,16 @@ static void node_composit_init_rotate(bNode *node)
node->custom1= 1; /* Bilinear Filter*/
}
-bNodeType cmp_node_rotate= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_ROTATE,
- /* name */ "Rotate",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
- /* input sock */ cmp_node_rotate_in,
- /* output sock */ cmp_node_rotate_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_rotate,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_rotate,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_rotate(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS,
+ cmp_node_rotate_in, cmp_node_rotate_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_init(&ntype, node_composit_init_rotate);
+ node_type_exec(&ntype, node_composit_exec_rotate);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
index 9779875b01a..6f030d3d7b3 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -75,7 +75,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
newx= MIN2(newx, CMP_SCALE_MAX);
newy= MIN2(newy, CMP_SCALE_MAX);
- ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
+ ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
if(ibuf) {
ibuf->rect_float= cbuf->rect;
IMB_scaleImBuf(ibuf, newx, newy);
@@ -109,22 +109,18 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
}
};
-bNodeType cmp_node_scale= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_SCALE,
- /* name */ "Scale",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
- /* input sock */ cmp_node_scale_in,
- /* output sock */ cmp_node_scale_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_scale,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_scale(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS,
+ cmp_node_scale_in, cmp_node_scale_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_scale);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
index 0ac47c58ab3..469425c4ace 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sephsva_out[]= {
{ -1, 0, "" }
};
-static void do_sephsva(bNode *node, float *out, float *in)
+static void do_sephsva(bNode *UNUSED(node), float *out, float *in)
{
float h, s, v;
@@ -55,7 +55,7 @@ static void do_sephsva(bNode *node, float *out, float *in)
out[3]= in[3];
}
-static void node_composit_exec_sephsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw channels */
/* stack order in: col */
@@ -96,23 +96,18 @@ static void node_composit_exec_sephsva(void *data, bNode *node, bNodeStack **in,
}
}
-bNodeType cmp_node_sephsva= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_SEPHSVA,
- /* name */ "Separate HSVA",
- /* width+range */ 80, 40, 140,
- /* class+opts */ NODE_CLASS_CONVERTOR, 0,
- /* input sock */ cmp_node_sephsva_in,
- /* output sock */ cmp_node_sephsva_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_sephsva,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_sephsva(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTOR, 0,
+ cmp_node_sephsva_in, cmp_node_sephsva_out);
+ node_type_size(&ntype, 80, 40, 140);
+ node_type_exec(&ntype, node_composit_exec_sephsva);
+
+ nodeRegisterType(lb, &ntype);
+}
+
/* **************** COMBINE HSVA ******************** */
static bNodeSocketType cmp_node_combhsva_in[]= {
@@ -127,7 +122,7 @@ static bNodeSocketType cmp_node_combhsva_out[]= {
{ -1, 0, "" }
};
-static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4)
+static void do_comb_hsva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
float r,g,b;
hsv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b);
@@ -138,7 +133,7 @@ static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float
out[3] = in4[0];
}
-static void node_composit_exec_combhsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: 1 rgba channels */
/* stack order in: 4 value channels */
@@ -171,21 +166,17 @@ static void node_composit_exec_combhsva(void *data, bNode *node, bNodeStack **in
}
}
-bNodeType cmp_node_combhsva= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_COMBHSVA,
- /* name */ "Combine HSVA",
- /* width+range */ 80, 40, 140,
- /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_combhsva_in,
- /* output sock */ cmp_node_combhsva_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_combhsva,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_combhsva(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_combhsva_in, cmp_node_combhsva_out);
+ node_type_size(&ntype, 80, 40, 140);
+ node_type_exec(&ntype, node_composit_exec_combhsva);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
index c5a57f8a175..969fadf65ad 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_seprgba_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_seprgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw channels */
/* stack order in: col */
@@ -74,23 +74,18 @@ static void node_composit_exec_seprgba(void *data, bNode *node, bNodeStack **in,
}
}
-bNodeType cmp_node_seprgba= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_SEPRGBA,
- /* name */ "Separate RGBA",
- /* width+range */ 80, 40, 140,
- /* class+opts */ NODE_CLASS_CONVERTOR, 0,
- /* input sock */ cmp_node_seprgba_in,
- /* output sock */ cmp_node_seprgba_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_seprgba,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_seprgba(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTOR, 0,
+ cmp_node_seprgba_in, cmp_node_seprgba_out);
+ node_type_size(&ntype, 80, 40, 140);
+ node_type_exec(&ntype, node_composit_exec_seprgba);
+
+ nodeRegisterType(lb, &ntype);
+}
+
/* **************** COMBINE RGBA ******************** */
@@ -106,7 +101,7 @@ static bNodeSocketType cmp_node_combrgba_out[]= {
{ -1, 0, "" }
};
-static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4)
+static void do_combrgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
out[0] = in1[0];
out[1] = in2[0];
@@ -114,7 +109,7 @@ static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float *
out[3] = in4[0];
}
-static void node_composit_exec_combrgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: 1 rgba channels */
/* stack order in: 4 value channels */
@@ -147,21 +142,16 @@ static void node_composit_exec_combrgba(void *data, bNode *node, bNodeStack **in
}
}
-bNodeType cmp_node_combrgba= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_COMBRGBA,
- /* name */ "Combine RGBA",
- /* width+range */ 80, 40, 140,
- /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_combrgba_in,
- /* output sock */ cmp_node_combrgba_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_combrgba,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_combrgba(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_combrgba_in, cmp_node_combrgba_out);
+ node_type_size(&ntype, 80, 40, 140);
+ node_type_exec(&ntype, node_composit_exec_combrgba);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
index 7b3dfccab50..b00885f6940 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepycca_out[]= {
{ -1, 0, "" }
};
-static void do_sepycca(bNode *node, float *out, float *in)
+static void do_sepycca_601(bNode *UNUSED(node), float *out, float *in)
{
float y, cb, cr;
@@ -56,13 +56,51 @@ static void do_sepycca(bNode *node, float *out, float *in)
out[3]= in[3];
}
-static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void do_sepycca_709(bNode *UNUSED(node), float *out, float *in)
+{
+ float y, cb, cr;
+
+ rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT709);
+
+ /*divided by 255 to normalize for viewing in */
+ out[0]= y/255.0;
+ out[1]= cb/255.0;
+ out[2]= cr/255.0;
+ out[3]= in[3];
+}
+
+static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in)
+{
+ float y, cb, cr;
+
+ rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_JFIF_0_255);
+
+ /*divided by 255 to normalize for viewing in */
+ out[0]= y/255.0;
+ out[1]= cb/255.0;
+ out[2]= cr/255.0;
+ out[3]= in[3];
+}
+
+static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* input no image? then only color operation */
if(in[0]->data==NULL) {
float y, cb, cr;
- rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr, BLI_YCC_ITU_BT601);
+ switch(node->custom1)
+ {
+ case 1:
+ rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr, BLI_YCC_ITU_BT709);
+ break;
+ case 2:
+ rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr, BLI_YCC_JFIF_0_255);
+ break;
+ case 0:
+ default:
+ rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr, BLI_YCC_ITU_BT601);
+ break;
+ }
/*divided by 255 to normalize for viewing in */
out[0]->vec[0] = y/255.0;
@@ -76,7 +114,19 @@ static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in,
CompBuf *cbuf2=typecheck_compbuf(cbuf, CB_RGBA);
/* convert the RGB stackbuf to an HSV representation */
- composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepycca, CB_RGBA);
+ switch(node->custom1)
+ {
+ case 1:
+ composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepycca_709, CB_RGBA);
+ break;
+ case 2:
+ composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepycca_jfif, CB_RGBA);
+ break;
+ case 0:
+ default:
+ composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepycca_601, CB_RGBA);
+ break;
+ }
/* separate each of those channels */
if(out[0]->hasoutput)
@@ -95,29 +145,25 @@ static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in,
}
}
-bNodeType cmp_node_sepycca= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_SEPYCCA,
- /* name */ "Separate YCbCrA",
- /* width+range */ 80, 40, 140,
- /* class+opts */ NODE_CLASS_CONVERTOR, 0,
- /* input sock */ cmp_node_sepycca_in,
- /* output sock */ cmp_node_sepycca_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_sepycca,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_sepycca(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_sepycca_in, cmp_node_sepycca_out);
+ node_type_size(&ntype, 80, 40, 140);
+ node_type_exec(&ntype, node_composit_exec_sepycca);
+
+ nodeRegisterType(lb, &ntype);
+}
+
/* **************** COMBINE YCCA ******************** */
static bNodeSocketType cmp_node_combycca_in[]= {
{ SOCK_VALUE, 1, "Y", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Cb", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Cr", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_VALUE, 1, "Cb", 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_VALUE, 1, "Cr", 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{ SOCK_VALUE, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
@@ -126,7 +172,7 @@ static bNodeSocketType cmp_node_combycca_out[]= {
{ -1, 0, "" }
};
-static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4)
+static void do_comb_ycca_601(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
float r,g,b;
float y, cb, cr;
@@ -144,16 +190,67 @@ static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float
out[3] = in4[0];
}
-static void node_composit_exec_combycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void do_comb_ycca_709(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
+{
+ float r,g,b;
+ float y, cb, cr;
+
+ /*need to un-normalize the data*/
+ y=in1[0]*255;
+ cb=in2[0]*255;
+ cr=in3[0]*255;
+
+ ycc_to_rgb(y,cb,cr, &r, &g, &b, BLI_YCC_ITU_BT709);
+
+ out[0] = r;
+ out[1] = g;
+ out[2] = b;
+ out[3] = in4[0];
+}
+
+static void do_comb_ycca_jfif(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
+{
+ float r,g,b;
+ float y, cb, cr;
+
+ /*need to un-normalize the data*/
+ y=in1[0]*255;
+ cb=in2[0]*255;
+ cr=in3[0]*255;
+
+ ycc_to_rgb(y,cb,cr, &r, &g, &b, BLI_YCC_JFIF_0_255);
+
+ out[0] = r;
+ out[1] = g;
+ out[2] = b;
+ out[3] = in4[0];
+}
+
+static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: 1 ycca channels */
/* stack order in: 4 value channels */
/* input no image? then only color operation */
if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
- out[0]->vec[0] = in[0]->vec[0];
- out[0]->vec[1] = in[1]->vec[0];
- out[0]->vec[2] = in[2]->vec[0];
+ float y = in[0]->vec[0] * 255;
+ float cb = in[1]->vec[0] * 255;
+ float cr = in[2]->vec[0] * 255;
+
+ switch(node->custom1)
+ {
+ case 1:
+ ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_ITU_BT709);
+ break;
+ case 2:
+ ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_JFIF_0_255);
+ break;
+ case 0:
+ default:
+ ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_ITU_BT601);
+ break;
+ }
+
out[0]->vec[3] = in[3]->vec[0];
}
else {
@@ -169,29 +266,43 @@ static void node_composit_exec_combycca(void *data, bNode *node, bNodeStack **in
stackbuf = alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
- composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec,
- in[2]->data, in[2]->vec, in[3]->data, in[3]->vec,
- do_comb_ycca, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
+
+ switch(node->custom1)
+ {
+ case 1:
+ composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec,
+ in[2]->data, in[2]->vec, in[3]->data, in[3]->vec,
+ do_comb_ycca_709, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
+ break;
+
+ case 2:
+ composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec,
+ in[2]->data, in[2]->vec, in[3]->data, in[3]->vec,
+ do_comb_ycca_jfif, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
+ break;
+ case 0:
+ default:
+ composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec,
+ in[2]->data, in[2]->vec, in[3]->data, in[3]->vec,
+ do_comb_ycca_601, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
+ break;
+ }
out[0]->data= stackbuf;
}
}
-bNodeType cmp_node_combycca= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_COMBYCCA,
- /* name */ "Combine YCbCrA",
- /* width+range */ 80, 40, 140,
- /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_combycca_in,
- /* output sock */ cmp_node_combycca_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_combycca,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_combycca(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_combycca_in, cmp_node_combycca_out);
+ node_type_size(&ntype, 80, 40, 140);
+ node_type_exec(&ntype, node_composit_exec_combycca);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
index 13b71026054..65b0e5a645c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepyuva_out[]= {
{ -1, 0, "" }
};
-static void do_sepyuva(bNode *node, float *out, float *in)
+static void do_sepyuva(bNode *UNUSED(node), float *out, float *in)
{
float y, u, v;
@@ -55,7 +55,7 @@ static void do_sepyuva(bNode *node, float *out, float *in)
out[3]= in[3];
}
-static void node_composit_exec_sepyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw channels */
/* stack order in: col */
@@ -96,22 +96,18 @@ static void node_composit_exec_sepyuva(void *data, bNode *node, bNodeStack **in,
}
}
-bNodeType cmp_node_sepyuva= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_SEPYUVA,
- /* name */ "Separate YUVA",
- /* width+range */ 80, 40, 140,
- /* class+opts */ NODE_CLASS_CONVERTOR, 0,
- /* input sock */ cmp_node_sepyuva_in,
- /* output sock */ cmp_node_sepyuva_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_sepyuva,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_sepyuva(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTOR, 0,
+ cmp_node_sepyuva_in, cmp_node_sepyuva_out);
+ node_type_size(&ntype, 80, 40, 140);
+ node_type_exec(&ntype, node_composit_exec_sepyuva);
+
+ nodeRegisterType(lb, &ntype);
+}
+
/* **************** COMBINE YUVA ******************** */
@@ -127,7 +123,7 @@ static bNodeSocketType cmp_node_combyuva_out[]= {
{ -1, 0, "" }
};
-static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4)
+static void do_comb_yuva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
float r,g,b;
yuv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b);
@@ -138,7 +134,7 @@ static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float
out[3] = in4[0];
}
-static void node_composit_exec_combyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: 1 rgba channels */
/* stack order in: 4 value channels */
@@ -171,20 +167,16 @@ static void node_composit_exec_combyuva(void *data, bNode *node, bNodeStack **in
}
}
-bNodeType cmp_node_combyuva= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_COMBYUVA,
- /* name */ "Combine YUVA",
- /* width+range */ 80, 40, 140,
- /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_combyuva_in,
- /* output sock */ cmp_node_combyuva_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_combyuva,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_combyuva(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_combyuva_in, cmp_node_combyuva_out);
+ node_type_size(&ntype, 80, 40, 140);
+ node_type_exec(&ntype, node_composit_exec_combyuva);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c
index a7d10017c1f..920bb33604f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_setalpha_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_setalpha(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: RGBA image */
/* stack order in: col, alpha */
@@ -70,20 +70,15 @@ static void node_composit_exec_setalpha(void *data, bNode *node, bNodeStack **in
}
}
-bNodeType cmp_node_setalpha= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_SETALPHA,
- /* name */ "Set Alpha",
- /* width+range */ 120, 40, 140,
- /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_setalpha_in,
- /* output sock */ cmp_node_setalpha_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_setalpha,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_setalpha(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_setalpha_in, cmp_node_setalpha_out);
+ node_type_size(&ntype, 120, 40, 140);
+ node_type_exec(&ntype, node_composit_exec_setalpha);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
index 98bda1bd7fa..e66abd994dd 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_splitviewer_in[]= {
{ -1, 0, "" }
};
-static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2, float *fac)
+static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac)
{
if(*fac==0.0f) {
QUATCOPY(out, in1);
@@ -46,7 +46,7 @@ static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2,
}
}
-static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
/* image assigned to output */
/* stack order input sockets: image image */
@@ -146,22 +146,20 @@ static void node_composit_init_splitviewer(bNode* node)
node->custom1= 50; /* default 50% split */
}
-bNodeType cmp_node_splitviewer= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_SPLITVIEWER,
- /* name */ "SplitViewer",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS,
- /* input sock */ cmp_node_splitviewer_in,
- /* output sock */ NULL,
- /* storage */ "ImageUser",
- /* execfunc */ node_composit_exec_splitviewer,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_splitviewer,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_splitviewer(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_SPLITVIEWER, "SplitViewer", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS,
+ cmp_node_splitviewer_in, NULL);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_init(&ntype, node_composit_init_splitviewer);
+ node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_splitviewer);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c
index f990fa452cb..8d8480688c7 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -79,7 +79,7 @@ static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco)
else {
VECCOPY(col, nor);
}
-
+
typecheck_compbuf_color(out, col, cbuf->type, cbuf->procedural_type);
}
@@ -96,19 +96,20 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
/* first make the preview image */
CompBuf *prevbuf= alloc_compbuf(140, 140, CB_RGBA, 1); /* alloc */
- /* Also take care about the render size! */
- sizex = (rd->size*rd->xsch)/100;
- sizey = (rd->size*rd->ysch)/100;
-
prevbuf->rect_procedural= texture_procedural;
prevbuf->node= node;
VECCOPY(prevbuf->procedural_offset, in[0]->vec);
VECCOPY(prevbuf->procedural_size, in[1]->vec);
prevbuf->procedural_type= CB_RGBA;
composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_rgba, CB_RGBA);
+
generate_preview(data, node, prevbuf);
free_compbuf(prevbuf);
+ /* texture procedural buffer type doesnt work well, we now render a buffer in scene size */
+ sizex = (rd->size*rd->xsch)/100;
+ sizey = (rd->size*rd->ysch)/100;
+
if(out[0]->hasoutput) {
CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 1); /* alloc */
@@ -117,6 +118,8 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
VECCOPY(stackbuf->procedural_offset, in[0]->vec);
VECCOPY(stackbuf->procedural_size, in[1]->vec);
stackbuf->procedural_type= CB_VAL;
+ composit1_pixel_processor(node, stackbuf, stackbuf, out[0]->vec, do_copy_value, CB_VAL);
+ stackbuf->rect_procedural= NULL;
out[0]->data= stackbuf;
}
@@ -128,28 +131,25 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
VECCOPY(stackbuf->procedural_offset, in[0]->vec);
VECCOPY(stackbuf->procedural_size, in[1]->vec);
stackbuf->procedural_type= CB_RGBA;
+ composit1_pixel_processor(node, stackbuf, stackbuf, out[0]->vec, do_copy_rgba, CB_RGBA);
+ stackbuf->rect_procedural= NULL;
out[1]->data= stackbuf;
}
}
}
-bNodeType cmp_node_texture= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_TEXTURE,
- /* name */ "Texture",
- /* width+range */ 120, 80, 240,
- /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW,
- /* input sock */ cmp_node_texture_in,
- /* output sock */ cmp_node_texture_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_texture,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_texture(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW,
+ cmp_node_texture_in, cmp_node_texture_out);
+ node_type_size(&ntype, 120, 80, 240);
+ node_type_exec(&ntype, node_composit_exec_texture);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
index 12f0c171f94..ac305ad0319 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
@@ -1,4 +1,4 @@
-/**
+/*
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -123,7 +123,7 @@ static void tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src)
}
-static void node_composit_exec_tonemap(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *new, *img = in[0]->data;
@@ -158,19 +158,17 @@ static void node_composit_init_tonemap(bNode* node)
node->storage = ntm;
}
-bNodeType cmp_node_tonemap = {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_TONEMAP,
- /* name */ "Tonemap",
- /* width+range */ 150, 120, 200,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_tonemap_in,
- /* output sock */ cmp_node_tonemap_out,
- /* storage */ "NodeTonemap",
- /* execfunc */ node_composit_exec_tonemap,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_tonemap,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_tonemap(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_tonemap_in, cmp_node_tonemap_out);
+ node_type_size(&ntype, 150, 120, 200);
+ node_type_init(&ntype, node_composit_init_tonemap);
+ node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_tonemap);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c
index ca359d436f6..9db7819658d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_translate_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_translate(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
if(in[0]->data) {
CompBuf *cbuf= in[0]->data;
@@ -56,20 +56,16 @@ static void node_composit_exec_translate(void *data, bNode *node, bNodeStack **i
}
}
-bNodeType cmp_node_translate= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_TRANSLATE,
- /* name */ "Translate",
- /* width+range */ 140, 100, 320,
- /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
- /* input sock */ cmp_node_translate_in,
- /* output sock */ cmp_node_translate_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_translate,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_translate(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS,
+ cmp_node_translate_in, cmp_node_translate_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_exec(&ntype, node_composit_exec_translate);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
index 6ce03f38cdb..9de4a8ca4ef 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -46,7 +46,7 @@ static void do_colorband_composit(bNode *node, float *out, float *in)
do_colorband(node->storage, in[0], out);
}
-static void node_composit_exec_valtorgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: fac */
/* stack order out: col, alpha */
@@ -80,23 +80,20 @@ static void node_composit_init_valtorgb(bNode* node)
node->storage= add_colorband(1);
}
-bNodeType cmp_node_valtorgb= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_VALTORGB,
- /* name */ "ColorRamp",
- /* width+range */ 240, 200, 300,
- /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- /* input sock */ cmp_node_valtorgb_in,
- /* output sock */ cmp_node_valtorgb_out,
- /* storage */ "ColorBand",
- /* execfunc */ node_composit_exec_valtorgb,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_valtorgb,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-
-};
+void register_node_type_cmp_valtorgb(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+ cmp_node_valtorgb_in, cmp_node_valtorgb_out);
+ node_type_size(&ntype, 240, 200, 300);
+ node_type_init(&ntype, node_composit_init_valtorgb);
+ node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_valtorgb);
+
+ nodeRegisterType(lb, &ntype);
+}
+
/* **************** RGBTOBW ******************** */
@@ -109,12 +106,12 @@ static bNodeSocketType cmp_node_rgbtobw_out[]= {
{ -1, 0, "" }
};
-static void do_rgbtobw(bNode *node, float *out, float *in)
+static void do_rgbtobw(bNode *UNUSED(node), float *out, float *in)
{
out[0]= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f;
}
-static void node_composit_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw */
/* stack order in: col */
@@ -137,21 +134,14 @@ static void node_composit_exec_rgbtobw(void *data, bNode *node, bNodeStack **in,
}
}
-bNodeType cmp_node_rgbtobw= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_RGBTOBW,
- /* name */ "RGB to BW",
- /* width+range */ 80, 40, 120,
- /* class+opts */ NODE_CLASS_CONVERTOR, 0,
- /* input sock */ cmp_node_rgbtobw_in,
- /* output sock */ cmp_node_rgbtobw_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_rgbtobw,
- /* butfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
+void register_node_type_cmp_rgbtobw(ListBase *lb)
+{
+ static bNodeType ntype;
-};
-
-
+ node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0,
+ cmp_node_rgbtobw_in, cmp_node_rgbtobw_out);
+ node_type_size(&ntype, 80, 40, 120);
+ node_type_exec(&ntype, node_composit_exec_rgbtobw);
+
+ nodeRegisterType(lb, &ntype);
+}
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_value.c b/source/blender/nodes/intern/CMP_nodes/CMP_value.c
index 14a3b6fe15c..bd5f6853dc5 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_value.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_value.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -35,27 +35,23 @@ static bNodeSocketType cmp_node_value_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
out[0]->vec[0]= sock->ns.vec[0];
}
-bNodeType cmp_node_value= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_VALUE,
- /* name */ "Value",
- /* width+range */ 80, 40, 120,
- /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS,
- /* input sock */ NULL,
- /* output sock */ cmp_node_value_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_value,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-};
+void register_node_type_cmp_value(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS,
+ NULL, cmp_node_value_out);
+ node_type_size(&ntype, 80, 40, 120);
+ node_type_exec(&ntype, node_composit_exec_value);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
index eaeeadd02af..ff17a27d5e5 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -44,7 +44,7 @@ static bNodeSocketType cmp_node_vecblur_out[]= {
-static void node_composit_exec_vecblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
NodeBlurData *nbd= node->storage;
CompBuf *new, *img= in[0]->data, *vecbuf= in[2]->data, *zbuf= in[1]->data;
@@ -91,20 +91,18 @@ static void node_composit_init_vecblur(bNode* node)
};
/* custom1: itterations, custom2: maxspeed (0 = nolimit) */
-bNodeType cmp_node_vecblur= {
- /* next, prev */ NULL, NULL,
- /* type code */ CMP_NODE_VECBLUR,
- /* name */ "Vector Blur",
- /* width+range */ 120, 80, 200,
- /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- /* input sock */ cmp_node_vecblur_in,
- /* output sock */ cmp_node_vecblur_out,
- /* storage */ "NodeBlurData",
- /* execfunc */ node_composit_exec_vecblur,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_vecblur,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-};
+void register_node_type_cmp_vecblur(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
+ cmp_node_vecblur_in, cmp_node_vecblur_out);
+ node_type_size(&ntype, 120, 80, 200);
+ node_type_init(&ntype, node_composit_init_vecblur);
+ node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_vecblur);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
index 80200ad9ce6..18b445c25fd 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -39,7 +39,7 @@ static bNodeSocketType cmp_node_viewer_in[]= {
};
-static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
/* image assigned to output */
/* stack order input sockets: col, alpha, z */
@@ -128,21 +128,18 @@ static void node_composit_init_viewer(bNode* node)
iuser->ok= 1;
}
-bNodeType cmp_node_viewer= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_VIEWER,
- /* name */ "Viewer",
- /* width+range */ 80, 60, 200,
- /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW,
- /* input sock */ cmp_node_viewer_in,
- /* output sock */ NULL,
- /* storage */ "ImageUser",
- /* execfunc */ node_composit_exec_viewer,
- /* butfunc */ NULL,
- /* initfunc */ node_composit_init_viewer,
- /* freestoragefunc */ node_free_standard_storage,
- /* copystoragefunc */ node_copy_standard_storage,
- /* id */ NULL
-
-};
+void register_node_type_cmp_viewer(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW,
+ cmp_node_viewer_in, NULL);
+ node_type_size(&ntype, 80, 60, 200);
+ node_type_init(&ntype, node_composit_init_viewer);
+ node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_viewer);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
index 7be9f34f00b..33e3bd94708 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -31,7 +31,7 @@
/* **************** Z COMBINE ******************** */
- /* lazy coder note: node->custom1 is abused to send signal */
+ /* lazy coder note: node->custom2 is abused to send signal */
static bNodeSocketType cmp_node_zcombine_in[]= {
{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_VALUE, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f},
@@ -47,13 +47,40 @@ static bNodeSocketType cmp_node_zcombine_out[]= {
static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *src2, float *z2)
{
+ float alpha;
+ float malpha;
+
if(*z1 <= *z2) {
- QUATCOPY(out, src1);
+ if (node->custom1) {
+ // use alpha in combine operation
+ alpha= src1[3];
+ malpha= 1.0f - alpha;
+ out[0]= malpha*src2[0] + alpha*src1[0];
+ out[1]= malpha*src2[1] + alpha*src1[1];
+ out[2]= malpha*src2[2] + alpha*src1[2];
+ out[3]= malpha*src2[3] + alpha*src1[3];
+ }
+ else {
+ // do combination based solely on z value
+ QUATCOPY(out, src1);
+ }
}
else {
- QUATCOPY(out, src2);
+ if (node->custom1) {
+ // use alpha in combine operation
+ alpha= src2[3];
+ malpha= 1.0f - alpha;
+ out[0]= malpha*src1[0] + alpha*src2[0];
+ out[1]= malpha*src1[1] + alpha*src2[1];
+ out[2]= malpha*src1[2] + alpha*src2[2];
+ out[3]= malpha*src1[3] + alpha*src2[3];
+ }
+ else {
+ // do combination based solely on z value
+ QUATCOPY(out, src1);
+ }
- if(node->custom1)
+ if(node->custom2)
*z1= *z2;
}
}
@@ -62,20 +89,49 @@ static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2)
{
if(*z1 > *z2) {
*out= 1.0f;
- if(node->custom1)
+ if(node->custom2)
*z1= *z2;
}
}
static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, float *acol)
{
- float alpha= *acol;
- float malpha= 1.0f - alpha;
-
- out[0]= malpha*col1[0] + alpha*col2[0];
- out[1]= malpha*col1[1] + alpha*col2[1];
- out[2]= malpha*col1[2] + alpha*col2[2];
- out[3]= malpha*col1[3] + alpha*col2[3];
+ float alpha;
+ float malpha;
+
+ if (node->custom1) {
+ // use alpha in combine operation, antialiased mask in used here just as hint for the z value
+ if (*acol>0.0f) {
+ alpha= col2[3];
+ malpha= 1.0f - alpha;
+
+
+ out[0]= malpha*col1[0] + alpha*col2[0];
+ out[1]= malpha*col1[1] + alpha*col2[1];
+ out[2]= malpha*col1[2] + alpha*col2[2];
+ out[3]= malpha*col1[3] + alpha*col2[3];
+ }
+ else {
+ alpha= col1[3];
+ malpha= 1.0f - alpha;
+
+
+ out[0]= malpha*col2[0] + alpha*col1[0];
+ out[1]= malpha*col2[1] + alpha*col1[1];
+ out[2]= malpha*col2[2] + alpha*col1[2];
+ out[3]= malpha*col2[3] + alpha*col1[3];
+ }
+ }
+ else {
+ // do combination based solely on z value but with antialiased mask
+ alpha = *acol;
+ malpha= 1.0f - alpha;
+
+ out[0]= malpha*col1[0] + alpha*col2[0];
+ out[1]= malpha*col1[1] + alpha*col2[1];
+ out[2]= malpha*col1[2] + alpha*col2[2];
+ out[3]= malpha*col1[3] + alpha*col2[3];
+ }
}
static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
@@ -107,11 +163,11 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
*zval= in[1]->vec[0];
}
/* lazy coder hack */
- node->custom1= 1;
+ node->custom2= 1;
out[1]->data= zbuf;
}
else {
- node->custom1= 0;
+ node->custom2= 0;
zbuf= in[1]->data;
}
@@ -163,20 +219,15 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
}
-bNodeType cmp_node_zcombine= {
- /* *next,*prev */ NULL, NULL,
- /* type code */ CMP_NODE_ZCOMBINE,
- /* name */ "Z Combine",
- /* width+range */ 80, 40, 120,
- /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- /* input sock */ cmp_node_zcombine_in,
- /* output sock */ cmp_node_zcombine_out,
- /* storage */ "",
- /* execfunc */ node_composit_exec_zcombine,
- /* butfunc */ NULL,
- /* initfunc */ NULL,
- /* freestoragefunc */ NULL,
- /* copystoragefunc */ NULL,
- /* id */ NULL
-
-};
+void register_node_type_cmp_zcombine(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
+ cmp_node_zcombine_in, cmp_node_zcombine_out);
+ node_type_size(&ntype, 80, 40, 120);
+ node_type_exec(&ntype, node_composit_exec_zcombine);
+
+ nodeRegisterType(lb, &ntype);
+}
+
diff --git a/source/blender/nodes/intern/CMP_nodes/Makefile b/source/blender/nodes/intern/CMP_nodes/Makefile
deleted file mode 100644
index 5e97864fb95..00000000000
--- a/source/blender/nodes/intern/CMP_nodes/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = nodes_cmp
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-CFLAGS += $(LEVEL_1_C_WARNINGS)
-
-CPPFLAGS += -I../../../blenkernel
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-CPPFLAGS += -I../../../makesdna
-CPPFLAGS += -I../../../makesrna
-CPPFLAGS += -I../../../blenlib
-CPPFLAGS += -I../../../editors/include
-CPPFLAGS += -I../../../imbuf
-CPPFLAGS += -I../../../render/extern/include
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(OPENGL_HEADERS)