Fix: ID namemap assert in auto smooth versioning code

When "moving" the new node group to the same library as the object, its
original name has to be cleared from the name-map as well. That's
because there is a separate name-map for each library. I had this in
the original PR, but incorrectly removed this because I thought it was
unnecessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/119747
This commit is contained in:
Hans Goudey 2024-03-21 17:26:45 +01:00 committed by Hans Goudey
parent 5fa1915d47
commit 040ff38fcd
1 changed files with 2 additions and 0 deletions

View File

@ -37,6 +37,7 @@
#include "BKE_idprop.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_main_namemap.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_legacy_convert.hh"
#include "BKE_modifier.hh"
@ -2381,6 +2382,7 @@ void BKE_main_mesh_legacy_convert_auto_smooth(Main &bmain)
/* Move the node group to the requested library so that library data-blocks don't point to
* local data-blocks. This requires making sure the name is unique in that library and
* changing the name maps to be consistent with the new state. */
BKE_main_namemap_remove_name(&bmain, &new_group->id, new_group->id.name + 2);
new_group->id.lib = library;
BKE_id_new_name_validate(&bmain, &bmain.nodetrees, &new_group->id, nullptr, false);
if (library) {