Outliner: Don't show empty base elements in the library overrides mode

In the library overrides mode, in some situations there would be empty
base elements like "Collections" or "Objects". Don't show them, it's
confusing wihout use. Code just failed to consider that case.
This commit is contained in:
Julian Eisel 2022-03-24 18:38:21 +01:00
parent 511dfb7743
commit a6214ce7ac
Notes: blender-bot 2024-04-11 14:26:06 +02:00
Referenced by issue #95802, Library Override - Outliner UI/UX
1 changed files with 7 additions and 0 deletions

View File

@ -104,6 +104,13 @@ ListBase TreeDisplayOverrideLibrary::add_library_contents(Main &mainvar)
}
}
/* Remove ID base elements that turn out to be empty. */
LISTBASE_FOREACH_MUTABLE (TreeElement *, te, &tree) {
if (BLI_listbase_is_empty(&te->subtree)) {
outliner_free_tree_element(te, &tree);
}
}
return tree;
}