Fix: versioning code results in duplicate node links
This issue was caused by having some hidden links and the changes in
8149678d5e to `version_geometry_nodes_replace_transfer_attribute_node`.
This commit is contained in:
@@ -284,20 +284,24 @@ void node_tree_relink_with_socket_id_map(bNodeTree &ntree,
|
||||
LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree.links) {
|
||||
if (link->tonode == &old_node) {
|
||||
bNodeSocket *old_socket = link->tosock;
|
||||
if (const std::string *new_identifier = map.lookup_ptr_as(old_socket->identifier)) {
|
||||
bNodeSocket *new_socket = nodeFindSocket(&new_node, SOCK_IN, new_identifier->c_str());
|
||||
link->tonode = &new_node;
|
||||
link->tosock = new_socket;
|
||||
old_socket->link = nullptr;
|
||||
if (old_socket->is_available()) {
|
||||
if (const std::string *new_identifier = map.lookup_ptr_as(old_socket->identifier)) {
|
||||
bNodeSocket *new_socket = nodeFindSocket(&new_node, SOCK_IN, new_identifier->c_str());
|
||||
link->tonode = &new_node;
|
||||
link->tosock = new_socket;
|
||||
old_socket->link = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (link->fromnode == &old_node) {
|
||||
bNodeSocket *old_socket = link->fromsock;
|
||||
if (const std::string *new_identifier = map.lookup_ptr_as(old_socket->identifier)) {
|
||||
bNodeSocket *new_socket = nodeFindSocket(&new_node, SOCK_OUT, new_identifier->c_str());
|
||||
link->fromnode = &new_node;
|
||||
link->fromsock = new_socket;
|
||||
old_socket->link = nullptr;
|
||||
if (old_socket->is_available()) {
|
||||
if (const std::string *new_identifier = map.lookup_ptr_as(old_socket->identifier)) {
|
||||
bNodeSocket *new_socket = nodeFindSocket(&new_node, SOCK_OUT, new_identifier->c_str());
|
||||
link->fromnode = &new_node;
|
||||
link->fromsock = new_socket;
|
||||
old_socket->link = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user