Fix #32052, Conflicts in unique node names.
authorLukas Toenne <lukas.toenne@googlemail.com>
Tue, 10 Jul 2012 09:31:08 +0000 (09:31 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Tue, 10 Jul 2012 09:31:08 +0000 (09:31 +0000)
All node group operators which move nodes directly between bNodeTree->nodes lists now make sure the node names are indeed unique in their new environment (the node group tree or the parent tree).

source/blender/editors/space_node/node_edit.c

index 9a6906c43bcdb46826d94b5afd47080acd225a1b..7d76994c07ada4b1ffd8543e1bc5a8309f7c2280 100644 (file)
@@ -1157,6 +1157,9 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
                BLI_remlink(&wgroup->nodes, node);
                BLI_addtail(&ntree->nodes, node);
                
+               /* ensure unique node name in the nodee tree */
+               nodeUniqueName(ntree, node);
+               
                node->locx += gnode->locx;
                node->locy += gnode->locy;
                
@@ -1370,6 +1373,9 @@ static int node_group_separate_selected(bNodeTree *ntree, bNode *gnode, int make
                BLI_remlink(&ngroup->nodes, newnode);
                BLI_addtail(&ntree->nodes, newnode);
                
+               /* ensure unique node name in the node tree */
+               nodeUniqueName(ntree, newnode);
+               
                newnode->locx += gnode->locx;
                newnode->locy += gnode->locy;
        }
@@ -3710,11 +3716,14 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
                        BLI_remlink(&ntree->nodes, node);
                        BLI_addtail(&ngroup->nodes, node);
                        
+                       /* ensure unique node name in the ngroup */
+                       nodeUniqueName(ngroup, node);
+                       
                        node->locx -= 0.5f * (min[0] + max[0]);
                        node->locy -= 0.5f * (min[1] + max[1]);
                }
        }
-
+       
        /* move animation data over */
        if (ntree->adt) {
                LinkData *ld, *ldn = NULL;