[Bf-blender-cvs] [7f596d39df] blender2.8: Outliner: Change default display mode to "Active Layer"

Julian Eisel noreply at git.blender.org
Wed Mar 15 20:14:32 CET 2017


Commit: 7f596d39dff110479f01cffcec203c3a98999b64
Author: Julian Eisel
Date:   Wed Mar 15 20:03:35 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB7f596d39dff110479f01cffcec203c3a98999b64

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.

===================================================================

M	source/blender/blenloader/intern/versioning_280.c

===================================================================

diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index ce1ea4e8ed..ac3f703fbd 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -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);
 	}
-
 }




More information about the Bf-blender-cvs mailing list