Fix #106235: Use consistent order for multi-input socket links #106320

Closed
Iliya Katushenock wants to merge 17 commits from mod_moder:fix_internal_link_drawing into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
4 changed files with 1667 additions and 6854 deletions
Showing only changes of commit d4c1936da6 - Show all commits

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -80,6 +80,11 @@ static const EnumPropertyItem prop_graphkeys_insertkey_types[] = {
0,
"Only Selected Channels",
"Insert a keyframe on selected F-Curves using each curve's current value"},
{GRAPHKEYS_INSERTKEY_ACTIVE,
"ACTIVE",
0,
"Only Active F-Curve",
"Insert a keyframe on the active F-Curve using the curve's current value"},
{GRAPHKEYS_INSERTKEY_ACTIVE | GRAPHKEYS_INSERTKEY_CURSOR,
"CURSOR_ACTIVE",
0,

View File

@ -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;