Merging r46414 through r46455 from trunk into soc-2011-tomato
[blender-staging.git] / source / blender / blenkernel / intern / node.c
index 81eb2dd289afd53d3c04cd502a515bd8984d86b7..9bae9c81533d03928b4871bfa708257a9033d283 100644 (file)
@@ -339,15 +339,15 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
        
        node_add_sockets_from_type(ntree, node, ntype);
        
-       if (ntype->initfunc!=NULL)
-               ntype->initfunc(ntree, node, ntemp);
-       
        /* initialize the node name with the node label */
        BLI_strncpy(node->name, nodeLabel(node), NODE_MAXSTR);
        nodeUniqueName(ntree, node);
        
        BLI_addtail(&ntree->nodes, node);
        
+       if (ntype->initfunc!=NULL)
+               ntype->initfunc(ntree, node, ntemp);
+       
        ntree->update |= NTREE_UPDATE_NODES;
        
        return node;