Fix (unreported): Outliner Data API tree subtree expansion

The changes in rB70151e41dc02 broke subtree expansion in the Data API
display mode because the closed subtrees are empty lists. Move the empty
subtree check from `outliner_item_openclose` to the walk navigation
code to prevent the issue.
This commit is contained in:
Nathan Craddock 2020-08-26 21:29:45 -06:00
parent 489b5790cf
commit 7f3febf4c0
2 changed files with 5 additions and 5 deletions

View File

@ -152,11 +152,8 @@ void OUTLINER_OT_highlight_update(wmOperatorType *ot)
/* Open or close a tree element, optionally toggling all children recursively */
void outliner_item_openclose(TreeElement *te, bool open, bool toggle_all)
{
if (BLI_listbase_is_empty(&te->subtree)) {
return;
}
TreeStoreElem *tselem = TREESTORE(te);
if (open) {
tselem->flag &= ~TSE_CLOSED;
}

View File

@ -1661,7 +1661,10 @@ static TreeElement *outliner_walk_right(SpaceOutliner *space_outliner,
if (!toggle_all && TSELEM_OPEN(tselem, space_outliner) && !BLI_listbase_is_empty(&te->subtree)) {
te = te->subtree.first;
}
else {
/* Prevent opening leaf elements in the tree.
* This cannot be done in `outliner_item_openclose` because the Data API display mode subtrees
* are empty unless expanded. */
else if (!BLI_listbase_is_empty(&te->subtree)) {
outliner_item_openclose(te, true, toggle_all);
}