Fix #106261: When geometry output is viewed the cycling operator picks wrong sockets.
The cycling method for the viewer connection starts searching from the next socket after the last current connection. If a geometry socket is is the last connected output this caused the method to jump to the next socket after the geometry, potentially skipping over valid data sockets that are not viewed yet. The solution is to ignore the geometry sockets in the cycling entirely and only consider data sockets (i.e. non-geometry sockets). Pull Request: https://projects.blender.org/blender/blender/pulls/106318
This commit is contained in:
parent
8785862ee4
commit
bdc3f1581d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user