Fix T89881: ignore unavailable sockets when searching for link cycles
This commit is contained in:
@@ -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_) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user