Outliner: Master Collection always expanded

This is part of T53495.

This makes sure the master collection is always expanded and you don't even get
the expand/collapse icons for it.

This is only for the Collecions (currently Master Collection Tree) option, not
for active view layer.
This commit is contained in:
Dalai Felinto 2018-01-02 14:00:03 -02:00
parent e1238bcced
commit a9fe94245b
2 changed files with 9 additions and 3 deletions

View File

@ -1411,8 +1411,11 @@ static void outliner_draw_tree_element(
te->flag |= TE_ACTIVE; // for lookup in display hierarchies
}
if ((soops->outlinevis == SO_COLLECTIONS) && te->parent == NULL) {
/* Master collection can't expand/collapse. */
}
else if (te->subtree.first || (tselem->type == 0 && te->idcode == ID_SCE) || (te->flag & TE_LAZY_CLOSED)) {
/* open/close icon, only when sublevels, except for scene */
if (te->subtree.first || (tselem->type == 0 && te->idcode == ID_SCE) || (te->flag & TE_LAZY_CLOSED)) {
int icon_x;
if (tselem->type == 0 && ELEM(te->idcode, ID_OB, ID_SCE))
icon_x = startx;

View File

@ -1490,7 +1490,7 @@ static void inline outliner_add_scene_collection_objects(
}
}
static void outliner_add_scene_collection_recursive(
static TreeElement *outliner_add_scene_collection_recursive(
SpaceOops *soops, ListBase *tree, SceneCollection *scene_collection, TreeElement *parent_ten)
{
TreeElement *ten = outliner_add_element(soops, tree, scene_collection, parent_ten, TSE_SCENE_COLLECTION, 0);
@ -1505,12 +1505,15 @@ static void outliner_add_scene_collection_recursive(
}
outliner_make_hierarchy(&ten->subtree);
return ten;
}
static void outliner_add_collections_master(SpaceOops *soops, Scene *scene)
{
SceneCollection *master_collection = BKE_collection_master(&scene->id);
outliner_add_scene_collection_recursive(soops, &soops->tree, master_collection, NULL);
TreeElement *ten = outliner_add_scene_collection_recursive(soops, &soops->tree, master_collection, NULL);
/* Master Collection should always be expanded. */
TREESTORE(ten)->flag &= ~TSE_CLOSED;
}
/* ======================================================= */