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/shader/nodes | |
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/shader/nodes')
22 files changed, 110 insertions, 108 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c index 3ec75dfa4fd..69a6a5c04a9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_camera.c +++ b/source/blender/nodes/shader/nodes/node_shader_camera.c @@ -43,7 +43,7 @@ static bNodeSocketTemplate sh_node_camera_out[]= { static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **out) { - if(data) { + if (data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; /* Data we need for shading. */ copy_v3_v3(out[0]->vec, shi->co); /* get view vector */ diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c index d30434f4e32..50bf4c58e4d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.c +++ b/source/blender/nodes/shader/nodes/node_shader_curves.c @@ -106,7 +106,7 @@ static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeSta /* stack order output: vec */ nodestack_get_vec(vec, SOCK_VECTOR, in[1]); curvemapping_evaluateRGBF(node->storage, out[0]->vec, vec); - if(in[0]->vec[0] != 1.0f) { + if (in[0]->vec[0] != 1.0f) { interp_v3_v3v3(out[0]->vec, vec, out[0]->vec, *in[0]->vec); } } diff --git a/source/blender/nodes/shader/nodes/node_shader_dynamic.c b/source/blender/nodes/shader/nodes/node_shader_dynamic.c index 0c6c53b38e4..805a7e54f04 100644 --- a/source/blender/nodes/shader/nodes/node_shader_dynamic.c +++ b/source/blender/nodes/shader/nodes/node_shader_dynamic.c @@ -459,7 +459,8 @@ static int node_dynamic_parse(struct bNode *node) if (!pyresult) { if (BTST(node->custom1, NODE_DYNAMIC_LOADED)) { node_dynamic_disable(node); - } else { + } + else { node_dynamic_disable_all_by_id(node->id); } node_dynamic_pyerror_print(node); @@ -574,7 +575,8 @@ static void node_dynamic_setup(bNode *node) } else { nodeMakeDynamicType(node); } - } else { + } + else { node_dynamic_rem_all_links(node->typeinfo); node_dynamic_free_typeinfo_sockets(node->typeinfo); node_dynamic_update_socket_links(node, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c index cf6f400ee2a..37ab8ac3f5b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geom.c +++ b/source/blender/nodes/shader/nodes/node_shader_geom.c @@ -53,17 +53,17 @@ static bNodeSocketTemplate sh_node_geom_out[]= { /* node execute callback */ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { - if(data) { + if (data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; NodeGeometry *ngeo= (NodeGeometry*)node->storage; ShadeInputUV *suv= &shi->uv[shi->actuv]; static float defaultvcol[4] = {1.0f, 1.0f, 1.0f, 1.0f}; int i; - if(ngeo->uvname[0]) { + if (ngeo->uvname[0]) { /* find uv map by name */ - for(i = 0; i < shi->totuv; i++) { - if(strcmp(shi->uv[i].name, ngeo->uvname)==0) { + for (i = 0; i < shi->totuv; i++) { + if (strcmp(shi->uv[i].name, ngeo->uvname)==0) { suv= &shi->uv[i]; break; } @@ -82,9 +82,9 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i /* find vertex color layer by name */ ShadeInputCol *scol= &shi->col[0]; - if(ngeo->colname[0]) { - for(i = 0; i < shi->totcol; i++) { - if(strcmp(shi->col[i].name, ngeo->colname)==0) { + if (ngeo->colname[0]) { + for (i = 0; i < shi->totcol; i++) { + if (strcmp(shi->col[i].name, ngeo->colname)==0) { scol= &shi->col[i]; break; } @@ -100,7 +100,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i out[GEOM_OUT_VCOL_ALPHA]->vec[0]= 1.0f; } - if(shi->osatex) { + if (shi->osatex) { out[GEOM_OUT_GLOB]->data= shi->dxgl; out[GEOM_OUT_GLOB]->datatype= NS_OSA_VECTORS; out[GEOM_OUT_LOCAL]->data= shi->dxco; diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c index 0f85196a45d..12b97e65be8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c +++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c @@ -50,12 +50,12 @@ static bNodeSocketTemplate sh_node_hue_sat_out[]= { /* note: it would be possible to use CMP version for both nodes */ static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac) { - if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) { + if (*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) { 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; hsv[2]*= *val; hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c index c2a58d49161..b7b080fa2df 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.c +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c @@ -54,15 +54,15 @@ static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack nodestack_get_vec(vec, SOCK_VECTOR, in[0]); mul_m4_v3(texmap->mat, vec); - if(texmap->flag & TEXMAP_CLIP_MIN) { - if(vec[0]<texmap->min[0]) vec[0]= texmap->min[0]; - if(vec[1]<texmap->min[1]) vec[1]= texmap->min[1]; - if(vec[2]<texmap->min[2]) vec[2]= texmap->min[2]; + if (texmap->flag & TEXMAP_CLIP_MIN) { + if (vec[0]<texmap->min[0]) vec[0]= texmap->min[0]; + if (vec[1]<texmap->min[1]) vec[1]= texmap->min[1]; + if (vec[2]<texmap->min[2]) vec[2]= texmap->min[2]; } - if(texmap->flag & TEXMAP_CLIP_MAX) { - if(vec[0]>texmap->max[0]) vec[0]= texmap->max[0]; - if(vec[1]>texmap->max[1]) vec[1]= texmap->max[1]; - if(vec[2]>texmap->max[2]) vec[2]= texmap->max[2]; + if (texmap->flag & TEXMAP_CLIP_MAX) { + if (vec[0]>texmap->max[0]) vec[0]= texmap->max[0]; + if (vec[1]>texmap->max[1]) vec[1]= texmap->max[1]; + if (vec[2]>texmap->max[2]) vec[2]= texmap->max[2]; } } diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c index decd3bb225f..279bbfa8d1b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_material.c @@ -78,7 +78,7 @@ static bNodeSocketTemplate sh_node_material_ext_out[]= { static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { - if(data && node->id) { + if (data && node->id) { ShadeResult shrnode; ShadeInput *shi; ShaderCallData *shcd= data; @@ -103,17 +103,17 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, shi->har= shi->mat->har; /* write values */ - if(hasinput[MAT_IN_COLOR]) + if (hasinput[MAT_IN_COLOR]) nodestack_get_vec(&shi->r, SOCK_VECTOR, in[MAT_IN_COLOR]); - if(hasinput[MAT_IN_SPEC]) + if (hasinput[MAT_IN_SPEC]) nodestack_get_vec(&shi->specr, SOCK_VECTOR, in[MAT_IN_SPEC]); - if(hasinput[MAT_IN_REFL]) + if (hasinput[MAT_IN_REFL]) nodestack_get_vec(&shi->refl, SOCK_FLOAT, in[MAT_IN_REFL]); /* retrieve normal */ - if(hasinput[MAT_IN_NORMAL]) { + if (hasinput[MAT_IN_NORMAL]) { nodestack_get_vec(shi->vn, SOCK_VECTOR, in[MAT_IN_NORMAL]); normalize_v3(shi->vn); } @@ -121,24 +121,24 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, copy_v3_v3(shi->vn, shi->vno); /* custom option to flip normal */ - if(node->custom1 & SH_NODE_MAT_NEG) { + if (node->custom1 & SH_NODE_MAT_NEG) { negate_v3(shi->vn); } if (node->type == SH_NODE_MATERIAL_EXT) { - if(hasinput[MAT_IN_MIR]) + if (hasinput[MAT_IN_MIR]) nodestack_get_vec(&shi->mirr, SOCK_VECTOR, in[MAT_IN_MIR]); - if(hasinput[MAT_IN_AMB]) + if (hasinput[MAT_IN_AMB]) nodestack_get_vec(&shi->amb, SOCK_FLOAT, in[MAT_IN_AMB]); - if(hasinput[MAT_IN_EMIT]) + if (hasinput[MAT_IN_EMIT]) nodestack_get_vec(&shi->emit, SOCK_FLOAT, in[MAT_IN_EMIT]); - if(hasinput[MAT_IN_SPECTRA]) + if (hasinput[MAT_IN_SPECTRA]) nodestack_get_vec(&shi->spectra, SOCK_FLOAT, in[MAT_IN_SPECTRA]); - if(hasinput[MAT_IN_RAY_MIRROR]) + if (hasinput[MAT_IN_RAY_MIRROR]) nodestack_get_vec(&shi->ray_mirror, SOCK_FLOAT, in[MAT_IN_RAY_MIRROR]); - if(hasinput[MAT_IN_ALPHA]) + if (hasinput[MAT_IN_ALPHA]) nodestack_get_vec(&shi->alpha, SOCK_FLOAT, in[MAT_IN_ALPHA]); - if(hasinput[MAT_IN_TRANSLUCENCY]) + if (hasinput[MAT_IN_TRANSLUCENCY]) nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]); } @@ -147,13 +147,13 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, shi->nodes= 0; /* write to outputs */ - if(node->custom1 & SH_NODE_MAT_DIFF) { + if (node->custom1 & SH_NODE_MAT_DIFF) { copy_v3_v3(col, shrnode.combined); - if(!(node->custom1 & SH_NODE_MAT_SPEC)) { + if (!(node->custom1 & SH_NODE_MAT_SPEC)) { sub_v3_v3(col, shrnode.spec); } } - else if(node->custom1 & SH_NODE_MAT_SPEC) { + else if (node->custom1 & SH_NODE_MAT_SPEC) { copy_v3_v3(col, shrnode.spec); } else @@ -161,13 +161,13 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, col[3]= shrnode.alpha; - if(shi->do_preview) + if (shi->do_preview) nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage); copy_v3_v3(out[MAT_OUT_COLOR]->vec, col); out[MAT_OUT_ALPHA]->vec[0]= shrnode.alpha; - if(node->custom1 & SH_NODE_MAT_NEG) { + if (node->custom1 & SH_NODE_MAT_NEG) { shi->vn[0]= -shi->vn[0]; shi->vn[1]= -shi->vn[1]; shi->vn[2]= -shi->vn[2]; @@ -185,7 +185,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, } /* copy passes, now just active node */ - if(node->flag & NODE_ACTIVE_ID) { + if (node->flag & NODE_ACTIVE_ID) { float combined[4], alpha; copy_v4_v4(combined, shcd->shr->combined); @@ -218,7 +218,7 @@ static GPUNodeLink *gpu_get_input_link(GPUNodeStack *in) static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - if(node->id) { + if (node->id) { GPUShadeInput shi; GPUShadeResult shr; bNodeSocket *sock; @@ -235,47 +235,47 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPU_shadeinput_set(mat, (Material*)node->id, &shi); /* write values */ - if(hasinput[MAT_IN_COLOR]) + if (hasinput[MAT_IN_COLOR]) shi.rgb = gpu_get_input_link(&in[MAT_IN_COLOR]); - if(hasinput[MAT_IN_SPEC]) + if (hasinput[MAT_IN_SPEC]) shi.specrgb = gpu_get_input_link(&in[MAT_IN_SPEC]); - if(hasinput[MAT_IN_REFL]) + if (hasinput[MAT_IN_REFL]) shi.refl = gpu_get_input_link(&in[MAT_IN_REFL]); /* retrieve normal */ - if(hasinput[MAT_IN_NORMAL]) { + if (hasinput[MAT_IN_NORMAL]) { GPUNodeLink *tmp; shi.vn = gpu_get_input_link(&in[MAT_IN_NORMAL]); GPU_link(mat, "vec_math_normalize", shi.vn, &shi.vn, &tmp); } /* custom option to flip normal */ - if(node->custom1 & SH_NODE_MAT_NEG) + if (node->custom1 & SH_NODE_MAT_NEG) GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn); if (node->type == SH_NODE_MATERIAL_EXT) { - if(hasinput[MAT_IN_AMB]) + if (hasinput[MAT_IN_AMB]) shi.amb= gpu_get_input_link(&in[MAT_IN_AMB]); - if(hasinput[MAT_IN_EMIT]) + if (hasinput[MAT_IN_EMIT]) shi.emit= gpu_get_input_link(&in[MAT_IN_EMIT]); - if(hasinput[MAT_IN_ALPHA]) + if (hasinput[MAT_IN_ALPHA]) shi.alpha= gpu_get_input_link(&in[MAT_IN_ALPHA]); } GPU_shaderesult_set(&shi, &shr); /* clears shr */ /* write to outputs */ - if(node->custom1 & SH_NODE_MAT_DIFF) { + if (node->custom1 & SH_NODE_MAT_DIFF) { out[MAT_OUT_COLOR].link= shr.combined; - if(!(node->custom1 & SH_NODE_MAT_SPEC)) { + if (!(node->custom1 & SH_NODE_MAT_SPEC)) { GPUNodeLink *link; GPU_link(mat, "vec_math_sub", shr.combined, shr.spec, &out[MAT_OUT_COLOR].link, &link); } } - else if(node->custom1 & SH_NODE_MAT_SPEC) { + else if (node->custom1 & SH_NODE_MAT_SPEC) { out[MAT_OUT_COLOR].link= shr.spec; } else @@ -285,7 +285,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, out[MAT_OUT_ALPHA].link = shr.alpha; // - if(node->custom1 & SH_NODE_MAT_NEG) + if (node->custom1 & SH_NODE_MAT_NEG) GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn); out[MAT_OUT_NORMAL].link = shi.vn; diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c index c9234c626aa..045fef1b010 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.c +++ b/source/blender/nodes/shader/nodes/node_shader_math.c @@ -48,7 +48,7 @@ static bNodeSocketTemplate sh_node_math_out[]= { static void node_shader_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - switch(node->custom1){ + switch(node->custom1) { case 0: /* Add */ out[0]->vec[0]= in[0]->vec[0] + in[1]->vec[0]; @@ -61,7 +61,7 @@ bNodeStack **out) break; case 3: /* Divide */ { - if(in[1]->vec[0]==0) /* We don't want to divide by zero. */ + if (in[1]->vec[0]==0) /* We don't want to divide by zero. */ out[0]->vec[0]= 0.0; else out[0]->vec[0]= in[0]->vec[0] / in[1]->vec[0]; @@ -69,7 +69,7 @@ bNodeStack **out) break; case 4: /* Sine */ { - if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ + if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0]= sin(in[0]->vec[0]); else out[0]->vec[0]= sin(in[1]->vec[0]); @@ -77,7 +77,7 @@ bNodeStack **out) break; case 5: /* Cosine */ { - if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ + if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0]= cos(in[0]->vec[0]); else out[0]->vec[0]= cos(in[1]->vec[0]); @@ -85,7 +85,7 @@ bNodeStack **out) break; case 6: /* Tangent */ { - if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ + if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0]= tan(in[0]->vec[0]); else out[0]->vec[0]= tan(in[1]->vec[0]); @@ -93,16 +93,16 @@ bNodeStack **out) break; case 7: /* Arc-Sine */ { - if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ + if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ /* Can't do the impossible... */ - if( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 ) + if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 ) out[0]->vec[0]= asin(in[0]->vec[0]); else out[0]->vec[0]= 0.0; } else { /* Can't do the impossible... */ - if( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 ) + if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 ) out[0]->vec[0]= asin(in[1]->vec[0]); else out[0]->vec[0]= 0.0; @@ -111,16 +111,16 @@ bNodeStack **out) break; case 8: /* Arc-Cosine */ { - if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ + if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ /* Can't do the impossible... */ - if( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 ) + if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 ) out[0]->vec[0]= acos(in[0]->vec[0]); else out[0]->vec[0]= 0.0; } else { /* Can't do the impossible... */ - if( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 ) + if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 ) out[0]->vec[0]= acos(in[1]->vec[0]); else out[0]->vec[0]= 0.0; @@ -129,7 +129,7 @@ bNodeStack **out) break; case 9: /* Arc-Tangent */ { - if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ + if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0]= atan(in[0]->vec[0]); else out[0]->vec[0]= atan(in[1]->vec[0]); @@ -138,7 +138,7 @@ bNodeStack **out) case 10: /* Power */ { /* Don't want any imaginary numbers... */ - if( in[0]->vec[0] >= 0 ) + if ( in[0]->vec[0] >= 0 ) out[0]->vec[0]= pow(in[0]->vec[0], in[1]->vec[0]); else out[0]->vec[0]= 0.0; @@ -147,7 +147,7 @@ bNodeStack **out) case 11: /* Logarithm */ { /* Don't want any imaginary numbers... */ - if( in[0]->vec[0] > 0 && in[1]->vec[0] > 0 ) + if ( in[0]->vec[0] > 0 && in[1]->vec[0] > 0 ) out[0]->vec[0]= log(in[0]->vec[0]) / log(in[1]->vec[0]); else out[0]->vec[0]= 0.0; @@ -155,7 +155,7 @@ bNodeStack **out) break; case 12: /* Minimum */ { - if( in[0]->vec[0] < in[1]->vec[0] ) + if ( in[0]->vec[0] < in[1]->vec[0] ) out[0]->vec[0]= in[0]->vec[0]; else out[0]->vec[0]= in[1]->vec[0]; @@ -163,7 +163,7 @@ bNodeStack **out) break; case 13: /* Maximum */ { - if( in[0]->vec[0] > in[1]->vec[0] ) + if ( in[0]->vec[0] > in[1]->vec[0] ) out[0]->vec[0]= in[0]->vec[0]; else out[0]->vec[0]= in[1]->vec[0]; @@ -171,7 +171,7 @@ bNodeStack **out) break; case 14: /* Round */ { - if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ + if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0]= (in[0]->vec[0]<0)?(int)(in[0]->vec[0] - 0.5f):(int)(in[0]->vec[0] + 0.5f); else out[0]->vec[0]= (in[1]->vec[0]<0)?(int)(in[1]->vec[0] - 0.5f):(int)(in[1]->vec[0] + 0.5f); @@ -179,7 +179,7 @@ bNodeStack **out) break; case 15: /* Less Than */ { - if( in[0]->vec[0] < in[1]->vec[0] ) + if ( in[0]->vec[0] < in[1]->vec[0] ) out[0]->vec[0]= 1.0f; else out[0]->vec[0]= 0.0f; @@ -187,7 +187,7 @@ bNodeStack **out) break; case 16: /* Greater Than */ { - if( in[0]->vec[0] > in[1]->vec[0] ) + if ( in[0]->vec[0] > in[1]->vec[0] ) out[0]->vec[0]= 1.0f; else out[0]->vec[0]= 0.0f; @@ -224,7 +224,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN case 8: case 9: case 14: - if(in[0].hasinput || !in[1].hasinput) + if (in[0].hasinput || !in[1].hasinput) GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0])); else GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1])); diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c index 8b0e9a5803b..14a115a8353 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output.c +++ b/source/blender/nodes/shader/nodes/node_shader_output.c @@ -41,7 +41,7 @@ static bNodeSocketTemplate sh_node_output_in[]= { static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { - if(data) { + if (data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; float col[4]; @@ -49,12 +49,12 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN nodestack_get_vec(col, SOCK_VECTOR, in[0]); nodestack_get_vec(col+3, SOCK_FLOAT, in[1]); - if(shi->do_preview) { + if (shi->do_preview) { nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage); node->lasty= shi->ys; } - if(node->flag & NODE_DO_OUTPUT) { + if (node->flag & NODE_DO_OUTPUT) { ShadeResult *shr= ((ShaderCallData *)data)->shr; copy_v4_v4(shr->combined, col); @@ -70,7 +70,7 @@ static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack GPUNodeLink *outlink; #if 0 - if(in[1].hasinput) + if (in[1].hasinput) GPU_material_enable_alpha(mat); #endif diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c index 551b70d9b8a..2fff2bab1d4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c @@ -54,7 +54,7 @@ static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode* node, static int node_shader_gpu_tex_checker(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_attribute(CD_ORCO, ""); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c index 8ecff6e3767..852c056dc28 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c @@ -55,13 +55,13 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNod Image *ima= (Image*)node->id; ImageUser *iuser= NULL; - if(!ima) { + if (!ima) { float black[4] = {0.0f, 0.0f, 0.0f, 1.0f}; GPUNodeLink *vec = GPU_uniform(black); return GPU_stack_link(mat, "set_rgba", out, out, vec); } - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_builtin(GPU_VIEW_POSITION); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c index a2403b6bdec..769cf845b42 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c @@ -52,7 +52,7 @@ static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode* node, static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_attribute(CD_ORCO, ""); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c index aa7ff279178..69e45469174 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -54,13 +54,13 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack Image *ima= (Image*)node->id; ImageUser *iuser= NULL; - if(!ima) { + if (!ima) { float black[4] = {0.0f, 0.0f, 0.0f, 1.0f}; GPUNodeLink *vec = GPU_uniform(black); return GPU_stack_link(mat, "set_rgba", out, out, vec); } - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_attribute(CD_MTFACE, ""); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c index 3a270220667..e2c0cfc020f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c @@ -57,7 +57,7 @@ static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, GPUNodeStack NodeTexMagic *tex = (NodeTexMagic*)node->storage; float depth = tex->depth; - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_attribute(CD_ORCO, ""); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c index 015b78687fd..9fe3e652eea 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c @@ -58,7 +58,7 @@ static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode* node, static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_attribute(CD_ORCO, ""); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c index bb365cf5a33..2667d2a5867 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c @@ -54,7 +54,7 @@ static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode* node, bN static int node_shader_gpu_tex_noise(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_attribute(CD_ORCO, ""); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c index a4131f3ca6c..b4855faaf94 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -54,7 +54,7 @@ static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode* node, bNod static int node_shader_gpu_tex_sky(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_attribute(CD_ORCO, ""); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c index 9adaab22b03..eebd4886c59 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c @@ -53,7 +53,7 @@ static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode* node, static int node_shader_gpu_tex_voronoi(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_attribute(CD_ORCO, ""); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c index d359a407bc0..3e079ffc4f4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c @@ -56,7 +56,7 @@ static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode* node, bNo static int node_shader_gpu_tex_wave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - if(!in[0].link) + if (!in[0].link) in[0].link = GPU_attribute(CD_ORCO, ""); node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c index 02818496dab..8b6386fe2f6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_texture.c +++ b/source/blender/nodes/shader/nodes/node_shader_texture.c @@ -48,7 +48,7 @@ static bNodeSocketTemplate sh_node_texture_out[]= { static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { - if(data && node->id) { + if (data && node->id) { ShadeInput *shi= ((ShaderCallData *)data)->shi; TexResult texres; bNodeSocket *sock_vector= node->inputs.first; @@ -65,14 +65,14 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b texres.tr= texres.tg= texres.tb= 0.0f; /* don't use in[0]->hasinput, see material node for explanation */ - if(sock_vector->link) { + if (sock_vector->link) { nodestack_get_vec(vec, SOCK_VECTOR, in[0]); - if(in[0]->datatype==NS_OSA_VECTORS) { + if (in[0]->datatype==NS_OSA_VECTORS) { float *fp= in[0]->data; retval= multitex_nodes((Tex *)node->id, vec, fp, fp+3, shi->osatex, &texres, thread, which_output, NULL, NULL); } - else if(in[0]->datatype==NS_OSA_VALUES) { + else if (in[0]->datatype==NS_OSA_VALUES) { float *fp= in[0]->data; float dxt[3], dyt[3]; @@ -89,18 +89,18 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b } /* stupid exception */ - if( ((Tex *)node->id)->type==TEX_STUCCI) { + if ( ((Tex *)node->id)->type==TEX_STUCCI) { texres.tin= 0.5f + 0.7f*texres.nor[0]; CLAMP(texres.tin, 0.0f, 1.0f); } /* intensity and color need some handling */ - if(texres.talpha) + if (texres.talpha) out[0]->vec[0]= texres.ta; else out[0]->vec[0]= texres.tin; - if((retval & TEX_RGB)==0) { + if ((retval & TEX_RGB)==0) { out[1]->vec[0]= out[0]->vec[0]; out[1]->vec[1]= out[0]->vec[0]; out[1]->vec[2]= out[0]->vec[0]; @@ -115,7 +115,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b copy_v3_v3(out[2]->vec, nor); - if(shi->do_preview) + if (shi->do_preview) nodeAddToPreview(node, out[1]->vec, shi->xs, shi->ys, shi->do_manage); } @@ -125,7 +125,7 @@ static int gpu_shader_texture(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G { Tex *tex = (Tex*)node->id; - if(tex && tex->type == TEX_IMAGE && tex->ima) { + if (tex && tex->type == TEX_IMAGE && tex->ima) { GPUNodeLink *texlink = GPU_image(tex->ima, NULL); return GPU_stack_link(mat, "texture_image", in, out, texlink); } diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c index f0a94928985..a9513eec6ea 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c @@ -48,7 +48,7 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStac /* stack order in: fac */ /* stack order out: col, alpha */ - if(node->storage) { + if (node->storage) { float fac; nodestack_get_vec(&fac, SOCK_FLOAT, in[0]); diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c index 75dbff11b6e..9b57780cd9d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c +++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c @@ -54,39 +54,39 @@ static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeSta nodestack_get_vec(vec1, SOCK_VECTOR, in[0]); nodestack_get_vec(vec2, SOCK_VECTOR, in[1]); - if(node->custom1 == 0) { /* Add */ + if (node->custom1 == 0) { /* Add */ out[0]->vec[0]= vec1[0] + vec2[0]; out[0]->vec[1]= vec1[1] + vec2[1]; out[0]->vec[2]= vec1[2] + vec2[2]; out[1]->vec[0]= (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3; } - else if(node->custom1 == 1) { /* Subtract */ + else if (node->custom1 == 1) { /* Subtract */ out[0]->vec[0]= vec1[0] - vec2[0]; out[0]->vec[1]= vec1[1] - vec2[1]; out[0]->vec[2]= vec1[2] - vec2[2]; out[1]->vec[0]= (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3; } - else if(node->custom1 == 2) { /* Average */ + else if (node->custom1 == 2) { /* Average */ out[0]->vec[0]= vec1[0] + vec2[0]; out[0]->vec[1]= vec1[1] + vec2[1]; out[0]->vec[2]= vec1[2] + vec2[2]; out[1]->vec[0] = normalize_v3( out[0]->vec ); } - else if(node->custom1 == 3) { /* Dot product */ + else if (node->custom1 == 3) { /* Dot product */ out[1]->vec[0]= (vec1[0] * vec2[0]) + (vec1[1] * vec2[1]) + (vec1[2] * vec2[2]); } - else if(node->custom1 == 4) { /* Cross product */ + else if (node->custom1 == 4) { /* Cross product */ out[0]->vec[0]= (vec1[1] * vec2[2]) - (vec1[2] * vec2[1]); out[0]->vec[1]= (vec1[2] * vec2[0]) - (vec1[0] * vec2[2]); out[0]->vec[2]= (vec1[0] * vec2[1]) - (vec1[1] * vec2[0]); out[1]->vec[0] = normalize_v3( out[0]->vec ); } - else if(node->custom1 == 5) { /* Normalize */ - if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ + else if (node->custom1 == 5) { /* Normalize */ + if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ out[0]->vec[0]= vec1[0]; out[0]->vec[1]= vec1[1]; out[0]->vec[2]= vec1[2]; @@ -118,7 +118,7 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPU_socket(&in[0]), GPU_socket(&in[1])); break; case 5: - if(in[0].hasinput || !in[1].hasinput) + if (in[0].hasinput || !in[1].hasinput) GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0])); else GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1])); |