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.
2 changed files with 6 additions and 0 deletions
Showing only changes of commit 509e0454fc - Show all commits

View File

@ -667,6 +667,9 @@ class NodeTreeMainUpdater {
link.tonode = &node;
link.tosock = to_socket;
link.flag |= NODE_LINK_VALID;
/* Drawing of internal link for multi-input socket have to starting at last index of set of
* random number of connection. */
link.multi_input_socket_index = -1;
node.runtime->internal_links.append(link);
}
BKE_ntree_update_tag_node_internal_link(&ntree, &node);

View File

@ -112,6 +112,9 @@ float2 node_link_calculate_multi_input_position(const float2 &socket_position,
{
const float offset = (total_inputs * NODE_MULTI_INPUT_LINK_GAP - NODE_MULTI_INPUT_LINK_GAP) *
0.5f;
if (index == -1) {
return {socket_position.x, socket_position.y + offset};
}
return {socket_position.x, socket_position.y - offset + index * NODE_MULTI_INPUT_LINK_GAP};
}