Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-03-19 23:10:55 +0300
committerJacques Lucke <jacques@blender.org>2021-03-19 23:13:10 +0300
commit00215692d18d80ba6733784ef54c03a4d7514c6d (patch)
treeb39a91736f22b380f5ed70bd0ef1d36e7ae6ad00 /source/blender/nodes/intern/derived_node_tree.cc
parent48731f45c248a368e4d52b5a136bcfd04a401b65 (diff)
Nodes: make distinction between directly and logically linked sockets more clear
This also moves the handling of muted nodes from derived node tree to node tree ref.
Diffstat (limited to 'source/blender/nodes/intern/derived_node_tree.cc')
-rw-r--r--source/blender/nodes/intern/derived_node_tree.cc37
1 files changed, 7 insertions, 30 deletions
diff --git a/source/blender/nodes/intern/derived_node_tree.cc b/source/blender/nodes/intern/derived_node_tree.cc
index 36c64b00f47..18605e93d94 100644
--- a/source/blender/nodes/intern/derived_node_tree.cc
+++ b/source/blender/nodes/intern/derived_node_tree.cc
@@ -168,35 +168,21 @@ 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 bool follow_only_first_incoming_link) const
+void DInputSocket::foreach_origin_socket(FunctionRef<void(DSocket)> callback) const
{
BLI_assert(*this);
- 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) {
+ for (const OutputSocketRef *linked_socket : socket_ref_->as_input().logically_linked_sockets()) {
const NodeRef &linked_node = linked_socket->node();
DOutputSocket linked_dsocket{context_, linked_socket};
- if (linked_node.is_muted()) {
- /* If the node is muted, follow the internal links of the node. */
- 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, true);
- }
- }
- }
- else if (linked_node.is_group_input_node()) {
+ if (linked_node.is_group_input_node()) {
if (context_->is_root()) {
/* This is a group input in the root node group. */
callback(linked_dsocket);
}
else {
DInputSocket socket_in_parent_group = linked_dsocket.get_corresponding_group_node_input();
- if (socket_in_parent_group->is_linked()) {
+ if (socket_in_parent_group->is_logically_linked()) {
/* Follow the links coming into the corresponding socket on the parent group node. */
socket_in_parent_group.foreach_origin_socket(callback);
}
@@ -210,7 +196,7 @@ void DInputSocket::foreach_origin_socket(FunctionRef<void(DSocket)> callback,
else if (linked_node.is_group_node()) {
DInputSocket socket_in_group = linked_dsocket.get_active_corresponding_group_output_socket();
if (socket_in_group) {
- if (socket_in_group->is_linked()) {
+ if (socket_in_group->is_logically_linked()) {
/* Follow the links coming into the group output node of the child node group. */
socket_in_group.foreach_origin_socket(callback);
}
@@ -233,20 +219,11 @@ void DInputSocket::foreach_origin_socket(FunctionRef<void(DSocket)> callback,
* from this socket. */
void DOutputSocket::foreach_target_socket(FunctionRef<void(DInputSocket)> callback) const
{
- for (const InputSocketRef *linked_socket : socket_ref_->as_output().linked_sockets()) {
+ for (const InputSocketRef *linked_socket : socket_ref_->as_output().logically_linked_sockets()) {
const NodeRef &linked_node = linked_socket->node();
DInputSocket linked_dsocket{context_, linked_socket};
- if (linked_node.is_muted()) {
- /* If the target node is muted, follow its internal links. */
- for (const InternalLinkRef *internal_link : linked_node.internal_links()) {
- if (&internal_link->from() == linked_socket) {
- DOutputSocket output_of_muted_node{context_, &internal_link->to()};
- output_of_muted_node.foreach_target_socket(callback);
- }
- }
- }
- else if (linked_node.is_group_output_node()) {
+ if (linked_node.is_group_output_node()) {
if (context_->is_root()) {
/* This is a group output in the root node group. */
callback(linked_dsocket);