Fix: Avoid node reevaluations for selection and parenting

Since 90ea1b7643, node trees have been reevaluated
after many selection operations because nodes are sorted based on
the selection status and an update tag was added for that. However,
for years the node order was allowed to be different between the
original and evaluated copy of node trees.

Though it is a bit sketchy to have that difference in the evaluated
node tree, reevaluations for just selection are very bad, so use a
"smaller" update tag and add a comment for justification.

Differential Revision: https://developer.blender.org/D17023
This commit is contained in:
Hans Goudey 2023-01-17 12:16:38 -06:00
parent 665732115e
commit d76a0e98ba
1 changed files with 5 additions and 1 deletions

View File

@ -1131,7 +1131,11 @@ void BKE_ntree_update_tag_node_removed(bNodeTree *ntree)
void BKE_ntree_update_tag_node_reordered(bNodeTree *ntree)
{
add_tree_tag(ntree, NTREE_CHANGED_ANY);
/* Don't add a tree update tag to avoid reevaluations for trivial operations like selection or
* parenting that typically influence the node order. This means the node order can be different
* for original and evaluated trees. A different solution might avoid sorting nodes based on UI
* states like selection, which would require not tying the node order to the drawing order. */
ntree->runtime->topology_cache_mutex.tag_dirty();
}
void BKE_ntree_update_tag_node_mute(bNodeTree *ntree, bNode *node)