diff options
author | Jacques Lucke <jacques@blender.org> | 2021-03-09 23:20:33 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-03-09 23:22:30 +0300 |
commit | 90520026e9cedfd080c649ae0d954a0d68e1c51a (patch) | |
tree | 46d35a975d0103a42766d522188b21b28e8e0dca /source/blender | |
parent | 7d827d0e9e1a396580be988313bfd9ee4273a517 (diff) |
Fix: only follow first input of multi-input-socket when muted
Otherwise muting a Join Geometry node has no effect, when there
are multiple Join Geometry nodes in a row.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/nodes/NOD_derived_node_tree.hh | 3 | ||||
-rw-r--r-- | source/blender/nodes/intern/derived_node_tree.cc | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/nodes/NOD_derived_node_tree.hh b/source/blender/nodes/NOD_derived_node_tree.hh index f1dbb2caf29..3529336baf6 100644 --- a/source/blender/nodes/NOD_derived_node_tree.hh +++ b/source/blender/nodes/NOD_derived_node_tree.hh @@ -132,7 +132,8 @@ class DInputSocket : public DSocket { DOutputSocket get_corresponding_group_node_output() const; Vector<DOutputSocket, 4> get_corresponding_group_input_sockets() const; - void foreach_origin_socket(FunctionRef<void(DSocket)> callback) const; + void foreach_origin_socket(FunctionRef<void(DSocket)> callback, + const bool follow_only_first_incoming_link = false) const; }; /* A (nullable) reference to an output socket and the context it is in. */ diff --git a/source/blender/nodes/intern/derived_node_tree.cc b/source/blender/nodes/intern/derived_node_tree.cc index c5f267470fd..36c64b00f47 100644 --- a/source/blender/nodes/intern/derived_node_tree.cc +++ b/source/blender/nodes/intern/derived_node_tree.cc @@ -168,10 +168,15 @@ DInputSocket DOutputSocket::get_active_corresponding_group_output_socket() const /* Call the given callback for every "real" origin socket. "Real" means that reroutes, muted nodes * and node groups are handled by this function. Origin sockets are ones where a node gets its * inputs from. */ -void DInputSocket::foreach_origin_socket(FunctionRef<void(DSocket)> callback) const +void DInputSocket::foreach_origin_socket(FunctionRef<void(DSocket)> callback, + const bool follow_only_first_incoming_link) const { BLI_assert(*this); - for (const OutputSocketRef *linked_socket : socket_ref_->as_input().linked_sockets()) { + Span<const OutputSocketRef *> linked_sockets_to_check = socket_ref_->as_input().linked_sockets(); + if (follow_only_first_incoming_link) { + linked_sockets_to_check = linked_sockets_to_check.take_front(1); + } + for (const OutputSocketRef *linked_socket : linked_sockets_to_check) { const NodeRef &linked_node = linked_socket->node(); DOutputSocket linked_dsocket{context_, linked_socket}; @@ -180,7 +185,7 @@ void DInputSocket::foreach_origin_socket(FunctionRef<void(DSocket)> callback) co for (const InternalLinkRef *internal_link : linked_node.internal_links()) { if (&internal_link->to() == linked_socket) { DInputSocket input_of_muted_node{context_, &internal_link->from()}; - input_of_muted_node.foreach_origin_socket(callback); + input_of_muted_node.foreach_origin_socket(callback, true); } } } |