style cleanup: nodes
authorCampbell Barton <ideasman42@gmail.com>
Mon, 27 May 2013 08:04:07 +0000 (08:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 27 May 2013 08:04:07 +0000 (08:04 +0000)
source/blender/editors/sculpt_paint/paint_mask.c
source/blender/imbuf/intern/cineon/cineon_dpx.c
source/blender/nodes/composite/node_composite_tree.c
source/blender/nodes/composite/node_composite_util.c
source/blender/nodes/intern/node_common.c
source/blender/nodes/intern/node_exec.c
source/blender/nodes/intern/node_socket.c
source/blender/nodes/intern/node_util.c
source/blender/nodes/shader/node_shader_tree.c
source/blender/nodes/texture/node_texture_tree.c
source/blender/nodes/texture/node_texture_util.c

index e0b3905b30f17941fd6731783dca731b861df93e..d42a7778a58ef0d297fffc590c39815f2420f286 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
index 255af7dc039393f58a705b15a7c506dbc0e1bf86..56ce46bf92e8e95fc9fe91e1d40b7dba01c32d8d 100644 (file)
@@ -26,7 +26,6 @@
  * cineon.c
  * contributors: joeedh, Julien Enche
  * I hearby donate this code and all rights to the Blender Foundation.
- * $Id$
  */
 
 /** \file blender/imbuf/intern/cineon/cineon_dpx.c
index 841dde3302b0d739d6d70db80762bbaaeb259b57..401b0144fcd3d87223dd7b83dd6800f3ea66d8a9 100644 (file)
@@ -97,9 +97,9 @@ static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node)
 {
        bNodeSocket *sock;
        
-       for (sock= node->outputs.first; sock; sock= sock->next) {
+       for (sock = node->outputs.first; sock; sock = sock->next) {
                if (sock->cache) {
-                       sock->cache= NULL;
+                       sock->cache = NULL;
                }
        }
 }
@@ -119,7 +119,7 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
        
        for (node = ntree->nodes.first; node; node = node->next) {
                /* ensure new user input gets handled ok */
-               node->need_exec= 0;
+               node->need_exec = 0;
                node->new_node->original = node;
                
                /* move over the compbufs */
@@ -128,16 +128,16 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
                if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
                        if (node->id) {
                                if (node->flag & NODE_DO_OUTPUT)
-                                       node->new_node->id= (ID *)node->id;
+                                       node->new_node->id = (ID *)node->id;
                                else
-                                       node->new_node->id= NULL;
+                                       node->new_node->id = NULL;
                        }
                }
                
-               for (sock= node->outputs.first; sock; sock= sock->next) {
-                       sock->new_sock->cache= sock->cache;
-                       sock->cache= NULL;
-                       sock->new_sock->new_sock= sock;
+               for (sock = node->outputs.first; sock; sock = sock->next) {
+                       sock->new_sock->cache = sock->cache;
+                       sock->cache = NULL;
+                       sock->new_sock->new_sock = sock;
                }
        }
        
@@ -151,8 +151,8 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
                         */
                        if (node->need_exec) {
                                bNodeLink *link;
-                               for (link=localtree->links.first; link; link=link->next)
-                                       if (link->fromnode==node && link->tonode)
+                               for (link = localtree->links.first; link; link = link->next)
+                                       if (link->fromnode == node && link->tonode)
                                                link->tonode->need_exec = 1;
                        }
                        
@@ -175,7 +175,7 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
        /* move over the compbufs and previews */
        BKE_node_preview_merge_tree(ntree, localtree, true);
        
-       for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+       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)) {
@@ -183,7 +183,7 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
                                        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 achieve much better performance on further calls this context should be
                                 * copied back to original node */
@@ -191,15 +191,15 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
                                        if (lnode->new_node->storage)
                                                BKE_tracking_distortion_free(lnode->new_node->storage);
 
-                                       lnode->new_node->storage= BKE_tracking_distortion_copy(lnode->storage);
+                                       lnode->new_node->storage = BKE_tracking_distortion_copy(lnode->storage);
                                }
                        }
                        
