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 | |
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')
101 files changed, 1164 insertions, 1138 deletions
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 0ebed7105f0..b60e962f534 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -63,8 +63,8 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func) { Scene *sce; - for(sce= main->scene.first; sce; sce= sce->id.next) { - if(sce->nodetree) { + for (sce= main->scene.first; sce; sce= sce->id.next) { + if (sce->nodetree) { func(calldata, &sce->id, sce->nodetree); } } @@ -88,8 +88,8 @@ static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node) { bNodeSocket *sock; - for(sock= node->outputs.first; sock; sock= sock->next) { - if(sock->cache) { + for (sock= node->outputs.first; sock; sock= sock->next) { + if (sock->cache) { free_compbuf(sock->cache); sock->cache= NULL; } @@ -99,7 +99,7 @@ static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node) static void free_cache(bNodeTree *ntree) { bNode *node; - for(node= ntree->nodes.first; node; node= node->next) + for (node= ntree->nodes.first; node; node= node->next) free_node_cache(ntree, node); } @@ -107,8 +107,8 @@ static void update_node(bNodeTree *ntree, bNode *node) { bNodeSocket *sock; - for(sock= node->outputs.first; sock; sock= sock->next) { - if(sock->cache) { + for (sock= node->outputs.first; sock; sock= sock->next) { + if (sock->cache) { //free_compbuf(sock->cache); //sock->cache= NULL; } @@ -126,23 +126,23 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree) bNode *node, *node_next; bNodeSocket *sock; - for(node= ntree->nodes.first; node; node= node->next) { + for (node= ntree->nodes.first; node; node= node->next) { /* ensure new user input gets handled ok */ node->need_exec= 0; /* move over the compbufs */ /* right after ntreeCopyTree() oldsock pointers are valid */ - if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { - if(node->id) { - if(node->flag & NODE_DO_OUTPUT) + if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { + if (node->id) { + if (node->flag & NODE_DO_OUTPUT) node->new_node->id= (ID *)copy_image((Image *)node->id); else node->new_node->id= NULL; } } - for(sock= node->outputs.first; sock; sock= sock->next) { + for (sock= node->outputs.first; sock; sock= sock->next) { sock->new_sock->cache= sock->cache; compbuf_set_node(sock->new_sock->cache, node->new_node); @@ -177,11 +177,11 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree) bNode *lnode; /* move over the compbufs and previews */ - for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) { - if( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) { - if(ntreeNodeExists(ntree, lnode->new_node)) { + for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) { + if ( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) { + if (ntreeNodeExists(ntree, lnode->new_node)) { - if(lnode->preview && lnode->preview->rect) { + if (lnode->preview && lnode->preview->rect) { nodeFreePreview(lnode->new_node); lnode->new_node->preview= lnode->preview; lnode->preview= NULL; @@ -197,28 +197,28 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree) bNodeSocket *lsock; /* move over the compbufs and previews */ - for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) { - if(ntreeNodeExists(ntree, lnode->new_node)) { - if(ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { - if(lnode->id && (lnode->flag & NODE_DO_OUTPUT)) { + for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) { + if (ntreeNodeExists(ntree, lnode->new_node)) { + if (ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { + if (lnode->id && (lnode->flag & NODE_DO_OUTPUT)) { /* image_merge does sanity check for pointers */ BKE_image_merge((Image *)lnode->new_node->id, (Image *)lnode->id); } } - else if(lnode->type==CMP_NODE_MOVIEDISTORTION) { + else if (lnode->type==CMP_NODE_MOVIEDISTORTION) { /* special case for distortion node: distortion context is allocating in exec function and to achive much better performance on further calls this context should be copied back to original node */ - if(lnode->storage) { - if(lnode->new_node->storage) + if (lnode->storage) { + if (lnode->new_node->storage) BKE_tracking_distortion_destroy(lnode->new_node->storage); lnode->new_node->storage= BKE_tracking_distortion_copy(lnode->storage); } } - for(lsock= lnode->outputs.first; lsock; lsock= lsock->next) { - if(ntreeOutputExists(lnode->new_node, lsock->new_sock)) { + for (lsock= lnode->outputs.first; lsock; lsock= lsock->next) { + if (ntreeOutputExists(lnode->new_node, lsock->new_sock)) { lsock->new_sock->cache= lsock->cache; compbuf_set_node(lsock->new_sock->cache, lnode->new_node); lsock->cache= NULL; @@ -276,21 +276,21 @@ struct bNodeTreeExec *ntreeCompositBeginExecTree(bNodeTree *ntree, int use_tree_ exec = ntree_exec_begin(ntree); - for(node= exec->nodetree->nodes.first; node; node= node->next) { + for (node= exec->nodetree->nodes.first; node; node= node->next) { /* initialize needed for groups */ node->exec= 0; - for(sock= node->outputs.first; sock; sock= sock->next) { + for (sock= node->outputs.first; sock; sock= sock->next) { bNodeStack *ns= node_get_socket_stack(exec->stack, sock); - if(ns && sock->cache) { + if (ns && sock->cache) { ns->data= sock->cache; sock->cache= NULL; } } /* cannot initialize them while using in threads */ - if(ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) { + if (ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) { curvemapping_initialize(node->storage); - if(node->type==CMP_NODE_CURVE_RGB) + if (node->type==CMP_NODE_CURVE_RGB) curvemapping_premultiply(node->storage, 0); } } @@ -310,22 +310,22 @@ struct bNodeTreeExec *ntreeCompositBeginExecTree(bNodeTree *ntree, int use_tree_ */ void ntreeCompositEndExecTree(bNodeTreeExec *exec, int use_tree_data) { - if(exec) { + if (exec) { bNodeTree *ntree= exec->nodetree; bNode *node; bNodeStack *ns; - for(node= exec->nodetree->nodes.first; node; node= node->next) { + for (node= exec->nodetree->nodes.first; node; node= node->next) { bNodeSocket *sock; - for(sock= node->outputs.first; sock; sock= sock->next) { + for (sock= node->outputs.first; sock; sock= sock->next) { ns = node_get_socket_stack(exec->stack, sock); - if(ns && ns->data) { + if (ns && ns->data) { sock->cache= ns->data; ns->data= NULL; } } - if(node->type==CMP_NODE_CURVE_RGB) + if (node->type==CMP_NODE_CURVE_RGB) curvemapping_premultiply(node->storage, 1); node->need_exec= 0; @@ -347,14 +347,14 @@ static int node_only_value(bNode *node) { bNodeSocket *sock; - if(ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_VALUE, CMP_NODE_RGB)) + if (ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_VALUE, CMP_NODE_RGB)) return 1; /* doing this for all node types goes wrong. memory free errors */ - if(node->inputs.first && node->type==CMP_NODE_MAP_VALUE) { + if (node->inputs.first && node->type==CMP_NODE_MAP_VALUE) { int retval= 1; - for(sock= node->inputs.first; sock; sock= sock->next) { - if(sock->link) + for (sock= node->inputs.first; sock; sock= sock->next) { + if (sock->link) retval &= node_only_value(sock->link->fromnode); } return retval; @@ -378,7 +378,7 @@ static void *exec_composite_node(void *nodeexec_v) node_get_stack(node, thd->stack, nsin, nsout); - if(node->typeinfo->execfunc) + if (node->typeinfo->execfunc) node->typeinfo->execfunc(thd->rd, node, nsin, nsout); else if (node->typeinfo->newexecfunc) node->typeinfo->newexecfunc(thd->rd, 0, node, nodeexec->data, nsin, nsout); @@ -399,13 +399,13 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd) int n, totnode= 0, group_edit= 0; /* if we are in group edit, viewer nodes get skipped when group has viewer */ - for(node= ntree->nodes.first; node; node= node->next) - if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT)) - if(ntreeHasType((bNodeTree *)node->id, CMP_NODE_VIEWER)) + for (node= ntree->nodes.first; node; node= node->next) + if (node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT)) + if (ntreeHasType((bNodeTree *)node->id, CMP_NODE_VIEWER)) group_edit= 1; /* NB: using the exec data list here to have valid dependency sort */ - for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { + for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { int a; node = nodeexec->node; @@ -413,9 +413,9 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd) /* test the outputs */ /* skip value-only nodes (should be in type!) */ - if(!node_only_value(node)) { - for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) { - if(nsout[a]->data==NULL && nsout[a]->hasoutput) { + if (!node_only_value(node)) { + for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) { + if (nsout[a]->data==NULL && nsout[a]->hasoutput) { node->need_exec= 1; break; } @@ -423,18 +423,18 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd) } /* test the inputs */ - for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) { + for (a=0, sock= node->inputs.first; sock; sock= sock->next, a++) { /* skip viewer nodes in bg render or group edit */ - if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && (G.background || group_edit)) + if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && (G.background || group_edit)) node->need_exec= 0; /* is sock in use? */ - else if(sock->link) { + else if (sock->link) { bNodeLink *link= sock->link; /* this is the test for a cyclic case */ - if(link->fromnode==NULL || link->tonode==NULL); - else if(link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) { - if(link->fromnode->need_exec) { + if (link->fromnode==NULL || link->tonode==NULL); + else if (link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) { + if (link->fromnode->need_exec) { node->need_exec= 1; break; } @@ -446,11 +446,11 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd) } } - if(node->need_exec) { + if (node->need_exec) { /* free output buffers */ - for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) { - if(nsout[a]->data) { + for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) { + if (nsout[a]->data) { free_compbuf(nsout[a]->data); nsout[a]->data= NULL; } @@ -470,11 +470,11 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd) /* last step: set the stack values for only-value nodes */ /* just does all now, compared to a full buffer exec this is nothing */ - if(totnode) { - for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { + if (totnode) { + for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { node = nodeexec->node; - if(node->need_exec==0 && node_only_value(node)) { - if(node->typeinfo->execfunc) { + if (node->need_exec==0 && node_only_value(node)) { + if (node->typeinfo->execfunc) { node_get_stack(node, exec->stack, nsin, nsout); node->typeinfo->execfunc(thd->rd, node, nsin, nsout); } @@ -499,28 +499,28 @@ static void freeExecutableNode(bNodeTreeExec *exec) int n; /* set exec flag for finished nodes that might need freed */ - for(node= ntree->nodes.first; node; node= node->next) { - if(node->type!=CMP_NODE_R_LAYERS) - if(node->exec & NODE_FINISHED) + for (node= ntree->nodes.first; node; node= node->next) { + if (node->type!=CMP_NODE_R_LAYERS) + if (node->exec & NODE_FINISHED) node->exec |= NODE_FREEBUFS; } /* clear this flag for input links that are not done yet. * Using the exec data for valid dependency sort. */ - 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; - if((node->exec & NODE_FINISHED)==0) { - for(sock= node->inputs.first; sock; sock= sock->next) - if(sock->link) + if ((node->exec & NODE_FINISHED)==0) { + for (sock= node->inputs.first; sock; sock= sock->next) + if (sock->link) sock->link->fromnode->exec &= ~NODE_FREEBUFS; } } /* now we can free buffers */ - for(node= ntree->nodes.first; node; node= node->next) { - if(node->exec & NODE_FREEBUFS) { - for(sock= node->outputs.first; sock; sock= sock->next) { + for (node= ntree->nodes.first; node; node= node->next) { + if (node->exec & NODE_FREEBUFS) { + for (sock= node->outputs.first; sock; sock= sock->next) { bNodeStack *ns= node_get_socket_stack(exec->stack, sock); - if(ns && ns->data) { + if (ns && ns->data) { free_compbuf(ns->data); ns->data= NULL; // printf("freed buf node %s \n", node->name); @@ -536,15 +536,15 @@ static bNodeExec *getExecutableNode(bNodeTreeExec *exec) bNodeSocket *sock; int n; - for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { - if(nodeexec->node->exec==0) { + for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { + if (nodeexec->node->exec==0) { /* input sockets should be ready */ - for(sock= nodeexec->node->inputs.first; sock; sock= sock->next) { - if(sock->link && sock->link->fromnode) - if((sock->link->fromnode->exec & NODE_READY)==0) + for (sock= nodeexec->node->inputs.first; sock; sock= sock->next) { + if (sock->link && sock->link->fromnode) + if ((sock->link->fromnode->exec & NODE_READY)==0) break; } - if(sock==NULL) + if (sock==NULL) return nodeexec; } } @@ -556,12 +556,12 @@ static void ntree_composite_texnode(bNodeTree *ntree, int init) { bNode *node; - for(node= ntree->nodes.first; node; node= node->next) { - if(node->type==CMP_NODE_TEXTURE && node->id) { + for (node= ntree->nodes.first; node; node= node->next) { + if (node->type==CMP_NODE_TEXTURE && node->id) { Tex *tex= (Tex *)node->id; - if(tex->nodetree && tex->use_nodes) { + if (tex->nodetree && tex->use_nodes) { /* has internal flag to detect it only does it once */ - if(init) { + if (init) { if (!tex->nodetree->execdata) tex->nodetree->execdata = ntreeTexBeginExecTree(tex->nodetree, 1); } @@ -584,11 +584,11 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) int totnode, curnode, rendering= 1, n; bNodeTreeExec *exec; - if(ntree==NULL) return; + if (ntree==NULL) return; exec = ntree->execdata; - if(do_preview) + if (do_preview) ntreeInitPreview(ntree, 0, 0); if (!ntree->execdata) { @@ -598,7 +598,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) ntree_composite_texnode(ntree, 1); /* prevent unlucky accidents */ - if(G.background) + if (G.background) rd->scemode &= ~R_COMP_CROP; /* setup callerdata for thread callback */ @@ -613,15 +613,15 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) BLI_init_threads(&threads, exec_composite_node, rd->threads); - while(rendering) { + while (rendering) { - if(BLI_available_threads(&threads)) { + if (BLI_available_threads(&threads)) { nodeexec= getExecutableNode(exec); - if(nodeexec) { + if (nodeexec) { node = nodeexec->node; - if(ntree->progress && totnode) + if (ntree->progress && totnode) ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode)); - if(ntree->stats_draw) { + if (ntree->stats_draw) { char str[128]; BLI_snprintf(str, sizeof(str), "Compositing %d %s", curnode, node->name); ntree->stats_draw(ntree->sdh, str); @@ -640,21 +640,21 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) rendering= 0; /* test for ESC */ - if(ntree->test_break && ntree->test_break(ntree->tbh)) { - for(node= ntree->nodes.first; node; node= node->next) + if (ntree->test_break && ntree->test_break(ntree->tbh)) { + for (node= ntree->nodes.first; node; node= node->next) node->exec |= NODE_READY; } /* check for ready ones, and if we need to continue */ - 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; - if(node->exec & NODE_READY) { - if((node->exec & NODE_FINISHED)==0) { + if (node->exec & NODE_READY) { + if ((node->exec & NODE_FINISHED)==0) { BLI_remove_thread(&threads, nodeexec); /* this waits for running thread to finish btw */ node->exec |= NODE_FINISHED; /* freeing unused buffers */ - if(rd->scemode & R_COMP_FREE) + if (rd->scemode & R_COMP_FREE) freeExecutableNode(exec); } } @@ -675,10 +675,10 @@ static void force_hidden_passes(bNode *node, int passflag) { bNodeSocket *sock; - for(sock= node->outputs.first; sock; sock= sock->next) + for (sock= node->outputs.first; sock; sock= sock->next) sock->flag &= ~SOCK_UNAVAIL; - if(!(passflag & SCE_PASS_COMBINED)) { + if (!(passflag & SCE_PASS_COMBINED)) { sock= BLI_findlink(&node->outputs, RRES_OUT_IMAGE); sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_ALPHA); @@ -686,60 +686,60 @@ static void force_hidden_passes(bNode *node, int passflag) } sock= BLI_findlink(&node->outputs, RRES_OUT_Z); - if(!(passflag & SCE_PASS_Z)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_Z)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_NORMAL); - if(!(passflag & SCE_PASS_NORMAL)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_NORMAL)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_VEC); - if(!(passflag & SCE_PASS_VECTOR)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_VECTOR)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_UV); - if(!(passflag & SCE_PASS_UV)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_UV)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_RGBA); - if(!(passflag & SCE_PASS_RGBA)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_RGBA)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF); - if(!(passflag & SCE_PASS_DIFFUSE)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_DIFFUSE)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_SPEC); - if(!(passflag & SCE_PASS_SPEC)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_SPEC)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_SHADOW); - if(!(passflag & SCE_PASS_SHADOW)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_SHADOW)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_AO); - if(!(passflag & SCE_PASS_AO)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_AO)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_REFLECT); - if(!(passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_REFRACT); - if(!(passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_INDIRECT); - if(!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB); - if(!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXMA); - if(!(passflag & SCE_PASS_INDEXMA)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_INDEXMA)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_MIST); - if(!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_EMIT); - if(!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_ENV); - if(!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_DIRECT); - if(!(passflag & SCE_PASS_DIFFUSE_DIRECT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_DIFFUSE_DIRECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_INDIRECT); - if(!(passflag & SCE_PASS_DIFFUSE_INDIRECT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_DIFFUSE_INDIRECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_COLOR); - if(!(passflag & SCE_PASS_DIFFUSE_COLOR)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_DIFFUSE_COLOR)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_DIRECT); - if(!(passflag & SCE_PASS_GLOSSY_DIRECT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_GLOSSY_DIRECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_INDIRECT); - if(!(passflag & SCE_PASS_GLOSSY_INDIRECT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_GLOSSY_INDIRECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_COLOR); - if(!(passflag & SCE_PASS_GLOSSY_COLOR)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_GLOSSY_COLOR)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_DIRECT); - if(!(passflag & SCE_PASS_TRANSM_DIRECT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_TRANSM_DIRECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_INDIRECT); - if(!(passflag & SCE_PASS_TRANSM_INDIRECT)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_TRANSM_INDIRECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_COLOR); - if(!(passflag & SCE_PASS_TRANSM_COLOR)) sock->flag |= SOCK_UNAVAIL; + if (!(passflag & SCE_PASS_TRANSM_COLOR)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_COLOR); } @@ -748,27 +748,27 @@ void ntreeCompositForceHidden(bNodeTree *ntree, Scene *curscene) { bNode *node; - if(ntree==NULL) return; + if (ntree==NULL) return; - for(node= ntree->nodes.first; node; node= node->next) { - if( node->type==CMP_NODE_R_LAYERS) { + for (node= ntree->nodes.first; node; node= node->next) { + if ( node->type==CMP_NODE_R_LAYERS) { Scene *sce= node->id?(Scene *)node->id:curscene; SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1); - if(srl) + if (srl) force_hidden_passes(node, srl->passflag); } - else if( node->type==CMP_NODE_IMAGE) { + else if ( node->type==CMP_NODE_IMAGE) { Image *ima= (Image *)node->id; - if(ima) { - if(ima->rr) { + if (ima) { + if (ima->rr) { ImageUser *iuser= node->storage; RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer); - if(rl) + if (rl) force_hidden_passes(node, rl->passflag); else force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA); } - else if(ima->type!=IMA_TYPE_MULTILAYER) { /* if ->rr not yet read we keep inputs */ + else if (ima->type!=IMA_TYPE_MULTILAYER) { /* if ->rr not yet read we keep inputs */ force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA|RRES_OUT_Z); } else @@ -787,14 +787,14 @@ void ntreeCompositTagRender(Scene *curscene) { Scene *sce; - for(sce= G.main->scene.first; sce; sce= sce->id.next) { - if(sce->nodetree) { + for (sce= G.main->scene.first; sce; sce= sce->id.next) { + if (sce->nodetree) { bNode *node; - for(node= sce->nodetree->nodes.first; node; node= node->next) { - if(node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE) + for (node= sce->nodetree->nodes.first; node; node= node->next) { + if (node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE) nodeUpdate(sce->nodetree, node); - else if(node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ + else if (node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ nodeUpdate(sce->nodetree, node); } } @@ -856,31 +856,31 @@ int ntreeCompositTagAnimated(bNodeTree *ntree) bNode *node; int tagged= 0; - if(ntree==NULL) return 0; + if (ntree==NULL) return 0; - for(node= ntree->nodes.first; node; node= node->next) { + for (node= ntree->nodes.first; node; node= node->next) { tagged = node_animation_properties(ntree, node); /* otherwise always tag these node types */ - if(node->type==CMP_NODE_IMAGE) { + if (node->type==CMP_NODE_IMAGE) { Image *ima= (Image *)node->id; - if(ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { + if (ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { nodeUpdate(ntree, node); tagged= 1; } } - else if(node->type==CMP_NODE_TIME) { + else if (node->type==CMP_NODE_TIME) { nodeUpdate(ntree, node); tagged= 1; } /* here was tag render layer, but this is called after a render, so re-composites fail */ - else if(node->type==NODE_GROUP) { - if( ntreeCompositTagAnimated((bNodeTree *)node->id) ) { + else if (node->type==NODE_GROUP) { + if ( ntreeCompositTagAnimated((bNodeTree *)node->id) ) { nodeUpdate(ntree, node); } } - else if(ELEM(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_TRANSFORM)) { + else if (ELEM(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_TRANSFORM)) { nodeUpdate(ntree, node); tagged= 1; } @@ -895,10 +895,10 @@ void ntreeCompositTagGenerators(bNodeTree *ntree) { bNode *node; - if(ntree==NULL) return; + if (ntree==NULL) return; - for(node= ntree->nodes.first; node; node= node->next) { - if( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE)) + for (node= ntree->nodes.first; node; node= node->next) { + if ( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE)) nodeUpdate(ntree, node); } } @@ -908,11 +908,11 @@ void ntreeCompositClearTags(bNodeTree *ntree) { bNode *node; - if(ntree==NULL) return; + if (ntree==NULL) return; - for(node= ntree->nodes.first; node; node= node->next) { + for (node= ntree->nodes.first; node; node= node->next) { node->need_exec= 0; - if(node->type==NODE_GROUP) + if (node->type==NODE_GROUP) ntreeCompositClearTags((bNodeTree *)node->id); } } diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 25c073922df..8e98c055157 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -42,12 +42,12 @@ CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc) cbuf->yrad= sizey/2; cbuf->type= type; - if(alloc) { - if(cbuf->type==CB_RGBA) + if (alloc) { + if (cbuf->type==CB_RGBA) cbuf->rect= MEM_mapallocN(4*sizeof(float)*sizex*sizey, "compbuf RGBA rect"); - else if(cbuf->type==CB_VEC3) + else if (cbuf->type==CB_VEC3) cbuf->rect= MEM_mapallocN(3*sizeof(float)*sizex*sizey, "compbuf Vector3 rect"); - else if(cbuf->type==CB_VEC2) + else if (cbuf->type==CB_VEC2) cbuf->rect= MEM_mapallocN(2*sizeof(float)*sizex*sizey, "compbuf Vector2 rect"); else cbuf->rect= MEM_mapallocN(sizeof(float)*sizex*sizey, "compbuf Fac rect"); @@ -64,7 +64,7 @@ CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc) CompBuf *dupalloc_compbuf(CompBuf *cbuf) { CompBuf *dupbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); - if(dupbuf) { + if (dupbuf) { memcpy(dupbuf->rect, cbuf->rect, cbuf->type*sizeof(float)*cbuf->x*cbuf->y); dupbuf->xof= cbuf->xof; @@ -79,15 +79,15 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf) CompBuf *dupbuf= (cbuf)? alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 0): NULL; CompBuf *lastbuf; - if(dupbuf) { + if (dupbuf) { dupbuf->rect= cbuf->rect; dupbuf->xof= cbuf->xof; dupbuf->yof= cbuf->yof; dupbuf->malloc= 0; /* get last buffer in list, and append dupbuf */ - for(lastbuf= cbuf; lastbuf; lastbuf= lastbuf->next) - if(lastbuf->next==NULL) + for (lastbuf= cbuf; lastbuf; lastbuf= lastbuf->next) + if (lastbuf->next==NULL) break; lastbuf->next= dupbuf; dupbuf->prev= lastbuf; @@ -99,13 +99,13 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf) void free_compbuf(CompBuf *cbuf) { /* check referencing, then remove from list and set malloc tag */ - if(cbuf->prev || cbuf->next) { - if(cbuf->prev) + if (cbuf->prev || cbuf->next) { + if (cbuf->prev) cbuf->prev->next= cbuf->next; - if(cbuf->next) + if (cbuf->next) cbuf->next->prev= cbuf->prev; - if(cbuf->malloc) { - if(cbuf->prev) + if (cbuf->malloc) { + if (cbuf->prev) cbuf->prev->malloc= 1; else cbuf->next->malloc= 1; @@ -113,7 +113,7 @@ void free_compbuf(CompBuf *cbuf) } } - if(cbuf->malloc && cbuf->rect) + if (cbuf->malloc && cbuf->rect) MEM_freeN(cbuf->rect); MEM_freeN(cbuf); @@ -138,16 +138,16 @@ CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, in float *outfp; int dx, y; - if(disprect.xmax>rectx) disprect.xmax = rectx; - if(disprect.ymax>recty) disprect.ymax = recty; - if(disprect.xmin>= disprect.xmax) return NULL; - if(disprect.ymin>= disprect.ymax) return NULL; + if (disprect.xmax>rectx) disprect.xmax = rectx; + if (disprect.ymax>recty) disprect.ymax = recty; + if (disprect.xmin>= disprect.xmax) return NULL; + if (disprect.ymin>= disprect.ymax) return NULL; cbuf= alloc_compbuf(disprect.xmax-disprect.xmin, disprect.ymax-disprect.ymin, type, 1); outfp= cbuf->rect; rectf += type*(disprect.ymin*rectx + disprect.xmin); dx= type*cbuf->x; - for(y=cbuf->y; y>0; y--, outfp+=dx, rectf+=type*rectx) + for (y=cbuf->y; y>0; y--, outfp+=dx, rectf+=type*rectx) memcpy(outfp, rectf, sizeof(float)*dx); return cbuf; @@ -160,7 +160,7 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy) int x, y, c, pixsize= inbuf->type; int ofsx, ofsy, stepx, stepy; - if(inbuf->x==newx && inbuf->y==newy) + if (inbuf->x==newx && inbuf->y==newy) return dupalloc_compbuf(inbuf); outbuf= alloc_compbuf(newx, newy, inbuf->type, 1); @@ -170,7 +170,7 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy) stepy = (65536.0 * (inbuf->y - 1.0) / (newy - 1.0)) + 0.5; ofsy = 32768; - for (y = newy; y > 0 ; y--){ + for (y = newy; y > 0 ; y--) { rectf = inbuf->rect; rectf += pixsize * (ofsy >> 16) * inbuf->x; @@ -180,7 +180,7 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy) for (x = newx ; x>0 ; x--) { rf= rectf + pixsize*(ofsx >> 16); - for(c=0; c<pixsize; c++) + for (c=0; c<pixsize; c++) newrectf[c] = rf[c]; newrectf+= pixsize; @@ -194,65 +194,65 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy) void typecheck_compbuf_color(float *out, float *in, int outtype, int intype) { - if(intype == outtype) { + if (intype == outtype) { memcpy(out, in, sizeof(float)*outtype); } - else if(outtype==CB_VAL) { - if(intype==CB_VEC2) { + else if (outtype==CB_VAL) { + if (intype==CB_VEC2) { *out= 0.5f*(in[0]+in[1]); } - else if(intype==CB_VEC3) { + else if (intype==CB_VEC3) { *out= 0.333333f*(in[0]+in[1]+in[2]); } - else if(intype==CB_RGBA) { + else if (intype==CB_RGBA) { *out= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f; } } - else if(outtype==CB_VEC2) { - if(intype==CB_VAL) { + else if (outtype==CB_VEC2) { + if (intype==CB_VAL) { out[0]= in[0]; out[1]= in[0]; } - else if(intype==CB_VEC3) { + else if (intype==CB_VEC3) { out[0]= in[0]; out[1]= in[1]; } - else if(intype==CB_RGBA) { + else if (intype==CB_RGBA) { out[0]= in[0]; out[1]= in[1]; } } - else if(outtype==CB_VEC3) { - if(intype==CB_VAL) { + else if (outtype==CB_VEC3) { + if (intype==CB_VAL) { out[0]= in[0]; out[1]= in[0]; out[2]= in[0]; } - else if(intype==CB_VEC2) { + else if (intype==CB_VEC2) { out[0]= in[0]; out[1]= in[1]; out[2]= 0.0f; } - else if(intype==CB_RGBA) { + else if (intype==CB_RGBA) { out[0]= in[0]; out[1]= in[1]; out[2]= in[2]; } } - else if(outtype==CB_RGBA) { - if(intype==CB_VAL) { + else if (outtype==CB_RGBA) { + if (intype==CB_VAL) { out[0]= in[0]; out[1]= in[0]; out[2]= in[0]; out[3]= 1.0f; } - else if(intype==CB_VEC2) { + else if (intype==CB_VEC2) { out[0]= in[0]; out[1]= in[1]; out[2]= 0.0f; out[3]= 1.0f; } - else if(intype==CB_VEC3) { + else if (intype==CB_VEC3) { out[0]= in[0]; out[1]= in[1]; out[2]= in[2]; @@ -263,7 +263,7 @@ void typecheck_compbuf_color(float *out, float *in, int outtype, int intype) CompBuf *typecheck_compbuf(CompBuf *inbuf, int type) { - if(inbuf && inbuf->type!=type) { + if (inbuf && inbuf->type!=type) { CompBuf *outbuf; float *inrf, *outrf; int x; @@ -274,7 +274,7 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type) outbuf->xof= inbuf->xof; outbuf->yof= inbuf->yof; - if(inbuf->rect_procedural) { + if (inbuf->rect_procedural) { outbuf->rect_procedural= inbuf->rect_procedural; copy_v3_v3(outbuf->procedural_size, inbuf->procedural_size); copy_v3_v3(outbuf->procedural_offset, inbuf->procedural_offset); @@ -287,82 +287,82 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type) outrf= outbuf->rect; x= inbuf->x*inbuf->y; - if(type==CB_VAL) { - if(inbuf->type==CB_VEC2) { - for(; x>0; x--, outrf+= 1, inrf+= 2) + if (type==CB_VAL) { + if (inbuf->type==CB_VEC2) { + for (; x>0; x--, outrf+= 1, inrf+= 2) *outrf= 0.5f*(inrf[0]+inrf[1]); } - else if(inbuf->type==CB_VEC3) { - for(; x>0; x--, outrf+= 1, inrf+= 3) + else if (inbuf->type==CB_VEC3) { + for (; x>0; x--, outrf+= 1, inrf+= 3) *outrf= 0.333333f*(inrf[0]+inrf[1]+inrf[2]); } - else if(inbuf->type==CB_RGBA) { - for(; x>0; x--, outrf+= 1, inrf+= 4) + else if (inbuf->type==CB_RGBA) { + for (; x>0; x--, outrf+= 1, inrf+= 4) *outrf= inrf[0]*0.35f + inrf[1]*0.45f + inrf[2]*0.2f; } } - else if(type==CB_VEC2) { - if(inbuf->type==CB_VAL) { - for(; x>0; x--, outrf+= 2, inrf+= 1) { + else if (type==CB_VEC2) { + if (inbuf->type==CB_VAL) { + for (; x>0; x--, outrf+= 2, inrf+= 1) { outrf[0]= inrf[0]; outrf[1]= inrf[0]; } } - else if(inbuf->type==CB_VEC3) { - for(; x>0; x--, outrf+= 2, inrf+= 3) { + else if (inbuf->type==CB_VEC3) { + for (; x>0; x--, outrf+= 2, inrf+= 3) { outrf[0]= inrf[0]; outrf[1]= inrf[1]; } } - else if(inbuf->type==CB_RGBA) { - for(; x>0; x--, outrf+= 2, inrf+= 4) { + else if (inbuf->type==CB_RGBA) { + for (; x>0; x--, outrf+= 2, inrf+= 4) { outrf[0]= inrf[0]; outrf[1]= inrf[1]; } } } - else if(type==CB_VEC3) { - if(inbuf->type==CB_VAL) { - for(; x>0; x--, outrf+= 3, inrf+= 1) { + else if (type==CB_VEC3) { + if (inbuf->type==CB_VAL) { + for (; x>0; x--, outrf+= 3, inrf+= 1) { outrf[0]= inrf[0]; outrf[1]= inrf[0]; outrf[2]= inrf[0]; } } - else if(inbuf->type==CB_VEC2) { - for(; x>0; x--, outrf+= 3, inrf+= 2) { + else if (inbuf->type==CB_VEC2) { + for (; x>0; x--, outrf+= 3, inrf+= 2) { outrf[0]= inrf[0]; outrf[1]= inrf[1]; outrf[2]= 0.0f; } } - else if(inbuf->type==CB_RGBA) { - for(; x>0; x--, outrf+= 3, inrf+= 4) { + else if (inbuf->type==CB_RGBA) { + for (; x>0; x--, outrf+= 3, inrf+= 4) { outrf[0]= inrf[0]; outrf[1]= inrf[1]; outrf[2]= inrf[2]; } } } - else if(type==CB_RGBA) { - if(inbuf->type==CB_VAL) { - for(; x>0; x--, outrf+= 4, inrf+= 1) { + else if (type==CB_RGBA) { + if (inbuf->type==CB_VAL) { + for (; x>0; x--, outrf+= 4, inrf+= 1) { outrf[0]= inrf[0]; outrf[1]= inrf[0]; outrf[2]= inrf[0]; outrf[3]= 1.0f; } } - else if(inbuf->type==CB_VEC2) { - for(; x>0; x--, outrf+= 4, inrf+= 2) { + else if (inbuf->type==CB_VEC2) { + for (; x>0; x--, outrf+= 4, inrf+= 2) { outrf[0]= inrf[0]; outrf[1]= inrf[1]; outrf[2]= 0.0f; outrf[3]= 1.0f; } } - else if(inbuf->type==CB_VEC3) { - for(; x>0; x--, outrf+= 4, inrf+= 3) { + else if (inbuf->type==CB_VEC3) { + for (; x>0; x--, outrf+= 4, inrf+= 3) { outrf[0]= inrf[0]; outrf[1]= inrf[1]; outrf[2]= inrf[2]; @@ -378,8 +378,8 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type) float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad) { - if(cbuf) { - if(cbuf->rect_procedural) { + if (cbuf) { + if (cbuf->rect_procedural) { cbuf->rect_procedural(cbuf, use, (float)x/(float)xrad, (float)y/(float)yrad); return use; } @@ -390,8 +390,8 @@ float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, x-= cbuf->xof; y-= cbuf->yof; - if(y<-cbuf->yrad || y>= -cbuf->yrad+cbuf->y) return col; - if(x<-cbuf->xrad || x>= -cbuf->xrad+cbuf->x) return col; + if (y<-cbuf->yrad || y>= -cbuf->yrad+cbuf->y) return col; + if (x<-cbuf->xrad || x>= -cbuf->xrad+cbuf->x) return col; return cbuf->rect + cbuf->type*( (cbuf->yrad+y)*cbuf->x + (cbuf->xrad+x) ); } @@ -407,7 +407,7 @@ static CompBuf *composit_check_compbuf(CompBuf *cbuf, int type, CompBuf *outbuf) CompBuf *dbuf= typecheck_compbuf(cbuf, type); /* if same as output and translated, duplicate so pixels don't interfere */ - if(dbuf == outbuf && !dbuf->rect_procedural && (dbuf->xof || dbuf->yof)) + if (dbuf == outbuf && !dbuf->rect_procedural && (dbuf->xof || dbuf->yof)) dbuf= dupalloc_compbuf(dbuf); return dbuf; @@ -428,14 +428,14 @@ void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa xrad= out->xrad; yrad= out->yrad; - for(y= -yrad; y<-yrad+out->y; y++) { - for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { + for (y= -yrad; y<-yrad+out->y; y++) { + for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad); func(node, outfp, srcfp); } } - if(src_use!=src_buf) + if (src_use!=src_buf) free_compbuf(src_use); } @@ -455,17 +455,17 @@ void composit2_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa xrad= out->xrad; yrad= out->yrad; - for(y= -yrad; y<-yrad+out->y; y++) { - for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { + for (y= -yrad; y<-yrad+out->y; y++) { + for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad); facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad); func(node, outfp, srcfp, facfp); } } - if(src_use!=src_buf) + if (src_use!=src_buf) free_compbuf(src_use); - if(fac_use!=fac_buf) + if (fac_use!=fac_buf) free_compbuf(fac_use); } @@ -486,8 +486,8 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo xrad= out->xrad; yrad= out->yrad; - for(y= -yrad; y<-yrad+out->y; y++) { - for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { + for (y= -yrad; y<-yrad+out->y; y++) { + for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad); src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad); facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad); @@ -496,11 +496,11 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo } } - if(src1_use!=src1_buf) + if (src1_use!=src1_buf) free_compbuf(src1_use); - if(src2_use!=src2_buf) + if (src2_use!=src2_buf) free_compbuf(src2_use); - if(fac_use!=fac_buf) + if (fac_use!=fac_buf) free_compbuf(fac_use); } @@ -523,8 +523,8 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo xrad= out->xrad; yrad= out->yrad; - for(y= -yrad; y<-yrad+out->y; y++) { - for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { + for (y= -yrad; y<-yrad+out->y; y++) { + for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad); src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad); fac1fp= compbuf_get_pixel(fac1_use, fac1, color, x, y, xrad, yrad); @@ -534,13 +534,13 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo } } - if(src1_use!=src1_buf) + if (src1_use!=src1_buf) free_compbuf(src1_use); - if(src2_use!=src2_buf) + if (src2_use!=src2_buf) free_compbuf(src2_use); - if(fac1_use!=fac1_buf) + if (fac1_use!=fac1_buf) free_compbuf(fac1_use); - if(fac2_use!=fac2_buf) + if (fac2_use!=fac2_buf) free_compbuf(fac2_use); } @@ -562,7 +562,7 @@ CompBuf *valbuf_from_rgbabuf(CompBuf *cbuf, int channel) rectf= cbuf->rect + channel; - for(tot= cbuf->x*cbuf->y; tot>0; tot--, valf++, rectf+=4) + for (tot= cbuf->x*cbuf->y; tot>0; tot--, valf++, rectf+=4) *valf= *rectf; return valbuf; @@ -580,8 +580,8 @@ static CompBuf *generate_procedural_preview(CompBuf *cbuf, int newx, int newy) xrad= outbuf->xrad; yrad= outbuf->yrad; - for(y= -yrad; y<-yrad+outbuf->y; y++) - for(x= -xrad; x<-xrad+outbuf->x; x++, outfp+=outbuf->type) + for (y= -yrad; y<-yrad+outbuf->y; y++) + for (x= -xrad; x<-xrad+outbuf->x; x++, outfp+=outbuf->type) cbuf->rect_procedural(cbuf, outfp, (float)x/(float)xrad, (float)y/(float)yrad); return outbuf; @@ -597,14 +597,14 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf) int dither= 0; unsigned char *rect; - if(preview && stackbuf) { + if (preview && stackbuf) { CompBuf *cbuf, *stackbuf_use; - if(stackbuf->rect==NULL && stackbuf->rect_procedural==NULL) return; + if (stackbuf->rect==NULL && stackbuf->rect_procedural==NULL) return; stackbuf_use= typecheck_compbuf(stackbuf, CB_RGBA); - if(stackbuf->x > stackbuf->y) { + if (stackbuf->x > stackbuf->y) { xsize= 140; ysize= (140*stackbuf->y)/stackbuf->x; } @@ -613,7 +613,7 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf) xsize= (140*stackbuf->x)/stackbuf->y; } - if(stackbuf_use->rect_procedural) + if (stackbuf_use->rect_procedural) cbuf= generate_procedural_preview(stackbuf_use, xsize, ysize); else cbuf= scalefast_compbuf(stackbuf_use, xsize, ysize); @@ -626,12 +626,12 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf) xsize, ysize, xsize, xsize); free_compbuf(cbuf); - if(stackbuf_use!=stackbuf) + if (stackbuf_use!=stackbuf) free_compbuf(stackbuf_use); BLI_lock_thread(LOCK_PREVIEW); - if(preview->rect) + if (preview->rect) MEM_freeN(preview->rect); preview->xsize= xsize; preview->ysize= ysize; @@ -705,21 +705,21 @@ void gamma_correct_compbuf(CompBuf *img, int inversed) float *drect; int x; - if(img->type!=CB_RGBA) return; + 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; + 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; + 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; } } } @@ -729,12 +729,12 @@ void premul_compbuf(CompBuf *img, int inversed) float *drect; int x; - if(img->type!=CB_RGBA) return; + if (img->type!=CB_RGBA) return; drect= img->rect; - if(inversed) { - for(x=img->x*img->y; x>0; x--, drect+=4) { - if(fabsf(drect[3]) < 1e-5f) { + if (inversed) { + for (x=img->x*img->y; x>0; x--, drect+=4) { + if (fabsf(drect[3]) < 1e-5f) { drect[0]= 0.0f; drect[1]= 0.0f; drect[2]= 0.0f; @@ -747,7 +747,7 @@ void premul_compbuf(CompBuf *img, int inversed) } } else { - for(x=img->x*img->y; x>0; x--, drect+=4) { + for (x=img->x*img->y; x>0; x--, drect+=4) { drect[0] *= drect[3]; drect[1] *= drect[3]; drect[2] *= drect[3]; @@ -1104,11 +1104,11 @@ void convolve(CompBuf* dst, CompBuf* in1, CompBuf* in2) // sets fcol to pixelcolor at (x, y) void qd_getPixel(CompBuf* src, int x, int y, float* col) { - if(src->rect_procedural) { + if (src->rect_procedural) { float bc[4]; src->rect_procedural(src, bc, (float)x/(float)src->xrad, (float)y/(float)src->yrad); - switch(src->type){ + switch(src->type) { /* these fallthrough to get all the channels */ case CB_RGBA: col[3]=bc[3]; case CB_VEC3: col[2]=bc[2]; @@ -1118,7 +1118,7 @@ void qd_getPixel(CompBuf* src, int x, int y, float* col) } else if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) { float* bc = &src->rect[(x + y*src->x)*src->type]; - switch(src->type){ + switch(src->type) { /* these fallthrough to get all the channels */ case CB_RGBA: col[3]=bc[3]; case CB_VEC3: col[2]=bc[2]; @@ -1127,7 +1127,7 @@ void qd_getPixel(CompBuf* src, int x, int y, float* col) } } else { - switch(src->type){ + switch(src->type) { /* these fallthrough to get all the channels */ case CB_RGBA: col[3]=0.0; case CB_VEC3: col[2]=0.0; @@ -1142,7 +1142,7 @@ void qd_setPixel(CompBuf* src, int x, int y, float* col) { if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) { float* bc = &src->rect[(x + y*src->x)*src->type]; - switch(src->type){ + switch(src->type) { /* these fallthrough to get all the channels */ case CB_RGBA: bc[3]=col[3]; case CB_VEC3: bc[2]=col[2]; diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c index 3a783f0f32d..5a716e18660 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c @@ -48,10 +48,10 @@ static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, flo { /* Zero alpha values should still permit an add of RGB data */ - if(over[3]<0.0f) { + if (over[3]<0.0f) { copy_v4_v4(out, src); } - else if(fac[0]==1.0f && over[3]>=1.0f) { + else if (fac[0]==1.0f && over[3]>=1.0f) { copy_v4_v4(out, over); } else { @@ -68,10 +68,10 @@ static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, flo static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float *over, float *fac) { - if(over[3]<=0.0f) { + if (over[3]<=0.0f) { copy_v4_v4(out, src); } - else if(fac[0]==1.0f && over[3]>=1.0f) { + else if (fac[0]==1.0f && over[3]>=1.0f) { copy_v4_v4(out, over); } else { @@ -89,10 +89,10 @@ static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over, float *fac) { - if(over[3]<=0.0f) { + if (over[3]<=0.0f) { copy_v4_v4(out, src); } - else if(fac[0]==1.0f && over[3]>=1.0f) { + else if (fac[0]==1.0f && over[3]>=1.0f) { copy_v4_v4(out, over); } else { @@ -115,11 +115,11 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS { /* stack order in: col col */ /* stack order out: col */ - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; /* input no image? then only color operation */ - if(in[1]->data==NULL && in[2]->data==NULL) { + if (in[1]->data==NULL && in[2]->data==NULL) { do_alphaover_premul(node, out[0]->vec, in[1]->vec, in[2]->vec, in[0]->vec); } else { @@ -128,9 +128,9 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */ NodeTwoFloats *ntf= node->storage; - if(ntf->x != 0.0f) + if (ntf->x != 0.0f) composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_mixed, CB_RGBA, CB_RGBA, CB_VAL); - else if(node->custom1) + else if (node->custom1) composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_key, CB_RGBA, CB_RGBA, CB_VAL); else composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_premul, CB_RGBA, CB_RGBA, CB_VAL); diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c index fe359372270..8faa060244a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c @@ -102,10 +102,10 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN int deltas[8]; short found_determinator= 0; - if(img == NULL || out[0]->hasoutput == 0) + if (img == NULL || out[0]->hasoutput == 0) return; - if(img->type != CB_RGBA) { + if (img->type != CB_RGBA) { img= typecheck_compbuf(in[0]->data, CB_RGBA); } @@ -114,9 +114,9 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN pix= img->type; step= pix * imgx; - if(refimg) { - if(refimg->x == imgx && refimg->y == imgy) { - if(ELEM3(refimg->type, CB_VAL, CB_VEC2, CB_VEC3)) { + if (refimg) { + if (refimg->x == imgx && refimg->y == imgy) { + if (ELEM3(refimg->type, CB_VAL, CB_VEC2, CB_VEC3)) { refimg= typecheck_compbuf(in[1]->data, CB_RGBA); found_determinator= 1; } @@ -147,23 +147,23 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN weight_tab[1] = weight_tab[3] = weight_tab[5] = weight_tab[7] = i2sigma_space * 2; /* iterations */ - for(i= 0; i < nbbd->iter; i++) { + for (i= 0; i < nbbd->iter; i++) { src= source->rect; ref= refimg->rect; dest= new->rect; /*goes through image, there are more loops for 1st/last line and all other lines*/ /*kernel element accumulates surrounding colors, which are then written with the update_output function*/ - for(x= 0; x < imgx; x++, src+= pix, ref+= pix) { + for (x= 0; x < imgx; x++, src+= pix, ref+= pix) { INIT_C3; KERNEL_ELEMENT_C3(6); - if(x > 0) { + if (x > 0) { KERNEL_ELEMENT_C3(5); KERNEL_ELEMENT_C3(4); } - if(x < imgx - 1) { + if (x < imgx - 1) { KERNEL_ELEMENT_C3(7); KERNEL_ELEMENT_C3(0); } @@ -173,7 +173,7 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN dest+= step; - for(y= 1; y < imgy - 1; y++, dest+= step, src+= pix, ref+= pix) { + for (y= 1; y < imgy - 1; y++, dest+= step, src+= pix, ref+= pix) { x= 0; INIT_C3; @@ -189,7 +189,7 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN src+= pix; ref+= pix; - for(x= 1; x < imgx - 1; x++, src+= pix, ref+= pix) { + for (x= 1; x < imgx - 1; x++, src+= pix, ref+= pix) { INIT_C3; KERNEL_ELEMENT_C3(0); @@ -215,16 +215,16 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN UPDATE_OUTPUT_C3; } - for(x= 0; x < imgx; x++, src+= pix, ref+= pix) { + for (x= 0; x < imgx; x++, src+= pix, ref+= pix) { INIT_C3; KERNEL_ELEMENT_C3(2); - if(x > 0) { + if (x > 0) { KERNEL_ELEMENT_C3(3); KERNEL_ELEMENT_C3(4); } - if(x < imgx - 1) { + if (x < imgx - 1) { KERNEL_ELEMENT_C3(1); KERNEL_ELEMENT_C3(0); } @@ -232,16 +232,16 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN UPDATE_OUTPUT_C3; } - if(node->exec & NODE_BREAK) break; + if (node->exec & NODE_BREAK) break; SWAP(CompBuf, *source, *new); } - if(img != in[0]->data) + if (img != in[0]->data) free_compbuf(img); - if(found_determinator == 1) { - if(refimg != in[1]->data) + if (found_determinator == 1) { + if (refimg != in[1]->data) free_compbuf(refimg); } diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index fad80723ca3..0e09f2d22ee 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -61,7 +61,7 @@ static float *make_gausstab(int filtertype, int rad) } sum= 1.0f/sum; - for(i=0; i<n; i++) + for (i=0; i<n; i++) gausstab[i]*= sum; return gausstab; @@ -101,14 +101,14 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca work= alloc_compbuf(imgx, imgy, img->type, 1); /* allocs */ /* horizontal */ - if(nbd->sizex == 0) { + if (nbd->sizex == 0) { memcpy(work->rect, img->rect, sizeof(float) * img->type * imgx * imgy); } else { rad = scale*(float)nbd->sizex; - if(rad>imgx/2) + if (rad>imgx/2) rad= imgx/2; - else if(rad<1) + else if (rad<1) rad= 1; gausstab= make_gausstab(nbd->filtertype, rad); @@ -130,7 +130,7 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca val= gausstabcent[i]; sum+= val; rval += val * (*src++); - if(pix==4) { + if (pix==4) { gval += val * (*src++); bval += val * (*src++); aval += val * (*src++); @@ -138,13 +138,13 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca } sum= 1.0f/sum; *dest++ = rval*sum; - if(pix==4) { + if (pix==4) { *dest++ = gval*sum; *dest++ = bval*sum; *dest++ = aval*sum; } } - if(node->exec & NODE_BREAK) + if (node->exec & NODE_BREAK) break; } @@ -152,14 +152,14 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca MEM_freeN(gausstab); } - if(nbd->sizey == 0) { + if (nbd->sizey == 0) { memcpy(new->rect, work->rect, sizeof(float) * img->type * imgx * imgy); } else { rad = scale*(float)nbd->sizey; - if(rad>imgy/2) + if (rad>imgy/2) rad= imgy/2; - else if(rad<1) + else if (rad<1) rad= 1; gausstab= make_gausstab(nbd->filtertype, rad); @@ -182,7 +182,7 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca val= gausstabcent[i]; sum+= val; rval += val * src[0]; - if(pix==4) { + if (pix==4) { gval += val * src[1]; bval += val * src[2]; aval += val * src[3]; @@ -191,14 +191,14 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca } sum= 1.0f/sum; dest[0] = rval*sum; - if(pix==4) { + if (pix==4) { dest[1] = gval*sum; dest[2] = bval*sum; dest[3] = aval*sum; } dest+= bigstep; } - if(node->exec & NODE_BREAK) + if (node->exec & NODE_BREAK) break; } MEM_freeN(gausstab); @@ -225,21 +225,21 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref /* horizontal */ radx = (float)nbd->sizex; - if(radx>imgx/2) + if (radx>imgx/2) radx= imgx/2; - else if(radx<1) + else if (radx<1) radx= 1; /* vertical */ rady = (float)nbd->sizey; - if(rady>imgy/2) + if (rady>imgy/2) rady= imgy/2; - else if(rady<1) + else if (rady<1) rady= 1; x= MAX2(radx, rady); maintabs= MEM_mallocN(x*sizeof(void *), "gauss array"); - for(i= 0; i<x; i++) + for (i= 0; i<x; i++) maintabs[i]= make_bloomtab(i+1); /* vars to store before we go */ @@ -258,12 +258,12 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref int refradx= (int)(radxf*0.3f*src[3]*(src[0]+src[1]+src[2])); int refrady= (int)(radyf*0.3f*src[3]*(src[0]+src[1]+src[2])); - if(refradx>radx) refradx= radx; - else if(refradx<1) refradx= 1; - if(refrady>rady) refrady= rady; - else if(refrady<1) refrady= 1; + if (refradx>radx) refradx= radx; + else if (refradx<1) refradx= 1; + if (refrady>rady) refrady= rady; + else if (refrady<1) refrady= 1; - if(refradx==1 && refrady==1) { + if (refradx==1 && refrady==1) { wb= wbuf->rect + ( y*imgx + x); dest= new->rect + 4*( y*imgx + x); wb[0]+= 1.0f; @@ -319,7 +319,7 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref free_compbuf(wbuf); x= MAX2(radx, rady); - for(i= 0; i<x; i++) + for (i= 0; i<x; i++) MEM_freeN(maintabs[i]); MEM_freeN(maintabs); @@ -331,9 +331,9 @@ static float hexagon_filter(float fi, float fj) fi= fabs(fi); fj= fabs(fj); - if(fj>0.33f) { + if (fj>0.33f) { fj= (fj-0.33f)/0.66f; - if(fi+fj>1.0f) + if (fi+fj>1.0f) return 0.0f; else return 1.0f; @@ -357,16 +357,16 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa /* horizontal */ radxf = fac*(float)nbd->sizex; - if(radxf>imgx/2.0f) + if (radxf>imgx/2.0f) radxf= imgx/2.0f; - else if(radxf<1.0f) + else if (radxf<1.0f) radxf= 1.0f; /* vertical */ radyf = fac*(float)nbd->sizey; - if(radyf>imgy/2.0f) + if (radyf>imgy/2.0f) radyf= imgy/2.0f; - else if(radyf<1.0f) + else if (radyf<1.0f) radyf= 1.0f; radx= ceil(radxf); @@ -378,8 +378,8 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa gausstab= MEM_mallocN(sizeof(float)*n, "filter tab"); dgauss= gausstab; val= 0.0f; - for(j=-rady; j<=rady; j++) { - for(i=-radx; i<=radx; i++, dgauss++) { + for (j=-rady; j<=rady; j++) { + for (i=-radx; i<=radx; i++, dgauss++) { float fj= (float)j/radyf; float fi= (float)i/radxf; float dist= sqrt(fj*fj + fi*fi); @@ -391,17 +391,17 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa } } - if(val!=0.0f) { + if (val!=0.0f) { val= 1.0f/val; - for(j= n -1; j>=0; j--) + for (j= n -1; j>=0; j--) gausstab[j]*= val; } else gausstab[4]= 1.0f; for (y = -rady+1; y < imgy+rady-1; y++) { - if(y<=0) srcd= img->rect; - else if(y<imgy) srcd+= pix*imgx; + if (y<=0) srcd= img->rect; + else if (y<imgy) srcd+= pix*imgx; else srcd= img->rect + pix*(imgy-1)*imgx; for (x = -radx+1; x < imgx+radx-1 ; x++) { @@ -413,8 +413,8 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa float *destd= new->rect + pix*( (y + minyr)*imgx + x + minxr); float *dgausd= gausstab + (minyr+rady)*(2*radx+1) + minxr+radx; - if(x<=0) src= srcd; - else if(x<imgx) src+= pix; + if (x<=0) src= srcd; + else if (x<imgx) src+= pix; else src= srcd + pix*(imgx-1); for (i= minyr; i <=maxyr; i++, destd+= pix*imgx, dgausd+= 2*radx + 1) { @@ -422,9 +422,9 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa dgauss= dgausd; for (j= minxr; j <=maxxr; j++, dest+=pix, dgauss++) { val= *dgauss; - if(val!=0.0f) { + if (val!=0.0f) { dest[0] += val * src[0]; - if(pix>1) { + if (pix>1) { dest[1] += val * src[1]; dest[2] += val * src[2]; dest[3] += val * src[3]; @@ -433,7 +433,7 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa } } } - if(node->exec & NODE_BREAK) + if (node->exec & NODE_BREAK) break; } @@ -459,7 +459,7 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf float proccol[4]; /* local color if compbuf is procedural */ int refradx, refrady; - if(ref->x!=img->x || ref->y!=img->y) + if (ref->x!=img->x || ref->y!=img->y) return; ref_use= typecheck_compbuf(ref, CB_VAL); @@ -470,9 +470,9 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf blurbuf->yof= ref_use->yof; blurd= blurbuf->rect; refd= ref_use->rect; - for(x= imgx*imgy; x>0; x--, refd++, blurd++) { - if(refd[0]<0.0f) blurd[0]= 0.0f; - else if(refd[0]>1.0f) blurd[0]= 1.0f; + for (x= imgx*imgy; x>0; x--, refd++, blurd++) { + if (refd[0]<0.0f) blurd[0]= 0.0f; + else if (refd[0]>1.0f) blurd[0]= 1.0f; else blurd[0]= refd[0]; } @@ -480,21 +480,21 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf /* horizontal */ radx = (float)nbd->sizex; - if(radx>imgx/2) + if (radx>imgx/2) radx= imgx/2; - else if(radx<1) + else if (radx<1) radx= 1; /* vertical */ rady = (float)nbd->sizey; - if(rady>imgy/2) + if (rady>imgy/2) rady= imgy/2; - else if(rady<1) + else if (rady<1) rady= 1; x= MAX2(radx, rady); maintabs= MEM_mallocN(x*sizeof(void *), "gauss array"); - for(i= 0; i<x; i++) + for (i= 0; i<x; i++) maintabs[i]= make_gausstab(nbd->filtertype, i+1); dest= new->rect; @@ -507,14 +507,14 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf refradx= (int)(refd[0]*radxf); refrady= (int)(refd[0]*radyf); - if(refradx>radx) refradx= radx; - else if(refradx<1) refradx= 1; - if(refrady>rady) refrady= rady; - else if(refrady<1) refrady= 1; + if (refradx>radx) refradx= radx; + else if (refradx<1) refradx= 1; + if (refrady>rady) refrady= rady; + else if (refrady<1) refrady= 1; - if(refradx==1 && refrady==1) { + if (refradx==1 && refrady==1) { src= img->rect + pix*( y*imgx + x); - if(pix==1) + if (pix==1) dest[0]= src[0]; else copy_v4_v4(dest, src); @@ -541,7 +541,7 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf val= gausstabcenty[i]*gausstabcentx[j]; sum+= val; rval += val * src[0]; - if(pix>1) { + if (pix>1) { gval += val * src[1]; bval += val * src[2]; aval += val * src[3]; @@ -550,25 +550,25 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf } sum= 1.0f/sum; dest[0] = rval*sum; - if(pix>1) { + if (pix>1) { dest[1] = gval*sum; dest[2] = bval*sum; dest[3] = aval*sum; } } } - if(node->exec & NODE_BREAK) + if (node->exec & NODE_BREAK) break; } free_compbuf(blurbuf); x= MAX2(radx, rady); - for(i= 0; i<x; i++) + for (i= 0; i<x; i++) MEM_freeN(maintabs[i]); MEM_freeN(maintabs); - if(ref_use!=ref) + if (ref_use!=ref) free_compbuf(ref_use); } @@ -577,15 +577,15 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN CompBuf *new, *img= in[0]->data; NodeBlurData *nbd= node->storage; - if(img==NULL) return; + if (img==NULL) return; /* store image in size that is needed for absolute/relative conversions on ui level */ nbd->image_in_width= img->x; nbd->image_in_height= img->y; - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; - if(nbd->relative) { + if (nbd->relative) { if (nbd->aspect==CMP_NODE_BLUR_ASPECT_NONE) { nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width); nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height); @@ -635,14 +635,15 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN } out[0]->data = new; - } else { + } + else { /* All non fast gauss blur methods */ - if(img->type==CB_VEC2 || img->type==CB_VEC3) { + if (img->type==CB_VEC2 || img->type==CB_VEC3) { img= typecheck_compbuf(in[0]->data, CB_RGBA); } /* if fac input, we do it different */ - if(in[1]->data) { + if (in[1]->data) { CompBuf *gammabuf; /* make output size of input image */ @@ -652,7 +653,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN new->xof = img->xof; new->yof = img->yof; - if(nbd->gamma) { + if (nbd->gamma) { gammabuf= dupalloc_compbuf(img); gamma_correct_compbuf(gammabuf, 0); } @@ -660,11 +661,11 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN blur_with_reference(node, new, gammabuf, in[1]->data); - if(nbd->gamma) { + if (nbd->gamma) { gamma_correct_compbuf(new, 1); free_compbuf(gammabuf); } - if(node->exec & NODE_BREAK) { + if (node->exec & NODE_BREAK) { free_compbuf(new); new= NULL; } @@ -672,7 +673,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN } else { - if(in[1]->vec[0]<=0.001f) { /* time node inputs can be a tiny value */ + if (in[1]->vec[0]<=0.001f) { /* time node inputs can be a tiny value */ new= pass_on_compbuf(img); } else { @@ -685,31 +686,31 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN new->xof = img->xof; new->yof = img->yof; - if(nbd->gamma) { + if (nbd->gamma) { gammabuf= dupalloc_compbuf(img); gamma_correct_compbuf(gammabuf, 0); } else gammabuf= img; - if(nbd->bokeh) + if (nbd->bokeh) bokeh_single_image(node, new, gammabuf, in[1]->vec[0]); - else if(1) + else if (1) blur_single_image(node, new, gammabuf, in[1]->vec[0]); else /* bloom experimental... */ bloom_with_reference(new, gammabuf, NULL, in[1]->vec[0], nbd); - if(nbd->gamma) { + if (nbd->gamma) { gamma_correct_compbuf(new, 1); free_compbuf(gammabuf); } - if(node->exec & NODE_BREAK) { + if (node->exec & NODE_BREAK) { free_compbuf(new); new= NULL; } } out[0]->data= new; } - if(img!=in[0]->data) + if (img!=in[0]->data) free_compbuf(img); } diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c index 83607ac66b3..caae5f313cd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.c +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c @@ -70,7 +70,7 @@ static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, fl b = a * (brightness + delta); } - for(c=0; c<3; c++){ + for (c=0; c<3; c++) { i = in[c]; v = a*i + b; out[c] = v; @@ -79,15 +79,15 @@ static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, fl static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; - if(in[0]->data) { + if (in[0]->data) { CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); stackbuf= dupalloc_compbuf(cbuf); composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, do_brightnesscontrast, CB_RGBA, CB_VAL, CB_VAL); out[0]->data = stackbuf; - if(cbuf != in[0]->data) + if (cbuf != in[0]->data) free_compbuf(cbuf); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index 785786dacbe..132b1659fa5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -105,10 +105,10 @@ static void do_channel_matte(bNode *node, float *out, float *in) alpha=1-alpha; /* test range*/ - if(alpha>c->t1) { + if (alpha>c->t1) { alpha=in[3]; /*whatever it was prior */ } - else if(alpha<c->t2){ + else if (alpha<c->t2) { alpha=0.0; } else {/*blend */ @@ -130,9 +130,9 @@ 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]->data==NULL) return; - if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return; + if (in[0]->hasinput==0) return; + if (in[0]->data==NULL) return; + if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return; cbuf=typecheck_compbuf(in[0]->data, CB_RGBA); @@ -177,10 +177,10 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack generate_preview(data, node, outbuf); out[0]->data=outbuf; - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A); - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); } diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c index b6f490a0320..2df8e1b6139 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c @@ -111,14 +111,14 @@ static void do_chroma_key(bNode *node, float *out, float *in) out[1]=in[1]; out[2]=in[2]; - if(kfg>0.0f) { /* found a pixel that is within key color */ + if (kfg>0.0f) { /* found a pixel that is within key color */ alpha=(1.0f-kfg)*(c->fstrength); beta=atan2(z,x); angle2=c->t2; /* t2 is radians. */ /* if beta is within the cutoff angle */ - if(fabsf(beta) < (angle2/2.0f)) { + if (fabsf(beta) < (angle2/2.0f)) { alpha=0.0; } @@ -144,9 +144,9 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack CompBuf *chromabuf; NodeChroma *c; - if(in[0]->hasinput==0) return; - if(in[0]->data==NULL) return; - if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return; + if (in[0]->hasinput==0) return; + if (in[0]->data==NULL) return; + if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return; cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); @@ -166,12 +166,12 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_ycca_to_rgba_normalized, CB_RGBA); out[0]->data= chromabuf; - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->data= valbuf_from_rgbabuf(chromabuf, CHAN_A); generate_preview(data, node, chromabuf); - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c index 2d56c9e5973..12b6e802555 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c @@ -54,7 +54,7 @@ static void do_color_key(bNode *node, float *out, float *in) copy_v3_v3(out, in); - if( + if ( /* do hue last because it needs to wrap, and does some more checks */ /* sat */ (fabsf(in[1]-c->key[1]) < c->t2) && @@ -79,9 +79,9 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack * CompBuf *colorbuf; NodeChroma *c; - if(in[0]->hasinput==0) return; - if(in[0]->data==NULL) return; - if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return; + if (in[0]->hasinput==0) return; + if (in[0]->data==NULL) return; + if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return; cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); @@ -103,12 +103,12 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack * composit1_pixel_processor(node, colorbuf, colorbuf, in[0]->vec, do_hsva_to_rgba, CB_RGBA); out[0]->data= colorbuf; - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->data= valbuf_from_rgbabuf(colorbuf, CHAN_A); generate_preview(data, node, colorbuf); - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c index af6a295cf7f..026d74aafc4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c @@ -141,7 +141,7 @@ static void do_apply_spillmap_red(bNode *node, float* out, float *in, float *map { NodeColorspill *ncs; ncs=node->storage; - if(map[0]>0) { + if (map[0]>0) { out[0]=in[0]-(ncs->uspillr*map[0]); out[1]=in[1]+(ncs->uspillg*map[0]); out[2]=in[2]+(ncs->uspillb*map[0]); @@ -157,7 +157,7 @@ static void do_apply_spillmap_green(bNode *node, float* out, float *in, float *m { NodeColorspill *ncs; ncs=node->storage; - if(map[0]>0) { + if (map[0]>0) { out[0]=in[0]+(ncs->uspillr*map[0]); out[1]=in[1]-(ncs->uspillg*map[0]); out[2]=in[2]+(ncs->uspillb*map[0]); @@ -173,7 +173,7 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma { NodeColorspill *ncs; ncs=node->storage; - if(map[0]>0) { + if (map[0]>0) { out[0]=in[0]+(ncs->uspillr*map[0]); out[1]=in[1]+(ncs->uspillg*map[0]); out[2]=in[2]-(ncs->uspillb*map[0]); @@ -197,9 +197,9 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod 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; + 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= */ /* UNUSED */ typecheck_compbuf(in[1]->data, CB_VAL); @@ -216,7 +216,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod { 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 { + } + 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; @@ -225,13 +226,14 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod { 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 { + } + 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; } } - if(ncs->unspill==0) { + if (ncs->unspill==0) { ncs->uspillr=1.0f; ncs->uspillg=0.0f; ncs->uspillb=0.0f; @@ -247,7 +249,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod { 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 { + } + 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; @@ -256,13 +259,14 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod { 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 { + } + 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) { + if (ncs->unspill==0) { ncs->uspillr=0.0f; ncs->uspillg=1.0f; ncs->uspillb=0.0f; @@ -278,7 +282,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod { 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 { + } + 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; @@ -287,13 +292,14 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod { 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 { + } + 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) { + if (ncs->unspill==0) { ncs->uspillr=0.0f; ncs->uspillg=0.0f; ncs->uspillb=1.0f; @@ -307,7 +313,7 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod out[0]->data=rgbbuf; - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); free_compbuf(spillmap); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c index 9995036f89c..f77e4cd9c4e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c @@ -130,9 +130,9 @@ static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNo /* stack order input: fac, image */ /* stack order output: image */ - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; - if(in[0]->vec[0] == 0.f && in[0]->data == NULL) { + if (in[0]->vec[0] == 0.f && in[0]->data == NULL) { out[0]->data = pass_on_compbuf(cbuf); return; } @@ -158,7 +158,8 @@ static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNo else { composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_colorbalance_lgg_fac, CB_RGBA, CB_VAL); } - } else { + } + else { /* offset/power/slope : ASC-CDL */ if ((in[0]->data==NULL) && (in[0]->vec[0] >= 1.f)) { composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_colorbalance_cdl, CB_RGBA); diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c index 73a84676caa..9b1e5e451c4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.c +++ b/source/blender/nodes/composite/nodes/node_composite_composite.c @@ -48,27 +48,27 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i /* image assigned to output */ /* stack order input sockets: col, alpha, z */ - if(node->flag & NODE_DO_OUTPUT) { /* only one works on out */ + if (node->flag & NODE_DO_OUTPUT) { /* only one works on out */ Scene *scene= (Scene *)node->id; RenderData *rd= data; - if(scene && (rd->scemode & R_DOCOMP)) { + if (scene && (rd->scemode & R_DOCOMP)) { Render *re= RE_GetRender(scene->id.name); RenderResult *rr= RE_AcquireResultWrite(re); - if(rr) { + if (rr) { CompBuf *outbuf, *zbuf=NULL; - if(rr->rectf) + if (rr->rectf) MEM_freeN(rr->rectf); outbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 1); - if(in[1]->data==NULL) + if (in[1]->data==NULL) composit1_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA); else composit2_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba, CB_RGBA, CB_VAL); - if(in[2]->data) { - if(rr->rectz) + if (in[2]->data) { + if (rr->rectz) MEM_freeN(rr->rectz); zbuf= alloc_compbuf(rr->rectx, rr->recty, CB_VAL, 1); composit1_pixel_processor(node, zbuf, in[2]->data, in[2]->vec, do_copy_value, CB_VAL); @@ -93,7 +93,7 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i RE_ReleaseResult(re); } } - if(in[0]->data) + if (in[0]->data) generate_preview(data, node, in[0]->data); } diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c index 3697f3e4c5c..242bc8396d7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.c +++ b/source/blender/nodes/composite/nodes/node_composite_crop.c @@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_crop_out[]= { static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - if(in[0]->data) { + if (in[0]->data) { NodeTwoXYs *ntxy= node->storage; CompBuf *cbuf= in[0]->data; CompBuf *stackbuf; @@ -53,7 +53,7 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack float *srcfp, *outfp; rcti outputrect; - if(node->custom2) { + if (node->custom2) { ntxy->x1= cbuf->x* ntxy->fac_x1; ntxy->x2= cbuf->x* ntxy->fac_x2; ntxy->y1= cbuf->y* ntxy->fac_y1; @@ -61,16 +61,16 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack } /* check input image size */ - if(cbuf->x <= ntxy->x1 + 1) + if (cbuf->x <= ntxy->x1 + 1) ntxy->x1= cbuf->x - 1; - if(cbuf->y <= ntxy->y1 + 1) + if (cbuf->y <= ntxy->y1 + 1) ntxy->y1= cbuf->y - 1; - if(cbuf->x <= ntxy->x2 + 1) + if (cbuf->x <= ntxy->x2 + 1) ntxy->x2= cbuf->x - 1; - if(cbuf->y <= ntxy->y2 + 1) + if (cbuf->y <= ntxy->y2 + 1) ntxy->y2= cbuf->y - 1; /* figure out the minimums and maximums */ @@ -79,7 +79,7 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack outputrect.ymax=MAX2(ntxy->y1, ntxy->y2) + 1; outputrect.ymin=MIN2(ntxy->y1, ntxy->y2); - if(node->custom1) { + if (node->custom1) { /* this option crops the image size too */ stackbuf= get_cropped_compbuf(&outputrect, cbuf->rect, cbuf->x, cbuf->y, cbuf->type); } @@ -89,10 +89,10 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack stackbuf = alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); /* select the cropped part of the image and set it to the output */ - for(y=outputrect.ymin; y<outputrect.ymax; y++){ + for (y=outputrect.ymin; y<outputrect.ymax; y++) { srcfp= cbuf->rect + (y * cbuf->x + outputrect.xmin) * cbuf->type; outfp= stackbuf->rect + (y * stackbuf->x + outputrect.xmin) * stackbuf->type; - for(x=outputrect.xmin; x<outputrect.xmax; x++, outfp+= stackbuf->type, srcfp+= cbuf->type) + for (x=outputrect.xmin; x<outputrect.xmax; x++, outfp+= stackbuf->type, srcfp+= cbuf->type) memcpy(outfp, srcfp, sizeof(float)*stackbuf->type); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c index 81424586a11..d17a7bf5dc8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.c +++ b/source/blender/nodes/composite/nodes/node_composite_curves.c @@ -47,7 +47,7 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack * /* stack order output: fac */ float fac= 0.0f; - if(node->custom1 < node->custom2) + if (node->custom1 < node->custom2) fac= (rd->cfra - node->custom1)/(float)(node->custom2-node->custom1); fac= curvemapping_evaluateF(node->storage, 0, fac); @@ -140,9 +140,9 @@ static void do_curves(bNode *node, float *out, float *in) static void do_curves_fac(bNode *node, float *out, float *in, float *fac) { - if(*fac >= 1.0f) + if (*fac >= 1.0f) curvemapping_evaluate_premulRGBF(node->storage, out, in); - else if(*fac <= 0.0f) { + else if (*fac <= 0.0f) { copy_v3_v3(out, in); } else { @@ -160,11 +160,11 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS /* stack order input: fac, image, black level, white level */ /* stack order output: image */ - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; /* input no image? then only color operation */ - if(in[1]->data==NULL) { + if (in[1]->data==NULL) { curvemapping_evaluateRGBF(node->storage, out[0]->vec, in[1]->vec); } else { @@ -174,7 +174,7 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec); - if(in[0]->data==NULL && in[0]->vec[0] == 1.0f) + if (in[0]->data==NULL && in[0]->vec[0] == 1.0f) composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA); else composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 1ff2dac2900..46b134e4f65 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -376,7 +376,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, wts->rect[px] = 0.f; } // esc set by main calling process - if(node->exec & NODE_BREAK) + if (node->exec & NODE_BREAK) break; } } @@ -400,7 +400,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, #pragma omp critical { if (((ydone & 7)==0) || (ydone==(img->y-1))) { - if(G.background==0) { + if (G.background==0) { printf("\rdefocus: Processing Line %d of %d ... ", ydone+1, img->y); fflush(stdout); } @@ -411,7 +411,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // esc set by main calling process. don't break because openmp doesn't // allow it, just continue and do nothing - if(node->exec & NODE_BREAK) + if (node->exec & NODE_BREAK) continue; zp = y * img->x; @@ -850,7 +850,7 @@ static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeSta premul_compbuf(new, 0); free_compbuf(old); } - if(node->exec & NODE_BREAK) { + if (node->exec & NODE_BREAK) { free_compbuf(new); new= NULL; } diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index eae59dea3f4..027786d8b22 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -63,15 +63,15 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * copy_v3_v3(outColor, inColor1); /*make 100% transparent*/ - if(difference < tolerence) { + if (difference < tolerence) { outColor[3]=0.0; } /*in the falloff region, make partially transparent */ - else if(difference < falloff+tolerence) { + else if (difference < falloff+tolerence) { difference=difference-tolerence; alpha=difference/falloff; /*only change if more transparent than before */ - if(alpha < inColor1[3]) { + if (alpha < inColor1[3]) { outColor[3]=alpha; } else { /* leave as before */ @@ -92,16 +92,16 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack ** /* NodeChroma *c; */ /* UNUSED */ /*is anything connected?*/ - if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return; + if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return; /*must have an image imput*/ - if(in[0]->data==NULL) return; + 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) { + if (in[1]->data) { imbuf2=typecheck_compbuf(in[1]->data, CB_RGBA); } @@ -112,14 +112,14 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack ** 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) + if (out[1]->hasoutput) out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A); generate_preview(data, node, outbuf); - if(imbuf1!=in[0]->data) + if (imbuf1!=in[0]->data) free_compbuf(imbuf1); - if(imbuf2!=in[1]->data) + if (imbuf2!=in[1]->data) free_compbuf(imbuf2); } diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c index f8abf96e742..ee857dd0007 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.c +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c @@ -117,11 +117,11 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod { /* stack order in: mask */ /* stack order out: mask */ - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; /* input no image? then only color operation */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { out[0]->vec[0] = out[0]->vec[1] = out[0]->vec[2] = 0.0f; out[0]->vec[3] = 0.0f; } @@ -134,12 +134,13 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod if (node->custom2 > 0) { // positive, dilate for (i = 0; i < node->custom2; i++) morpho_dilate(stackbuf); - } else if (node->custom2 < 0) { // negative, erode + } + else if (node->custom2 < 0) { // negative, erode for (i = 0; i > node->custom2; i--) morpho_erode(stackbuf); } - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); out[0]->data= stackbuf; diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index d0f7feccf2e..f65b3312bea 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -68,37 +68,37 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, rot= itsc * spin; /* blur the image */ - for(i= 0; i < iterations; ++i) { + for (i= 0; i < iterations; ++i) { const float cs= cosf(rot), ss= sinf(rot); const float isc= 1.f / (1.f + sc); unsigned int x, y; float col[4]= {0,0,0,0}; - for(y= 0; y < img->y; ++y) { + for (y= 0; y < img->y; ++y) { const float v= isc * (y - center_y_pix) + ty; - for(x= 0; x < img->x; ++x) { + for (x= 0; x < img->x; ++x) { const float u= isc * (x - center_x_pix) + tx; unsigned int p= (x + y * img->x) * img->type; getpix(tmp, cs * u + ss * v + center_x_pix, cs * v - ss * u + center_y_pix, col); /* mix img and transformed tmp */ - for(j= 0; j < 4; ++j) { + for (j= 0; j < 4; ++j) { img->rect[p + j]= 0.5f * (img->rect[p + j] + col[j]); } } } /* copy img to tmp */ - if(i != (iterations - 1)) + if (i != (iterations - 1)) memcpy(tmp->rect, img->rect, sizeof(float) * img->x * img->y * img->type); /* double transformations */ tx *= 2.f, ty *= 2.f; sc *= 2.f, rot *= 2.f; - if(node->exec & NODE_BREAK) break; + if (node->exec & NODE_BREAK) break; } free_compbuf(tmp); @@ -112,7 +112,7 @@ static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack NodeDBlurData *ndbd= node->storage; CompBuf *new, *img= in[0]->data; - if((img == NULL) || (out[0]->hasoutput == 0)) return; + if ((img == NULL) || (out[0]->hasoutput == 0)) return; if (img->type != CB_RGBA) new = typecheck_compbuf(img, CB_RGBA); diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index ad7c1fa589e..6e4bbc632ea 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -66,8 +66,8 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf * ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); ibuf->rect_float= cbuf->rect; - for(y=0; y < stackbuf->y; y++) { - for(x=0; x < stackbuf->x; x++) { + for (y=0; y < stackbuf->y; y++) { + for (x=0; x < stackbuf->x; x++) { /* calc pixel coordinates */ qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof, vec); @@ -117,10 +117,10 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf * 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; } - if(node->exec & NODE_BREAK) break; + if (node->exec & NODE_BREAK) break; } IMB_freeImBuf(ibuf); @@ -133,8 +133,8 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf * float vec[3]; float col[3]; - for(y=0; y < stackbuf->y; y++) { - for(x=0; x < stackbuf->x; x++) { + for (y=0; y < stackbuf->y; y++) { + for (x=0; x < stackbuf->x; x++) { qd_getPixel(vecbuf, x, y, vec); dx = vec[0] * (xscale[0]); @@ -153,10 +153,10 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf * static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; - if(in[0]->data && in[1]->data) { + if (in[0]->data && in[1]->data) { CompBuf *cbuf= in[0]->data; CompBuf *vecbuf= in[1]->data; CompBuf *xbuf= in[2]->data; @@ -175,9 +175,9 @@ static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeSt out[0]->data= stackbuf; - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); - if(vecbuf!=in[1]->data) + if (vecbuf!=in[1]->data) free_compbuf(vecbuf); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c index 292bb66613d..7aaaa7ed9b4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c @@ -62,15 +62,15 @@ static void do_distance_matte(bNode *node, float *out, float *in) copy_v3_v3(out, in); /*make 100% transparent */ - if(distance < tolerence) { + if (distance < tolerence) { out[3]=0.0; } /*in the falloff region, make partially transparent */ - else if(distance < falloff+tolerence){ + else if (distance < falloff+tolerence) { distance=distance-tolerence; alpha=distance/falloff; /*only change if more transparent than before */ - if(alpha < in[3]) { + if (alpha < in[3]) { out[3]=alpha; } else { /* leave as before */ @@ -93,9 +93,9 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac NodeChroma *c; /*is anything connected?*/ - if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return; + if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return; /*must have an image imput*/ - if(in[0]->data==NULL) return; + if (in[0]->data==NULL) return; inbuf=typecheck_compbuf(in[0]->data, CB_RGBA); @@ -112,11 +112,11 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac out[0]->data=workbuf; - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->data=valbuf_from_rgbabuf(workbuf, CHAN_A); generate_preview(data, node, workbuf); - if(inbuf!=in[0]->data) + if (inbuf!=in[0]->data) free_compbuf(inbuf); } diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c index d012815fff9..966d8f8a21a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c @@ -792,7 +792,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l pix_nextRow=a-rw; pix_prevCol=a+1; pix_nextCol=a-1; - while(a>dx-2) { + while (a>dx-2) { if (!limask[a]) { // if the inner mask is empty if (lomask[a]) { // if the outer mask is full /* @@ -854,7 +854,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i pix_nextRow=a-rw; pix_prevCol=a+1; pix_nextCol=a-1; - while(a>dx-2) { + while (a>dx-2) { if (!limask[a]) { // if the inner mask is empty if (lomask[a]) { // if the outer mask is full /* diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c index 94a109de8f2..6d470467cb0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.c +++ b/source/blender/nodes/composite/nodes/node_composite_filter.c @@ -51,24 +51,24 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac) rowlen= in->x; - for(y=0; y<in->y; y++) { + for (y=0; y<in->y; y++) { /* setup rows */ - if(y==0) row1= in->rect; + if (y==0) row1= in->rect; else row1= in->rect + pix*(y-1)*rowlen; row2= in->rect + y*pix*rowlen; - if(y==in->y-1) row3= row2; + if (y==in->y-1) row3= row2; else row3= row2 + pix*rowlen; fp= out->rect + pix*y*rowlen; - if(pix==CB_RGBA) { + if (pix==CB_RGBA) { copy_v4_v4(fp, row2); fp+= pix; - for(x=2; x<rowlen; x++) { - for(c=0; c<3; c++) { + for (x=2; x<rowlen; x++) { + for (c=0; c<3; c++) { f1= filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8]; f2= filter[0]*row1[0] + filter[3]*row1[4] + filter[6]*row1[8] + filter[1]*row2[0] + filter[4]*row2[4] + filter[7]*row2[8] + filter[2]*row3[0] + filter[5]*row3[4] + filter[8]*row3[8]; fp[0]= mfac*row2[4] + fac*sqrt(f1*f1 + f2*f2); @@ -80,9 +80,9 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac) } copy_v4_v4(fp, row2+4); } - else if(pix==CB_VAL) { + else if (pix==CB_VAL) { fp+= pix; - for(x=2; x<rowlen; x++) { + for (x=2; x<rowlen; x++) { f1= filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2]; f2= filter[0]*row1[0] + filter[3]*row1[1] + filter[6]*row1[2] + filter[1]*row2[0] + filter[4]*row2[1] + filter[7]*row2[2] + filter[2]*row3[0] + filter[5]*row3[1] + filter[8]*row3[2]; fp[0]= mfac*row2[1] + fac*sqrt(f1*f1 + f2*f2); @@ -101,35 +101,35 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac) rowlen= in->x; - for(y=0; y<in->y; y++) { + for (y=0; y<in->y; y++) { /* setup rows */ - if(y==0) row1= in->rect; + if (y==0) row1= in->rect; else row1= in->rect + pixlen*(y-1)*rowlen; row2= in->rect + y*pixlen*rowlen; - if(y==in->y-1) row3= row2; + if (y==in->y-1) row3= row2; else row3= row2 + pixlen*rowlen; fp= out->rect + pixlen*(y)*rowlen; - if(pixlen==1) { + if (pixlen==1) { fp[0]= row2[0]; fp+= 1; - for(x=2; x<rowlen; x++) { + for (x=2; x<rowlen; x++) { fp[0]= mfac*row2[1] + fac*(filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2]); fp++; row1++; row2++; row3++; } fp[0]= row2[1]; } - else if(pixlen==2) { + else if (pixlen==2) { fp[0]= row2[0]; fp[1]= row2[1]; fp+= 2; - for(x=2; x<rowlen; x++) { - for(c=0; c<2; c++) { + for (x=2; x<rowlen; x++) { + for (c=0; c<2; c++) { fp[0]= mfac*row2[2] + fac*(filter[0]*row1[0] + filter[1]*row1[2] + filter[2]*row1[4] + filter[3]*row2[0] + filter[4]*row2[2] + filter[5]*row2[4] + filter[6]*row3[0] + filter[7]*row3[2] + filter[8]*row3[4]); fp++; row1++; row2++; row3++; } @@ -137,12 +137,12 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac) fp[0]= row2[2]; fp[1]= row2[3]; } - else if(pixlen==3) { + else if (pixlen==3) { copy_v3_v3(fp, row2); fp+= 3; - for(x=2; x<rowlen; x++) { - for(c=0; c<3; c++) { + for (x=2; x<rowlen; x++) { + for (c=0; c<3; c++) { fp[0]= mfac*row2[3] + fac*(filter[0]*row1[0] + filter[1]*row1[3] + filter[2]*row1[6] + filter[3]*row2[0] + filter[4]*row2[3] + filter[5]*row2[6] + filter[6]*row3[0] + filter[7]*row3[3] + filter[8]*row3[6]); fp++; row1++; row2++; row3++; } @@ -153,8 +153,8 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac) copy_v4_v4(fp, row2); fp+= 4; - for(x=2; x<rowlen; x++) { - for(c=0; c<4; c++) { + for (x=2; x<rowlen; x++) { + for (c=0; c<4; c++) { fp[0]= mfac*row2[4] + fac*(filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8]); fp++; row1++; row2++; row3++; } @@ -175,12 +175,12 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in, float kirsch[9]= {5,5,5,-3,-3,-3,-2,-2,-2}; float shadow[9]= {1,2,1,0,1,0,-1,-2,-1}; - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; /* stack order in: Image */ /* stack order out: Image */ - if(in[1]->data) { + if (in[1]->data) { /* make output size of first available input image */ CompBuf *cbuf= in[1]->data; CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); /* allocs */ diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c index 974a14037eb..3c297299edc 100644 --- a/source/blender/nodes/composite/nodes/node_composite_flip.c +++ b/source/blender/nodes/composite/nodes/node_composite_flip.c @@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_flip_out[]= { static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - if(in[0]->data) { + if (in[0]->data) { CompBuf *cbuf= in[0]->data; CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); /* note, this returns zero'd image */ int i, src_pix, src_width, src_height, srcydelt, outydelt, x, y; @@ -59,20 +59,20 @@ static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack srcydelt= src_width*src_pix; outydelt= srcydelt; - if(node->custom1) { /*set up output pointer for y flip*/ + if (node->custom1) { /*set up output pointer for y flip*/ outfp+= (src_height-1)*outydelt; outydelt= -outydelt; } - for(y=0; y<src_height; y++) { - if(node->custom1 == 1) { /* no x flip so just copy line*/ + for (y=0; y<src_height; y++) { + if (node->custom1 == 1) { /* no x flip so just copy line*/ memcpy(outfp, srcfp, sizeof(float) * src_pix * src_width); srcfp+=srcydelt; } else { outfp += (src_width-1)*src_pix; - for(x=0; x<src_width; x++) { - for(i=0; i<src_pix; i++) { + for (x=0; x<src_width; x++) { + for (i=0; i<src_pix; i++) { outfp[i]= srcfp[i]; } outfp -= src_pix; diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c index 90135b5cf35..ae793b44f2c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.c +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c @@ -48,7 +48,7 @@ static bNodeSocketTemplate cmp_node_gamma_out[]= { static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac) { int i=0; - for(i=0; i<3; i++) { + for (i=0; i<3; i++) { /* check for negative to avoid nan's */ out[i] = (in[i] > 0.0f)? powf(in[i],fac[0]): in[i]; } @@ -58,10 +58,10 @@ static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack { /* stack order in: Fac, Image */ /* stack order out: Image */ - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; /* input no image? then only color operation */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { do_gamma(node, out[0]->vec, in[0]->vec, in[1]->vec); } else { diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index d4e15f780e5..42760ddfc4e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -436,7 +436,8 @@ static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack if (img->type != CB_RGBA) { new = typecheck_compbuf(img, CB_RGBA); src = typecheck_compbuf(img, CB_RGBA); - } else { + } + else { new = dupalloc_compbuf(img); src = dupalloc_compbuf(img); } diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index c4598717e00..7349d1dd4bf 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -48,12 +48,12 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac) { NodeHueSat *nhs= node->storage; - if(*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0f || nhs->val!=1.0f)) { + if (*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0f || nhs->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]+= (nhs->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]*= nhs->sat; hsv[2]*= nhs->val; hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); @@ -72,10 +72,10 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta { /* stack order in: Fac, Image */ /* stack order out: Image */ - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; /* input no image? then only color operation */ - if(in[1]->data==NULL) { + if (in[1]->data==NULL) { do_hue_sat_fac(node, out[0]->vec, in[1]->vec, in[0]->vec); } else { @@ -88,7 +88,7 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta out[0]->data= stackbuf; /* get rid of intermediary cbuf if it's extra */ - if(stackbuf!=cbuf) + if (stackbuf!=cbuf) free_compbuf(cbuf); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c index 6b0849b2391..23d04a28276 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c @@ -109,16 +109,16 @@ static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNode /* stack order input: fac, image, black level, white level */ /* stack order output: image */ - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; - if(in[0]->vec[0] == 0.f && in[0]->data == NULL) { + if (in[0]->vec[0] == 0.f && in[0]->data == NULL) { out[0]->data = pass_on_compbuf(cbuf); return; } /* input no image? then only color operation */ - if(in[1]->data==NULL) { + if (in[1]->data==NULL) { do_huecorrect_fac(node, out[0]->vec, in[1]->vec, in[0]->vec); } diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c index 0600e44b0d0..c1dba471f20 100644 --- a/source/blender/nodes/composite/nodes/node_composite_idMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c @@ -52,15 +52,15 @@ static void do_idmask(CompBuf *stackbuf, CompBuf *cbuf, float idnr) char *abuf= MEM_mapallocN(cbuf->x*cbuf->y, "anti ali buf"); rect= cbuf->rect; - for(x= cbuf->x*cbuf->y - 1; x>=0; x--) - if(rect[x]==idnr) + for (x= cbuf->x*cbuf->y - 1; x>=0; x--) + if (rect[x]==idnr) abuf[x]= 255; antialias_tagbuf(cbuf->x, cbuf->y, abuf); rect= stackbuf->rect; - for(x= cbuf->x*cbuf->y - 1; x>=0; x--) - if(abuf[x]>1) + for (x= cbuf->x*cbuf->y - 1; x>=0; x--) + if (abuf[x]>1) rect[x]= (1.0f/255.0f)*(float)abuf[x]; MEM_freeN(abuf); @@ -74,8 +74,8 @@ static void do_idmask_fsa(CompBuf *stackbuf, CompBuf *cbuf, float idnr) rect= cbuf->rect; rs= stackbuf->rect; - for(x= cbuf->x*cbuf->y - 1; x>=0; x--) - if(rect[x]==idnr) + for (x= cbuf->x*cbuf->y - 1; x>=0; x--) + if (rect[x]==idnr) rs[x]= 1.0f; } @@ -85,19 +85,19 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in, { RenderData *rd= data; - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; - if(in[0]->data) { + if (in[0]->data) { CompBuf *cbuf= in[0]->data; CompBuf *stackbuf; - if(cbuf->type!=CB_VAL) + if (cbuf->type!=CB_VAL) return; stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); /* allocs */; - if((rd->scemode & R_FULL_SAMPLE) || node->custom2 == 0) + if ((rd->scemode & R_FULL_SAMPLE) || node->custom2 == 0) do_idmask_fsa(stackbuf, cbuf, (float)node->custom1); else do_idmask(stackbuf, cbuf, (float)node->custom1); diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 997bd72d5c4..44efbc6f9db 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -75,8 +75,8 @@ float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc) *alloc= FALSE; - if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) { - if(ibuf->profile != IB_PROFILE_NONE) { + if (rd->color_mgt_flag & R_COLOR_MANAGEMENT) { + if (ibuf->profile != IB_PROFILE_NONE) { rect= ibuf->rect_float; } else { @@ -90,7 +90,7 @@ float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc) } } else { - if(ibuf->profile == IB_PROFILE_NONE) { + if (ibuf->profile == IB_PROFILE_NONE) { rect= ibuf->rect_float; } else { @@ -119,7 +119,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i int alloc= FALSE; ibuf= BKE_image_get_ibuf(ima, iuser); - if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { + if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { return NULL; } @@ -129,7 +129,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i /* now we need a float buffer from the image with matching color management */ /* XXX weak code, multilayer is excluded from this */ - if(ibuf->channels == 4 && ima->rr==NULL) { + if (ibuf->channels == 4 && ima->rr==NULL) { rect= node_composit_get_float_buffer(rd, ibuf, &alloc); } else { @@ -141,9 +141,9 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i type= ibuf->channels; - if(rd->scemode & R_COMP_CROP) { + if (rd->scemode & R_COMP_CROP) { stackbuf= get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type); - if(alloc) + if (alloc) MEM_freeN(rect); } else { @@ -176,8 +176,8 @@ static CompBuf *node_composit_get_zimage(bNode *node, RenderData *rd) ImBuf *ibuf= BKE_image_get_ibuf((Image *)node->id, node->storage); CompBuf *zbuf= NULL; - if(ibuf && ibuf->zbuf_float) { - if(rd->scemode & R_COMP_CROP) { + if (ibuf && ibuf->zbuf_float) { + if (rd->scemode & R_COMP_CROP) { zbuf= get_cropped_compbuf(&rd->disprect, ibuf->zbuf_float, ibuf->x, ibuf->y, CB_VAL); } else { @@ -194,11 +194,11 @@ static CompBuf *compbuf_multilayer_get(RenderData *rd, RenderLayer *rl, Image *i RenderPass *rpass; short index; - for(index=0, rpass= rl->passes.first; rpass; rpass= rpass->next, index++) - if(rpass->passtype==passtype) + for (index=0, rpass= rl->passes.first; rpass; rpass= rpass->next, index++) + if (rpass->passtype==passtype) break; - if(rpass) { + if (rpass) { CompBuf *cbuf; iuser->pass= index; @@ -212,58 +212,58 @@ static CompBuf *compbuf_multilayer_get(RenderData *rd, RenderLayer *rl, Image *i static void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, Image *ima, ImageUser *iuser) { - if(out[RRES_OUT_Z]->hasoutput) + if (out[RRES_OUT_Z]->hasoutput) out[RRES_OUT_Z]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_Z); - if(out[RRES_OUT_VEC]->hasoutput) + if (out[RRES_OUT_VEC]->hasoutput) out[RRES_OUT_VEC]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_VECTOR); - if(out[RRES_OUT_NORMAL]->hasoutput) + if (out[RRES_OUT_NORMAL]->hasoutput) out[RRES_OUT_NORMAL]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_NORMAL); - if(out[RRES_OUT_UV]->hasoutput) + if (out[RRES_OUT_UV]->hasoutput) out[RRES_OUT_UV]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_UV); - if(out[RRES_OUT_RGBA]->hasoutput) + if (out[RRES_OUT_RGBA]->hasoutput) out[RRES_OUT_RGBA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_RGBA); - if(out[RRES_OUT_DIFF]->hasoutput) + if (out[RRES_OUT_DIFF]->hasoutput) out[RRES_OUT_DIFF]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE); - if(out[RRES_OUT_SPEC]->hasoutput) + if (out[RRES_OUT_SPEC]->hasoutput) out[RRES_OUT_SPEC]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_SPEC); - if(out[RRES_OUT_SHADOW]->hasoutput) + if (out[RRES_OUT_SHADOW]->hasoutput) out[RRES_OUT_SHADOW]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_SHADOW); - if(out[RRES_OUT_AO]->hasoutput) + if (out[RRES_OUT_AO]->hasoutput) out[RRES_OUT_AO]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_AO); - if(out[RRES_OUT_REFLECT]->hasoutput) + if (out[RRES_OUT_REFLECT]->hasoutput) out[RRES_OUT_REFLECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_REFLECT); - if(out[RRES_OUT_REFRACT]->hasoutput) + if (out[RRES_OUT_REFRACT]->hasoutput) out[RRES_OUT_REFRACT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_REFRACT); - if(out[RRES_OUT_INDIRECT]->hasoutput) + if (out[RRES_OUT_INDIRECT]->hasoutput) out[RRES_OUT_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDIRECT); - if(out[RRES_OUT_INDEXOB]->hasoutput) + if (out[RRES_OUT_INDEXOB]->hasoutput) out[RRES_OUT_INDEXOB]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXOB); - if(out[RRES_OUT_INDEXMA]->hasoutput) + if (out[RRES_OUT_INDEXMA]->hasoutput) out[RRES_OUT_INDEXMA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXMA); - if(out[RRES_OUT_MIST]->hasoutput) + if (out[RRES_OUT_MIST]->hasoutput) out[RRES_OUT_MIST]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_MIST); - if(out[RRES_OUT_EMIT]->hasoutput) + if (out[RRES_OUT_EMIT]->hasoutput) out[RRES_OUT_EMIT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_EMIT); - if(out[RRES_OUT_ENV]->hasoutput) + if (out[RRES_OUT_ENV]->hasoutput) out[RRES_OUT_ENV]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_ENVIRONMENT); - if(out[RRES_OUT_DIFF_DIRECT]->hasoutput) + if (out[RRES_OUT_DIFF_DIRECT]->hasoutput) out[RRES_OUT_DIFF_DIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE_DIRECT); - if(out[RRES_OUT_DIFF_INDIRECT]->hasoutput) + if (out[RRES_OUT_DIFF_INDIRECT]->hasoutput) out[RRES_OUT_DIFF_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE_INDIRECT); - if(out[RRES_OUT_DIFF_COLOR]->hasoutput) + if (out[RRES_OUT_DIFF_COLOR]->hasoutput) out[RRES_OUT_DIFF_COLOR]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE_COLOR); - if(out[RRES_OUT_GLOSSY_DIRECT]->hasoutput) + if (out[RRES_OUT_GLOSSY_DIRECT]->hasoutput) out[RRES_OUT_GLOSSY_DIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_GLOSSY_DIRECT); - if(out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput) + if (out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput) out[RRES_OUT_GLOSSY_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_GLOSSY_INDIRECT); - if(out[RRES_OUT_GLOSSY_COLOR]->hasoutput) + if (out[RRES_OUT_GLOSSY_COLOR]->hasoutput) out[RRES_OUT_GLOSSY_COLOR]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_GLOSSY_COLOR); - if(out[RRES_OUT_TRANSM_DIRECT]->hasoutput) + if (out[RRES_OUT_TRANSM_DIRECT]->hasoutput) out[RRES_OUT_TRANSM_DIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_TRANSM_DIRECT); - if(out[RRES_OUT_TRANSM_INDIRECT]->hasoutput) + if (out[RRES_OUT_TRANSM_INDIRECT]->hasoutput) out[RRES_OUT_TRANSM_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_TRANSM_INDIRECT); - if(out[RRES_OUT_TRANSM_COLOR]->hasoutput) + if (out[RRES_OUT_TRANSM_COLOR]->hasoutput) out[RRES_OUT_TRANSM_COLOR]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_TRANSM_COLOR); } @@ -273,7 +273,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE /* image assigned to output */ /* stack order input sockets: col, alpha */ - if(node->id) { + if (node->id) { RenderData *rd= data; Image *ima= (Image *)node->id; ImageUser *iuser= (ImageUser *)node->storage; @@ -283,13 +283,13 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE BKE_image_user_calc_frame(iuser, rd->cfra, 0); /* force a load, we assume iuser index will be set OK anyway */ - if(ima->type==IMA_TYPE_MULTILAYER) + if (ima->type==IMA_TYPE_MULTILAYER) BKE_image_get_ibuf(ima, iuser); - if(ima->type==IMA_TYPE_MULTILAYER && ima->rr) { + if (ima->type==IMA_TYPE_MULTILAYER && ima->rr) { RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer); - if(rl) { + if (rl) { out[0]->data= stackbuf= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_COMBINED); /* go over all layers */ @@ -325,14 +325,14 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE /* put image on stack */ out[0]->data= stackbuf; - if(out[2]->hasoutput) + if (out[2]->hasoutput) out[2]->data= node_composit_get_zimage(node, rd); } } /* alpha and preview for both types */ - if(stackbuf) { - if(out[1]->hasoutput) + if (stackbuf) { + if (out[1]->hasoutput) out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A); generate_preview(data, node, stackbuf); @@ -370,18 +370,18 @@ void register_node_type_cmp_image(bNodeTreeType *ttype) static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, int recty, int passcode) { float *fp= RE_RenderLayerGetPass(rl, passcode); - if(fp) { + if (fp) { CompBuf *buf; int buftype= CB_VEC3; - if(ELEM4(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST, SCE_PASS_INDEXMA)) + if (ELEM4(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST, SCE_PASS_INDEXMA)) buftype= CB_VAL; - else if(passcode==SCE_PASS_VECTOR) + else if (passcode==SCE_PASS_VECTOR) buftype= CB_VEC4; - else if(ELEM(passcode, SCE_PASS_COMBINED, SCE_PASS_RGBA)) + else if (ELEM(passcode, SCE_PASS_COMBINED, SCE_PASS_RGBA)) buftype= CB_RGBA; - if(rd->scemode & R_COMP_CROP) + if (rd->scemode & R_COMP_CROP) buf= get_cropped_compbuf(&rd->disprect, fp, rectx, recty, buftype); else { buf= alloc_compbuf(rectx, recty, buftype, 0); @@ -394,58 +394,58 @@ static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, in static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out, int rectx, int recty) { - if(out[RRES_OUT_Z]->hasoutput) + if (out[RRES_OUT_Z]->hasoutput) out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_Z); - if(out[RRES_OUT_VEC]->hasoutput) + if (out[RRES_OUT_VEC]->hasoutput) out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_VECTOR); - if(out[RRES_OUT_NORMAL]->hasoutput) + if (out[RRES_OUT_NORMAL]->hasoutput) out[RRES_OUT_NORMAL]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_NORMAL); - if(out[RRES_OUT_UV]->hasoutput) + if (out[RRES_OUT_UV]->hasoutput) out[RRES_OUT_UV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_UV); - if(out[RRES_OUT_RGBA]->hasoutput) + if (out[RRES_OUT_RGBA]->hasoutput) out[RRES_OUT_RGBA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RGBA); - if(out[RRES_OUT_DIFF]->hasoutput) + if (out[RRES_OUT_DIFF]->hasoutput) out[RRES_OUT_DIFF]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE); - if(out[RRES_OUT_SPEC]->hasoutput) + if (out[RRES_OUT_SPEC]->hasoutput) out[RRES_OUT_SPEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SPEC); - if(out[RRES_OUT_SHADOW]->hasoutput) + if (out[RRES_OUT_SHADOW]->hasoutput) out[RRES_OUT_SHADOW]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SHADOW); - if(out[RRES_OUT_AO]->hasoutput) + if (out[RRES_OUT_AO]->hasoutput) out[RRES_OUT_AO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_AO); - if(out[RRES_OUT_REFLECT]->hasoutput) + if (out[RRES_OUT_REFLECT]->hasoutput) out[RRES_OUT_REFLECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFLECT); - if(out[RRES_OUT_REFRACT]->hasoutput) + if (out[RRES_OUT_REFRACT]->hasoutput) out[RRES_OUT_REFRACT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFRACT); - if(out[RRES_OUT_INDIRECT]->hasoutput) + if (out[RRES_OUT_INDIRECT]->hasoutput) out[RRES_OUT_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDIRECT); - if(out[RRES_OUT_INDEXOB]->hasoutput) + if (out[RRES_OUT_INDEXOB]->hasoutput) out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB); - if(out[RRES_OUT_INDEXMA]->hasoutput) + if (out[RRES_OUT_INDEXMA]->hasoutput) out[RRES_OUT_INDEXMA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXMA); - if(out[RRES_OUT_MIST]->hasoutput) + if (out[RRES_OUT_MIST]->hasoutput) out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST); - if(out[RRES_OUT_EMIT]->hasoutput) + if (out[RRES_OUT_EMIT]->hasoutput) out[RRES_OUT_EMIT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_EMIT); - if(out[RRES_OUT_ENV]->hasoutput) + if (out[RRES_OUT_ENV]->hasoutput) out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT); - if(out[RRES_OUT_DIFF_DIRECT]->hasoutput) + if (out[RRES_OUT_DIFF_DIRECT]->hasoutput) out[RRES_OUT_DIFF_DIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE_DIRECT); - if(out[RRES_OUT_DIFF_INDIRECT]->hasoutput) + if (out[RRES_OUT_DIFF_INDIRECT]->hasoutput) out[RRES_OUT_DIFF_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE_INDIRECT); - if(out[RRES_OUT_DIFF_COLOR]->hasoutput) + if (out[RRES_OUT_DIFF_COLOR]->hasoutput) out[RRES_OUT_DIFF_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE_COLOR); - if(out[RRES_OUT_GLOSSY_DIRECT]->hasoutput) + if (out[RRES_OUT_GLOSSY_DIRECT]->hasoutput) out[RRES_OUT_GLOSSY_DIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_GLOSSY_DIRECT); - if(out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput) + if (out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput) out[RRES_OUT_GLOSSY_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_GLOSSY_INDIRECT); - if(out[RRES_OUT_GLOSSY_COLOR]->hasoutput) + if (out[RRES_OUT_GLOSSY_COLOR]->hasoutput) out[RRES_OUT_GLOSSY_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_GLOSSY_COLOR); - if(out[RRES_OUT_TRANSM_DIRECT]->hasoutput) + if (out[RRES_OUT_TRANSM_DIRECT]->hasoutput) out[RRES_OUT_TRANSM_DIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_DIRECT); - if(out[RRES_OUT_TRANSM_INDIRECT]->hasoutput) + if (out[RRES_OUT_TRANSM_INDIRECT]->hasoutput) out[RRES_OUT_TRANSM_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_INDIRECT); - if(out[RRES_OUT_TRANSM_COLOR]->hasoutput) + if (out[RRES_OUT_TRANSM_COLOR]->hasoutput) out[RRES_OUT_TRANSM_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_COLOR); } @@ -456,24 +456,24 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU RenderData *rd= data; RenderResult *rr= NULL; - if(re) + if (re) rr= RE_AcquireResultRead(re); - if(rr) { + if (rr) { SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1); - if(srl) { + if (srl) { RenderLayer *rl= RE_GetRenderLayer(rr, srl->name); - if(rl && rl->rectf) { + 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) + 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) { + if (stackbuf==NULL) { printf("Error; Preview Panel in UV Window returns zero sized image\n"); } else { @@ -483,7 +483,7 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU /* put on stack */ out[RRES_OUT_IMAGE]->data= stackbuf; - if(out[RRES_OUT_ALPHA]->hasoutput) + 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); @@ -494,7 +494,7 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU } } - if(re) + if (re) RE_ReleaseResult(re); } diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c index 4fda90e0a1e..8f3a6fc2e25 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ b/source/blender/nodes/composite/nodes/node_composite_invert.c @@ -45,14 +45,16 @@ static bNodeSocketTemplate cmp_node_invert_out[]= { static void do_invert(bNode *node, float *out, float *in) { - if(node->custom1 & CMP_CHAN_RGB) { + if (node->custom1 & CMP_CHAN_RGB) { out[0] = 1.0f - in[0]; out[1] = 1.0f - in[1]; out[2] = 1.0f - in[2]; - } else + } + else { copy_v3_v3(out, in); + } - if(node->custom1 & CMP_CHAN_A) + if (node->custom1 & CMP_CHAN_A) out[3] = 1.0f - in[3]; else out[3] = in[3]; @@ -67,12 +69,12 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac) /* blend inverted result against original input with fac */ facm = 1.0f - fac[0]; - if(node->custom1 & CMP_CHAN_RGB) { + if (node->custom1 & CMP_CHAN_RGB) { col[0] = fac[0]*col[0] + (facm*in[0]); col[1] = fac[0]*col[1] + (facm*in[1]); col[2] = fac[0]*col[2] + (facm*in[2]); } - if(node->custom1 & CMP_CHAN_A) + if (node->custom1 & CMP_CHAN_A) col[3] = fac[0]*col[3] + (facm*in[3]); copy_v4_v4(out, col); @@ -84,10 +86,10 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac /* stack order out: Image */ float *fac= in[0]->vec; - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; /* input no image? then only color operation */ - if(in[1]->data==NULL && in[0]->data==NULL) { + if (in[1]->data==NULL && in[0]->data==NULL) { do_invert_fac(node, out[0]->vec, in[1]->vec, fac); } else { @@ -105,7 +107,8 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac out[0]->data= stackbuf; return; - } else { + } + else { out[0]->data = pass_on_compbuf(cbuf); return; } diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c index 9417e504a1b..ec6d2006296 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ b/source/blender/nodes/composite/nodes/node_composite_levels.c @@ -57,13 +57,13 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins) int x,y; /*fill bins */ - for(y=0; y<in->y; y++) { - for(x=0; x<in->x; x++) { + for (y=0; y<in->y; y++) { + for (x=0; x<in->x; x++) { /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0f) { /* don't count transparent pixels */ + if (value[3] > 0.0f) { /* don't count transparent pixels */ switch(node->custom1) { case 1: { /* all colors */ rgb_tobw(value[0],value[1],value[2], &value[0]); @@ -97,8 +97,8 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins) } /*end switch */ /*clip*/ - if(ivalue<0) ivalue=0; - if(ivalue>255) ivalue=255; + if (ivalue<0) ivalue=0; + if (ivalue>255) ivalue=255; /*put in the correct bin*/ bins[ivalue]+=1; @@ -114,13 +114,13 @@ static float brightness_mean(bNode* node, CompBuf* in) int x,y; float value[4]; - for(x=0; x< in->x; x++) { - for(y=0; y < in->y; y++) { + for (x=0; x< in->x; x++) { + for (y=0; y < in->y; y++) { /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0f) { /* don't count transparent pixels */ + if (value[3] > 0.0f) { /* don't count transparent pixels */ numPixels++; switch(node->custom1) { @@ -166,13 +166,13 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean) int x,y; float value[4]; - for(x=0; x< in->x; x++) { - for(y=0; y < in->y; y++) { + for (x=0; x< in->x; x++) { + for (y=0; y < in->y; y++) { /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0f) { /* don't count transparent pixels */ + if (value[3] > 0.0f) { /* don't count transparent pixels */ numPixels++; switch(node->custom1) { @@ -224,18 +224,18 @@ static void draw_histogram(bNode *node, CompBuf *out, int* bins) /* find max value */ max=0; - for(x=0; x<256; x++) { - if(bins[x]>max) max=bins[x]; + for (x=0; x<256; x++) { + if (bins[x]>max) max=bins[x]; } /*draw histogram in buffer */ - for(x=0; x<out->x; x++) { - for(y=0;y<out->y; y++) { + for (x=0; x<out->x; x++) { + for (y=0;y<out->y; y++) { /* get normalized value (0..255) */ value=((float)bins[x]/(float)max)*255.0f; - if(y < (int)value) { /*if the y value is below the height of the bar for this line then draw with the color */ + if (y < (int)value) { /*if the y value is below the height of the bar for this line then draw with the color */ switch (node->custom1) { case 1: { /* draw in black */ color[0]=0.0; color[1]=0.0; color[2]=0.0; color[3]=1.0; @@ -259,7 +259,7 @@ static void draw_histogram(bNode *node, CompBuf *out, int* bins) } } } - else{ + else { color[0]=0.8; color[1]=0.8; color[2]=0.8; color[3]=1.0; } @@ -277,14 +277,14 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack * int bins[256]; int x; - if(in[0]->hasinput==0) return; - if(in[0]->data==NULL) return; + if (in[0]->hasinput==0) return; + if (in[0]->data==NULL) return; histogram=alloc_compbuf(256, 256, CB_RGBA, 1); cbuf=typecheck_compbuf(in[0]->data, CB_RGBA); /*initalize bins*/ - for(x=0; x<256; x++) { + for (x=0; x<256; x++) { bins[x]=0; } @@ -303,14 +303,14 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack * printf("Std Dev: %f\n", std_dev); */ - if(out[0]->hasoutput) + if (out[0]->hasoutput) out[0]->vec[0]= mean; - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->vec[0]= std_dev; generate_preview(data, node, histogram); - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); free_compbuf(histogram); } diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c index ad5e9d423e5..85c291fd9ec 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c @@ -51,10 +51,10 @@ static void do_luma_matte(bNode *node, float *out, float *in) float alpha; /* test range*/ - if(in[0]>c->t1) { + if (in[0]>c->t1) { alpha=1.0; } - else if(in[0]<c->t2){ + else if (in[0]<c->t2) { alpha=0.0; } else {/*blend */ @@ -76,9 +76,9 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack ** CompBuf *cbuf; CompBuf *outbuf; - if(in[0]->hasinput==0) return; - if(in[0]->data==NULL) return; - if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return; + if (in[0]->hasinput==0) return; + if (in[0]->data==NULL) return; + if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return; cbuf=typecheck_compbuf(in[0]->data, CB_RGBA); @@ -92,7 +92,7 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack ** out[0]->data=outbuf; if (out[1]->hasoutput) out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A); - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); } diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c index 1ca729c8393..7d62e6b8030 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c @@ -64,10 +64,10 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr sx= stackbuf->x; sy= stackbuf->y; - for(y=0; y<sy; y++) { - for(x=0; x<sx; x++, out+=4, uv+=3, uvnext+=3, uvprev+=3) { - if(x>0 && x<sx-1 && y>0 && y<sy-1) { - if(uv[2]!=0.0f) { + for (y=0; y<sy; y++) { + for (x=0; x<sx; x++, out+=4, uv+=3, uvnext+=3, uvprev+=3) { + if (x>0 && x<sx-1 && y>0 && y<sy-1) { + if (uv[2]!=0.0f) { float uv_l, uv_r; /* adaptive sampling, red (U) channel */ @@ -113,16 +113,16 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr /* UV to alpha threshold */ alpha= 1.0f - threshold*(dx+dy); - if(alpha<0.0f) alpha= 0.0f; + if (alpha<0.0f) alpha= 0.0f; else alpha*= uv[2]; /* should use mipmap */ - if(dx > 0.20f) dx= 0.20f; - if(dy > 0.20f) dy= 0.20f; + if (dx > 0.20f) dx= 0.20f; + if (dy > 0.20f) dy= 0.20f; ibuf_sample(ibuf, uv[0], uv[1], dx, dy, out); /* premul */ - if(alpha<1.0f) { + if (alpha<1.0f) { out[0]*= alpha; out[1]*= alpha; out[2]*= alpha; @@ -139,10 +139,10 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; - if(in[0]->data && in[1]->data) { + if (in[0]->data && in[1]->data) { CompBuf *cbuf= in[0]->data; CompBuf *uvbuf= in[1]->data; CompBuf *stackbuf; @@ -155,9 +155,9 @@ static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack out[0]->data= stackbuf; - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); - if(uvbuf!=in[1]->data) + if (uvbuf!=in[1]->data) free_compbuf(uvbuf); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c index 380aa0b716b..2fd115261f8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c @@ -47,11 +47,11 @@ static void do_map_value(bNode *node, float *out, float *src) TexMapping *texmap= node->storage; out[0]= (src[0] + texmap->loc[0])*texmap->size[0]; - if(texmap->flag & TEXMAP_CLIP_MIN) - if(out[0]<texmap->min[0]) + if (texmap->flag & TEXMAP_CLIP_MIN) + if (out[0]<texmap->min[0]) out[0]= texmap->min[0]; - if(texmap->flag & TEXMAP_CLIP_MAX) - if(out[0]>texmap->max[0]) + if (texmap->flag & TEXMAP_CLIP_MAX) + if (out[0]>texmap->max[0]) out[0]= texmap->max[0]; } @@ -59,10 +59,10 @@ static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeS { /* stack order in: valbuf */ /* stack order out: valbuf */ - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; /* input no image? then only value operation */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { do_map_value(node, out[0]->vec, in[0]->vec); } else { diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c index 6c2cbb9a92b..6f3d2f6baaf 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.c +++ b/source/blender/nodes/composite/nodes/node_composite_math.c @@ -59,7 +59,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) break; case 3: /* Divide */ { - if(in2[0]==0) /* We don't want to divide by zero. */ + if (in2[0]==0) /* We don't want to divide by zero. */ out[0]= 0.0; else out[0]= in[0] / in2[0]; @@ -77,7 +77,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) case 7: /* Arc-Sine */ { /* Can't do the impossible... */ - if(in[0] <= 1 && in[0] >= -1 ) + if (in[0] <= 1 && in[0] >= -1 ) out[0]= asin(in[0]); else out[0]= 0.0; @@ -86,7 +86,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) case 8: /* Arc-Cosine */ { /* Can't do the impossible... */ - if( in[0] <= 1 && in[0] >= -1 ) + if ( in[0] <= 1 && in[0] >= -1 ) out[0]= acos(in[0]); else out[0]= 0.0; @@ -98,14 +98,16 @@ static void do_math(bNode *node, float *out, float *in, float *in2) case 10: /* Power */ { /* Only raise negative numbers by full integers */ - if( in[0] >= 0 ) { + if ( in[0] >= 0 ) { out[0]= pow(in[0], in2[0]); - } else { + } + 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.999f || y_mod_1 < 0.001f) { out[0]= powf(in[0], floorf(in2[0] + 0.5f)); - } else { + } + else { out[0] = 0.0f; } } @@ -114,7 +116,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) case 11: /* Logarithm */ { /* Don't want any imaginary numbers... */ - if( in[0] > 0 && in2[0] > 0 ) + if ( in[0] > 0 && in2[0] > 0 ) out[0]= log(in[0]) / log(in2[0]); else out[0]= 0.0; @@ -122,7 +124,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) break; case 12: /* Minimum */ { - if( in[0] < in2[0] ) + if ( in[0] < in2[0] ) out[0]= in[0]; else out[0]= in2[0]; @@ -130,7 +132,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) break; case 13: /* Maximum */ { - if( in[0] > in2[0] ) + if ( in[0] > in2[0] ) out[0]= in[0]; else out[0]= in2[0]; @@ -139,7 +141,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) case 14: /* Round */ { /* round by the second value */ - if( in2[0] != 0.0f ) + if ( in2[0] != 0.0f ) out[0]= floorf(in[0] / in2[0] + 0.5f) * in2[0]; else out[0]= floorf(in[0] + 0.5f); @@ -147,7 +149,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) break; case 15: /* Less Than */ { - if( in[0] < in2[0] ) + if ( in[0] < in2[0] ) out[0]= 1.0f; else out[0]= 0.0f; @@ -155,7 +157,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) break; case 16: /* Greater Than */ { - if( in[0] > in2[0] ) + if ( in[0] > in2[0] ) out[0]= 1.0f; else out[0]= 0.0f; @@ -171,16 +173,16 @@ static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack CompBuf *stackbuf; /* check for inputs and outputs for early out*/ - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; /* no image-color operation */ - if(in[0]->data==NULL && in[1]->data==NULL) { + if (in[0]->data==NULL && in[1]->data==NULL) { do_math(node, out[0]->vec, in[0]->vec, in[1]->vec); return; } /*create output based on first input */ - if(cbuf) { + if (cbuf) { stackbuf=alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); } /* and if it doesn't exist use the second input since we diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c index 0296fa417d6..6539e81beec 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c @@ -48,7 +48,7 @@ static void do_mix_rgb(bNode *node, float *out, float *in1, float *in2, float *f float col[3]; copy_v3_v3(col, in1); - if(node->custom2) + if (node->custom2) ramp_blend(node->custom1, col, in2[3]*fac[0], in2); else ramp_blend(node->custom1, col, fac[0], in2); @@ -62,10 +62,10 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, /* stack order out: Image */ float *fac= in[0]->vec; - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; /* input no image? then only color operation */ - if(in[1]->data==NULL && in[2]->data==NULL) { + if (in[1]->data==NULL && in[2]->data==NULL) { do_mix_rgb(node, out[0]->vec, in[1]->vec, in[2]->vec, fac); } else { diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c index 6ec64ef7c09..dd2c169fe9a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c @@ -53,7 +53,7 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov orig_ibuf= BKE_movieclip_get_ibuf(clip, user); - if(orig_ibuf==NULL || (orig_ibuf->rect==NULL && orig_ibuf->rect_float==NULL)) { + if (orig_ibuf==NULL || (orig_ibuf->rect==NULL && orig_ibuf->rect_float==NULL)) { IMB_freeImBuf(orig_ibuf); return NULL; } @@ -67,7 +67,7 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov } /* now we need a float buffer from the image with matching color management */ - if(ibuf->channels == 4) { + if (ibuf->channels == 4) { rect= node_composit_get_float_buffer(rd, ibuf, &alloc); } else { @@ -76,16 +76,16 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov } /* done coercing into the correct color management */ - if(!alloc) { + if (!alloc) { rect= MEM_dupallocN(rect); alloc= 1; } type= ibuf->channels; - if(rd->scemode & R_COMP_CROP) { + if (rd->scemode & R_COMP_CROP) { stackbuf= get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type); - if(alloc) + if (alloc) MEM_freeN(rect); } else { @@ -102,7 +102,7 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { - if(node->id) { + if (node->id) { RenderData *rd= data; MovieClip *clip= (MovieClip *)node->id; MovieClipUser *user= (MovieClipUser *)node->storage; @@ -118,7 +118,7 @@ static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **U /* put image on stack */ out[0]->data= stackbuf; - if(stab->flag&TRACKING_2D_STABILIZATION) { + if (stab->flag&TRACKING_2D_STABILIZATION) { float loc[2], scale, angle; BKE_tracking_stabilization_data(&clip->tracking, rd->cfra, stackbuf->x, stackbuf->y, diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c index a0b7e62e644..d9f0da9b8aa 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c @@ -49,8 +49,8 @@ static bNodeSocketTemplate cmp_node_moviedistortion_out[]= { static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { - if(in[0]->data) { - if(node->id) { + if (in[0]->data) { + if (node->id) { MovieClip *clip= (MovieClip *)node->id; CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 0); @@ -58,7 +58,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); - if(ibuf) { + if (ibuf) { RenderData *rd= data; ImBuf *obuf; MovieTracking *tracking= &clip->tracking; @@ -72,10 +72,10 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) BKE_movieclip_get_size(clip, &user, &width, &height); - if(!node->storage) + if (!node->storage) node->storage= BKE_tracking_distortion_create(); - if(node->custom1==0) + if (node->custom1==0) obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 1); else obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 0); @@ -93,9 +93,10 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) /* pass on output and free */ out[0]->data= stackbuf; - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); - } else { + } + else { CompBuf *cbuf= in[0]->data; CompBuf *stackbuf= pass_on_compbuf(cbuf); @@ -106,7 +107,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) static const char *label(bNode *node) { - if(node->custom1==0) + if (node->custom1==0) return IFACE_("Undistortion"); else return IFACE_("Distortion"); @@ -114,7 +115,7 @@ static const char *label(bNode *node) static void storage_free(bNode *node) { - if(node->storage) + if (node->storage) BKE_tracking_distortion_destroy(node->storage); node->storage= NULL; @@ -122,7 +123,7 @@ static void storage_free(bNode *node) static void storage_copy(bNode *orig_node, bNode *new_node) { - if(orig_node->storage) + if (orig_node->storage) new_node->storage= BKE_tracking_distortion_copy(orig_node->storage); } diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c index 638f67c4207..e9b5f10172c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normal.c +++ b/source/blender/nodes/composite/nodes/node_composite_normal.c @@ -63,12 +63,12 @@ static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStac /* stack order output: normal, value */ /* input no image? then only vector op */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { copy_v3_v3(out[0]->vec, nor); /* render normals point inside... the widget points outside */ out[1]->vec[0]= -dot_v3v3(out[0]->vec, in[0]->vec); } - else if(out[1]->hasoutput) { + else if (out[1]->hasoutput) { /* make output size of input image */ CompBuf *cbuf= in[0]->data; CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); /* allocs */ diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c index 455966e4f38..69386c3b816 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normalize.c +++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c @@ -65,10 +65,10 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS { /* stack order in: valbuf */ /* stack order out: valbuf */ - if(out[0]->hasoutput==0) return; + if (out[0]->hasoutput==0) return; /* Input has no image buffer? Then pass the value */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { copy_v4_v4(out[0]->vec, in[0]->vec); } else { @@ -93,7 +93,8 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS if ((max-min) != 0.0f) { mult = 1.0f/(max-min); composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, NULL, &min, NULL, &mult, do_normalize, CB_VAL, CB_VAL, CB_VAL); - } else { + } + else { memcpy(stackbuf->rect, cbuf->rect, sizeof(float) * cbuf->x * cbuf->y); } diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index fc92c3aabc8..e93c250e756 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -55,7 +55,7 @@ bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, con sock->storage = sockdata; sock->struct_type = SOCK_STRUCT_OUTPUT_FILE; - if(im_format) { + if (im_format) { sockdata->format= *im_format; if (BKE_imtype_is_movie(sockdata->format.imtype)) { sockdata->format.imtype= R_IMF_IMTYPE_OPENEXR; @@ -186,7 +186,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sock->name); BKE_makepicstring(filename, path, bmain->name, rd->cfra, format->imtype, (rd->scemode & R_EXTENSION), TRUE); - if(0 == BKE_write_ibuf(ibuf, filename, format)) + if (0 == BKE_write_ibuf(ibuf, filename, format)) printf("Cannot save Node File Output to %s\n", filename); else printf("Saved: %s\n", filename); @@ -199,7 +199,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack has_preview = 1; } - if(in[i]->data != cbuf) + if (in[i]->data != cbuf) free_compbuf(cbuf); } } @@ -287,7 +287,7 @@ static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack } /* when the filename has no permissions, this can fail */ - if(IMB_exr_begin_write(exrhandle, filename, rectx, recty, nimf->format.exr_codec)) { + if (IMB_exr_begin_write(exrhandle, filename, rectx, recty, nimf->format.exr_codec)) { IMB_exr_write_channels(exrhandle); } else { diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c index bf934fcd0f7..3d8b0108bbb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c +++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c @@ -46,17 +46,17 @@ static bNodeSocketTemplate cmp_node_premulkey_out[]= { static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; - if(in[0]->data) { + if (in[0]->data) { CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); stackbuf= dupalloc_compbuf(cbuf); premul_compbuf(stackbuf, node->custom1 == 1); out[0]->data = stackbuf; - if(cbuf != in[0]->data) + if (cbuf != in[0]->data) free_compbuf(cbuf); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index 141fcef457f..6952817248d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -48,10 +48,10 @@ static bNodeSocketTemplate cmp_node_rotate_out[]= { static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; - if(in[0]->data) { + 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; @@ -75,14 +75,14 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0); - if(ibuf && obuf){ + if (ibuf && obuf) { ibuf->rect_float=cbuf->rect; obuf->rect_float=stackbuf->rect; - for(y=miny; y<maxy; y++) { + for (y=miny; y<maxy; y++) { yo= y+(int)centy; - for(x=minx; x<maxx;x++) { + for (x=minx; x<maxx;x++) { u=c*x + y*s + centx; v=-s*x + c*y + centy; xo= x+(int)centx; @@ -115,7 +115,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac /* pass on output and free */ out[0]->data= stackbuf; - if(cbuf!=in[0]->data) { + if (cbuf!=in[0]->data) { free_compbuf(cbuf); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c index 188449df5fb..b28f6a91dab 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.c +++ b/source/blender/nodes/composite/nodes/node_composite_scale.c @@ -49,27 +49,28 @@ static bNodeSocketTemplate cmp_node_scale_out[]= { /* node->custom1 stores if input values are absolute or relative scale */ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; - if(in[0]->data) { + if (in[0]->data) { RenderData *rd= data; CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); ImBuf *ibuf; int newx, newy; - if(node->custom1==CMP_SCALE_RELATIVE) { + if (node->custom1==CMP_SCALE_RELATIVE) { newx= MAX2((int)(in[1]->vec[0]*cbuf->x), 1); newy= MAX2((int)(in[2]->vec[0]*cbuf->y), 1); } - else if(node->custom1==CMP_SCALE_SCENEPERCENT) { + else if (node->custom1==CMP_SCALE_SCENEPERCENT) { newx = cbuf->x * (rd->size / 100.0f); newy = cbuf->y * (rd->size / 100.0f); } else if (node->custom1==CMP_SCALE_RENDERPERCENT) { newx= (rd->xsch * rd->size)/100; newy= (rd->ysch * rd->size)/100; - } else { /* CMP_SCALE_ABSOLUTE */ + } + else { /* CMP_SCALE_ABSOLUTE */ newx= MAX2((int)in[1]->vec[0], 1); newy= MAX2((int)in[2]->vec[0], 1); } @@ -77,11 +78,11 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b newy= MIN2(newy, CMP_SCALE_MAX); ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); - if(ibuf) { + if (ibuf) { ibuf->rect_float= cbuf->rect; IMB_scaleImBuf(ibuf, newx, newy); - if(ibuf->rect_float == cbuf->rect) { + if (ibuf->rect_float == cbuf->rect) { /* no scaling happened. */ stackbuf= pass_on_compbuf(in[0]->data); } @@ -105,7 +106,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b } out[0]->data= stackbuf; - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); } else if (node->custom1==CMP_SCALE_ABSOLUTE) { diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c index cde54cfd132..6dac2d16401 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c @@ -64,7 +64,7 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta /* stack order in: col */ /* input no image? then only color operation */ - if(in[0]->data==NULL) { + 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); @@ -83,17 +83,17 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sephsva, CB_RGBA); /* separate each of those channels */ - if(out[0]->hasoutput) + if (out[0]->hasoutput) out[0]->data= valbuf_from_rgbabuf(cbuf2, CHAN_R); - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->data= valbuf_from_rgbabuf(cbuf2, CHAN_G); - if(out[2]->hasoutput) + if (out[2]->hasoutput) out[2]->data= valbuf_from_rgbabuf(cbuf2, CHAN_B); - if(out[3]->hasoutput) + if (out[3]->hasoutput) out[3]->data= valbuf_from_rgbabuf(cbuf2, CHAN_A); /*not used anymore */ - if(cbuf2!=cbuf) + if (cbuf2!=cbuf) free_compbuf(cbuf2); free_compbuf(cbuf); } @@ -142,7 +142,7 @@ static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeSt /* stack order in: 4 value channels */ /* input no image? then only color operation in HSV */ - if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) { + if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) { hsv_to_rgb(in[0]->vec[0], in[1]->vec[0], in[2]->vec[0], &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2]); out[0]->vec[3] = in[3]->vec[0]; diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c index 1f0b504f161..be4a8ac76fe 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c @@ -51,7 +51,7 @@ static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), /* stack order in: col */ /* input no image? then only color operation */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { out[0]->vec[0] = in[0]->vec[0]; out[1]->vec[0] = in[0]->vec[1]; out[2]->vec[0] = in[0]->vec[2]; @@ -62,16 +62,16 @@ static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); /* don't do any pixel processing, just copy the stack directly (faster, I presume) */ - if(out[0]->hasoutput) + if (out[0]->hasoutput) out[0]->data= valbuf_from_rgbabuf(cbuf, CHAN_R); - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->data= valbuf_from_rgbabuf(cbuf, CHAN_G); - if(out[2]->hasoutput) + if (out[2]->hasoutput) out[2]->data= valbuf_from_rgbabuf(cbuf, CHAN_B); - if(out[3]->hasoutput) + if (out[3]->hasoutput) out[3]->data= valbuf_from_rgbabuf(cbuf, CHAN_A); - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); } @@ -118,7 +118,7 @@ static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeSt /* 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)) { + 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]; diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c index a5f827b094d..b12f08bb13d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c @@ -88,7 +88,7 @@ static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in) static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* input no image? then only color operation */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { float y, cb, cr; switch(node->custom1) @@ -132,17 +132,17 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta } /* separate each of those channels */ - if(out[0]->hasoutput) + if (out[0]->hasoutput) out[0]->data= valbuf_from_rgbabuf(cbuf2, CHAN_R); - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->data= valbuf_from_rgbabuf(cbuf2, CHAN_G); - if(out[2]->hasoutput) + if (out[2]->hasoutput) out[2]->data= valbuf_from_rgbabuf(cbuf2, CHAN_B); - if(out[3]->hasoutput) + if (out[3]->hasoutput) out[3]->data= valbuf_from_rgbabuf(cbuf2, CHAN_A); /*not used anymore */ - if(cbuf2!=cbuf) + if (cbuf2!=cbuf) free_compbuf(cbuf2); free_compbuf(cbuf); } @@ -235,7 +235,7 @@ static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeSt /* 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)) { + if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) { float y = in[0]->vec[0] * 255; float cb = in[1]->vec[0] * 255; float cr = in[2]->vec[0] * 255; diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c index 2a2f64a5209..8dd551643f5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c @@ -64,7 +64,7 @@ static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeSta /* stack order in: col */ /* input no image? then only color operation */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { float y, u, v; rgb_to_yuv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &u, &v); @@ -83,17 +83,17 @@ static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeSta composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepyuva, CB_RGBA); /* separate each of those channels */ - if(out[0]->hasoutput) + if (out[0]->hasoutput) out[0]->data= valbuf_from_rgbabuf(cbuf2, CHAN_R); - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->data= valbuf_from_rgbabuf(cbuf2, CHAN_G); - if(out[2]->hasoutput) + if (out[2]->hasoutput) out[2]->data= valbuf_from_rgbabuf(cbuf2, CHAN_B); - if(out[3]->hasoutput) + if (out[3]->hasoutput) out[3]->data= valbuf_from_rgbabuf(cbuf2, CHAN_A); /*not used anymore */ - if(cbuf2!=cbuf) + if (cbuf2!=cbuf) free_compbuf(cbuf2); free_compbuf(cbuf); } @@ -143,7 +143,7 @@ static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeSt /* 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)) { + 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]; diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c index 6c24185bb88..646bcc47617 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c @@ -49,7 +49,7 @@ static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeSt /* stack order in: col, alpha */ /* input no image? then only color operation */ - if(in[0]->data==NULL && in[1]->data==NULL) { + if (in[0]->data==NULL && in[1]->data==NULL) { out[0]->vec[0] = in[0]->vec[0]; out[0]->vec[1] = in[0]->vec[1]; out[0]->vec[2] = in[0]->vec[2]; @@ -60,7 +60,7 @@ static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeSt CompBuf *cbuf= in[0]->data?in[0]->data:in[1]->data; CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */ - if(in[1]->data==NULL && in[1]->vec[0]==1.0f) { + if (in[1]->data==NULL && in[1]->vec[0]==1.0f) { /* pass on image */ composit1_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, do_copy_rgb, CB_RGBA); } diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c index 16356098fe6..c2263053987 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c @@ -41,7 +41,7 @@ static bNodeSocketTemplate cmp_node_splitviewer_in[]= { static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac) { - if(*fac==0.0f) { + if (*fac==0.0f) { copy_v4_v4(out, in1); } else { @@ -54,10 +54,10 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack * /* image assigned to output */ /* stack order input sockets: image image */ - if(in[0]->data==NULL || in[1]->data==NULL) + if (in[0]->data==NULL || in[1]->data==NULL) return; - if(node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */ + if (node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */ Image *ima= (Image *)node->id; RenderData *rd= data; ImBuf *ibuf; @@ -73,7 +73,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack * /* always returns for viewer image, but we check nevertheless */ ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock); - if(ibuf==NULL) { + if (ibuf==NULL) { printf("node_composit_exec_viewer error\n"); BKE_image_release_ibuf(ima, lock); return; @@ -100,7 +100,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack * /* Check which offset mode is selected and limit offset if needed */ - if(node->custom2 == 0) { + if (node->custom2 == 0) { offset = buf1->x / 100.0f * node->custom1; CLAMP(offset, 0, buf1->x); } @@ -109,17 +109,17 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack * CLAMP(offset, 0, buf1->y); } - if(node->custom2 == 0) { - for(y=0; y<buf1->y; y++) { + if (node->custom2 == 0) { + for (y=0; y<buf1->y; y++) { float *fac= mask->rect + y*buf1->x; - for(x=offset; x>0; x--, fac++) + for (x=offset; x>0; x--, fac++) *fac= 1.0f; } } else { - for(y=0; y<offset; y++) { + for (y=0; y<offset; y++) { float *fac= mask->rect + y*buf1->x; - for(x=buf1->x; x>0; x--, fac++) + for (x=buf1->x; x>0; x--, fac++) *fac= 1.0f; } } @@ -132,9 +132,9 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack * free_compbuf(cbuf); free_compbuf(mask); - if(in[0]->data != buf1) + if (in[0]->data != buf1) free_compbuf(buf1); - if(in[1]->data != buf2) + if (in[1]->data != buf2) free_compbuf(buf2); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c index f41751b3e15..0eac85c4030 100644 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c @@ -47,7 +47,7 @@ static bNodeSocketTemplate cmp_node_stabilize2d_out[]= { static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { - if(in[0]->data && node->id) { + if (in[0]->data && node->id) { RenderData *rd= data; MovieClip *clip= (MovieClip *)node->id; CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); @@ -61,7 +61,7 @@ static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack * /* pass on output and free */ out[0]->data= stackbuf; - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c index 7f8f14bcfc5..562e2b2737e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_texture.c +++ b/source/blender/nodes/composite/nodes/node_composite_texture.c @@ -60,19 +60,19 @@ static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco) retval= multitex_ext((Tex *)node->id, vec, NULL, NULL, 0, &texres); - if(type==CB_VAL) { - if(texres.talpha) + if (type==CB_VAL) { + if (texres.talpha) col[0]= texres.ta; else col[0]= texres.tin; } - else if(type==CB_RGBA) { - if(texres.talpha) + else if (type==CB_RGBA) { + if (texres.talpha) col[3]= texres.ta; else col[3]= texres.tin; - if((retval & TEX_RGB)) { + if ((retval & TEX_RGB)) { col[0]= texres.tr; col[1]= texres.tg; col[2]= texres.tb; @@ -92,7 +92,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, { /* outputs: value, color, normal */ - if(node->id) { + if (node->id) { RenderData *rd= data; short sizex, sizey; @@ -113,7 +113,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, sizex = (rd->size*rd->xsch)/100; sizey = (rd->size*rd->ysch)/100; - if(out[0]->hasoutput) { + if (out[0]->hasoutput) { CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 1); /* alloc */ stackbuf->rect_procedural= texture_procedural; @@ -126,7 +126,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, out[0]->data= stackbuf; } - if(out[1]->hasoutput) { + if (out[1]->hasoutput) { CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_RGBA, 1); /* alloc */ stackbuf->rect_procedural= texture_procedural; diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c index 9b34e117496..baa5ba046dd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c @@ -142,7 +142,7 @@ static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeSta out[0]->data = new; - if(img!=in[0]->data) + if (img!=in[0]->data) free_compbuf(img); } diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c index a016f3d1d96..a610d8a66c4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_transform.c +++ b/source/blender/nodes/composite/nodes/node_composite_transform.c @@ -77,14 +77,14 @@ CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, f ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); obuf= IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0); - if(ibuf && obuf) { + if (ibuf && obuf) { int i, j; ibuf->rect_float= cbuf->rect; obuf->rect_float= stackbuf->rect; - for(j=0; j<cbuf->y; j++) { - for(i=0; i<cbuf->x;i++) { + for (j=0; j<cbuf->y; j++) { + for (i=0; i<cbuf->x;i++) { float vec[3]= {i, j, 0}; mul_v3_m4v3(vec, mat, vec); @@ -113,7 +113,7 @@ CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, f static void node_composit_exec_transform(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { - if(in[0]->data) { + if (in[0]->data) { CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); CompBuf *stackbuf; @@ -122,7 +122,7 @@ static void node_composit_exec_transform(void *UNUSED(data), bNode *node, bNodeS /* pass on output and free */ out[0]->data= stackbuf; - if(cbuf!=in[0]->data) + if (cbuf!=in[0]->data) free_compbuf(cbuf); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c index 073b035add0..970e2c79f14 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.c +++ b/source/blender/nodes/composite/nodes/node_composite_translate.c @@ -48,7 +48,7 @@ static bNodeSocketTemplate cmp_node_translate_out[]= { static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { - if(in[0]->data) { + if (in[0]->data) { CompBuf *cbuf= in[0]->data; CompBuf *stackbuf= pass_on_compbuf(cbuf); diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c index 30f624641d1..86986f6038d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c @@ -54,12 +54,12 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt /* stack order in: fac */ /* stack order out: col, alpha */ - if(out[0]->hasoutput==0 && out[1]->hasoutput==0) + if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return; - if(node->storage) { + if (node->storage) { /* input no image? then only color operation */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { do_colorband(node->storage, in[0]->vec[0], out[0]->vec); } else { @@ -71,7 +71,7 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt out[0]->data= stackbuf; - if(out[1]->hasoutput) + if (out[1]->hasoutput) out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A); } @@ -119,11 +119,11 @@ static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeSta /* stack order out: bw */ /* stack order in: col */ - if(out[0]->hasoutput==0) + if (out[0]->hasoutput==0) return; /* input no image? then only color operation */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { do_rgbtobw(node, out[0]->vec, in[0]->vec); } else { diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c index 69f896e9bb5..1d4662aa87b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c @@ -52,21 +52,21 @@ static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeSta NodeBlurData *nbd= node->storage; CompBuf *new, *img= in[0]->data, *vecbuf= in[2]->data, *zbuf= in[1]->data; - if(img==NULL || vecbuf==NULL || zbuf==NULL || out[0]->hasoutput==0) + if (img==NULL || vecbuf==NULL || zbuf==NULL || out[0]->hasoutput==0) return; - if(vecbuf->x!=img->x || vecbuf->y!=img->y) { + if (vecbuf->x!=img->x || vecbuf->y!=img->y) { printf("ERROR: cannot do different sized vecbuf yet\n"); return; } - if(vecbuf->type!=CB_VEC4) { + if (vecbuf->type!=CB_VEC4) { printf("ERROR: input should be vecbuf\n"); return; } - if(zbuf->type!=CB_VAL) { + if (zbuf->type!=CB_VAL) { printf("ERROR: input should be zbuf\n"); return; } - if(zbuf->x!=img->x || zbuf->y!=img->y) { + if (zbuf->x!=img->x || zbuf->y!=img->y) { printf("ERROR: cannot do different sized zbuf yet\n"); return; } @@ -81,7 +81,7 @@ static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeSta out[0]->data= new; - if(img!=in[0]->data) + if (img!=in[0]->data) free_compbuf(img); } diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c index f1a6cae62ab..f9b1e55f29f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c @@ -47,7 +47,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, /* image assigned to output */ /* stack order input sockets: col, alpha, z */ - if(node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */ + if (node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */ RenderData *rd= data; Image *ima= (Image *)node->id; ImBuf *ibuf; @@ -59,7 +59,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, /* always returns for viewer image, but we check nevertheless */ ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock); - if(ibuf==NULL) { + if (ibuf==NULL) { printf("node_composit_exec_viewer error\n"); BKE_image_release_ibuf(ima, lock); return; @@ -72,7 +72,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, /* get size */ tbuf= in[0]->data?in[0]->data:(in[1]->data?in[1]->data:in[2]->data); - if(tbuf==NULL) { + if (tbuf==NULL) { rectx= 320; recty= 256; } else { @@ -92,14 +92,14 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, cbuf->rect= ibuf->rect_float; /* when no alpha, we can simply copy */ - if(in[1]->data==NULL) { + if (in[1]->data==NULL) { composit1_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA); } else composit2_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba, CB_RGBA, CB_VAL); /* zbuf option */ - if(in[2]->data) { + if (in[2]->data) { CompBuf *zbuf= alloc_compbuf(rectx, recty, CB_VAL, 1); ibuf->zbuf_float= zbuf->rect; ibuf->mall |= IB_zbuffloat; @@ -117,7 +117,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, free_compbuf(cbuf); } - else if(in[0]->data) { + else if (in[0]->data) { generate_preview(data, node, in[0]->data); } } diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c index 57b0b7bbf14..64342751e84 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c @@ -53,7 +53,7 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float * float alpha; float malpha; - if(*z1 <= *z2) { + if (*z1 <= *z2) { if (node->custom1) { // use alpha in combine operation alpha= src1[3]; @@ -83,16 +83,16 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float * copy_v4_v4(out, src1); } - if(node->custom2) + if (node->custom2) *z1= *z2; } } static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2) { - if(*z1 > *z2) { + if (*z1 > *z2) { *out= 1.0f; - if(node->custom2) + if (node->custom2) *z1= *z2; } } @@ -145,24 +145,24 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in /* stack order in: col z col z */ /* stack order out: col z */ - if(out[0]->hasoutput==0 && out[1]->hasoutput==0) + if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return; /* no input image; do nothing now */ - if(in[0]->data==NULL) { + if (in[0]->data==NULL) { return; } - if(out[1]->hasoutput) { + if (out[1]->hasoutput) { /* copy or make a buffer for for the first z value, here we write result in */ - if(in[1]->data) + if (in[1]->data) zbuf= dupalloc_compbuf(in[1]->data); else { float *zval; int tot= cbuf->x*cbuf->y; zbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); - for(zval= zbuf->rect; tot; tot--, zval++) + for (zval= zbuf->rect; tot; tot--, zval++) *zval= in[1]->vec[0]; } /* lazy coder hack */ @@ -174,7 +174,7 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in zbuf= in[1]->data; } - if(rd->scemode & R_FULL_SAMPLE) { + if (rd->scemode & R_FULL_SAMPLE) { /* make output size of first input image */ CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); // allocs @@ -199,16 +199,16 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in /* convert to char */ aabuf= MEM_mallocN(cbuf->x*cbuf->y, "aa buf"); fp= mbuf->rect; - for(x= cbuf->x*cbuf->y-1; x>=0; x--) - if(fp[x]==0.0f) aabuf[x]= 0; + for (x= cbuf->x*cbuf->y-1; x>=0; x--) + if (fp[x]==0.0f) aabuf[x]= 0; else aabuf[x]= 255; antialias_tagbuf(cbuf->x, cbuf->y, aabuf); /* convert to float */ fp= mbuf->rect; - for(x= cbuf->x*cbuf->y-1; x>=0; x--) - if(aabuf[x]>1) + for (x= cbuf->x*cbuf->y-1; x>=0; x--) + if (aabuf[x]>1) fp[x]= (1.0f/255.0f)*(float)aabuf[x]; composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[2]->data, in[2]->vec, mbuf, NULL, diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index c039365ec69..d2ec5ee032b 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -105,7 +105,7 @@ bNodeSocket *node_group_add_extern_socket(bNodeTree *UNUSED(ntree), ListBase *lb sock->default_value = node_socket_make_default_value(sock->type); node_socket_copy_default_value(sock->type, sock->default_value, gsock->default_value); - if(lb) + if (lb) BLI_addtail(lb, sock); return sock; @@ -125,42 +125,42 @@ bNode *node_group_make_from_selected(bNodeTree *ntree) INIT_MINMAX2(min, max); /* is there something to group? also do some clearing */ - for(node= ntree->nodes.first; node; node= node->next) { - if(node->flag & NODE_SELECT) { + for (node= ntree->nodes.first; node; node= node->next) { + if (node->flag & NODE_SELECT) { /* no groups in groups */ - if(node->type==NODE_GROUP) + if (node->type==NODE_GROUP) return NULL; DO_MINMAX2( (&node->locx), min, max); totnode++; } node->done= 0; } - if(totnode==0) return NULL; + if (totnode==0) return NULL; /* check if all connections are OK, no unselected node has both inputs and outputs to a selection */ - for(link= ntree->links.first; link; link= link->next) { - if(link->fromnode && link->tonode && link->fromnode->flag & NODE_SELECT) + for (link= ntree->links.first; link; link= link->next) { + if (link->fromnode && link->tonode && link->fromnode->flag & NODE_SELECT) link->tonode->done |= 1; - if(link->fromnode && link->tonode && link->tonode->flag & NODE_SELECT) + if (link->fromnode && link->tonode && link->tonode->flag & NODE_SELECT) link->fromnode->done |= 2; } - for(node= ntree->nodes.first; node; node= node->next) { - if((node->flag & NODE_SELECT)==0) - if(node->done==3) + for (node= ntree->nodes.first; node; node= node->next) { + if ((node->flag & NODE_SELECT)==0) + if (node->done==3) break; } - if(node) + if (node) return NULL; /* OK! new nodetree */ ngroup= ntreeAddTree("NodeGroup", ntree->type, NODE_GROUP); /* move nodes over */ - for(node= ntree->nodes.first; node; node= nextn) { + for (node= ntree->nodes.first; node; node= nextn) { nextn= node->next; - if(node->flag & NODE_SELECT) { + if (node->flag & NODE_SELECT) { /* keep track of this node's RNA "base" path (the part of the pat identifying the node) * if the old nodetree has animation data which potentially covers this node */ @@ -210,20 +210,20 @@ bNode *node_group_make_from_selected(bNodeTree *ntree) gnode->locy= 0.5f*(min[1]+max[1]); /* relink external sockets */ - for(link= ntree->links.first; link; link= linkn) { + for (link= ntree->links.first; link; link= linkn) { linkn= link->next; - if(link->fromnode && link->tonode && (link->fromnode->flag & link->tonode->flag & NODE_SELECT)) { + if (link->fromnode && link->tonode && (link->fromnode->flag & link->tonode->flag & NODE_SELECT)) { BLI_remlink(&ntree->links, link); BLI_addtail(&ngroup->links, link); } - else if(link->tonode && (link->tonode->flag & NODE_SELECT)) { + else if (link->tonode && (link->tonode->flag & NODE_SELECT)) { gsock = node_group_expose_socket(ngroup, link->tosock, SOCK_IN); link->tosock->link = nodeAddLink(ngroup, NULL, gsock, link->tonode, link->tosock); link->tosock = node_group_add_extern_socket(ntree, &gnode->inputs, SOCK_IN, gsock); link->tonode = gnode; } - else if(link->fromnode && (link->fromnode->flag & NODE_SELECT)) { + else if (link->fromnode && (link->fromnode->flag & NODE_SELECT)) { /* search for existing group node socket */ for (gsock=ngroup->outputs.first; gsock; gsock=gsock->next) if (gsock->link && gsock->link->fromsock==link->fromsock) @@ -258,10 +258,10 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) ListBase anim_basepaths = {NULL, NULL}; ngroup= (bNodeTree *)gnode->id; - if(ngroup==NULL) return 0; + if (ngroup==NULL) return 0; /* clear new pointers, set in copytree */ - for(node= ntree->nodes.first; node; node= node->next) + for (node= ntree->nodes.first; node; node= node->next) node->new_node= NULL; /* wgroup is a temporary copy of the NodeTree we're merging in @@ -271,7 +271,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) wgroup= ntreeCopyTree(ngroup); /* add the nodes into the ntree */ - for(node= wgroup->nodes.first; node; node= nextn) { + for (node= wgroup->nodes.first; node; node= nextn) { nextn= node->next; /* keep track of this node's RNA "base" path (the part of the pat identifying the node) @@ -299,7 +299,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) } /* restore external links to and from the gnode */ - for(link= ntree->links.first; link; link= link->next) { + for (link= ntree->links.first; link; link= link->next) { if (link->fromnode==gnode) { if (link->fromsock->groupsock) { bNodeSocket *gsock= link->fromsock->groupsock; @@ -326,13 +326,13 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) } } /* remove internal output links, these are not used anymore */ - for(link=wgroup->links.first; link; link= linkn) { + for (link=wgroup->links.first; link; link= linkn) { linkn = link->next; if (!link->tonode) nodeRemLink(wgroup, link); } /* restore links from internal nodes */ - for(link= wgroup->links.first; link; link= link->next) { + for (link= wgroup->links.first; link; link= link->next) { /* indicates link to group input */ if (!link->fromnode) { /* NB: can't use find_group_node_input here, @@ -355,7 +355,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) } /* add internal links to the ntree */ - for(link= wgroup->links.first; link; link= linkn) { + for (link= wgroup->links.first; link; link= linkn) { linkn= link->next; BLI_remlink(&wgroup->links, link); BLI_addtail(&ntree->links, link); @@ -543,11 +543,11 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o if (gsock->flag & SOCK_INTERNAL) return NULL; - for(sock= lb->first; sock; sock= sock->next) { - if(sock->own_index==gsock->own_index) + for (sock= lb->first; sock; sock= sock->next) { + if (sock->own_index==gsock->own_index) break; } - if(sock) { + if (sock) { sock->groupsock = gsock; BLI_strncpy(sock->name, gsock->name, sizeof(sock->name)); @@ -615,7 +615,7 @@ struct bNodeTree *node_group_edit_set(bNode *node, int edit) if (edit) { bNodeTree *ngroup= (bNodeTree*)node->id; if (ngroup) { - if(ngroup->id.lib) + if (ngroup->id.lib) ntreeMakeLocal(ngroup); node->flag |= NODE_GROUP_EDIT; diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index eaf19ad71b6..3b757e753a4 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -55,13 +55,13 @@ void node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack /* build pointer stack */ if (in) { - for(sock= node->inputs.first; sock; sock= sock->next) { + for (sock= node->inputs.first; sock; sock= sock->next) { *(in++) = node_get_socket_stack(stack, sock); } } if (out) { - for(sock= node->outputs.first; sock; sock= sock->next) { + for (sock= node->outputs.first; sock; sock= sock->next) { *(out++) = node_get_socket_stack(stack, sock); } } @@ -135,7 +135,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) bNode **nodelist; int totnodes, n; - if((ntree->init & NTREE_TYPE_INIT)==0) + if ((ntree->init & NTREE_TYPE_INIT)==0) ntreeInitTypes(ntree); /* get a dependency-sorted list of nodes */ @@ -147,10 +147,10 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) exec->nodetree = ntree; /* group inputs essentially work as outputs */ - for(gsock=ntree->inputs.first; gsock; gsock = gsock->next) + for (gsock=ntree->inputs.first; gsock; gsock = gsock->next) node_init_output_index(gsock, &index); /* set stack indexes */ - for(n=0; n < totnodes; ++n) { + for (n=0; n < totnodes; ++n) { node = nodelist[n]; node->stack_index = index; @@ -162,7 +162,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) node_init_output_index(sock, &index); } /* group outputs essentially work as inputs */ - for(gsock=ntree->outputs.first; gsock; gsock = gsock->next) + for (gsock=ntree->outputs.first; gsock; gsock = gsock->next) node_init_input_index(gsock, &index); /* allocated exec data pointers for nodes */ @@ -181,13 +181,13 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) /* ns = */ setup_stack(exec->stack, sock); } /* prepare all internal nodes for execution */ - for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) { + for (n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) { node = nodeexec->node = nodelist[n]; /* tag inputs */ for (sock=node->inputs.first; sock; sock=sock->next) { /* disable the node if an input link is invalid */ - if(sock->link && !(sock->link->flag & NODE_LINK_VALID)) + if (sock->link && !(sock->link->flag & NODE_LINK_VALID)) node->need_exec= 0; ns = setup_stack(exec->stack, sock); @@ -199,7 +199,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) /* ns = */ setup_stack(exec->stack, sock); } - if(node->typeinfo->initexecfunc) + if (node->typeinfo->initexecfunc) nodeexec->data = node->typeinfo->initexecfunc(node); } /* prepare group tree outputs */ @@ -222,7 +222,7 @@ void ntree_exec_end(bNodeTreeExec *exec) if (exec->stack) MEM_freeN(exec->stack); - for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { + for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { if (nodeexec->node->typeinfo->freeexecfunc) nodeexec->node->typeinfo->freeexecfunc(nodeexec->node, nodeexec->data); } @@ -240,8 +240,8 @@ bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread) ListBase *lb= &exec->threadstack[thread]; bNodeThreadStack *nts; - for(nts=lb->first; nts; nts=nts->next) { - if(!nts->used) { + for (nts=lb->first; nts; nts=nts->next) { + if (!nts->used) { nts->used= 1; break; } @@ -272,15 +272,15 @@ void ntreeExecNodes(bNodeTreeExec *exec, void *callerdata, int thread) /* nodes are presorted, so exec is in order of list */ - 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; - if(node->need_exec) { + if (node->need_exec) { node_get_stack(node, exec->stack, nsin, nsout); /* Handle muted nodes... * If the mute func is not set, assume the node should never be muted, * and hence execute it! */ - if(node->typeinfo->execfunc) + if (node->typeinfo->execfunc) node->typeinfo->execfunc(callerdata, node, nsin, nsout); else if (node->typeinfo->newexecfunc) node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout); @@ -298,15 +298,15 @@ void ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *call /* nodes are presorted, so exec is in order of list */ - 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; - if(node->need_exec) { + if (node->need_exec) { node_get_stack(node, nts->stack, nsin, nsout); /* Handle muted nodes... * If the mute func is not set, assume the node should never be muted, * and hence execute it! */ - if(node->typeinfo->execfunc) + if (node->typeinfo->execfunc) node->typeinfo->execfunc(callerdata, node, nsin, nsout); else if (node->typeinfo->newexecfunc) node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout); diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index f03aff8fb92..4e6cf1f9bdd 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -485,13 +485,13 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in { bNodeSocket *sock; - for(sock= socklist->first; sock; sock= sock->next) { - if(!(sock->flag & SOCK_DYNAMIC) && strncmp(sock->name, stemp->name, NODE_MAXSTR)==0) + for (sock= socklist->first; sock; sock= sock->next) { + if (!(sock->flag & SOCK_DYNAMIC) && strncmp(sock->name, stemp->name, NODE_MAXSTR)==0) break; } - if(sock) { + if (sock) { sock->type= stemp->type; /* in future, read this from tydefs! */ - if(stemp->limit==0) sock->limit= 0xFFF; + if (stemp->limit==0) sock->limit= 0xFFF; else sock->limit= stemp->limit; sock->flag |= stemp->flag; @@ -550,7 +550,7 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou bNodeSocketTemplate *stemp; /* no inputs anymore? */ - if(stemp_first==NULL) { + if (stemp_first==NULL) { for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) { nextsock = sock->next; if (!(sock->flag & SOCK_DYNAMIC)) @@ -560,7 +560,7 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou else { /* step by step compare */ stemp= stemp_first; - while(stemp->type != -1) { + while (stemp->type != -1) { stemp->sock= verify_socket_template(ntree, node, in_out, socklist, stemp); stemp++; } @@ -578,14 +578,14 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou * so we can add static sockets infront of it. */ sock = socklist->first; - while(stemp->type != -1) { + while (stemp->type != -1) { /* put static sockets infront of dynamic */ BLI_insertlinkbefore(socklist, sock, stemp->sock); stemp++; } } else { - while(stemp->type != -1) { + while (stemp->type != -1) { BLI_addtail(socklist, stemp->sock); stemp++; } @@ -600,7 +600,7 @@ void node_verify_socket_templates(bNodeTree *ntree, bNode *node) * This also prevents group node sockets from being removed, without the need to explicitly * check the node type here. */ - if(ntype && ((ntype->inputs && ntype->inputs[0].type>=0) || (ntype->outputs && ntype->outputs[0].type>=0))) { + if (ntype && ((ntype->inputs && ntype->inputs[0].type>=0) || (ntype->outputs && ntype->outputs[0].type>=0))) { verify_socket_template_list(ntree, node, SOCK_IN, &node->inputs, ntype->inputs); verify_socket_template_list(ntree, node, SOCK_OUT, &node->outputs, ntype->outputs); } diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c index 5967f3c2046..1c38bdf39d7 100644 --- a/source/blender/nodes/intern/node_util.c +++ b/source/blender/nodes/intern/node_util.c @@ -110,7 +110,7 @@ ListBase node_internal_connect_default(bNodeTree *ntree, bNode *node) ret.first = ret.last = NULL; /* Security check! */ - if(!ntree) + if (!ntree) return ret; for (datatype=0; datatype < NUM_SOCKET_TYPES; ++datatype) { diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index e12ac4dee49..c028ca83664 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -65,16 +65,16 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func) Lamp *la; World *wo; - for(ma= main->mat.first; ma; ma= ma->id.next) - if(ma->nodetree) + for (ma= main->mat.first; ma; ma= ma->id.next) + if (ma->nodetree) func(calldata, &ma->id, ma->nodetree); - for(la= main->lamp.first; la; la= la->id.next) - if(la->nodetree) + for (la= main->lamp.first; la; la= la->id.next) + if (la->nodetree) func(calldata, &la->id, la->nodetree); - for(wo= main->world.first; wo; wo= wo->id.next) - if(wo->nodetree) + for (wo= main->world.first; wo; wo= wo->id.next) + if (wo->nodetree) func(calldata, &wo->id, wo->nodetree); } @@ -83,7 +83,7 @@ static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback f func(calldata, NODE_CLASS_INPUT, IFACE_("Input")); func(calldata, NODE_CLASS_OUTPUT, IFACE_("Output")); - if(scene_use_new_shading_nodes(scene)) { + if (scene_use_new_shading_nodes(scene)) { func(calldata, NODE_CLASS_SHADER, IFACE_("Shader")); func(calldata, NODE_CLASS_TEXTURE, IFACE_("Texture")); } @@ -115,12 +115,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); @@ -202,7 +202,7 @@ bNodeTreeExec *ntreeShaderBeginExecTree(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) { @@ -220,14 +220,14 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree, int use_tree_data) */ void ntreeShaderEndExecTree(bNodeTreeExec *exec, int use_tree_data) { - if(exec) { + if (exec) { bNodeTree *ntree= exec->nodetree; bNodeThreadStack *nts; int a; - if(exec->threadstack) { - for(a=0; a<BLENDER_MAX_THREADS; a++) { - for(nts=exec->threadstack[a].first; nts; nts=nts->next) + if (exec->threadstack) { + 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]); } @@ -266,7 +266,7 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr) /* ensure execdata is only initialized once */ if (!exec) { BLI_lock_thread(LOCK_NODES); - if(!ntree->execdata) + if (!ntree->execdata) ntree->execdata = ntreeShaderBeginExecTree(ntree, 1); BLI_unlock_thread(LOCK_NODES); @@ -280,7 +280,7 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr) // \note: set material back to preserved material shi->mat = mat; /* better not allow negative for now */ - if(shr->combined[0]<0.0f) shr->combined[0]= 0.0f; - if(shr->combined[1]<0.0f) shr->combined[1]= 0.0f; - if(shr->combined[2]<0.0f) shr->combined[2]= 0.0f; + if (shr->combined[0]<0.0f) shr->combined[0]= 0.0f; + if (shr->combined[1]<0.0f) shr->combined[1]= 0.0f; + if (shr->combined[2]<0.0f) shr->combined[2]= 0.0f; } 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); 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])); 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); |