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.
This commit is contained in:
Bastien Montagne 2022-10-19 10:27:56 +02:00
parent 358155a8da
commit e5782df4ab
1 changed files with 4 additions and 0 deletions

View File

@ -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 {