diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index c65cc2fd398..7d65292ae90 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -524,7 +524,7 @@ static void remove_links_to_unavailable_viewer_sockets(bNodeTree &btree, bNode & static bNodeSocket *determine_socket_to_view(bNode &node_to_view) { - int last_linked_socket_index = -1; + int last_linked_data_socket_index = -1; bool has_linked_geometry_socket = false; for (bNodeSocket *socket : node_to_view.output_sockets()) { if (!socket_can_be_viewed(*socket)) { @@ -541,12 +541,14 @@ static bNodeSocket *determine_socket_to_view(bNode &node_to_view) if (socket->type == SOCK_GEOMETRY) { has_linked_geometry_socket = true; } - last_linked_socket_index = socket->index(); + else { + last_linked_data_socket_index = socket->index(); + } } } } - if (last_linked_socket_index == -1) { + if (last_linked_data_socket_index == -1 && !has_linked_geometry_socket) { /* Return the first socket that can be viewed. */ for (bNodeSocket *socket : node_to_view.output_sockets()) { if (socket_can_be_viewed(*socket)) { @@ -559,7 +561,7 @@ static bNodeSocket *determine_socket_to_view(bNode &node_to_view) /* Pick the next socket to be linked to the viewer. */ const int tot_outputs = node_to_view.output_sockets().size(); for (const int offset : IndexRange(1, tot_outputs)) { - const int index = (last_linked_socket_index + offset) % tot_outputs; + const int index = (last_linked_data_socket_index + offset) % tot_outputs; bNodeSocket &output_socket = node_to_view.output_socket(index); if (!socket_can_be_viewed(output_socket)) { continue;