Fix user counting when ungrouping a node group.
Existing code for ungrouping did not correctly handle user counters: - counter for the group was not decremented - counters for containing nodes were not incremented The latter resulted in losing some nodes after orphan cleaning or several save/reload cycles. The bug did not have destructive consequences until recently, because it was compensated by another bug (fixed in rBe993667a46c2). Maniphest Tasks: T74665, T74682 Differential Revision: https://developer.blender.org/D7332
This commit is contained in:
parent
95f51bb01d
commit
c544df997e
@ -193,11 +193,11 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
|
||||
}
|
||||
|
||||
/* wgroup is a temporary copy of the NodeTree we're merging in
|
||||
* - all of wgroup's nodes are transferred across to their new home
|
||||
* - all of wgroup's nodes are copied across to their new home
|
||||
* - ngroup (i.e. the source NodeTree) is left unscathed
|
||||
* - temp copy. don't change ID usercount
|
||||
* - temp copy. do change ID usercount for the copies
|
||||
*/
|
||||
wgroup = ntreeCopyTree_ex_new_pointers(ngroup, bmain, false);
|
||||
wgroup = ntreeCopyTree_ex_new_pointers(ngroup, bmain, true);
|
||||
|
||||
/* Add the nodes into the ntree */
|
||||
for (node = wgroup->nodes.first; node; node = nextnode) {
|
||||
@ -351,8 +351,8 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
|
||||
nodeRemoveNode(bmain, ntree, node, false);
|
||||
}
|
||||
|
||||
/* delete the group instance */
|
||||
nodeRemoveNode(bmain, ntree, gnode, false);
|
||||
/* delete the group instance and dereference group tree */
|
||||
nodeRemoveNode(bmain, ntree, gnode, true);
|
||||
|
||||
ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user