[Bf-blender-cvs] [e5782df4aba] master: Fix (unreported) error messages about invalid ID usercount when batch-deleting IDs.
Bastien Montagne
noreply at git.blender.org
Wed Oct 19 10:29:58 CEST 2022
Commit: e5782df4aba90ca70fca9a949e5b546abdb12ec3
Author: Bastien Montagne
Date: Wed Oct 19 10:27:56 2022 +0200
Branches: master
https://developer.blender.org/rBe5782df4aba90ca70fca9a949e5b546abdb12ec3
Fix (unreported) error messages about invalid ID usercount when batch-deleting IDs.
Batch-delete by-passes a lot of ID usages handling in to-be-deleted IDs,
so usercount of deleted IDs needs to be manually reset to avoid the
annoying error messages in the console.
===================================================================
M source/blender/blenkernel/intern/lib_id_delete.c
===================================================================
diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c
index a2236089093..ae5dc75c36a 100644
--- a/source/blender/blenkernel/intern/lib_id_delete.c
+++ b/source/blender/blenkernel/intern/lib_id_delete.c
@@ -294,6 +294,10 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion)
* is never affected). */
for (ID *id = tagged_deleted_ids.first; id; id = id->next) {
id->tag |= LIB_TAG_NO_MAIN;
+ /* Usercount needs to be reset artificially, since some usages may not be cleared in batch
+ * deletion (typically, if one deleted ID uses another deleted ID, this may not be cleared by
+ * remapping code, depending on order in which these are handled). */
+ id->us = ID_FAKE_USERS(id);
}
}
else {
More information about the Bf-blender-cvs
mailing list