Fix: Various mishandling of node identifiers and vector

In a few places, nodes were added without updating the Identifiers and
vector. In other places nodes we removed without removing from and
rebuilding the vector. This is solved in a few ways. First I exposed
a function to rebuild the vector from scratch, and added unique ID
finding to a few places.

The changes to node group building and separating are more involved,
mostly because it was hard to see the correct behavior without some
refactoring. Now `VectorSet` is used to store nodes involved in the
operation. Some things are handled more simply with the topology
cache and by passing a span of nodes.
This commit is contained in:
2022-12-02 13:20:40 -06:00
parent 948f13a8e7
commit ab4926bcff
9 changed files with 199 additions and 202 deletions

View File

@@ -446,10 +446,12 @@ static void flatten_group_do(bNodeTree *ntree, bNode *gnode)
/* migrate node */
BLI_remlink(&ngroup->nodes, node);
BLI_addtail(&ntree->nodes, node);
nodeUniqueID(ntree, node);
/* ensure unique node name in the node tree */
/* This is very slow and it has no use for GPU nodetree. (see T70609) */
// nodeUniqueName(ntree, node);
}
ngroup->runtime->nodes_by_id.clear();
/* Save first and last link to iterate over flattened group links. */
bNodeLink *glinks_first = static_cast<bNodeLink *>(ntree->links.last);