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:
authorJoseph Eagar <joeedh@gmail.com>2011-05-09 03:43:18 +0400
committerJoseph Eagar <joeedh@gmail.com>2011-05-09 03:43:18 +0400
commit6ef77cf95accc3cb914e7efd964118ce6e9521cf (patch)
tree1d8dbf95355038c93f79f9053a0bf1d55b561ec3 /source/blender/nodes
parent3462ddf17f38eb61fc3bb2751d55de15a47455c3 (diff)
parent770119d16f7dbee99a60d19540818892c970c4e2 (diff)
=bmesh= merge from trunk at r36529
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_blur.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c100
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c94
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c28
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c193
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_crop.c26
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_curves.c10
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_defocus.c26
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c72
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_displace.c14
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c62
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c10
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c8
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_image.c132
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_invert.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c28
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_levels.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c8
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_math.c16
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_rotate.c91
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c72
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c12
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c8
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_viewer.c10
-rw-r--r--source/blender/nodes/intern/CMP_util.c130
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_curves.c4
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_geom.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_mapping.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_material.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c8
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_curves.c6
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_image.c10
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_math.c12
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c8
-rw-r--r--source/blender/nodes/intern/TEX_util.c2
39 files changed, 619 insertions, 601 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
index cba7e150633..9dcdfaf21e6 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
@@ -142,7 +142,7 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS
static void node_alphaover_init(bNode* node)
{
- node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
+ node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
}
void register_node_type_cmp_alphaover(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
index 1031ab3d360..2b33126b3a7 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
@@ -715,7 +715,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
static void node_composit_init_blur(bNode* node)
{
- node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data");
+ node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data");
}
void register_node_type_cmp_blur(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
index cdd360dc0fe..b32c531d8f9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
@@ -74,34 +74,34 @@ static void do_channel_matte(bNode *node, float *out, float *in)
float alpha=0.0;
switch(c->algorithm) {
- case 0: { /* Alpha=key_channel-limit channel */
- int key_channel=node->custom2-1;
- int limit_channel=c->channel-1;
- alpha=in[key_channel]-in[limit_channel];
- break;
- }
- case 1: { /* Alpha=G-MAX(R, B) */
- switch(node->custom2) {
+ case 0: { /* Alpha=key_channel-limit channel */
+ int key_channel=node->custom2-1;
+ int limit_channel=c->channel-1;
+ alpha=in[key_channel]-in[limit_channel];
+ break;
+ }
+ case 1: { /* Alpha=G-MAX(R, B) */
+ switch(node->custom2) {
case 1: {
- alpha=in[0]-MAX2(in[1],in[2]);
- break;
- }
+ alpha=in[0]-MAX2(in[1],in[2]);
+ break;
+ }
case 2: {
- alpha=in[1]-MAX2(in[0],in[2]);
- break;
- }
+ alpha=in[1]-MAX2(in[0],in[2]);
+ break;
+ }
case 3: {
- alpha=in[2]-MAX2(in[0],in[1]);
- break;
- }
+ alpha=in[2]-MAX2(in[0],in[1]);
+ break;
+ }
default:
break;
- }
- }
- default:
- break;
- }
-
+ }
+ }
+ default:
+ break;
+ }
+
/*flip because 0.0 is transparent, not 1.0*/
alpha=1-alpha;
@@ -124,7 +124,6 @@ static void do_channel_matte(bNode *node, float *out, float *in)
else {
out[3]=in[3];
}
-
}
static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
@@ -132,7 +131,7 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
CompBuf *cbuf;
CompBuf *outbuf;
- if(in[0]->hasinput==0) return;
+ if(in[0]->hasinput==0) return;
if(in[0]->data==NULL) return;
if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
@@ -142,24 +141,24 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
/*convert to colorspace*/
switch(node->custom1) {
- case CMP_NODE_CHANNEL_MATTE_CS_RGB:
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
- composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_hsva, CB_RGBA);
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/
- composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_yuva, CB_RGBA);
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/
- composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_normalized_rgba_to_ycca2, CB_RGBA);
- break;
- default:
- break;
+ case CMP_NODE_CHANNEL_MATTE_CS_RGB:
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
+ composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_hsva, CB_RGBA);
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/
+ composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_yuva, CB_RGBA);
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/
+ composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_normalized_rgba_to_ycca2, CB_RGBA);
+ break;
+ default:
+ break;
}
/*use the selected channel information to do the key */
composit1_pixel_processor(node, outbuf, outbuf, in[1]->vec, do_channel_matte, CB_RGBA);
-
+
/*convert back to RGB colorspace in place*/
switch(node->custom1) {
case CMP_NODE_CHANNEL_MATTE_CS_RGB: /*RGB*/
@@ -189,17 +188,17 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
static void node_composit_init_channel_matte(bNode *node)
{
- NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
- node->storage=c;
- c->t1= 1.0f;
- c->t2= 0.0f;
- c->t3= 0.0f;
- c->fsize= 0.0f;
- c->fstrength= 0.0f;
- c->algorithm=1; /*max channel limiting */
- c->channel=1; /* limit by red */
- node->custom1= 1; /* RGB channel */
- node->custom2= 2; /* Green Channel */
+ NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
+ node->storage=c;
+ c->t1= 1.0f;
+ c->t2= 0.0f;
+ c->t3= 0.0f;
+ c->fsize= 0.0f;
+ c->fstrength= 0.0f;
+ c->algorithm=1; /*max channel limiting */
+ c->channel=1; /* limit by red */
+ node->custom1= 1; /* RGB channel */
+ node->custom2= 2; /* Green Channel */
}
void register_node_type_cmp_channel_matte(ListBase *lb)
@@ -215,4 +214,3 @@ void register_node_type_cmp_channel_matte(ListBase *lb)
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 fc0e9b3ee4b..03230f2e212 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
@@ -49,17 +49,17 @@ static bNodeSocketType cmp_node_chroma_out[]={
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);
+ rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
- //normalize to 0..1.0
- out[0]=out[0]/255.0;
- out[1]=out[1]/255.0;
- out[2]=out[2]/255.0;
+ //normalize to 0..1.0
+ out[0]=out[0]/255.0;
+ out[1]=out[1]/255.0;
+ out[2]=out[2]/255.0;
- //rescale to -1.0..1.0
- out[0]=(out[0]*2.0)-1.0;
- out[1]=(out[1]*2.0)-1.0;
- out[2]=(out[2]*2.0)-1.0;
+ //rescale to -1.0..1.0
+ out[0]=(out[0]*2.0)-1.0;
+ out[1]=(out[1]*2.0)-1.0;
+ out[2]=(out[2]*2.0)-1.0;
// out[0]=((out[0])-16)/255.0;
// out[1]=((out[1])-128)/255.0;
@@ -69,16 +69,16 @@ static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *i
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;
- in[1]=(in[1]+1.0)/2.0;
- in[2]=(in[2]+1.0)/2.0;
+ /*un-normalize the normalize from above */
+ in[0]=(in[0]+1.0)/2.0;
+ in[1]=(in[1]+1.0)/2.0;
+ in[2]=(in[2]+1.0)/2.0;
- in[0]=(in[0]*255.0);
- in[1]=(in[1]*255.0);
- in[2]=(in[2]*255.0);
+ in[0]=(in[0]*255.0);
+ in[1]=(in[1]*255.0);
+ in[2]=(in[2]*255.0);
-// in[0]=(in[0]*255.0)+16;
+ // in[0]=(in[0]*255.0)+16;
// in[1]=(in[1]*255.0)+128;
// in[2]=(in[2]*255.0)+128;
ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
@@ -88,41 +88,41 @@ static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *i
static void do_chroma_key(bNode *node, float *out, float *in)
{
NodeChroma *c;
- float x, z, alpha;
- float theta, beta, angle, angle2;
- float kfg;
+ float x, z, alpha;
+ float theta, beta, angle, angle2;
+ float kfg;
c=node->storage;
- /* Algorithm from book "Video Demistified," does not include the spill reduction part */
+ /* Algorithm from book "Video Demistified," does not include the spill reduction part */
/* find theta, the angle that the color space should be rotated based on key*/
- theta=atan2(c->key[2], c->key[1]);
+ theta=atan2(c->key[2], c->key[1]);
/*rotate the cb and cr into x/z space */
- x=in[1]*cos(theta)+in[2]*sin(theta);
- z=in[2]*cos(theta)-in[1]*sin(theta);
+ x=in[1]*cos(theta)+in[2]*sin(theta);
+ z=in[2]*cos(theta)-in[1]*sin(theta);
- /*if within the acceptance angle */
- angle=c->t1*M_PI/180.0; /* convert to radians */
-
- /* if kfg is <0 then the pixel is outside of the key color */
- kfg=x-(fabs(z)/tan(angle/2.0));
+ /*if within the acceptance angle */
+ angle=c->t1*M_PI/180.0; /* convert to radians */
+
+ /* if kfg is <0 then the pixel is outside of the key color */
+ kfg=x-(fabs(z)/tan(angle/2.0));
- out[0]=in[0];
- out[1]=in[1];
- out[2]=in[2];
+ out[0]=in[0];
+ out[1]=in[1];
+ out[2]=in[2];
- if(kfg>0.0) { /* found a pixel that is within key color */
- alpha=(1.0-kfg)*(c->fstrength);
+ if(kfg>0.0) { /* found a pixel that is within key color */
+ alpha=(1.0-kfg)*(c->fstrength);
- beta=atan2(z,x);
- angle2=c->t2*M_PI/180.0;
+ beta=atan2(z,x);
+ angle2=c->t2*M_PI/180.0;
- /* if beta is within the cutoff angle */
- if(fabs(beta)<(angle2/2.0)) {
- alpha=0.0;
- }
+ /* if beta is within the cutoff angle */
+ if(fabs(beta)<(angle2/2.0)) {
+ alpha=0.0;
+ }
/* don't make something that was more transparent less transparent */
if (alpha<in[3]) {
@@ -180,13 +180,13 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack
static void node_composit_init_chroma_matte(bNode *node)
{
- NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
- node->storage= c;
- c->t1= 30.0f;
- c->t2= 10.0f;
- c->t3= 0.0f;
- c->fsize= 0.0f;
- c->fstrength= 1.0f;
+ NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
+ node->storage= c;
+ c->t1= 30.0f;
+ c->t2= 10.0f;
+ c->t3= 0.0f;
+ c->fsize= 0.0f;
+ c->fstrength= 1.0f;
}
void register_node_type_cmp_chroma_matte(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
index 90916284f1e..151850105b7 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
@@ -53,14 +53,14 @@ static void do_color_key(bNode *node, float *out, float *in)
c=node->storage;
- VECCOPY(out, in);
+ VECCOPY(out, in);
- if(fabs(in[0]-c->key[0]) < c->t1 &&
- fabs(in[1]-c->key[1]) < c->t2 &&
- fabs(in[2]-c->key[2]) < c->t3)
- {
- out[3]=0.0; /*make transparent*/
- }
+ if(fabs(in[0]-c->key[0]) < c->t1 &&
+ fabs(in[1]-c->key[1]) < c->t2 &&
+ fabs(in[2]-c->key[2]) < c->t3)
+ {
+ out[3]=0.0; /*make transparent*/
+ }
else { /*pixel is outside key color */
out[3]=in[3]; /* make pixel just as transparent as it was before */
@@ -108,13 +108,13 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack *
static void node_composit_init_color_matte(bNode *node)
{
- NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node color");
- node->storage= c;
- c->t1= 0.01f;
- c->t2= 0.1f;
- c->t3= 0.1f;
- c->fsize= 0.0f;
- c->fstrength= 1.0f;
+ NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node color");
+ node->storage= c;
+ c->t1= 0.01f;
+ c->t2= 0.1f;
+ c->t3= 0.1f;
+ c->fsize= 0.0f;
+ c->fstrength= 1.0f;
}
void register_node_type_cmp_color_matte(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
index c9997ba8a75..905d97709c3 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
@@ -39,8 +39,8 @@
/* ******************* Color Spill Supression ********************************* */
static bNodeSocketType cmp_node_color_spill_in[]={
- {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+ {SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{-1,0,""}
};
@@ -51,17 +51,17 @@ static bNodeSocketType cmp_node_color_spill_out[]={
static void do_simple_spillmap_red(bNode *node, float* out, float *in)
{
- NodeColorspill *ncs;
+ NodeColorspill *ncs;
ncs=node->storage;
out[0]=in[0]-( ncs->limscale * in[ncs->limchan] );
}
static void do_simple_spillmap_red_fac(bNode *node, float* out, float *in, float *fac)
{
- NodeColorspill *ncs;
- ncs=node->storage;
+ NodeColorspill *ncs;
+ ncs=node->storage;
- out[0] = *fac * (in[0]-( ncs->limscale * in[ncs->limchan]));
+ out[0] = *fac * (in[0]-( ncs->limscale * in[ncs->limchan]));
}
static void do_simple_spillmap_green(bNode *node, float* out, float *in)
@@ -73,10 +73,10 @@ static void do_simple_spillmap_green(bNode *node, float* out, float *in)
static void do_simple_spillmap_green_fac(bNode *node, float* out, float *in, float *fac)
{
- NodeColorspill *ncs;
- ncs=node->storage;
+ NodeColorspill *ncs;
+ ncs=node->storage;
- out[0] = *fac * (in[1]-( ncs->limscale * in[ncs->limchan]));
+ out[0] = *fac * (in[1]-( ncs->limscale * in[ncs->limchan]));
}
static void do_simple_spillmap_blue(bNode *node, float* out, float *in)
@@ -88,10 +88,10 @@ static void do_simple_spillmap_blue(bNode *node, float* out, float *in)
static void do_simple_spillmap_blue_fac(bNode *node, float* out, float *in, float *fac)
{
- NodeColorspill *ncs;
- ncs=node->storage;
+ NodeColorspill *ncs;
+ ncs=node->storage;
- out[0] = *fac * (in[2]-( ncs->limscale * in[ncs->limchan]));
+ out[0] = *fac * (in[2]-( ncs->limscale * in[ncs->limchan]));
}
static void do_average_spillmap_red(bNode *node, float* out, float *in)
@@ -103,10 +103,10 @@ static void do_average_spillmap_red(bNode *node, float* out, float *in)
static void do_average_spillmap_red_fac(bNode *node, float* out, float *in, float *fac)
{
- NodeColorspill *ncs;
- ncs=node->storage;
+ NodeColorspill *ncs;
+ ncs=node->storage;
- out[0] = *fac * (in[0]-(ncs->limscale * avg(in[1], in[2]) ));
+ out[0] = *fac * (in[0]-(ncs->limscale * avg(in[1], in[2]) ));
}
static void do_average_spillmap_green(bNode *node, float* out, float *in)
@@ -118,10 +118,10 @@ static void do_average_spillmap_green(bNode *node, float* out, float *in)
static void do_average_spillmap_green_fac(bNode *node, float* out, float *in, float *fac)
{
- NodeColorspill *ncs;
- ncs=node->storage;
+ NodeColorspill *ncs;
+ ncs=node->storage;
- out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[2]) ));
+ out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[2]) ));
}
static void do_average_spillmap_blue(bNode *node, float* out, float *in)
@@ -133,10 +133,10 @@ static void do_average_spillmap_blue(bNode *node, float* out, float *in)
static void do_average_spillmap_blue_fac(bNode *node, float* out, float *in, float *fac)
{
- NodeColorspill *ncs;
- ncs=node->storage;
+ NodeColorspill *ncs;
+ ncs=node->storage;
- out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[1]) ));
+ out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[1]) ));
}
static void do_apply_spillmap_red(bNode *node, float* out, float *in, float *map)
@@ -189,48 +189,47 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma
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
- discussions from vfxtalk.com.*/
- CompBuf *cbuf;
- CompBuf *mask;
+ /* Originally based on the information from the book "The Art and Science of Digital Composition" and
+ * discussions from vfxtalk.com .*/
+ CompBuf *cbuf;
+ CompBuf *mask;
CompBuf *rgbbuf;
CompBuf *spillmap;
NodeColorspill *ncs;
ncs=node->storage;
- /* early out for missing connections */
- if(out[0]->hasoutput==0 ) return;
- if(in[0]->hasinput==0) return;
- if(in[0]->data==NULL) return;
+ /* early out for missing connections */
+ if(out[0]->hasoutput==0 ) return;
+ if(in[0]->hasinput==0) return;
+ if(in[0]->data==NULL) return;
- cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
- mask=typecheck_compbuf(in[1]->data, CB_VAL);
+ cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
+ mask=typecheck_compbuf(in[1]->data, CB_VAL);
spillmap=alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
rgbbuf=dupalloc_compbuf(cbuf);
switch(node->custom1)
{
- case 1: /*red spill*/
+ case 1: /*red spill*/
{
switch(node->custom2)
{
- case 0: /* simple limit */
- {
- if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
- composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_red, CB_RGBA);
- } else {
- composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_red_fac, CB_RGBA, CB_VAL);
- }
+ case 0: /* simple limit */
+ {
+ if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+ composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_red, CB_RGBA);
+ } else {
+ composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_red_fac, CB_RGBA, CB_VAL);
+ }
break;
}
- case 1: /* average limit */
- {
- if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
- composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_red, CB_RGBA);
- } else {
- composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_red_fac, CB_RGBA, CB_VAL);
- }
+ case 1: /* average limit */
+ {
+ if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+ composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_red, CB_RGBA);
+ } else {
+ composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_red_fac, CB_RGBA, CB_VAL);
+ }
break;
}
}
@@ -242,59 +241,59 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_red, CB_RGBA, CB_VAL);
break;
}
- case 2: /*green spill*/
+ case 2: /*green spill*/
{
switch(node->custom2)
{
- case 0: /* simple limit */
- {
- if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
- composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_green, CB_RGBA);
- } else {
- composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_green_fac, CB_RGBA, CB_VAL);
- }
- break;
- }
- case 1: /* average limit */
- {
- if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
- composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_green, CB_RGBA);
- } else {
- composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_green_fac, CB_RGBA, CB_VAL);
- }
- break;
- }
+ case 0: /* simple limit */
+ {
+ if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+ composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_green, CB_RGBA);
+ } else {
+ composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_green_fac, CB_RGBA, CB_VAL);
+ }
+ break;
+ }
+ case 1: /* average limit */
+ {
+ if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+ composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_green, CB_RGBA);
+ } else {
+ composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_green_fac, CB_RGBA, CB_VAL);
+ }
+ break;
+ }
}
if(ncs->unspill==0) {
ncs->uspillr=0.0f;
ncs->uspillg=1.0f;
ncs->uspillb=0.0f;
- }
+ }
composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_green, CB_RGBA, CB_VAL);
break;
}
- case 3: /*blue spill*/
+ case 3: /*blue spill*/
{
switch(node->custom2)
{
- case 0: /* simple limit */
- {
- if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
- composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_blue, CB_RGBA);
- } else {
- composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_blue_fac, CB_RGBA, CB_VAL);
- }
- break;
- }
- case 1: /* average limit */
- {
- if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
- composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_blue, CB_RGBA);
- } else {
- composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_blue_fac, CB_RGBA, CB_VAL);
- }
- break;
- }
+ case 0: /* simple limit */
+ {
+ if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+ composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_blue, CB_RGBA);
+ } else {
+ composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_blue_fac, CB_RGBA, CB_VAL);
+ }
+ break;
+ }
+ case 1: /* average limit */
+ {
+ if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
+ composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_blue, CB_RGBA);
+ } else {
+ composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_blue_fac, CB_RGBA, CB_VAL);
+ }
+ break;
+ }
}
if(ncs->unspill==0) {
ncs->uspillr=0.0f;
@@ -304,27 +303,27 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_blue, CB_RGBA, CB_VAL);
break;
}
- default:
- break;
+ default:
+ break;
}
out[0]->data=rgbbuf;
if(cbuf!=in[0]->data)
free_compbuf(cbuf);
-
- free_compbuf(spillmap);
+
+ free_compbuf(spillmap);
}
static void node_composit_init_color_spill(bNode *node)
{
- NodeColorspill *ncs= MEM_callocN(sizeof(NodeColorspill), "node colorspill");
- node->storage=ncs;
- node->custom1= 2; /* green channel */
- node->custom2= 0; /* simple limit algo*/
- ncs->limchan= 0; /* limit by red */
- ncs->limscale= 1.0f; /* limit scaling factor */
- ncs->unspill=0; /* do not use unspill */
+ NodeColorspill *ncs= MEM_callocN(sizeof(NodeColorspill), "node colorspill");
+ node->storage=ncs;
+ node->custom1= 2; /* green channel */
+ node->custom2= 0; /* simple limit algo*/
+ ncs->limchan= 0; /* limit by red */
+ ncs->limscale= 1.0f; /* limit scaling factor */
+ ncs->unspill=0; /* do not use unspill */
}
void register_node_type_cmp_color_spill(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
index 5a0e2047ed7..0331217f0cb 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
@@ -53,14 +53,14 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
CompBuf *stackbuf;
int x, y;
float *srcfp, *outfp;
- rcti outputrect;
+ rcti outputrect;
- if(node->custom2) {
- ntxy->x1= cbuf->x* ntxy->fac_x1;
- ntxy->x2= cbuf->x* ntxy->fac_x2;
- ntxy->y1= cbuf->y* ntxy->fac_y1;
- ntxy->y2= cbuf->y* ntxy->fac_y2;
- }
+ if(node->custom2) {
+ ntxy->x1= cbuf->x* ntxy->fac_x1;
+ ntxy->x2= cbuf->x* ntxy->fac_x2;
+ ntxy->y1= cbuf->y* ntxy->fac_y1;
+ ntxy->y2= cbuf->y* ntxy->fac_y2;
+ }
/* check input image size */
if(cbuf->x <= ntxy->x1 + 1)
@@ -105,12 +105,12 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
static void node_composit_init_crop(bNode* node)
{
- NodeTwoXYs *nxy= MEM_callocN(sizeof(NodeTwoXYs), "node xy data");
- node->storage= nxy;
- nxy->x1= 0;
- nxy->x2= 0;
- nxy->y1= 0;
- nxy->y2= 0;
+ NodeTwoXYs *nxy= MEM_callocN(sizeof(NodeTwoXYs), "node xy data");
+ node->storage= nxy;
+ nxy->x1= 0;
+ nxy->x2= 0;
+ nxy->y1= 0;
+ nxy->y2= 0;
}
void register_node_type_cmp_crop(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
index f0b399ae1e8..921c5e21fea 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
@@ -59,9 +59,9 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack *
static void node_composit_init_curves_time(bNode* node)
{
- node->custom1= 1;
- node->custom2= 250;
- node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+ node->custom1= 1;
+ node->custom2= 250;
+ node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
}
void register_node_type_cmp_curve_time(ListBase *lb)
@@ -102,7 +102,7 @@ static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeS
static void node_composit_init_curve_vec(bNode* node)
{
- node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
+ node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
}
void register_node_type_cmp_curve_vec(ListBase *lb)
@@ -189,7 +189,7 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
static void node_composit_init_curve_rgb(bNode* node)
{
- node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
+ node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
}
void register_node_type_cmp_curve_rgb(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
index 303d5ee01aa..f249e2cff6c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
@@ -859,19 +859,19 @@ static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeSta
static void node_composit_init_defocus(bNode* node)
{
- /* qdn: defocus node */
- NodeDefocus *nbd = MEM_callocN(sizeof(NodeDefocus), "node defocus data");
- nbd->bktype = 0;
- nbd->rotation = 0.f;
- nbd->preview = 1;
- nbd->gamco = 0;
- nbd->samples = 16;
- nbd->fstop = 128.f;
- nbd->maxblur = 0;
- nbd->bthresh = 1.f;
- nbd->scale = 1.f;
- nbd->no_zbuf = 1;
- node->storage = nbd;
+ /* qdn: defocus node */
+ NodeDefocus *nbd = MEM_callocN(sizeof(NodeDefocus), "node defocus data");
+ nbd->bktype = 0;
+ nbd->rotation = 0.f;
+ nbd->preview = 1;
+ nbd->gamco = 0;
+ nbd->samples = 16;
+ nbd->fstop = 128.f;
+ nbd->maxblur = 0;
+ nbd->bthresh = 1.f;
+ nbd->scale = 1.f;
+ nbd->no_zbuf = 1;
+ node->storage = nbd;
}
void register_node_type_cmp_defocus(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
index f0e112761e3..296053298da 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
@@ -51,35 +51,35 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *
{
NodeChroma *c= (NodeChroma *)node->storage;
float tolerence=c->t1;
- float falloff=c->t2;
+ float falloff=c->t2;
float difference;
- float alpha;
-
- difference=fabs(inColor2[0]-inColor1[0])+
+ float alpha;
+
+ difference= fabs(inColor2[0]-inColor1[0])+
fabs(inColor2[1]-inColor1[1])+
fabs(inColor2[2]-inColor1[2]);
- /*average together the distances*/
- difference=difference/3.0;
+ /*average together the distances*/
+ difference=difference/3.0;
- VECCOPY(outColor, inColor1);
+ VECCOPY(outColor, inColor1);
- /*make 100% transparent*/
- if(difference < tolerence){
- outColor[3]=0.0;
+ /*make 100% transparent*/
+ if(difference < tolerence) {
+ outColor[3]=0.0;
+ }
+ /*in the falloff region, make partially transparent */
+ else if(difference < falloff+tolerence) {
+ difference=difference-tolerence;
+ alpha=difference/falloff;
+ /*only change if more transparent than before */
+ if(alpha < inColor1[3]) {
+ outColor[3]=alpha;
+ }
+ else { /* leave as before */
+ outColor[3]=inColor1[3];
+ }
}
- /*in the falloff region, make partially transparent */
- else if(difference < falloff+tolerence){
- difference=difference-tolerence;
- alpha=difference/falloff;
- /*only change if more transparent than before */
- if(alpha < inColor1[3]) {
- outColor[3]=alpha;
- }
- else { /* leave as before */
- outColor[3]=inColor1[3];
- }
- }
else {
/*foreground object*/
outColor[3]= inColor1[3];
@@ -90,29 +90,29 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
{
CompBuf *outbuf=0;
CompBuf *imbuf1=0;
- CompBuf *imbuf2=0;
+ CompBuf *imbuf2=0;
NodeChroma *c;
-
+
/*is anything connected?*/
if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
/*must have an image imput*/
if(in[0]->data==NULL) return;
-
+
imbuf1=typecheck_compbuf(in[0]->data, CB_RGBA);
- /* if there's an image, use that, if not use the color */
- if(in[1]->data) {
- imbuf2=typecheck_compbuf(in[1]->data, CB_RGBA);
- }
-
+ /* if there's an image, use that, if not use the color */
+ if(in[1]->data) {
+ imbuf2=typecheck_compbuf(in[1]->data, CB_RGBA);
+ }
+
c=node->storage;
outbuf=dupalloc_compbuf(imbuf1);
-
+
/* note, processor gets a keyvals array passed on as buffer constant */
composit2_pixel_processor(node, outbuf, imbuf1, in[0]->vec, imbuf2, in[1]->vec, do_diff_matte, CB_RGBA, CB_RGBA);
-
+
out[0]->data=outbuf;
if(out[1]->hasoutput)
out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
@@ -127,10 +127,10 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
static void node_composit_init_diff_matte(bNode *node)
{
- NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
- node->storage= c;
- c->t1= 0.1f;
- c->t2= 0.1f;
+ NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
+ node->storage= c;
+ c->t1= 0.1f;
+ c->t2= 0.1f;
}
void register_node_type_cmp_diff_matte(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
index d52a47993d2..9139edf8560 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
@@ -53,7 +53,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 *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale)
+static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale)
{
ImBuf *ibuf;
int x, y;
@@ -83,6 +83,10 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
else
ys = yscale[0];
+ /* clamp x and y displacement to triple image resolution -
+ * to prevent hangs from huge values mistakenly plugged in eg. z buffers */
+ CLAMP(xs, -stackbuf->x*4, stackbuf->x*4);
+ CLAMP(ys, -stackbuf->y*4, stackbuf->y*4);
p_dx = vec[0] * xs;
p_dy = vec[1] * ys;
@@ -114,7 +118,11 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
ibuf_sample(ibuf, u, v, dxt, dyt, col);
qd_setPixel(stackbuf, x, y, col);
+
+ if(node->exec & NODE_BREAK) break;
}
+
+ if(node->exec & NODE_BREAK) break;
}
IMB_freeImBuf(ibuf);
@@ -145,7 +153,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
}
-static void node_composit_exec_displace(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
@@ -164,7 +172,7 @@ static void node_composit_exec_displace(void *UNUSED(data), bNode *UNUSED(node),
stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
- do_displace(stackbuf, cbuf, vecbuf, in[1]->vec, xbuf, ybuf, in[2]->vec, in[3]->vec);
+ do_displace(node, stackbuf, cbuf, vecbuf, in[1]->vec, xbuf, ybuf, in[2]->vec, in[3]->vec);
out[0]->data= stackbuf;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
index 3eb38465c4f..5f7613464c1 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
@@ -53,42 +53,42 @@ static void do_distance_matte(bNode *node, float *out, float *in)
{
NodeChroma *c= (NodeChroma *)node->storage;
float tolerence=c->t1;
- float falloff=c->t2;
+ float falloff=c->t2;
float distance;
- float alpha;
-
- distance=sqrt((c->key[0]-in[0])*(c->key[0]-in[0]) +
+ float alpha;
+
+ distance=sqrt((c->key[0]-in[0])*(c->key[0]-in[0]) +
(c->key[1]-in[1])*(c->key[1]-in[1]) +
(c->key[2]-in[2])*(c->key[2]-in[2]));
- VECCOPY(out, in);
-
- /*make 100% transparent */
- if(distance < tolerence) {
- out[3]=0.0;
- }
- /*in the falloff region, make partially transparent */
- else if(distance < falloff+tolerence){
- distance=distance-tolerence;
- alpha=distance/falloff;
- /*only change if more transparent than before */
- if(alpha < in[3]) {
- out[3]=alpha;
- }
- else { /* leave as before */
- out[3]=in[3];
- }
- }
- else {
- out[3]=in[3];
- }
+ VECCOPY(out, in);
+
+ /*make 100% transparent */
+ if(distance < tolerence) {
+ out[3]=0.0;
+ }
+ /*in the falloff region, make partially transparent */
+ else if(distance < falloff+tolerence){
+ distance=distance-tolerence;
+ alpha=distance/falloff;
+ /*only change if more transparent than before */
+ if(alpha < in[3]) {
+ out[3]=alpha;
+ }
+ else { /* leave as before */
+ out[3]=in[3];
+ }
+ }
+ else {
+ out[3]=in[3];
+ }
}
static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
/*
- Losely based on the Sequencer chroma key plug-in, but enhanced to work in other color spaces and
- uses a differnt difference function (suggested in forums of vfxtalk.com).
+ Loosely based on the Sequencer chroma key plug-in, but enhanced to work in other color spaces and
+ uses a different difference function (suggested in forums of vfxtalk.com).
*/
CompBuf *workbuf;
CompBuf *inbuf;
@@ -124,10 +124,10 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
static void node_composit_init_distance_matte(bNode *node)
{
- NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
- node->storage= c;
- c->t1= 0.1f;
- c->t2= 0.1f;
+ NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
+ node->storage= c;
+ c->t1= 0.1f;
+ c->t2= 0.1f;
}
void register_node_type_cmp_distance_matte(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
index 238f9b063c2..7b5511c699c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
@@ -97,11 +97,11 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta
static void node_composit_init_hue_sat(bNode* node)
{
- NodeHueSat *nhs= MEM_callocN(sizeof(NodeHueSat), "node hue sat");
- node->storage= nhs;
- nhs->hue= 0.5f;
- nhs->sat= 1.0f;
- nhs->val= 1.0f;
+ NodeHueSat *nhs= MEM_callocN(sizeof(NodeHueSat), "node hue sat");
+ node->storage= nhs;
+ nhs->hue= 0.5f;
+ nhs->sat= 1.0f;
+ nhs->val= 1.0f;
}
void register_node_type_cmp_hue_sat(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
index ce5092e2859..edf6c454285 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
@@ -53,7 +53,7 @@ static void do_huecorrect(bNode *node, float *out, float *in)
/* adjust hue, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(node->storage, 0, hsv[0]);
- hsv[0] *= (f * 2.f);
+ hsv[0] += f-0.5f;
/* adjust saturation, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(node->storage, 1, hsv[0]);
@@ -63,7 +63,7 @@ static void do_huecorrect(bNode *node, float *out, float *in)
f = curvemapping_evaluateF(node->storage, 2, hsv[0]);
hsv[2] *= (f * 2.f);
- CLAMP(hsv[0], 0.f, 1.f);
+ hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */
CLAMP(hsv[1], 0.f, 1.f);
/* convert back to rgb */
@@ -81,7 +81,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac)
/* adjust hue, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(node->storage, 0, hsv[0]);
- hsv[0] *= (f * 2.f);
+ hsv[0] += f-0.5f;
/* adjust saturation, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(node->storage, 1, hsv[0]);
@@ -91,7 +91,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac)
f = curvemapping_evaluateF(node->storage, 2, hsv[0]);
hsv[2] *= (f * 2.f);
- CLAMP(hsv[0], 0.f, 1.f);
+ hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */
CLAMP(hsv[1], 0.f, 1.f);
/* convert back to rgb */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
index 1ea3cf96ad0..3caaad26bae 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
@@ -294,12 +294,12 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
static void node_composit_init_image(bNode* node)
{
- ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
- node->storage= iuser;
- iuser->frames= 1;
- iuser->sfra= 1;
- iuser->fie_ima= 2;
- iuser->ok= 1;
+ ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
+ node->storage= iuser;
+ iuser->frames= 1;
+ iuser->sfra= 1;
+ iuser->fie_ima= 2;
+ iuser->ok= 1;
}
void register_node_type_cmp_image(ListBase *lb)
@@ -321,27 +321,27 @@ void register_node_type_cmp_image(ListBase *lb)
static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, int recty, int passcode)
{
- float *fp= RE_RenderLayerGetPass(rl, passcode);
- if(fp) {
- CompBuf *buf;
- int buftype= CB_VEC3;
-
- if(ELEM3(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST))
- buftype= CB_VAL;
- else if(passcode==SCE_PASS_VECTOR)
- buftype= CB_VEC4;
- else if(ELEM(passcode, SCE_PASS_COMBINED, SCE_PASS_RGBA))
- buftype= CB_RGBA;
-
- if(rd->scemode & R_COMP_CROP)
- buf= get_cropped_compbuf(&rd->disprect, fp, rectx, recty, buftype);
- else {
- buf= alloc_compbuf(rectx, recty, buftype, 0);
- buf->rect= fp;
- }
- return buf;
- }
- return NULL;
+ float *fp= RE_RenderLayerGetPass(rl, passcode);
+ if(fp) {
+ CompBuf *buf;
+ int buftype= CB_VEC3;
+
+ if(ELEM3(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST))
+ buftype= CB_VAL;
+ else if(passcode==SCE_PASS_VECTOR)
+ buftype= CB_VEC4;
+ else if(ELEM(passcode, SCE_PASS_COMBINED, SCE_PASS_RGBA))
+ buftype= CB_RGBA;
+
+ if(rd->scemode & R_COMP_CROP)
+ buf= get_cropped_compbuf(&rd->disprect, fp, rectx, recty, buftype);
+ else {
+ buf= alloc_compbuf(rectx, recty, buftype, 0);
+ buf->rect= fp;
+ }
+ return buf;
+ }
+ return NULL;
}
static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out, int rectx, int recty)
@@ -383,51 +383,51 @@ static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStac
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;
- RenderData *rd= data;
- RenderResult *rr= NULL;
-
- if(re)
- rr= RE_AcquireResultRead(re);
-
- if(rr) {
- SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
- if(srl) {
- RenderLayer *rl= RE_GetRenderLayer(rr, srl->name);
- if(rl && rl->rectf) {
- CompBuf *stackbuf;
-
- /* we put render rect on stack, cbuf knows rect is from other ibuf when freed! */
- if(rd->scemode & R_COMP_CROP)
- stackbuf= get_cropped_compbuf(&rd->disprect, rl->rectf, rr->rectx, rr->recty, CB_RGBA);
- else {
- stackbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 0);
- stackbuf->rect= rl->rectf;
- }
- if(stackbuf==NULL) {
- printf("Error; Preview Panel in UV Window returns zero sized image\n");
- }
- else {
- stackbuf->xof= rr->xof;
- stackbuf->yof= rr->yof;
+ Scene *sce= (Scene *)node->id;
+ Render *re= (sce)? RE_GetRender(sce->id.name): NULL;
+ RenderData *rd= data;
+ RenderResult *rr= NULL;
+
+ if(re)
+ rr= RE_AcquireResultRead(re);
+
+ if(rr) {
+ SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
+ if(srl) {
+ RenderLayer *rl= RE_GetRenderLayer(rr, srl->name);
+ if(rl && rl->rectf) {
+ CompBuf *stackbuf;
+
+ /* we put render rect on stack, cbuf knows rect is from other ibuf when freed! */
+ if(rd->scemode & R_COMP_CROP)
+ stackbuf= get_cropped_compbuf(&rd->disprect, rl->rectf, rr->rectx, rr->recty, CB_RGBA);
+ else {
+ stackbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 0);
+ stackbuf->rect= rl->rectf;
+ }
+ if(stackbuf==NULL) {
+ printf("Error; Preview Panel in UV Window returns zero sized image\n");
+ }
+ else {
+ stackbuf->xof= rr->xof;
+ stackbuf->yof= rr->yof;
- /* put on stack */
- out[RRES_OUT_IMAGE]->data= stackbuf;
+ /* put on stack */
+ out[RRES_OUT_IMAGE]->data= stackbuf;
- if(out[RRES_OUT_ALPHA]->hasoutput)
- out[RRES_OUT_ALPHA]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
+ if(out[RRES_OUT_ALPHA]->hasoutput)
+ out[RRES_OUT_ALPHA]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
- node_composit_rlayers_out(rd, rl, out, rr->rectx, rr->recty);
+ node_composit_rlayers_out(rd, rl, out, rr->rectx, rr->recty);
- generate_preview(data, node, stackbuf);
+ generate_preview(data, node, stackbuf);
+ }
}
- }
- }
- }
+ }
+ }
- if(re)
- RE_ReleaseResult(re);
+ if(re)
+ RE_ReleaseResult(re);
}
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
index f42bcb576fd..27b0324dfe0 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
@@ -116,7 +116,7 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac
static void node_composit_init_invert(bNode *node)
{
- node->custom1 |= CMP_CHAN_RGB;
+ node->custom1 |= CMP_CHAN_RGB;
}
/* custom1 = mix type */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
index 37c28514679..3a005210c6a 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
@@ -44,29 +44,36 @@ static bNodeSocketType cmp_node_lensdist_out[]= {
{ -1, 0, "" }
};
-
-static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb, int jit, int proj, int fit)
+/* assumes *dst is type RGBA */
+static void lensDistort(CompBuf *dst, CompBuf *src, float kr, float kg, float kb, int jit, int proj, int fit)
{
int x, y, z;
const float cx = 0.5f*(float)dst->x, cy = 0.5f*(float)dst->y;
if (proj) {
// shift
- CompBuf* tsrc = dupalloc_compbuf(src);
+ CompBuf *tsrc = dupalloc_compbuf(src);
+
for (z=0; z<tsrc->type; ++z)
IIR_gauss(tsrc, (kr+0.5f)*(kr+0.5f), z, 1);
kr *= 20.f;
+
for (y=0; y<dst->y; y++) {
- fRGB* colp = (fRGB*)&dst->rect[y*dst->x*dst->type];
+ fRGB *colp = (fRGB*)&dst->rect[y*dst->x*dst->type];
const float v = (y + 0.5f)/(float)dst->y;
+
for (x=0; x<dst->x; x++) {
const float u = (x + 0.5f)/(float)dst->x;
+
qd_getPixelLerpChan(tsrc, (u*dst->x + kr) - 0.5f, v*dst->y - 0.5f, 0, colp[x]);
if (tsrc->type == CB_VAL)
colp[x][1] = tsrc->rect[x + y*tsrc->x];
else
colp[x][1] = tsrc->rect[(x + y*tsrc->x)*tsrc->type + 1];
qd_getPixelLerpChan(tsrc, (u*dst->x - kr) - 0.5f, v*dst->y - 0.5f, 2, colp[x]+2);
+
+ /* set alpha */
+ colp[x][3]= 1.0f;
}
}
free_compbuf(tsrc);
@@ -80,17 +87,20 @@ static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb
const float mk = MAX3(kr, kg, kb);
const float sc = (fit && (mk > 0.f)) ? (1.f/(1.f + 2.f*mk)) : (1.f/(1.f + mk));
const float drg = 4.f*(kg - kr), dgb = 4.f*(kb - kg);
+
kr *= 4.f, kg *= 4.f, kb *= 4.f;
for (y=0; y<dst->y; y++) {
- fRGB* colp = (fRGB*)&dst->rect[y*dst->x*dst->type];
+ fRGB *colp = (fRGB*)&dst->rect[y*dst->x*dst->type];
const float v = sc*((y + 0.5f) - cy)/cy;
+
for (x=0; x<dst->x; x++) {
int dr = 0, dg = 0, db = 0;
float d, t, ln[6] = {0, 0, 0, 0, 0, 0};
fRGB c1, tc = {0, 0, 0, 0};
const float u = sc*((x + 0.5f) - cx)/cx;
int sta = 0, mid = 0, end = 0;
+
if ((t = 1.f - kr*(u*u + v*v)) >= 0.f) {
d = 1.f/(1.f + sqrtf(t));
ln[0] = (u*d + 0.5f)*dst->x - 0.5f, ln[1] = (v*d + 0.5f)*dst->y - 0.5f;
@@ -113,6 +123,7 @@ static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb
const float dsf = sqrtf(dx*dx + dy*dy) + 1.f;
const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf);
const float sd = 1.f/(float)ds;
+
for (z=0; z<ds; ++z) {
const float tz = ((float)z + (jit ? BLI_frand() : 0.5f))*sd;
t = 1.f - (kr + tz*drg)*(u*u + v*v);
@@ -128,6 +139,7 @@ static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb
const float dsf = sqrtf(dx*dx + dy*dy) + 1.f;
const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf);
const float sd = 1.f/(float)ds;
+
for (z=0; z<ds; ++z) {
const float tz = ((float)z + (jit ? BLI_frand() : 0.5f))*sd;
t = 1.f - (kg + tz*dgb)*(u*u + v*v);
@@ -144,18 +156,18 @@ static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb
if (dg) colp[x][1] = 2.f*tc[1] / (float)dg;
if (db) colp[x][2] = 2.f*tc[2] / (float)db;
+ /* set alpha */
+ colp[x][3]= 1.0f;
}
}
-
}
-
}
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;
+ NodeLensDist *nld = node->storage;
const float k = MAX2(MIN2(in[1]->vec[0], 1.f), -0.999f);
// smaller dispersion range for somewhat more control
const float d = 0.25f*MAX2(MIN2(in[2]->vec[0], 1.f), 0.f);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c
index 4436be14b5c..2c9f7d97f09 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c
@@ -330,7 +330,7 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
static void node_composit_init_view_levels(bNode* node)
{
- node->custom1=1; /*All channels*/
+ node->custom1=1; /*All channels*/
}
void register_node_type_cmp_view_levels(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
index 7ed38996cf8..34e58791932 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
@@ -102,10 +102,10 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack **
static void node_composit_init_luma_matte(bNode *node)
{
- NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
- node->storage=c;
- c->t1= 1.0f;
- c->t2= 0.0f;
+ NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
+ node->storage=c;
+ c->t1= 1.0f;
+ c->t2= 0.0f;
}
void register_node_type_cmp_luma_matte(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
index b4af253ac3a..f14e0fbd804 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
@@ -81,7 +81,7 @@ static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeS
static void node_composit_init_map_value(bNode* node)
{
- node->storage= add_mapping();
+ node->storage= add_mapping();
}
void register_node_type_cmp_map_value(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
index 039f7e6fab1..4348fd18759 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
@@ -102,15 +102,15 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
/* Only raise negative numbers by full integers */
if( in[0] >= 0 ) {
out[0]= pow(in[0], in2[0]);
- } else {
- float y_mod_1 = fmod(in2[0], 1);
+ } 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;
- }
- }
+ 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 */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
index 61a1c5d1c94..1d52e694ea9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
@@ -78,7 +78,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), TRUE);
- if(0 == BKE_write_ibuf((Scene *)node->id, ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality))
+ if(0 == BKE_write_ibuf(ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality))
printf("Cannot save Node File Output to %s\n", string);
else
printf("Saved: %s\n", string);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
index 14f25aa442b..b6b1764ff0f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
@@ -49,80 +49,81 @@ static bNodeSocketType cmp_node_rotate_out[]= {
/* only supports RGBA nodes now */
static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
-
+
if(out[0]->hasoutput==0)
return;
-
+
if(in[0]->data) {
CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* note, this returns zero'd image */
float rad, u, v, s, c, centx, centy, miny, maxy, minx, maxx;
int x, y, yo, xo;
- ImBuf *ibuf, *obuf;
-
+ ImBuf *ibuf, *obuf;
+
rad= (M_PI*in[1]->vec[0])/180.0f;
-
+
s= sin(rad);
c= cos(rad);
centx= cbuf->x/2;
centy= cbuf->y/2;
-
+
minx= -centx;
maxx= -centx + (float)cbuf->x;
miny= -centy;
maxy= -centy + (float)cbuf->y;
-
-
- 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;
- obuf->rect_float=stackbuf->rect;
-
- for(y=miny; y<maxy; y++) {
- yo= y+(int)centy;
-
- for(x=minx; x<maxx;x++) {
- u=c*x + y*s + centx;
- v=-s*x + c*y + centy;
- xo= x+(int)centx;
-
- switch(node->custom1) {
- case 0:
- neareast_interpolation(ibuf, obuf, u, v, xo, yo);
- break ;
- case 1:
- bilinear_interpolation(ibuf, obuf, u, v, xo, yo);
- break;
- case 2:
- bicubic_interpolation(ibuf, obuf, u, v, xo, yo);
- }
-
- }
+
+
+ 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;
+ obuf->rect_float=stackbuf->rect;
+
+ for(y=miny; y<maxy; y++) {
+ yo= y+(int)centy;
+
+ for(x=minx; x<maxx;x++) {
+ u=c*x + y*s + centx;
+ v=-s*x + c*y + centy;
+ xo= x+(int)centx;
+
+ switch(node->custom1) {
+ case 0:
+ neareast_interpolation(ibuf, obuf, u, v, xo, yo);
+ break ;
+ case 1:
+ bilinear_interpolation(ibuf, obuf, u, v, xo, yo);
+ break;
+ case 2:
+ bicubic_interpolation(ibuf, obuf, u, v, xo, yo);
+ }
+
+ }
}
-
- /* rotate offset vector too, but why negative rad, ehh?? Has to be replaced with [3][3] matrix once (ton) */
- s= sin(-rad);
- c= cos(-rad);
- centx= (float)cbuf->xof; centy= (float)cbuf->yof;
- stackbuf->xof= (int)( c*centx + s*centy);
- stackbuf->yof= (int)(-s*centx + c*centy);
+
+ /* rotate offset vector too, but why negative rad, ehh?? Has to be replaced with [3][3] matrix once (ton) */
+ s= sin(-rad);
+ c= cos(-rad);
+ centx= (float)cbuf->xof; centy= (float)cbuf->yof;
+ stackbuf->xof= (int)( c*centx + s*centy);
+ stackbuf->yof= (int)(-s*centx + c*centy);
IMB_freeImBuf(ibuf);
IMB_freeImBuf(obuf);
}
-
+
/* pass on output and free */
out[0]->data= stackbuf;
- if(cbuf!=in[0]->data)
+ if(cbuf!=in[0]->data) {
free_compbuf(cbuf);
+ }
}
}
static void node_composit_init_rotate(bNode *node)
{
- node->custom1= 1; /* Bilinear Filter*/
+ node->custom1= 1; /* Bilinear Filter*/
}
void register_node_type_cmp_rotate(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
index 4e338c73c39..87c4ed1dac0 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
@@ -69,7 +69,7 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta
if(in[0]->data==NULL) {
float h, s, v;
- rgb_to_hsv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &h, &s, &v);
+ rgb_to_hsv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &h, &s, &v);
out[0]->vec[0] = h;
out[1]->vec[0] = s;
@@ -129,46 +129,46 @@ static bNodeSocketType cmp_node_combhsva_out[]= {
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);
+ float r,g,b;
+ hsv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b);
- out[0] = r;
- out[1] = g;
- out[2] = b;
- out[3] = in4[0];
+ out[0] = r;
+ out[1] = g;
+ out[2] = b;
+ out[3] = in4[0];
}
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 */
-
- /* 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];
- out[0]->vec[3] = in[3]->vec[0];
- }
- else {
- /* make output size of first available input image */
- CompBuf *cbuf;
- CompBuf *stackbuf;
-
- /* allocate a CompBuf the size of the first available input */
- if (in[0]->data) cbuf = in[0]->data;
- else if (in[1]->data) cbuf = in[1]->data;
- else if (in[2]->data) cbuf = in[2]->data;
- else cbuf = in[3]->data;
-
- 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_hsva, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
-
- out[0]->data= stackbuf;
- }
+ /* stack order out: 1 rgba 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];
+ out[0]->vec[3] = in[3]->vec[0];
+ }
+ else {
+ /* make output size of first available input image */
+ CompBuf *cbuf;
+ CompBuf *stackbuf;
+
+ /* allocate a CompBuf the size of the first available input */
+ if (in[0]->data) cbuf = in[0]->data;
+ else if (in[1]->data) cbuf = in[1]->data;
+ else if (in[2]->data) cbuf = in[2]->data;
+ else cbuf = in[3]->data;
+
+ 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_hsva, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
+
+ out[0]->data= stackbuf;
+ }
}
void register_node_type_cmp_combhsva(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
index 69499f25b39..13cb3bcfed5 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
@@ -143,12 +143,12 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
static void node_composit_init_splitviewer(bNode* node)
{
- ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
- node->storage= iuser;
- iuser->sfra= 1;
- iuser->fie_ima= 2;
- iuser->ok= 1;
- node->custom1= 50; /* default 50% split */
+ ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
+ node->storage= iuser;
+ iuser->sfra= 1;
+ iuser->fie_ima= 2;
+ iuser->ok= 1;
+ node->custom1= 50; /* default 50% split */
}
void register_node_type_cmp_splitviewer(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
index fa6b5db89f6..1e1c8c61b46 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
@@ -82,7 +82,7 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt
static void node_composit_init_valtorgb(bNode* node)
{
- node->storage= add_colorband(1);
+ node->storage= add_colorband(1);
}
void register_node_type_cmp_valtorgb(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
index b21418f6698..c43bfa2435a 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
@@ -89,10 +89,10 @@ static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeSta
static void node_composit_init_vecblur(bNode* node)
{
- NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur data");
- node->storage= nbd;
- nbd->samples= 32;
- nbd->fac= 1.0f;
+ NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur data");
+ node->storage= nbd;
+ nbd->samples= 32;
+ nbd->fac= 1.0f;
}
/* custom1: itterations, custom2: maxspeed (0 = nolimit) */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
index b3629eb1e16..c4e719efbf9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
@@ -126,11 +126,11 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
static void node_composit_init_viewer(bNode* node)
{
- ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
- node->storage= iuser;
- iuser->sfra= 1;
- iuser->fie_ima= 2;
- iuser->ok= 1;
+ ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
+ node->storage= iuser;
+ iuser->sfra= 1;
+ iuser->fie_ima= 2;
+ iuser->ok= 1;
}
void register_node_type_cmp_viewer(ListBase *lb)
diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/intern/CMP_util.c
index 45e7cf9d3e7..78025f4d964 100644
--- a/source/blender/nodes/intern/CMP_util.c
+++ b/source/blender/nodes/intern/CMP_util.c
@@ -673,116 +673,116 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
void do_rgba_to_yuva(bNode *UNUSED(node), float *out, float *in)
{
- rgb_to_yuv(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
- out[3]=in[3];
+ rgb_to_yuv(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
+ out[3]=in[3];
}
void do_rgba_to_hsva(bNode *UNUSED(node), float *out, float *in)
{
- rgb_to_hsv(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
- out[3]=in[3];
+ rgb_to_hsv(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
+ out[3]=in[3];
}
void do_rgba_to_ycca(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);
- out[3]=in[3];
+ rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
+ out[3]=in[3];
}
void do_yuva_to_rgba(bNode *UNUSED(node), float *out, float *in)
{
- yuv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
- out[3]=in[3];
+ yuv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
+ out[3]=in[3];
}
void do_hsva_to_rgba(bNode *UNUSED(node), float *out, float *in)
{
- hsv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
- out[3]=in[3];
+ hsv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
+ out[3]=in[3];
}
void do_ycca_to_rgba(bNode *UNUSED(node), float *out, float *in)
{
- ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
- out[3]=in[3];
+ ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
+ out[3]=in[3];
}
void do_copy_rgba(bNode *UNUSED(node), float *out, float *in)
{
- QUATCOPY(out, in);
+ QUATCOPY(out, in);
}
void do_copy_rgb(bNode *UNUSED(node), float *out, float *in)
{
- VECCOPY(out, in);
- out[3]= 1.0f;
+ VECCOPY(out, in);
+ out[3]= 1.0f;
}
void do_copy_value(bNode *UNUSED(node), float *out, float *in)
{
- out[0]= in[0];
+ out[0]= in[0];
}
void do_copy_a_rgba(bNode *UNUSED(node), float *out, float *in, float *fac)
{
- VECCOPY(out, in);
- out[3]= *fac;
+ VECCOPY(out, in);
+ out[3]= *fac;
}
/* only accepts RGBA buffers */
void gamma_correct_compbuf(CompBuf *img, int inversed)
{
- float *drect;
- int x;
-
- if(img->type!=CB_RGBA) return;
-
- drect= img->rect;
- if(inversed) {
- for(x=img->x*img->y; x>0; x--, drect+=4) {
- if(drect[0]>0.0f) drect[0]= sqrt(drect[0]); else drect[0]= 0.0f;
- if(drect[1]>0.0f) drect[1]= sqrt(drect[1]); else drect[1]= 0.0f;
- if(drect[2]>0.0f) drect[2]= sqrt(drect[2]); else drect[2]= 0.0f;
- }
- }
- else {
- for(x=img->x*img->y; x>0; x--, drect+=4) {
- if(drect[0]>0.0f) drect[0]*= drect[0]; else drect[0]= 0.0f;
- if(drect[1]>0.0f) drect[1]*= drect[1]; else drect[1]= 0.0f;
- if(drect[2]>0.0f) drect[2]*= drect[2]; else drect[2]= 0.0f;
- }
- }
+ float *drect;
+ int x;
+
+ if(img->type!=CB_RGBA) return;
+
+ drect= img->rect;
+ if(inversed) {
+ for(x=img->x*img->y; x>0; x--, drect+=4) {
+ if(drect[0]>0.0f) drect[0]= sqrt(drect[0]); else drect[0]= 0.0f;
+ if(drect[1]>0.0f) drect[1]= sqrt(drect[1]); else drect[1]= 0.0f;
+ if(drect[2]>0.0f) drect[2]= sqrt(drect[2]); else drect[2]= 0.0f;
+ }
+ }
+ else {
+ for(x=img->x*img->y; x>0; x--, drect+=4) {
+ if(drect[0]>0.0f) drect[0]*= drect[0]; else drect[0]= 0.0f;
+ if(drect[1]>0.0f) drect[1]*= drect[1]; else drect[1]= 0.0f;
+ if(drect[2]>0.0f) drect[2]*= drect[2]; else drect[2]= 0.0f;
+ }
+ }
}
void premul_compbuf(CompBuf *img, int inversed)
{
- float *drect;
- int x;
-
- if(img->type!=CB_RGBA) return;
-
- drect= img->rect;
- if(inversed) {
- for(x=img->x*img->y; x>0; x--, drect+=4) {
- if(fabs(drect[3]) < 1e-5f) {
- drect[0]= 0.0f;
- drect[1]= 0.0f;
- drect[2]= 0.0f;
- }
- else {
- drect[0] /= drect[3];
- drect[1] /= drect[3];
- drect[2] /= drect[3];
- }
- }
- }
- else {
- for(x=img->x*img->y; x>0; x--, drect+=4) {
- drect[0] *= drect[3];
- drect[1] *= drect[3];
- drect[2] *= drect[3];
- }
- }
+ float *drect;
+ int x;
+
+ if(img->type!=CB_RGBA) return;
+
+ drect= img->rect;
+ if(inversed) {
+ for(x=img->x*img->y; x>0; x--, drect+=4) {
+ if(fabs(drect[3]) < 1e-5f) {
+ drect[0]= 0.0f;
+ drect[1]= 0.0f;
+ drect[2]= 0.0f;
+ }
+ else {
+ drect[0] /= drect[3];
+ drect[1] /= drect[3];
+ drect[2] /= drect[3];
+ }
+ }
+ }
+ else {
+ for(x=img->x*img->y; x>0; x--, drect+=4) {
+ drect[0] *= drect[3];
+ drect[1] *= drect[3];
+ drect[2] *= drect[3];
+ }
+ }
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c
index 78b5e4c1e56..a39a639897e 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c
@@ -59,7 +59,7 @@ static void node_shader_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeSta
static void node_shader_init_curve_vec(bNode* node)
{
- node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
+ node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
}
static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
@@ -114,7 +114,7 @@ static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeSta
static void node_shader_init_curve_rgb(bNode *node)
{
- node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
+ node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
}
static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
index c08d5f3548d..379f54bec57 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
@@ -120,7 +120,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
static void node_shader_init_geometry(bNode *node)
{
- node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
+ node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
}
static int gpu_shader_geom(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
index 528b43ae56e..eb300301ce2 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
@@ -71,7 +71,7 @@ static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack
static void node_shader_init_mapping(bNode *node)
{
- node->storage= add_mapping();
+ node->storage= add_mapping();
}
static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_material.c b/source/blender/nodes/intern/SHD_nodes/SHD_material.c
index 317dd07f8fe..40dfbc0edea 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_material.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_material.c
@@ -195,7 +195,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
static void node_shader_init_material(bNode* node)
{
- node->custom1= SH_NODE_MAT_DIFF|SH_NODE_MAT_SPEC;
+ node->custom1= SH_NODE_MAT_DIFF|SH_NODE_MAT_SPEC;
}
static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
index d2538f4c819..86f832c12ee 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
@@ -61,7 +61,7 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStac
static void node_shader_init_valtorgb(bNode *node)
{
- node->storage= add_colorband(1);
+ node->storage= add_colorband(1);
}
static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
@@ -102,10 +102,10 @@ static bNodeSocketType sh_node_rgbtobw_out[]= {
static void node_shader_exec_rgbtobw(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
- /* stack order out: bw */
- /* stack order in: col */
+ /* stack order out: bw */
+ /* stack order in: col */
- out[0]->vec[0]= in[0]->vec[0]*0.35f + in[0]->vec[1]*0.45f + in[0]->vec[2]*0.2f;
+ out[0]->vec[0]= in[0]->vec[0]*0.35f + in[0]->vec[1]*0.45f + in[0]->vec[2]*0.2f;
}
static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
index e388efd17c0..b7af6c748ff 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
@@ -62,9 +62,9 @@ static void time_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out
static void time_init(bNode* node)
{
- node->custom1= 1;
- node->custom2= 250;
- node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+ node->custom1= 1;
+ node->custom2= 250;
+ node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
}
void register_node_type_tex_curve_time(ListBase *lb)
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_image.c b/source/blender/nodes/intern/TEX_nodes/TEX_image.c
index fcb18ab3342..a54ca4bb119 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_image.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_image.c
@@ -90,11 +90,11 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
static void init(bNode* node)
{
- ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
- node->storage= iuser;
- iuser->sfra= 1;
- iuser->fie_ima= 2;
- iuser->ok= 1;
+ ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
+ node->storage= iuser;
+ iuser->sfra= 1;
+ iuser->fie_ima= 2;
+ iuser->ok= 1;
}
void register_node_type_tex_image(ListBase *lb)
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_math.c b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
index e00781741a0..18468bdd55c 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_math.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
@@ -114,14 +114,14 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
/* Only raise negative numbers by full integers */
if( in0 >= 0 ) {
out[0]= pow(in0, in1);
- } else {
- float y_mod_1 = fmod(in1, 1);
+ } else {
+ float y_mod_1 = fmod(in1, 1);
if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
*out = pow(in0, floor(in1 + 0.5f));
- } else {
- *out = 0.0;
- }
- }
+ } else {
+ *out = 0.0;
+ }
+ }
}
break;
case 11: /* Logarithm */
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
index 19fa6c67c09..8f59828081c 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
@@ -80,12 +80,12 @@ void register_node_type_tex_valtorgb(ListBase *lb)
/* **************** RGBTOBW ******************** */
static bNodeSocketType rgbtobw_in[]= {
- { SOCK_RGBA, 1, "Color", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { SOCK_RGBA, 1, "Color", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
};
static bNodeSocketType rgbtobw_out[]= {
- { SOCK_VALUE, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { SOCK_VALUE, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
};
diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/intern/TEX_util.c
index 51b3c6d909f..b5e27ca2ccb 100644
--- a/source/blender/nodes/intern/TEX_util.c
+++ b/source/blender/nodes/intern/TEX_util.c
@@ -41,7 +41,7 @@
retrieve the color from the delegate.
comments: (ton)
-
+
This system needs recode, a node system should rely on the stack, and
callbacks for nodes only should evaluate own node, not recursively go
over other previous ones.