Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-24 10:38:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-24 10:38:07 +0400
commitab4a2aaf4a4b2b4e416aa1f113b30362cbe0dec3 (patch)
tree81af4c18519181490074508dbe9a8d515eab634f /source/blender/nodes/composite
parent5a90ea77bc1333efe4e1e54984a080550ed3f707 (diff)
style cleanup: follow style guide for formatting of if/for/while loops, and else if's
Diffstat (limited to 'source/blender/nodes/composite')
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c302
-rw-r--r--source/blender/nodes/composite/node_composite_util.c242
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bilateralblur.c36
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.c155
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_brightness.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chromaMatte.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorMatte.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorSpill.c38
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorbalance.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_crop.c18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_curves.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_dilate.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_directionalblur.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_displace.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distanceMatte.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.c46
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_flip.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_gamma.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_glare.c3
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_hueSatVal.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_huecorrect.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_idMask.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c168
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_invert.c19
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.c46
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lummaMatte.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapUV.c24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapValue.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.c32
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mixrgb.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_movieclip.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.c21
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normal.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normalize.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_premulkey.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rotate.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.c17
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_setalpha.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_splitViewer.c24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_stabilize2d.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_texture.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_tonemap.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_transform.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_translate.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_valToRgb.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_vecBlur.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_viewer.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_zcombine.c28
59 files changed, 846 insertions, 828 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,