diff options
author | Jacques Lucke <jacques@blender.org> | 2021-12-31 13:33:47 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-12-31 13:33:47 +0300 |
commit | 018272ee5bc74b9b651218b72cf0b348e9ca149d (patch) | |
tree | f3a8d8ddd03e4f7248dd5c3ea1571d614fb9fec5 /source/blender | |
parent | 71468f475b449fc2c72d9c0438db9b37788058ab (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/node_tree_update.cc | 6 |
1 files changed, 6 insertions, 0 deletions
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; |