Do not use nodeLabel() to generate new nodes' names, this is an UI func returning translated strings, which should never get into data. And it may generates dummy names in some situations (like all new Filter nodes were getting "Soften" as name (default option), better to always get "Filter" in this case!).

(Note for Lockal: also checked fcurves/drivers, but those names are directly taken from RNA prop name, hence they are as UI label, translated in the current language, but not stored in data. So no problem here ;) ).
This commit is contained in:
Bastien Montagne 2012-10-08 07:40:57 +00:00
parent 8b7896814f
commit f299813bfa

@ -326,10 +326,13 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
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
* 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);
/* XXX Do not use nodeLabel() here, it returns translated content, which should *only* be used
* in UI, *never* in data...
* This solution may be a bit rougher than nodeLabel()'s returned string, but it's simpler
* than adding a "no translate" flag to this func (and labelfunc() as well). */
BLI_strncpy(node->name, node->typeinfo->name, NODE_MAXSTR);
nodeUniqueName(ntree, node);
ntree->update |= NTREE_UPDATE_NODES;