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.
Showing only changes of commit 01929a4de2 - Show all commits

View File

@ -969,7 +969,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
scene->eevee.gi_irradiance_pool_size = 16;
}
}
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
scene->toolsettings->snap_flag_anim |= SCE_SNAP;
scene->toolsettings->snap_anim_mode |= SCE_SNAP_TO_FRAME;
@ -1015,6 +1015,29 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
FOREACH_NODETREE_END;
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 23)) {
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
blender::Map<const bNodeSocket *, int> total_inputs;
LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
const bNodeSocket &socket = *link->tosock;
if (!socket.is_multi_input()) {
continue;
}
total_inputs.add_or_modify(
&socket, [](int *value) { *value = 0; }, [](int *value) { (*value)++; });
}
LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
const bNodeSocket &socket = *link->tosock;
if (!socket.is_multi_input()) {
continue;
}
const int last_input_index = total_inputs.lookup(&socket);
link->multi_input_socket_index = last_input_index - link->multi_input_socket_index;
}
}
FOREACH_NODETREE_END;
}
/**
* Versioning code until next subversion bump goes here.
*