[Bf-blender-cvs] [d76a0e98bae] master: Fix: Avoid node reevaluations for selection and parenting

Hans Goudey noreply at git.blender.org
Tue Jan 17 19:50:24 CET 2023


Commit: d76a0e98baecfca4e691fd29bcf027d8cc1e07bf
Author: Hans Goudey
Date:   Tue Jan 17 12:16:38 2023 -0600
Branches: master
https://developer.blender.org/rBd76a0e98baecfca4e691fd29bcf027d8cc1e07bf

Fix: Avoid node reevaluations for selection and parenting

Since 90ea1b76434fe175e9, 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

===================================================================

M	source/blender/blenkernel/intern/node_tree_update.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc
index 2943bea830b..374d67bbfa8 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -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)



More information about the Bf-blender-cvs mailing list