Fix #122189: Unused IDs with 'extra' usages not shown in Unused Outliner view.

The only ID usages that make it a 'used' ID are its own 'fake user'
flag, and normal refcounting usages from other IDs.

This was already the behavior of the Purge operation, but the Outliner
view would still hide IDs who were only used by shallow 'extra' usages
(typically the UI, e.g. the Image Editor).
This commit is contained in:
Bastien Montagne
2024-05-24 11:28:44 +02:00
parent 63e2124aa9
commit ef8fe6a4ab

View File

@@ -64,7 +64,7 @@ ListBase TreeDisplayIDOrphans::build_tree(const TreeSourceData &source_data)
/* Add the orphaned data-blocks - these will not be added with any subtrees attached. */
for (ID *id : List<ID>(lbarray[a])) {
if (ID_REAL_USERS(id) <= 0) {
if (ID_REFCOUNTING_USERS(id) <= 0) {
add_element((te) ? &te->subtree : &tree, id, nullptr, te, TSE_SOME_ID, 0);
}
}
@@ -76,7 +76,7 @@ ListBase TreeDisplayIDOrphans::build_tree(const TreeSourceData &source_data)
bool TreeDisplayIDOrphans::datablock_has_orphans(ListBase &lb) const
{
for (ID *id : List<ID>(lb)) {
if (ID_REAL_USERS(id) <= 0) {
if (ID_REFCOUNTING_USERS(id) <= 0) {
return true;
}
}