diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 10:38:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 10:38:07 +0400 |
commit | ab4a2aaf4a4b2b4e416aa1f113b30362cbe0dec3 (patch) | |
tree | 81af4c18519181490074508dbe9a8d515eab634f /source/blender/nodes/texture | |
parent | 5a90ea77bc1333efe4e1e54984a080550ed3f707 (diff) |
style cleanup: follow style guide for formatting of if/for/while loops, and else if's
Diffstat (limited to 'source/blender/nodes/texture')
14 files changed, 99 insertions, 93 deletions
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 2795cbd3e5a..add9fdb0b30 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -57,8 +57,8 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func) { Tex *tx; - for(tx= main->tex.first; tx; tx= tx->id.next) { - if(tx->nodetree) { + for (tx= main->tex.first; tx; tx= tx->id.next) { + if (tx->nodetree) { func(calldata, &tx->id, tx->nodetree); } } @@ -97,12 +97,12 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree) bNode *lnode; /* copy over contents of previews */ - for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) { - if(ntreeNodeExists(ntree, lnode->new_node)) { + for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) { + if (ntreeNodeExists(ntree, lnode->new_node)) { bNode *node= lnode->new_node; - if(node->preview && node->preview->rect) { - if(lnode->preview && lnode->preview->rect) { + if (node->preview && node->preview->rect) { + if (lnode->preview && lnode->preview->rect) { int xsize= node->preview->xsize; int ysize= node->preview->ysize; memcpy(node->preview->rect, lnode->preview->rect, 4*xsize + xsize*ysize*sizeof(char)*4); @@ -135,15 +135,15 @@ int ntreeTexTagAnimated(bNodeTree *ntree) { bNode *node; - if(ntree==NULL) return 0; + if (ntree==NULL) return 0; - for(node= ntree->nodes.first; node; node= node->next) { - if(node->type==TEX_NODE_CURVE_TIME) { + for (node= ntree->nodes.first; node; node= node->next) { + if (node->type==TEX_NODE_CURVE_TIME) { nodeUpdate(ntree, node); return 1; } - else if(node->type==NODE_GROUP) { - if( ntreeTexTagAnimated((bNodeTree *)node->id) ) { + else if (node->type==NODE_GROUP) { + if ( ntreeTexTagAnimated((bNodeTree *)node->id) ) { return 1; } } @@ -174,7 +174,7 @@ bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree, int use_tree_data) /* allocate the thread stack listbase array */ exec->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array"); - for(node= exec->nodetree->nodes.first; node; node= node->next) + for (node= exec->nodetree->nodes.first; node; node= node->next) node->need_exec= 1; if (use_tree_data) { @@ -194,10 +194,10 @@ static void tex_free_delegates(bNodeTreeExec *exec) bNodeStack *ns; int th, a; - for(th=0; th<BLENDER_MAX_THREADS; th++) - for(nts=exec->threadstack[th].first; nts; nts=nts->next) - for(ns= nts->stack, a=0; a<exec->stacksize; a++, ns++) - if(ns->data && !ns->is_copy) + for (th=0; th<BLENDER_MAX_THREADS; th++) + for (nts=exec->threadstack[th].first; nts; nts=nts->next) + for (ns= nts->stack, a=0; a<exec->stacksize; a++, ns++) + if (ns->data && !ns->is_copy) MEM_freeN(ns->data); } @@ -206,16 +206,16 @@ static void tex_free_delegates(bNodeTreeExec *exec) */ void ntreeTexEndExecTree(bNodeTreeExec *exec, int use_tree_data) { - if(exec) { + if (exec) { bNodeTree *ntree= exec->nodetree; bNodeThreadStack *nts; int a; - if(exec->threadstack) { + if (exec->threadstack) { tex_free_delegates(exec); - for(a=0; a<BLENDER_MAX_THREADS; a++) { - for(nts=exec->threadstack[a].first; nts; nts=nts->next) + for (a=0; a<BLENDER_MAX_THREADS; a++) { + for (nts=exec->threadstack[a].first; nts; nts=nts->next) if (nts->stack) MEM_freeN(nts->stack); BLI_freelistN(&exec->threadstack[a]); } @@ -246,7 +246,7 @@ int ntreeTexExecTree( int preview, ShadeInput *shi, MTex *mtex -){ +) { TexCallData data; float *nor= texres->nor; int retval = TEX_INT; @@ -268,7 +268,7 @@ int ntreeTexExecTree( /* ensure execdata is only initialized once */ if (!exec) { BLI_lock_thread(LOCK_NODES); - if(!nodes->execdata) + if (!nodes->execdata) ntreeTexBeginExecTree(nodes, 1); BLI_unlock_thread(LOCK_NODES); @@ -279,7 +279,7 @@ int ntreeTexExecTree( ntreeExecThreadNodes(exec, nts, &data, thread); ntreeReleaseThreadStack(nts); - if(texres->nor) retval |= TEX_NOR; + if (texres->nor) retval |= TEX_NOR; retval |= TEX_RGB; /* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was set however, the texture code checks this for other reasons (namely, a normal is required for material) */ diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c index a528f8cb7a7..255ed9e51fc 100644 --- a/source/blender/nodes/texture/node_texture_util.c +++ b/source/blender/nodes/texture/node_texture_util.c @@ -53,10 +53,10 @@ static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, short thread) { - if(dg->node->need_exec) { + if (dg->node->need_exec) { dg->fn(out, params, dg->node, dg->in, thread); - if(dg->cdata->do_preview) + if (dg->cdata->do_preview) tex_do_preview(dg->node, params->previewco, out); } } @@ -64,10 +64,10 @@ static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, sh static void tex_input(float *out, int sz, bNodeStack *in, TexParams *params, short thread) { TexDelegate *dg = in->data; - if(dg) { + if (dg) { tex_call_delegate(dg, in->vec, params, thread); - if(in->hasoutput && in->sockettype == SOCK_FLOAT) + if (in->hasoutput && in->sockettype == SOCK_FLOAT) in->vec[1] = in->vec[2] = in->vec[0]; } memcpy(out, in->vec, sz * sizeof(float)); @@ -118,7 +118,7 @@ void tex_do_preview(bNode *node, float *co, float *col) { bNodePreview *preview= node->preview; - if(preview) { + if (preview) { int xs= ((co[0] + 1.0f)*0.5f)*preview->xsize; int ys= ((co[1] + 1.0f)*0.5f)*preview->ysize; @@ -129,7 +129,7 @@ void tex_do_preview(bNode *node, float *co, float *col) void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata) { TexDelegate *dg; - if(!out->data) + if (!out->data) /* Freed in tex_end_exec (node.c) */ dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate"); else @@ -145,20 +145,21 @@ void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexC void ntreeTexCheckCyclics(struct bNodeTree *ntree) { bNode *node; - for(node= ntree->nodes.first; node; node= node->next) { + for (node= ntree->nodes.first; node; node= node->next) { - if(node->type == TEX_NODE_TEXTURE && node->id) { + if (node->type == TEX_NODE_TEXTURE && node->id) { /* custom2 stops the node from rendering */ - if(node->custom1) { + if (node->custom1) { node->custom2 = 1; node->custom1 = 0; - } else { + } + else { Tex *tex = (Tex *)node->id; node->custom2 = 0; node->custom1 = 1; - if(tex->use_nodes && tex->nodetree) { + if (tex->use_nodes && tex->nodetree) { ntreeTexCheckCyclics(tex->nodetree); } node->custom1 = 0; diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c index 9e76309bce9..ac8799762bd 100644 --- a/source/blender/nodes/texture/nodes/node_texture_bricks.c +++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c @@ -91,7 +91,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor rownum = (int)floor(y / row_height); - if( node->custom1 && node->custom2 ) { + if ( node->custom1 && node->custom2 ) { brick_width *= ((int)(rownum) % node->custom2 ) ? 1.0f : node->custom4; /* squash */ offset = ((int)(rownum) % node->custom1 ) ? 0 : (brick_width*node->custom3); /* offset */ } @@ -104,11 +104,12 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor tint = noise((rownum << 16) + (bricknum & 0xFFFF)) + bias; CLAMP(tint,0.0f,1.0f); - if( ins_x < mortar_thickness || ins_y < mortar_thickness || + if ( ins_x < mortar_thickness || ins_y < mortar_thickness || ins_x > (brick_width - mortar_thickness) || ins_y > (row_height - mortar_thickness) ) { copy_v4_v4( out, mortar ); - } else { + } + else { copy_v4_v4( out, bricks1 ); ramp_blend( MA_RAMP_BLEND, out, tint, bricks2 ); } diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c index 6b5848270ba..c96a73d09f2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_checker.c +++ b/source/blender/nodes/texture/nodes/node_texture_checker.c @@ -57,9 +57,10 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** int yi = (int)fabs(floor(0.00001f + y / sz)); int zi = (int)fabs(floor(0.00001f + z / sz)); - if( (xi % 2 == yi % 2) == (zi % 2) ) { + if ( (xi % 2 == yi % 2) == (zi % 2) ) { tex_input_rgba(out, in[0], p, thread); - } else { + } + else { tex_input_rgba(out, in[1], p, thread); } } diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c index 5256db98d78..a3ac196ab12 100644 --- a/source/blender/nodes/texture/nodes/node_texture_compose.c +++ b/source/blender/nodes/texture/nodes/node_texture_compose.c @@ -48,7 +48,7 @@ static bNodeSocketTemplate outputs[]= { static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { int i; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) out[i] = tex_input_value(in[i], p, thread); } diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c index 08e7efc1606..0f7213a5be0 100644 --- a/source/blender/nodes/texture/nodes/node_texture_curves.c +++ b/source/blender/nodes/texture/nodes/node_texture_curves.c @@ -46,7 +46,7 @@ static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNU /* stack order output: fac */ float fac= 0.0f; - if(node->custom1 < node->custom2) + if (node->custom1 < node->custom2) fac = (p->cfra - node->custom1)/(float)(node->custom2-node->custom1); fac = curvemapping_evaluateF(node->storage, 0, fac); diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c index e566fb0298a..d5a957a3b28 100644 --- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c +++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c @@ -49,16 +49,16 @@ static bNodeSocketTemplate outputs[]= { static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, float *in, float fac) { - if(fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) { + if (fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) { float col[3], hsv[3], mfac= 1.0f - fac; rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2); hsv[0]+= (hue - 0.5f); - if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f; + if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f; hsv[1]*= sat; - if(hsv[1]>1.0f) hsv[1]= 1.0f; else if(hsv[1]<0.0f) hsv[1]= 0.0f; + if (hsv[1]>1.0f) hsv[1]= 1.0f; else if (hsv[1]<0.0f) hsv[1]= 0.0f; hsv[2]*= val; - if(hsv[2]>1.0f) hsv[2]= 1.0f; else if(hsv[2]<0.0f) hsv[2]= 0.0f; + if (hsv[2]>1.0f) hsv[2]= 1.0f; else if (hsv[2]<0.0f) hsv[2]= 0.0f; hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); out[0]= mfac*in[0] + fac*col[0]; diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c index 0acfe62ed82..d0bc30089e2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_image.c +++ b/source/blender/nodes/texture/nodes/node_texture_image.c @@ -45,9 +45,9 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i Image *ima= (Image *)node->id; ImageUser *iuser= (ImageUser *)node->storage; - if( ima ) { + if ( ima ) { ImBuf *ibuf = BKE_image_get_ibuf(ima, iuser); - if( ibuf ) { + if ( ibuf ) { float xsize, ysize; float xoff, yoff; int px, py; @@ -61,19 +61,19 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i px = (int)( (x-xoff) * xsize ); py = (int)( (y-yoff) * ysize ); - if( (!xsize) || (!ysize) ) return; + if ( (!xsize) || (!ysize) ) return; - if( !ibuf->rect_float ) { + if ( !ibuf->rect_float ) { BLI_lock_thread(LOCK_IMAGE); - if( !ibuf->rect_float ) + if ( !ibuf->rect_float ) IMB_float_from_rect(ibuf); BLI_unlock_thread(LOCK_IMAGE); } - while( px < 0 ) px += ibuf->x; - while( py < 0 ) py += ibuf->y; - while( px >= ibuf->x ) px -= ibuf->x; - while( py >= ibuf->y ) py -= ibuf->y; + while ( px < 0 ) px += ibuf->x; + while ( py < 0 ) py += ibuf->y; + while ( px >= ibuf->x ) px -= ibuf->x; + while ( py >= ibuf->y ) py -= ibuf->y; result = ibuf->rect_float + py*ibuf->x*4 + px*4; copy_v4_v4( out, result ); diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 4659aa2b6c0..29d154df884 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -51,7 +51,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor float in0 = tex_input_value(in[0], p, thread); float in1 = tex_input_value(in[1], p, thread); - switch(node->custom1){ + switch(node->custom1) { case 0: /* Add */ *out= in0 + in1; @@ -64,7 +64,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; case 3: /* Divide */ { - if(in1==0) /* We don't want to divide by zero. */ + if (in1==0) /* We don't want to divide by zero. */ *out= 0.0; else *out= in0 / in1; @@ -88,7 +88,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 7: /* Arc-Sine */ { /* Can't do the impossible... */ - if( in0 <= 1 && in0 >= -1 ) + if ( in0 <= 1 && in0 >= -1 ) *out= asin(in0); else *out= 0.0; @@ -97,7 +97,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 8: /* Arc-Cosine */ { /* Can't do the impossible... */ - if( in0 <= 1 && in0 >= -1 ) + if ( in0 <= 1 && in0 >= -1 ) *out= acos(in0); else *out= 0.0; @@ -111,13 +111,15 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 10: /* Power */ { /* Only raise negative numbers by full integers */ - if( in0 >= 0 ) { + if ( in0 >= 0 ) { out[0]= pow(in0, in1); - } else { + } + 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 { + } + else { *out = 0.0; } } @@ -126,7 +128,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 11: /* Logarithm */ { /* Don't want any imaginary numbers... */ - if( in0 > 0 && in1 > 0 ) + if ( in0 > 0 && in1 > 0 ) *out= log(in0) / log(in1); else *out= 0.0; @@ -134,7 +136,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; case 12: /* Minimum */ { - if( in0 < in1 ) + if ( in0 < in1 ) *out= in0; else *out= in1; @@ -142,7 +144,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; case 13: /* Maximum */ { - if( in0 > in1 ) + if ( in0 > in1 ) *out= in0; else *out= in1; @@ -156,7 +158,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 15: /* Less Than */ { - if( in0 < in1 ) + if ( in0 < in1 ) *out= 1.0f; else *out= 0.0f; @@ -165,7 +167,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 16: /* Greater Than */ { - if( in0 > in1 ) + if ( in0 > in1 ) *out= 1.0f; else *out= 0.0f; diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index 36b31a864a5..22748fec2ea 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -46,11 +46,11 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o TexCallData *cdata = (TexCallData *)data; TexResult *target = cdata->target; - if(cdata->do_preview) { + if (cdata->do_preview) { TexParams params; params_from_cdata(¶ms, cdata); - if(in[1] && in[1]->hasinput && !in[0]->hasinput) + if (in[1] && in[1]->hasinput && !in[0]->hasinput) tex_input_rgba(&target->tr, in[1], ¶ms, cdata->thread); else tex_input_rgba(&target->tr, in[0], ¶ms, cdata->thread); @@ -58,7 +58,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o } else { /* 0 means don't care, so just use first */ - if(cdata->which_output == node->custom1 || (cdata->which_output == 0 && node->custom1 == 1)) { + if (cdata->which_output == node->custom1 || (cdata->which_output == 0 && node->custom1 == 1)) { TexParams params; params_from_cdata(¶ms, cdata); @@ -67,8 +67,8 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o target->tin = (target->tr + target->tg + target->tb) / 3.0f; target->talpha = 1; - if(target->nor) { - if(in[1] && in[1]->hasinput) + if (target->nor) { + if (in[1] && in[1]->hasinput) tex_input_vec(target->nor, in[1], ¶ms, cdata->thread); else target->nor = NULL; @@ -88,22 +88,23 @@ static void unique_name(bNode *node) i = node; while(i->prev) i = i->prev; - for(; i; i=i->next) { - if( + for (; i; i=i->next) { + if ( i == node || i->type != TEX_NODE_OUTPUT || strcmp(name, ((TexNodeOutput*)(i->storage))->name) ) continue; - if(!new_name) { + if (!new_name) { int len = strlen(name); - if(len >= 4 && sscanf(name + len - 4, ".%03d", &suffix) == 1) { + if (len >= 4 && sscanf(name + len - 4, ".%03d", &suffix) == 1) { new_len = len; - } else { + } + else { suffix = 0; new_len = len + 4; - if(new_len > (sizeof(tno->name) - 1)) + if (new_len > (sizeof(tno->name) - 1)) new_len = (sizeof(tno->name) - 1); } @@ -114,7 +115,7 @@ static void unique_name(bNode *node) sprintf(new_name + new_len - 4, ".%03d", ++suffix); } - if(new_name) { + if (new_name) { strcpy(tno->name, new_name); MEM_freeN(new_name); } @@ -130,9 +131,9 @@ static void assign_index(struct bNode *node) tnode = tnode->prev; check_index: - for(; tnode; tnode= tnode->next) - if(tnode->type == TEX_NODE_OUTPUT && tnode != node) - if(tnode->custom1 == index) { + for (; tnode; tnode= tnode->next) + if (tnode->type == TEX_NODE_OUTPUT && tnode != node) + if (tnode->custom1 == index) { index ++; goto check_index; } diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c index efc8228c01c..348827bd26c 100644 --- a/source/blender/nodes/texture/nodes/node_texture_proc.c +++ b/source/blender/nodes/texture/nodes/node_texture_proc.c @@ -62,7 +62,7 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char TexResult texres; int textype; - if(is_normal) { + if (is_normal) { texres.nor = result; } else @@ -71,10 +71,10 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char textype = multitex_nodes(tex, p->co, p->dxt, p->dyt, p->osatex, &texres, thread, 0, p->shi, p->mtex); - if(is_normal) + if (is_normal) return; - if(textype & TEX_RGB) { + if (textype & TEX_RGB) { copy_v4_v4(result, &texres.tr); } else { @@ -108,7 +108,7 @@ static int count_outputs(bNode *node) { bNodeSocket *sock; int num = 0; - for(sock= node->outputs.first; sock; sock= sock->next) { + for (sock= node->outputs.first; sock; sock= sock->next) { num++; } return num; @@ -132,8 +132,8 @@ static int count_outputs(bNode *node) static void name##_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) \ { \ int outs = count_outputs(node); \ - if(outs >= 1) tex_output(node, in, out[0], &name##_colorfn, data); \ - if(outs >= 2) tex_output(node, in, out[1], &name##_normalfn, data); \ + if (outs >= 1) tex_output(node, in, out[0], &name##_colorfn, data); \ + if (outs >= 2) tex_output(node, in, out[1], &name##_normalfn, data); \ } @@ -289,7 +289,7 @@ static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(nt default_tex(tex); tex->type = node->type - TEX_NODE_PROC; - if(tex->type == TEX_WOOD) + if (tex->type == TEX_WOOD) tex->stype = TEX_BANDNOISE; } diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c index d408b874b84..bf93231c306 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.c +++ b/source/blender/nodes/texture/nodes/node_texture_texture.c @@ -63,11 +63,11 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor zero_v3(dyt); } - if(node->custom2 || node->need_exec==0) { + if (node->custom2 || node->need_exec==0) { /* this node refers to its own texture tree! */ copy_v4_v4(out, (fabs(co[0] - co[1]) < .01) ? white : red ); } - else if(nodetex) { + else if (nodetex) { TexResult texres; int textype; float nor[] = {0,0,0}; @@ -80,7 +80,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor textype = multitex_nodes(nodetex, co, dxt, dyt, p->osatex, &texres, thread, 0, p->shi, p->mtex); - if(textype & TEX_RGB) { + if (textype & TEX_RGB) { copy_v4_v4(out, &texres.tr); } else { diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c index c0efa43c14f..1d282b4d4cc 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c @@ -45,7 +45,7 @@ static bNodeSocketTemplate valtorgb_out[]= { static void valtorgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) { - if(node->storage) { + if (node->storage) { float fac = tex_input_value(in[0], p, thread); do_colorband(node->storage, fac, out); diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c index 401e72761e3..0d7a04b06e2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.c +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c @@ -46,7 +46,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o { TexCallData *cdata = (TexCallData *)data; - if(cdata->do_preview) { + if (cdata->do_preview) { TexParams params; float col[4]; params_from_cdata(¶ms, cdata); |