diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/lib_id_delete.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c index 8075660dcd1..7c5032c97f4 100644 --- a/source/blender/blenkernel/intern/lib_id_delete.c +++ b/source/blender/blenkernel/intern/lib_id_delete.c @@ -305,13 +305,16 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion) /* Since we removed ID from Main, * we also need to unlink its own other IDs usages ourself. */ BKE_libblock_relink_ex(bmain, id, NULL, NULL, 0); - /* Now we can safely mark that ID as not being in Main database anymore. */ - id->tag |= LIB_TAG_NO_MAIN; - /* This is needed because we may not have remapped usages - * of that ID by other deleted ones. */ - // id->us = 0; /* Is it actually? */ } } + + /* Now we can safely mark that ID as not being in Main database anymore. */ + /* NOTE: This needs to be done in a separate loop than above, otherwise some usercounts of + * deleted IDs may not be properly decreased by the remappings (since `NO_MAIN` ID usercounts + * is never affected). */ + for (ID *id = tagged_deleted_ids.first; id; id = id->next) { + id->tag |= LIB_TAG_NO_MAIN; + } } else { /* First tag all datablocks directly from target lib. |