Outliner: Change default display mode to "Active Layer"
We concluded this is going to be the display mode users will need to work with the most, so makes sense to make it the default one. Also, if the opened file only has one collection in the active render layer, we expand it (almost empty list would be misleading). What I had to do to make the expanding work is a bit ugly, but didn't find a better way. During do_version we don't have access to the TreeElement instances, and including ED_outliner.h to share code here should be avoided too.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "BKE_scene.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_mempool.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BLO_readfile.h"
|
||||
@@ -180,6 +181,30 @@ void do_versions_after_linking_280(Main *main)
|
||||
scene->basact = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_OUTLINER) {
|
||||
SpaceOops *soutliner = (SpaceOops *)sl;
|
||||
SceneLayer *layer = BKE_scene_layer_context_active(screen->scene);
|
||||
|
||||
soutliner->outlinevis = SO_ACT_LAYER;
|
||||
|
||||
if (BLI_listbase_count_ex(&layer->layer_collections, 2) == 1) {
|
||||
/* Create a tree store element for the collection. This is normally
|
||||
* done in check_persistent (outliner_tree.c), but we need to access
|
||||
* it here :/ (expand element if it's the only one) */
|
||||
TreeStoreElem *tselem = BLI_mempool_alloc(soutliner->treestore);
|
||||
tselem->type = TSE_LAYER_COLLECTION;
|
||||
tselem->id = layer->layer_collections.first;
|
||||
tselem->nr = tselem->used = 0;
|
||||
tselem->flag &= ~TSE_CLOSED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,5 +227,4 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
||||
/* temporary validation of 280 files for layers */
|
||||
blo_do_version_temporary(main);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user