Page MenuHome

Nodes: Use topology cache for node exec node list
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Nov 20 2022, 9:48 PM.

Details

Summary

Instead of generating a dependency sorted node list whenever
evaluating texture or EEVEE/viewport shader nodes, use the
existing sorted array from the topology cache. This is more
efficient because the algorithm isn't quadratic, and the result
is cached. It's also the second-to-last place to use
node.runtime->level, which can be removed soon.

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Nov 20 2022, 9:48 PM
Hans Goudey (HooglyBoogly) created this revision.
diff --git a/source/blender/nodes/shader/node_shader_tree.cc b/source/blender/nodes/shader/node_shader_tree.cc
index 0c0bb1c4316..09a1125d7b5 100644
--- a/source/blender/nodes/shader/node_shader_tree.cc
+++ b/source/blender/nodes/shader/node_shader_tree.cc
@@ -889,6 +889,7 @@ static void ntree_shader_weight_tree_invert(bNodeTree *ntree, bNode *output_node
             case SH_NODE_VOLUME_PRINCIPLED:
             case SH_NODE_VOLUME_SCATTER:
               fromsock = ntree_shader_node_find_input(fromnode, "Weight");
+              fromsock->flag &= ~SOCK_UNAVAIL;
               if (fromsock->link) {
                 ntree_weight_tree_merge_weight(ntree, fromnode, fromsock, &tonode, &tosock);
               }

Should also add a comment that the socket is made available so that links to it are available as well and are not ignored in other places.

  • Fix "weight" sockets by making them available in the localized tree
This revision is now accepted and ready to land.Nov 21 2022, 4:31 PM