From 018272ee5bc74b9b651218b72cf0b348e9ca149d Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 31 Dec 2021 11:33:47 +0100 Subject: 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. --- source/blender/blenkernel/intern/node_tree_update.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender') 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 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 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 get_socket_topology_hashes(const NodeTreeRef &tree, Span sockets) { + BLI_assert(!tree.has_link_cycles()); Array> hash_by_socket_id(tree.sockets().size()); Stack sockets_to_check = sockets; -- cgit v1.2.3