Commit: 90520026e9cedfd080c649ae0d954a0d68e1c51a
Author: Jacques Lucke
Date: Tue Mar 9 21:20:33 2021 +0100
Branches: master
https://developer.blender.org/rB90520026e9cedfd080c649ae0d954a0d68e1c51a
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.
===================================================================
M source/blender/nodes/NOD_derived_node_tree.hh
M source/blender/nodes/intern/derived_node_tree.cc
===================================================================
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);
}
}
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs