[Bf-blender-cvs] [018272ee5bc] master: Fix T94416: incorrect handling when nodes are linked in a loop

Jacques Lucke noreply at git.blender.org
Fri Dec 31 11:33:56 CET 2021


Commit: 018272ee5bc74b9b651218b72cf0b348e9ca149d
Author: Jacques Lucke
Date:   Fri Dec 31 11:33:47 2021 +0100
Branches: master
https://developer.blender.org/rB018272ee5bc74b9b651218b72cf0b348e9ca149d

Fix T94416: incorrect handling when nodes are linked in a loop

This just skips the entire algorithm when there are cycles.
In the future, cycles could be handled more gracefully in the
algorithm, but for now that's not worth it and is not necessary
to fix the bug.

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

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 6bf1c883f1d..be9777281cb 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -1366,6 +1366,11 @@ class NodeTreeMainUpdater {
   uint32_t get_combined_socket_topology_hash(const NodeTreeRef &tree,
                                              Span<const SocketRef *> sockets)
   {
+    if (tree.has_link_cycles()) {
+      /* Return dummy value when the link has any cycles. The algorithm below could be improved to
+       * handle cycles more gracefully. */
+      return 0;
+    }
     Array<uint32_t> hashes = this->get_socket_topology_hashes(tree, sockets);
     uint32_t combined_hash = 0;
     for (uint32_t hash : hashes) {
@@ -1377,6 +1382,7 @@ class NodeTreeMainUpdater {
   Array<uint32_t> get_socket_topology_hashes(const NodeTreeRef &tree,
                                              Span<const SocketRef *> sockets)
   {
+    BLI_assert(!tree.has_link_cycles());
     Array<std::optional<uint32_t>> hash_by_socket_id(tree.sockets().size());
     Stack<const SocketRef *> sockets_to_check = sockets;



More information about the Bf-blender-cvs mailing list