fix for blender naming all new node groups "Missing Datablock"

This commit is contained in:
Campbell Barton
2012-07-09 22:39:35 +00:00
parent df107939c9
commit 24f672d57b

View File

@@ -321,15 +321,18 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
node->color[0] = node->color[1] = node->color[2] = 0.608; /* default theme color */
node_add_sockets_from_type(ntree, node, ntype);
/* 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);
/* initialize the node name with the node label.
* note: do this after the initfunc so nodes get
* their data set which may be used in naming
* (node groups for example) */
BLI_strncpy(node->name, nodeLabel(node), NODE_MAXSTR);
nodeUniqueName(ntree, node);
ntree->update |= NTREE_UPDATE_NODES;