Fix #144065: Do not transfer special user count (e.g. the fake user) when duplicating.

This commit is contained in:
Bastien Montagne
2025-08-08 12:30:04 +02:00
parent 62d1c3d998
commit d5bc0fb4bb
5 changed files with 8 additions and 5 deletions

View File

@@ -675,7 +675,7 @@ Brush *BKE_brush_duplicate(Main *bmain,
if (!is_subprocess) {
/* This code will follow into all ID links using an ID tagged with ID_TAG_NEW. */
BKE_libblock_relink_to_newid(bmain, &new_brush->id, 0);
BKE_libblock_relink_to_newid(bmain, &new_brush->id, ID_REMAP_SKIP_USER_CLEAR);
#ifndef NDEBUG
/* Call to `BKE_libblock_relink_to_newid` above is supposed to have cleared all those flags. */

View File

@@ -772,7 +772,8 @@ Collection *BKE_collection_duplicate(Main *bmain,
* using the original obdata ID, leading to them being falsly detected as being in Edit mode,
* and therefore not remapping their obdata to the newly duplicated one.
* See #139715. */
BKE_libblock_relink_to_newid(bmain, &collection_new->id, ID_REMAP_FORCE_OBDATA_IN_EDITMODE);
BKE_libblock_relink_to_newid(
bmain, &collection_new->id, ID_REMAP_FORCE_OBDATA_IN_EDITMODE | ID_REMAP_SKIP_USER_CLEAR);
#ifndef NDEBUG
/* Call to `BKE_libblock_relink_to_newid` above is supposed to have cleared all those flags. */

View File

@@ -2664,7 +2664,8 @@ Object *BKE_object_duplicate(Main *bmain,
* using the original obdata ID, leading to them being falsly detected as being in Edit mode,
* and therefore not remapping their obdata to the newly duplicated one.
* See #139715. */
BKE_libblock_relink_to_newid(bmain, &obn->id, ID_REMAP_FORCE_OBDATA_IN_EDITMODE);
BKE_libblock_relink_to_newid(
bmain, &obn->id, ID_REMAP_FORCE_OBDATA_IN_EDITMODE | ID_REMAP_SKIP_USER_CLEAR);
#ifndef NDEBUG
/* Call to `BKE_libblock_relink_to_newid` above is supposed to have cleared all those flags. */

View File

@@ -1983,7 +1983,8 @@ Scene *BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type)
* using the original obdata ID, leading to them being falsly detected as being in Edit mode,
* and therefore not remapping their obdata to the newly duplicated one.
* See #139715. */
BKE_libblock_relink_to_newid(bmain, &sce_copy->id, ID_REMAP_FORCE_OBDATA_IN_EDITMODE);
BKE_libblock_relink_to_newid(
bmain, &sce_copy->id, ID_REMAP_FORCE_OBDATA_IN_EDITMODE | ID_REMAP_SKIP_USER_CLEAR);
#ifndef NDEBUG
/* Call to `BKE_libblock_relink_to_newid` above is supposed to have cleared all those

View File

@@ -2342,7 +2342,7 @@ static void copy_object_set_idnew(bContext *C)
Main *bmain = CTX_data_main(C);
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
BKE_libblock_relink_to_newid(bmain, &ob->id, 0);
BKE_libblock_relink_to_newid(bmain, &ob->id, ID_REMAP_SKIP_USER_CLEAR);
}
CTX_DATA_END;