Fix T94357: Node Ungroup operator copies current node tree

This was a mistake in rBfdc4a1a590d8befb1ff which copied the parent
node tree into itself rather than accessing the node group's nodes.
This commit is contained in:
Hans Goudey 2021-12-23 22:48:55 -06:00
parent 35bd6fe993
commit 81b3933abb
Notes: blender-bot 2023-02-14 06:54:28 +01:00
Referenced by issue #94357, Unable to Ungroup group nodes
Referenced by issue #94360, Assert on dragging keyframes
1 changed files with 2 additions and 1 deletions

View File

@ -223,13 +223,14 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
{
ListBase anim_basepaths = {nullptr, nullptr};
LinkNode *nodes_delayed_free = nullptr;
const bNodeTree *ngroup = reinterpret_cast<const bNodeTree *>(gnode->id);
/* wgroup is a temporary copy of the NodeTree we're merging in
* - all of wgroup's nodes are copied across to their new home
* - ngroup (i.e. the source NodeTree) is left unscathed
* - temp copy. do change ID usercount for the copies
*/
bNodeTree *wgroup = ntreeCopyTree(bmain, ntree);
bNodeTree *wgroup = ntreeCopyTree(bmain, ngroup);
/* Add the nodes into the ntree */
LISTBASE_FOREACH_MUTABLE (bNode *, node, &wgroup->nodes) {