-                       for (lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
+                       for (lsock = lnode->outputs.first; lsock; lsock = lsock->next) {
                                if (ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
-                                       lsock->new_sock->cache= lsock->cache;
-                                       lsock->cache= NULL;
-                                       lsock->new_sock= NULL;
+                                       lsock->new_sock->cache = lsock->cache;
+                                       lsock->cache = NULL;
+                                       lsock->new_sock = NULL;
                                }
                        }
                }
@@ -227,7 +227,7 @@ void register_node_tree_type_cmp(void)
        tt->type = NTREE_COMPOSIT;
        strcpy(tt->idname, "CompositorNodeTree");
        strcpy(tt->ui_name, "Compositing");
-       tt->ui_icon = 0;        /* defined in drawnode.c */
+       tt->ui_icon = 0;    /* defined in drawnode.c */
        strcpy(tt->ui_description, "");
        
        tt->free_cache = free_cache;
@@ -277,7 +277,7 @@ 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;
        
        set_output_visible(node, passflag, RRES_OUT_IMAGE,            SCE_PASS_COMBINED);
index 02a5f410d836c945569465466fffdb70b9441811..8e279cf6d68e8718666b7574897bc1856e2bac4f 100644 (file)
 
 int cmp_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
 {
-       return (strcmp(ntree->idname, "CompositorNodeTree")==0);
+       return STREQ(ntree->idname, "CompositorNodeTree");
 }
 
 void cmp_node_update_default(bNodeTree *UNUSED(ntree), bNode *node)
 {
        bNodeSocket *sock;
-       for (sock= node->outputs.first; sock; sock= sock->next) {
+       for (sock = node->outputs.first; sock; sock = sock->next) {
                if (sock->cache) {
                        //free_compbuf(sock->cache);
                        //sock->cache= NULL;
                }
        }
-       node->need_exec= 1;
+       node->need_exec = 1;
 }
 
 void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
index 24f35cc81af22bc88ea384d7ce6083dc7b72b415..e763c4bbeb703826088490568158f464097847e8 100644 (file)
@@ -66,7 +66,7 @@
 bNodeSocket *node_group_find_input_socket(bNode *groupnode, const char *identifier)
 {
        bNodeSocket *sock;
-       for (sock=groupnode->inputs.first; sock; sock = sock->next)
+       for (sock = groupnode->inputs.first; sock; sock = sock->next)
                if (STREQ(sock->identifier, identifier))
                        return sock;
        return NULL;
@@ -75,7 +75,7 @@ bNodeSocket *node_group_find_input_socket(bNode *groupnode, const char *identifi
 bNodeSocket *node_group_find_output_socket(bNode *groupnode, const char *identifier)
 {
        bNodeSocket *sock;
-       for (sock=groupnode->outputs.first; sock; sock = sock->next)
+       for (sock = groupnode->outputs.first; sock; sock = sock->next)
                if (STREQ(sock->identifier, identifier))
                        return sock;
        return NULL;
@@ -90,11 +90,11 @@ const char *node_group_label(bNode *node)
 int node_group_poll_instance(bNode *node, bNodeTree *nodetree)
 {
        if (node->typeinfo->poll(node->typeinfo, nodetree)) {
-               bNodeTree *grouptree = (bNodeTree*)node->id;
+               bNodeTree *grouptree = (bNodeTree *)node->id;
                if (grouptree)
                        return nodeGroupPoll(nodetree, grouptree);
                else
-                       return TRUE;    /* without a linked node tree, group node is always ok */
+                       return TRUE;    /* without a linked node tree, group node is always ok */
        }
        else
                return FALSE;
@@ -108,7 +108,7 @@ int nodeGroupPoll(bNodeTree *nodetree, bNodeTree *grouptree)
        if (nodetree == grouptree)
                return 0;
        
-       for (node=grouptree->nodes.first; node; node=node->next) {
+       for (node = grouptree->nodes.first; node; node = node->next) {
                if (node->typeinfo->poll_instance && !node->typeinfo->poll_instance(node, nodetree)) {
                        valid = 0;
                        break;
@@ -122,7 +122,7 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, bNode *gnode, bNodeSoc
 {
        bNodeSocket *sock;
        
-       for (sock= verify_lb->first; sock; sock= sock->next) {
+       for (sock = verify_lb->first; sock; sock = sock->next) {
                if (STREQ(sock->identifier, iosock->identifier))
                        break;
        }
@@ -178,7 +178,7 @@ void node_group_verify(struct bNodeTree *ntree, struct bNode *node, struct ID *i
 {
        /* check inputs and outputs, and remove or insert them */
        if (id == node->id) {
-               bNodeTree *ngroup= (bNodeTree *)node->id;
+               bNodeTree *ngroup = (bNodeTree *)node->id;
                group_verify_socket_list(ntree, node, &ngroup->inputs, &node->inputs, SOCK_IN);
                group_verify_socket_list(ntree, node, &ngroup->outputs, &node->outputs, SOCK_OUT);
        }
@@ -199,13 +199,13 @@ static void node_frame_init(bNodeTree *UNUSED(ntree), bNode *node)
 void register_node_type_frame(void)
 {
        /* frame type is used for all tree types, needs dynamic allocation */
-       bNodeType *ntype= MEM_callocN(sizeof(bNodeType), "frame node type");
+       bNodeType *ntype = MEM_callocN(sizeof(bNodeType), "frame node type");
 
-       node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT, NODE_BACKGROUND|NODE_OPTIONS);
+       node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT, NODE_BACKGROUND | NODE_OPTIONS);
        node_type_init(ntype, node_frame_init);
        node_type_storage(ntype, "NodeFrame", node_free_standard_storage, node_copy_standard_storage);
        node_type_size(ntype, 150, 100, 0);
-       node_type_compatibility(ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
+       node_type_compatibility(ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
        
        ntype->needs_free = 1;
        nodeRegisterType(ntype);
@@ -245,7 +245,7 @@ static void node_reroute_init(bNodeTree *ntree, bNode *node)
 void register_node_type_reroute(void)
 {
        /* frame type is used for all tree types, needs dynamic allocation */
-       bNodeType *ntype= MEM_callocN(sizeof(bNodeType), "frame node type");
+       bNodeType *ntype = MEM_callocN(sizeof(bNodeType), "frame node type");
        
        node_type_base(ntype, NODE_REROUTE, "Reroute", NODE_CLASS_LAYOUT, 0);
        node_type_init(ntype, node_reroute_init);
@@ -287,9 +287,9 @@ static void node_reroute_inherit_type_recursive(bNodeTree *ntree, bNode *node)
        }
        
        /* determine socket type from unambiguous input/output connection if possible */
-       if (input->limit==1 && input->link)
+       if (input->limit == 1 && input->link)
                type = input->link->fromsock->type;
-       else if (output->limit==1 && output->link)
+       else if (output->limit == 1 && output->link)
                type = output->link->tosock->type;
        
        /* arbitrary, could also test output->type, both are the same */
@@ -408,13 +408,13 @@ static void node_group_input_update(bNodeTree *ntree, bNode *node)
 void register_node_type_group_input(void)
 {
        /* used for all tree types, needs dynamic allocation */
-       bNodeType *ntype= MEM_callocN(sizeof(bNodeType), "node type");
+       bNodeType *ntype = MEM_callocN(sizeof(bNodeType), "node type");
        
        node_type_base(ntype, NODE_GROUP_INPUT, "Group Input", NODE_CLASS_INTERFACE, NODE_OPTIONS);
        node_type_size(ntype, 140, 80, 200);
        node_type_init(ntype, node_group_input_init);
        node_type_update(ntype, node_group_input_update, node_group_input_verify);
-       node_type_compatibility(ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
+       node_type_compatibility(ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
        
        ntype->needs_free = 1;
        nodeRegisterType(ntype);
@@ -495,13 +495,13 @@ static void node_group_output_update(bNodeTree *ntree, bNode *node)
 void register_node_type_group_output(void)
 {
        /* used for all tree types, needs dynamic allocation */
-       bNodeType *ntype= MEM_callocN(sizeof(bNodeType), "node type");
+       bNodeType *ntype = MEM_callocN(sizeof(bNodeType), "node type");
        
        node_type_base(ntype, NODE_GROUP_OUTPUT, "Group Output", NODE_CLASS_INTERFACE, NODE_OPTIONS);
        node_type_size(ntype, 140, 80, 200);
        node_type_init(ntype, node_group_output_init);
        node_type_update(ntype, node_group_output_update, node_group_output_verify);
-       node_type_compatibility(ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
+       node_type_compatibility(ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
        
        ntype->needs_free = 1;
        nodeRegisterType(ntype);
index de81ea61baa1c5821ee43b4bf157b5701a5fa087..d18dddd4ff4220420172c59435bde3702d2dbf85 100644 (file)
@@ -65,13 +65,13 @@ void node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack
        
        /* build pointer stack */
        if (in) {
-               for (sock= node->inputs.first; sock; sock= sock->next) {
+               for (sock = node->inputs.first; sock; sock = sock->next) {
                        *(in++) = node_get_socket_stack(stack, sock);
                }
        }
        
        if (out) {
-               for (sock= node->outputs.first; sock; sock= sock->next) {
+               for (sock = node->outputs.first; sock; sock = sock->next) {
                        *(out++) = node_get_socket_stack(stack, sock);
                }
        }
@@ -170,7 +170,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context, bNodeTree *ntree, bNo
        
        /* set stack indices */
        index = 0;
-       for (n=0; n < totnodes; ++n) {
+       for (n = 0; n < totnodes; ++n) {
                node = nodelist[n];
                
                node->stack_index = index;
@@ -197,18 +197,18 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context, bNodeTree *ntree, bNo
        exec->stack = MEM_callocN(exec->stacksize * sizeof(bNodeStack), "bNodeStack");
        
        /* all non-const results are considered inputs */
-       for (n=0; n < exec->stacksize; ++n)
+       for (n = 0; n < exec->stacksize; ++n)
                exec->stack[n].hasinput = 1;
        
        /* prepare all nodes for execution */
-       for (n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
+       for (n = 0, nodeexec = exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
                node = nodeexec->node = nodelist[n];
                
                /* tag inputs */
                for (sock = node->inputs.first; sock; sock = sock->next) {
                        /* disable the node if an input link is invalid */
                        if (sock->link && !(sock->link->flag & NODE_LINK_VALID))
-                               node->need_exec= 0;
+                               node->need_exec = 0;
                        
                        ns = setup_stack(exec->stack, ntree, node, sock);
                        if (ns)
@@ -240,7 +240,7 @@ void ntree_exec_end(bNodeTreeExec *exec)
        if (exec->stack)
                MEM_freeN(exec->stack);
        
-       for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+       for (n = 0, nodeexec = exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
                if (nodeexec->node->typeinfo)
                        if (nodeexec->node->typeinfo->freeexecfunc)
                                nodeexec->node->typeinfo->freeexecfunc(nodeexec->node, nodeexec->data.data);
@@ -256,10 +256,10 @@ void ntree_exec_end(bNodeTreeExec *exec)
 
 bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread)
 {
-       ListBase *lb= &exec->threadstack[thread];
+       ListBase *lb = &exec->threadstack[thread];
        bNodeThreadStack *nts;
        
-       for (nts=lb->first; nts; nts=nts->next) {
+       for (nts = lb->first; nts; nts = nts->next) {
                if (!nts->used) {
                        nts->used = TRUE;
                        break;
@@ -267,8 +267,8 @@ bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread)
        }
        
        if (!nts) {
-               nts= MEM_callocN(sizeof(bNodeThreadStack), "bNodeThreadStack");
-               nts->stack= MEM_dupallocN(exec->stack);
+               nts = MEM_callocN(sizeof(bNodeThreadStack), "bNodeThreadStack");
+               nts->stack = MEM_dupallocN(exec->stack);
                nts->used = TRUE;
                BLI_addtail(lb, nts);
        }
@@ -283,15 +283,15 @@ void ntreeReleaseThreadStack(bNodeThreadStack *nts)
 
 bool ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *callerdata, int thread)
 {
-       bNodeStack *nsin[MAX_SOCKET];   /* arbitrary... watch this */
-       bNodeStack *nsout[MAX_SOCKET];  /* arbitrary... watch this */
+       bNodeStack *nsin[MAX_SOCKET];   /* arbitrary... watch this */
+       bNodeStack *nsout[MAX_SOCKET];  /* arbitrary... watch this */
        bNodeExec *nodeexec;
        bNode *node;
        int n;
        
        /* nodes are presorted, so exec is in order of list */
        
-       for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+       for (n = 0, nodeexec = exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
                node = nodeexec->node;
                if (node->need_exec) {
                        node_get_stack(node, nts->stack, nsin, nsout);
index 153d46771865710437b70de61eb302744c71ab3a..4b3cd1c22a120e8eaac515f6a0ac9afd15ce8815 100644 (file)
@@ -105,8 +105,8 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in
 {
        bNodeSocket *sock;
        
-       for (sock= socklist->first; sock; sock= sock->next) {
-               if (strncmp(sock->name, stemp->name, NODE_MAXSTR)==0)
+       for (sock = socklist->first; sock; sock = sock->next) {
+               if (strncmp(sock->name, stemp->name, NODE_MAXSTR) == 0)
                        break;
        }
        if (sock) {
@@ -136,27 +136,27 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou
        bNodeSocketTemplate *stemp;
        
        /* no inputs anymore? */
-       if (stemp_first==NULL) {
-               for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) {
+       if (stemp_first == NULL) {
+               for (sock = (bNodeSocket *)socklist->first; sock; sock = nextsock) {
                        nextsock = sock->next;
                        nodeRemoveSocket(ntree, node, sock);
                }
        }
        else {
                /* step by step compare */
-               stemp= stemp_first;
+               stemp = stemp_first;
                while (stemp->type != -1) {
-                       stemp->sock= verify_socket_template(ntree, node, in_out, socklist, stemp);
+                       stemp->sock = verify_socket_template(ntree, node, in_out, socklist, stemp);
                        stemp++;
                }
                /* leftovers are removed */
-               for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) {
+               for (sock = (bNodeSocket *)socklist->first; sock; sock = nextsock) {
                        nextsock = sock->next;
                        nodeRemoveSocket(ntree, node, sock);
                }
                
                /* and we put back the verified sockets */
-               stemp= stemp_first;
+               stemp = stemp_first;
                if (socklist->first) {
                        /* some dynamic sockets left, store the list start
                         * so we can add static sockets infront of it.
@@ -179,7 +179,7 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou
 
 void node_verify_socket_templates(bNodeTree *ntree, bNode *node)
 {
-       bNodeType *ntype= node->typeinfo;
+       bNodeType *ntype = node->typeinfo;
        /* Don't try to match socket lists when there are no templates.
         * This prevents group node sockets from being removed, without the need to explicitly
         * check the node type here.
@@ -199,63 +199,63 @@ void node_socket_init_default_value(bNodeSocket *sock)
        int subtype = sock->typeinfo->subtype;
        
        if (sock->default_value)
-               return; /* already initialized */
+               return; /* already initialized */
        
        switch (type) {
-       case SOCK_FLOAT: {
-               bNodeSocketValueFloat *dval = MEM_callocN(sizeof(bNodeSocketValueFloat), "node socket value float");
-               dval->subtype = subtype;
-               dval->value = 0.0f;
-               dval->min = -FLT_MAX;
-               dval->max = FLT_MAX;
+               case SOCK_FLOAT: {
+                       bNodeSocketValueFloat *dval = MEM_callocN(sizeof(bNodeSocketValueFloat), "node socket value float");
+                       dval->subtype = subtype;
+                       dval->value = 0.0f;
+                       dval->min = -FLT_MAX;
+                       dval->max = FLT_MAX;
                
-               sock->default_value = dval;
-               break;
-       }
-       case SOCK_INT: {
-               bNodeSocketValueInt *dval = MEM_callocN(sizeof(bNodeSocketValueInt), "node socket value int");
-               dval->subtype = subtype;
-               dval->value = 0;
-               dval->min = INT_MIN;
-               dval->max = INT_MAX;
+                       sock->default_value = dval;
+                       break;
+               }
+               case SOCK_INT: {
+                       bNodeSocketValueInt *dval = MEM_callocN(sizeof(bNodeSocketValueInt), "node socket value int");
+                       dval->subtype = subtype;
+                       dval->value = 0;
+                       dval->min = INT_MIN;
+                       dval->max = INT_MAX;
                
-               sock->default_value = dval;
-               break;
-       }
-       case SOCK_BOOLEAN: {
-               bNodeSocketValueBoolean *dval = MEM_callocN(sizeof(bNodeSocketValueBoolean), "node socket value bool");
-               dval->value = false;
+                       sock->default_value = dval;
+                       break;
+               }
+               case SOCK_BOOLEAN: {
+                       bNodeSocketValueBoolean *dval = MEM_callocN(sizeof(bNodeSocketValueBoolean), "node socket value bool");
+                       dval->value = false;
                
-               sock->default_value = dval;
-               break;
-       }
-       case SOCK_VECTOR: {
-               static float default_value[] = { 0.0f, 0.0f, 0.0f };
-               bNodeSocketValueVector *dval = MEM_callocN(sizeof(bNodeSocketValueVector), "node socket value vector");
-               dval->subtype = subtype;
-               copy_v3_v3(dval->value, default_value);
-               dval->min = -FLT_MAX;
-               dval->max = FLT_MAX;
+                       sock->default_value = dval;
+                       break;
+               }
+               case SOCK_VECTOR: {
+                       static float default_value[] = { 0.0f, 0.0f, 0.0f };
+                       bNodeSocketValueVector *dval = MEM_callocN(sizeof(bNodeSocketValueVector), "node socket value vector");
+                       dval->subtype = subtype;
+                       copy_v3_v3(dval->value, default_value);
+                       dval->min = -FLT_MAX;
+                       dval->max = FLT_MAX;
                
-               sock->default_value = dval;
-               break;
-       }
-       case SOCK_RGBA: {
-               static float default_value[] = { 0.0f, 0.0f, 0.0f, 1.0f };
-               bNodeSocketValueRGBA *dval = MEM_callocN(sizeof(bNodeSocketValueRGBA), "node socket value color");
-               copy_v4_v4(dval->value, default_value);
+                       sock->default_value = dval;
+                       break;
+               }
+               case SOCK_RGBA: {
+                       static float default_value[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+                       bNodeSocketValueRGBA *dval = MEM_callocN(sizeof(bNodeSocketValueRGBA), "node socket value color");
+                       copy_v4_v4(dval->value, default_value);
                
-               sock->default_value = dval;
-               break;
-       }
-       case SOCK_STRING: {
-               bNodeSocketValueString *dval = MEM_callocN(sizeof(bNodeSocketValueString), "node socket value string");
-               dval->subtype = subtype;
-               dval->value[0] = '\0';
+                       sock->default_value = dval;
+                       break;
+               }
+               case SOCK_STRING: {
+                       bNodeSocketValueString *dval = MEM_callocN(sizeof(bNodeSocketValueString), "node socket value string");
+                       dval->subtype = subtype;
+                       dval->value[0] = '\0';
                
-               sock->default_value = dval;
-               break;
-       }
+                       sock->default_value = dval;
+                       break;
+               }
        }
 }
 
index c622c1c52279cc1aed505395e53bcb1eb91e67d0..f9a450174a37a7f064c4f76734604ca0dd23562c 100644 (file)
@@ -112,7 +112,7 @@ const char *node_filter_label(bNode *node)
 
 void node_update_internal_links_default(bNodeTree *ntree, bNode *node)
 {
-       bNodeSocket *fromsock_first=NULL, *tosock_first=NULL;   /* used for fallback link if no other reconnections are found */
+       bNodeSocket *fromsock_first = NULL, *tosock_first = NULL;   /* used for fallback link if no other reconnections are found */
        int datatype;
        int num_links_in = 0, num_links_out = 0, num_reconnect = 0;
 
@@ -120,7 +120,7 @@ void node_update_internal_links_default(bNodeTree *ntree, bNode *node)
        if (!ntree)
                return;
 
-       for (datatype=0; datatype < NUM_SOCKET_TYPES; ++datatype) {
+       for (datatype = 0; datatype < NUM_SOCKET_TYPES; ++datatype) {
                bNodeSocket *fromsock, *tosock;
                int fromindex, toindex;
                bNodeLink *link;
@@ -129,7 +129,7 @@ void node_update_internal_links_default(bNodeTree *ntree, bNode *node)
                
                fromindex = INT_MAX;
                fromsock = NULL;
-               for (link=ntree->links.first; link; link=link->next) {
+               for (link = ntree->links.first; link; link = link->next) {
                        if (nodeLinkIsHidden(link))
                                continue;
                        if (link->tonode == node && link->tosock->type == datatype) {
@@ -148,7 +148,7 @@ void node_update_internal_links_default(bNodeTree *ntree, bNode *node)
                
                toindex = INT_MAX;
                tosock = NULL;
-               for (link=ntree->links.first; link; link=link->next) {
+               for (link = ntree->links.first; link; link = link->next) {
                        if (nodeLinkIsHidden(link))
                                continue;
                        if (link->fromnode == node && link->fromsock->type == datatype) {
@@ -182,7 +182,7 @@ void node_update_internal_links_default(bNodeTree *ntree, bNode *node)
        /* if there is one input and one output link, but no reconnections by type,
         * simply connect those two sockets.
         */
-       if (num_reconnect==0 && num_links_in==1 && num_links_out==1) {
+       if ((num_reconnect == 0) && (num_links_in == 1) && (num_links_out == 1)) {
                bNodeLink *ilink = MEM_callocN(sizeof(bNodeLink), "internal node link");
                ilink->fromnode = node;
                ilink->fromsock = fromsock_first;
index 0a5d1a3216ccb7975653dfa7b6976065d22711a9..65ae205a2ab75bd62b93f04869dcfe784e0267a5 100644 (file)
@@ -68,9 +68,9 @@ static int shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype))
        Scene *scene = CTX_data_scene(C);
        /* allow empty engine string too, this is from older versions that didn't have registerable engines yet */
        return (scene->r.engine[0] == '\0' ||
-            STREQ(scene->r.engine, "BLENDER_RENDER") ||
-            STREQ(scene->r.engine, "BLENDER_GAME") ||
-            STREQ(scene->r.engine, "CYCLES"));
+               STREQ(scene->r.engine, "BLENDER_RENDER") ||
+               STREQ(scene->r.engine, "BLENDER_GAME") ||
+               STREQ(scene->r.engine, "CYCLES"));
 }
 
 static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(treetype), bNodeTree **r_ntree, ID **r_id, ID **r_from)
@@ -169,7 +169,7 @@ void register_node_tree_type_sh(void)
        tt->type = NTREE_SHADER;
        strcpy(tt->idname, "ShaderNodeTree");
        strcpy(tt->ui_name, "Shader");
-       tt->ui_icon = 0;        /* defined in drawnode.c */
+       tt->ui_icon = 0;    /* defined in drawnode.c */
        strcpy(tt->ui_description, "");
        
        tt->foreach_nodeclass = foreach_nodeclass;
index 6636957facb8ab6298ac1eb70712358815ba64e6..94589c927b39d43ef8f38d619ff17446b8476c1f 100644 (file)
@@ -72,9 +72,9 @@ static void texture_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tr
                        tx = give_current_object_texture(ob);
                        if (tx) {
                                if (ob->type == OB_LAMP)
-                                       *r_from = (ID*)ob->data;
+                                       *r_from = (ID *)ob->data;
                                else
-                                       *r_from = (ID*)give_current_material(ob, ob->actcol);
+                                       *r_from = (ID *)give_current_material(ob, ob->actcol);
                                
                                /* from is not set fully for material nodes, should be ID + Node then */
                                *r_id = &tx->id;
@@ -169,7 +169,7 @@ void register_node_tree_type_tex(void)
        tt->type = NTREE_TEXTURE;
        strcpy(tt->idname, "TextureNodeTree");
        strcpy(tt->ui_name, "Texture");
-       tt->ui_icon = 0;        /* defined in drawnode.c */
+       tt->ui_icon = 0;    /* defined in drawnode.c */
        strcpy(tt->ui_description, "");
        
        tt->foreach_nodeclass = foreach_nodeclass;
index 80644157b02c015e9cbfa3542d7c6423b830618f..a8117b7b33399acf6886073c874feb9b48b40556 100644 (file)
@@ -52,7 +52,7 @@
 
 int tex_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
 {
-       return (strcmp(ntree->idname, "TextureNodeTree")==0);
+       return STREQ(ntree->idname, "TextureNodeTree");
 }
 
 void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag)