Fix T96073: Don't remove links when inserting reroute nodes

This was an oversight in rB06ac5992618a75c453e495e06af7c5faf30499a7.
This commit is contained in:
Jacques Lucke 2022-02-28 16:42:15 +01:00
parent 413e87b6b7
commit 37d2c774c1
Notes: blender-bot 2023-02-14 11:01:33 +01:00
Referenced by issue #96073, Geometry Nodes: Removing connections when using points of another types
1 changed files with 12 additions and 10 deletions

View File

@ -2452,16 +2452,18 @@ void ED_node_link_insert(Main *bmain, ScrArea *area)
bNodeSocket *best_input = get_main_socket(ntree, *node_to_insert, SOCK_IN);
bNodeSocket *best_output = get_main_socket(ntree, *node_to_insert, SOCK_OUT);
/* Ignore main sockets when the types don't match. */
if (best_input != nullptr && ntree.typeinfo->validate_link != nullptr &&
!ntree.typeinfo->validate_link(static_cast<eNodeSocketDatatype>(old_link->fromsock->type),
static_cast<eNodeSocketDatatype>(best_input->type))) {
best_input = nullptr;
}
if (best_output != nullptr && ntree.typeinfo->validate_link != nullptr &&
!ntree.typeinfo->validate_link(static_cast<eNodeSocketDatatype>(best_output->type),
static_cast<eNodeSocketDatatype>(old_link->tosock->type))) {
best_output = nullptr;
if (node_to_insert->type != NODE_REROUTE) {
/* Ignore main sockets when the types don't match. */
if (best_input != nullptr && ntree.typeinfo->validate_link != nullptr &&
!ntree.typeinfo->validate_link(static_cast<eNodeSocketDatatype>(old_link->fromsock->type),
static_cast<eNodeSocketDatatype>(best_input->type))) {
best_input = nullptr;
}
if (best_output != nullptr && ntree.typeinfo->validate_link != nullptr &&
!ntree.typeinfo->validate_link(static_cast<eNodeSocketDatatype>(best_output->type),
static_cast<eNodeSocketDatatype>(old_link->tosock->type))) {
best_output = nullptr;
}
}
bNode *from_node = old_link->fromnode;