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/node_shader_util.c | |
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/node_shader_util.c')
-rw-r--r-- | source/blender/nodes/shader/node_shader_util.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index 606ba98762c..df2f7879231 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -42,14 +42,14 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns) { float *from= ns->vec; - if(type_in==SOCK_FLOAT) { - if(ns->sockettype==SOCK_FLOAT) + if (type_in==SOCK_FLOAT) { + if (ns->sockettype==SOCK_FLOAT) *in= *from; else *in= 0.333333f*(from[0]+from[1]+from[2]); } - else if(type_in==SOCK_VECTOR) { - if(ns->sockettype==SOCK_FLOAT) { + else if (type_in==SOCK_VECTOR) { + if (ns->sockettype==SOCK_FLOAT) { in[0]= from[0]; in[1]= from[0]; in[2]= from[0]; @@ -59,10 +59,10 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns) } } else { /* type_in==SOCK_RGBA */ - if(ns->sockettype==SOCK_RGBA) { + if (ns->sockettype==SOCK_RGBA) { copy_v4_v4(in, from); } - else if(ns->sockettype==SOCK_FLOAT) { + else if (ns->sockettype==SOCK_FLOAT) { in[0]= from[0]; in[1]= from[0]; in[2]= from[0]; @@ -84,22 +84,22 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo bNodeSocket *sock; int a; - for(node= ntree->nodes.first; node; node= node->next) { - if(node->type==SH_NODE_TEXTURE) { - if((r_mode & R_OSA) && node->id) { + for (node= ntree->nodes.first; node; node= node->next) { + if (node->type==SH_NODE_TEXTURE) { + if ((r_mode & R_OSA) && node->id) { Tex *tex= (Tex *)node->id; if ELEM3(tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP) *texco |= TEXCO_OSA|NEED_UV; } /* usability exception... without input we still give the node orcos */ sock= node->inputs.first; - if(sock==NULL || sock->link==NULL) + if (sock==NULL || sock->link==NULL) *texco |= TEXCO_ORCO|NEED_UV; } - else if(node->type==SH_NODE_GEOMETRY) { + else if (node->type==SH_NODE_GEOMETRY) { /* note; sockets always exist for the given type! */ - for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) { - if(sock->flag & SOCK_IN_USE) { + for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) { + if (sock->flag & SOCK_IN_USE) { switch(a) { case GEOM_OUT_GLOB: *texco |= TEXCO_GLOB|NEED_UV; break; @@ -125,17 +125,17 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo /* nodes that use ID data get synced with local data */ void nodeShaderSynchronizeID(bNode *node, int copyto) { - if(node->id==NULL) return; + if (node->id==NULL) return; - if(ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) { + if (ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) { bNodeSocket *sock; Material *ma= (Material *)node->id; int a; /* hrmf, case in loop isn't super fast, but we don't edit 100s of material at same time either! */ - for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) { - if(!nodeSocketIsHidden(sock)) { - if(copyto) { + for (a=0, sock= node->inputs.first; sock; sock= sock->next, a++) { + if (!nodeSocketIsHidden(sock)) { + if (copyto) { switch(a) { case MAT_IN_COLOR: copy_v3_v3(&ma->r, ((bNodeSocketValueRGBA*)sock->default_value)->value); break; @@ -249,19 +249,19 @@ bNode *nodeGetActiveTexture(bNodeTree *ntree) /* this is the node we texture paint and draw in textured draw */ bNode *node; - if(!ntree) + if (!ntree) return NULL; /* check for group edit */ - for(node= ntree->nodes.first; node; node= node->next) - if(node->flag & NODE_GROUP_EDIT) + for (node= ntree->nodes.first; node; node= node->next) + if (node->flag & NODE_GROUP_EDIT) break; - if(node) + if (node) ntree= (bNodeTree*)node->id; - for(node= ntree->nodes.first; node; node= node->next) - if(node->flag & NODE_ACTIVE_TEXTURE) + for (node= ntree->nodes.first; node; node= node->next) + if (node->flag & NODE_ACTIVE_TEXTURE) return node; return NULL; @@ -280,31 +280,31 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs) stack= exec->stack; - for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { + for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { node = nodeexec->node; doit = 0; /* for groups, only execute outputs for edited group */ - if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) { - if(do_outputs && (node->flag & NODE_DO_OUTPUT)) + if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) { + if (do_outputs && (node->flag & NODE_DO_OUTPUT)) doit = 1; } else doit = 1; if (doit) { - if(node->typeinfo->gpufunc) { + if (node->typeinfo->gpufunc) { node_get_stack(node, stack, nsin, nsout); gpu_stack_from_data_list(gpuin, &node->inputs, nsin); gpu_stack_from_data_list(gpuout, &node->outputs, nsout); - if(node->typeinfo->gpufunc(mat, node, gpuin, gpuout)) + if (node->typeinfo->gpufunc(mat, node, gpuin, gpuout)) data_from_gpu_stack_list(&node->outputs, nsout, gpuout); } - else if(node->typeinfo->gpuextfunc) { + else if (node->typeinfo->gpuextfunc) { node_get_stack(node, stack, nsin, nsout); gpu_stack_from_data_list(gpuin, &node->inputs, nsin); gpu_stack_from_data_list(gpuout, &node->outputs, nsout); - if(node->typeinfo->gpuextfunc(mat, node, nodeexec->data, gpuin, gpuout)) + if (node->typeinfo->gpuextfunc(mat, node, nodeexec->data, gpuin, gpuout)) data_from_gpu_stack_list(&node->outputs, nsout, gpuout); } } @@ -318,7 +318,7 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in float domin= (texmap->flag & TEXMAP_CLIP_MIN) != 0; float domax= (texmap->flag & TEXMAP_CLIP_MAX) != 0; - if(domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) { + if (domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) { GPUNodeLink *tmat = GPU_uniform((float*)texmap->mat); GPUNodeLink *tmin = GPU_uniform(texmap->min); GPUNodeLink *tmax = GPU_uniform(texmap->max); |