Fix #108141: Group Insert operator creates invalid links

Just avoid creating links to outside the group. The original
version worked a little more accurately. But still she was just
making up links (because the inline version of the graph wasn't the same anyway).
For now, this is just a workaround to work around the
problem in the new behavior caused by fa3ca9afdb .

Pull Request: https://projects.blender.org/blender/blender/pulls/108332
This commit is contained in:
Iliya Katueshenock
2023-06-16 20:24:31 +02:00
committed by Hans Goudey
parent a6931db38b
commit 4e7ee5d9ac

View File

@@ -913,16 +913,19 @@ static void node_group_make_insert_selected(const bContext &C,
links_to_remove.add(link);
continue;
}
if (link->fromnode == gnode) {
links_to_remove.add(link);
continue;
}
if (nodes_to_move.contains(link->fromnode)) {
internal_links_to_move.add(link);
continue;
}
else {
InputSocketInfo &info = input_links.lookup_or_add_default(link->fromsock);
info.from_node = link->fromnode;
info.links.append(link);
if (!info.interface_socket) {
info.interface_socket = add_interface_from_socket(ntree, group, *link->tosock);
}
InputSocketInfo &info = input_links.lookup_or_add_default(link->fromsock);
info.from_node = link->fromnode;
info.links.append(link);
if (!info.interface_socket) {
info.interface_socket = add_interface_from_socket(ntree, group, *link->tosock);
}
}
}
@@ -932,12 +935,15 @@ static void node_group_make_insert_selected(const bContext &C,
links_to_remove.add(link);
continue;
}
if (link->tonode == gnode) {
links_to_remove.add(link);
continue;
}
if (nodes_to_move.contains(link->tonode)) {
internal_links_to_move.add(link);
continue;
}
else {
output_links.append({link, add_interface_from_socket(ntree, group, *link->fromsock)});
}
output_links.append({link, add_interface_from_socket(ntree, group, *link->fromsock)});
}
}
}