diff options
author | Jacques Lucke <jacques@blender.org> | 2021-07-21 12:27:04 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-07-21 12:28:26 +0300 |
commit | ab101d444d30a2f98320fc96f2dc4d56ccd98965 (patch) | |
tree | 7d405240e33249caab9335561e3a4b45272f097d /source | |
parent | 8b0fac4116f21020a5dc2fb7ec9597760eb2b39e (diff) |
Fix T89881: ignore unavailable sockets when searching for link cycles
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/nodes/intern/derived_node_tree.cc | 4 | ||||
-rw-r--r-- | source/blender/nodes/intern/node_tree_ref.cc | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/nodes/intern/derived_node_tree.cc b/source/blender/nodes/intern/derived_node_tree.cc index 3d5557d4049..f7279cf7524 100644 --- a/source/blender/nodes/intern/derived_node_tree.cc +++ b/source/blender/nodes/intern/derived_node_tree.cc @@ -73,7 +73,9 @@ void DerivedNodeTree::destruct_context_recursively(DTreeContext *context) context->~DTreeContext(); } -/* Returns true if there are any cycles in the node tree. */ +/** + * \return True when there is a link cycle. Unavailable sockets are ignored. + */ bool DerivedNodeTree::has_link_cycles() const { for (const NodeTreeRef *tree_ref : used_node_tree_refs_) { diff --git a/source/blender/nodes/intern/node_tree_ref.cc b/source/blender/nodes/intern/node_tree_ref.cc index 9ce9d6fc273..641d02af902 100644 --- a/source/blender/nodes/intern/node_tree_ref.cc +++ b/source/blender/nodes/intern/node_tree_ref.cc @@ -423,7 +423,13 @@ static bool has_link_cycles_recursive(const NodeRef &node, is_in_stack[node_id] = true; for (const OutputSocketRef *from_socket : node.outputs()) { + if (!from_socket->is_available()) { + continue; + } for (const InputSocketRef *to_socket : from_socket->directly_linked_sockets()) { + if (!to_socket->is_available()) { + continue; + } const NodeRef &to_node = to_socket->node(); if (has_link_cycles_recursive(to_node, visited, is_in_stack)) { return true; @@ -435,6 +441,9 @@ static bool has_link_cycles_recursive(const NodeRef &node, return false; } +/** + * \return True when there is a link cycle. Unavailable sockets are ignored. + */ bool NodeTreeRef::has_link_cycles() const { const int node_amount = nodes_by_id_.size(); |