[Bf-blender-cvs] [84e16c49924] master: Fix `BLI_libblock_ensure_unique_name` not ignoring linked IDs.

Bastien Montagne noreply at git.blender.org
Tue Jun 1 12:30:57 CEST 2021


Commit: 84e16c499243f6bdeb29f684408f4d206b919ee8
Author: Bastien Montagne
Date:   Tue Jun 1 11:46:43 2021 +0200
Branches: master
https://developer.blender.org/rB84e16c499243f6bdeb29f684408f4d206b919ee8

Fix `BLI_libblock_ensure_unique_name` not ignoring linked IDs.

This function would considere that there was a name conflict even in
case existing ID would be a linked one.

This is only a (symbolic) perforance improvement and logical fix, since
`BKE_id_new_name_validate` would not do that mistake anyway.

===================================================================

M	source/blender/blenkernel/intern/lib_id.c

===================================================================

diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c
index 8a6fb5b3e9e..2dd0dc2c097 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -2198,7 +2198,7 @@ void BLI_libblock_ensure_unique_name(Main *bmain, const char *name)
 
   /* search for id */
   idtest = BLI_findstring(lb, name + 2, offsetof(ID, name) + 2);
-  if (idtest != NULL) {
+  if (idtest != NULL && !ID_IS_LINKED(idtest)) {
     /* BKE_id_new_name_validate also takes care of sorting. */
     BKE_id_new_name_validate(lb, idtest, NULL, false);
     bmain->is_memfile_undo_written = false;



More information about the Bf-blender-cvs mailing list