[Bf-blender-cvs] [db9f0527e84] blender2.8: Outliner: Change All Scenes to Scenes and make it focus on compositing

Dalai Felinto noreply at git.blender.org
Fri Jan 19 15:20:48 CET 2018


Commit: db9f0527e8458524bbdf8b48f54d442bf9d870cf
Author: Dalai Felinto
Date:   Thu Jan 18 18:30:30 2018 -0200
Branches: blender2.8
https://developer.blender.org/rBdb9f0527e8458524bbdf8b48f54d442bf9d870cf

Outliner: Change All Scenes to Scenes and make it focus on compositing

We have different ways of explore the scene objects, namely View Layer and
Collections. This change let us focus on compositing elements only such as:

* View Layers
** Collections
** Render Passes
* Freestyle
* Grease Pencil?

Not included in this commit is an option to handle filtering of
collections passes, ... Not sure if we would like, though.
Since they are all properly nested under a "Collections" / "Passes"
parent.

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

M	source/blender/blenloader/intern/versioning_260.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/editors/space_outliner/outliner_edit.c
M	source/blender/editors/space_outliner/outliner_tree.c
M	source/blender/editors/space_outliner/space_outliner.c
M	source/blender/makesdna/DNA_outliner_types.h
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c
index bf5b19b92ee..d26c30e6d31 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -2454,14 +2454,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main)
 						SpaceOops *so = (SpaceOops *)sl;
 
 						if (!ELEM(so->outlinevis,
-						          SO_ALL_SCENES,
+						          SO_SCENES,
 						          SO_GROUPS,
 						          SO_LIBRARIES,
 						          SO_SEQUENCE,
 						          SO_DATABLOCKS,
 						          SO_USERDEF))
 						{
-							so->outlinevis = SO_ALL_SCENES;
+							so->outlinevis = SO_SCENES;
 						}
 					}
 				}
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 9a4d171f7fa..1f92852e54f 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -898,7 +898,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 							SpaceOops *so = (SpaceOops *)sl;
 
 							if (!ELEM(so->outlinevis,
-									  SO_ALL_SCENES,
+									  SO_SCENES,
 									  SO_GROUPS,
 									  SO_LIBRARIES,
 									  SO_SEQUENCE,
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 96692799e0d..50e81cdde01 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -2085,7 +2085,7 @@ static int outliner_parenting_poll(bContext *C)
 	SpaceOops *soops = CTX_wm_space_outliner(C);
 
 	if (soops) {
-		return ELEM(soops->outlinevis, SO_ALL_SCENES, SO_GROUPS);
+		return ELEM(soops->outlinevis, SO_SCENES, SO_GROUPS);
 	}
 
 	return false;
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 851e19a3650..78956db6de2 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -92,7 +92,11 @@
 
 /* prototypes */
 static void outliner_add_layer_collections_recursive(
-        SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten);
+        SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten,
+        const bool show_objects);
+static void outliner_add_view_layer(
+        SpaceOops *soops, ListBase *tree, TreeElement *parent,
+        Scene *scene, ViewLayer *layer, const bool show_objects);
 static void outliner_make_hierarchy(ListBase *lb);
 
 /* ********************************************************* */
@@ -382,12 +386,21 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
 	TreeElement *tenla = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
 	int a;
 	
-	tenla->name = IFACE_("RenderLayers");
+	tenla->name = IFACE_("View Layers");
 	for (a = 0, view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next, a++) {
 		TreeElement *tenlay = outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
 		tenlay->name = view_layer->name;
 		tenlay->directdata = &view_layer->flag;
-		outliner_add_passes(soops, tenlay, &sce->id, view_layer);
+
+		TreeElement *te_view_layers;
+		te_view_layers = outliner_add_element(soops, &tenlay->subtree, sce, tenlay, TSE_LAYER_COLLECTION_BASE, 0);
+		te_view_layers->name = IFACE_("Collections");
+		outliner_add_view_layer(soops, &te_view_layers->subtree, te_view_layers, sce, view_layer, false);
+
+		TreeElement *te_passes;
+		te_passes = outliner_add_element(soops, &tenlay->subtree, sce, tenlay, TSE_LAYER_COLLECTION_BASE, 0);
+		te_passes->name = IFACE_("Passes");
+		outliner_add_passes(soops, te_passes, &sce->id, view_layer);
 	}
 	
 	// TODO: move this to the front?
@@ -396,8 +409,6 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
 		
 	outliner_add_element(soops, lb, sce->gpd, te, 0, 0);
 	
-	outliner_add_element(soops,  lb, sce->world, te, 0, 0);
-
 #ifdef WITH_FREESTYLE
 	if (STREQ(sce->view_render->engine_id, RE_engine_id_BLENDER_RENDER) && (sce->r.mode & R_EDGE_FRS))
 		outliner_add_line_styles(soops, lb, sce, te);
@@ -1268,7 +1279,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 
 	if ((type != TSE_LAYER_COLLECTION) && (te->idcode == ID_GR)) {
 		Group *group = (Group *)id;
-		outliner_add_layer_collections_recursive(soops, &te->subtree, id, &group->view_layer->layer_collections, NULL);
+		outliner_add_layer_collections_recursive(soops, &te->subtree, id, &group->view_layer->layer_collections, NULL, true);
 	}
 
 	return te;
@@ -1458,7 +1469,8 @@ static bool outliner_layer_collections_reorder_poll(
 }
 
 static void outliner_add_layer_collections_recursive(
-        SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten)
+        SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten,
+        const bool show_objects)
 {
 	for (LayerCollection *collection = layer_collections->first; collection; collection = collection->next) {
 		TreeElement *ten = outliner_add_element(soops, tree, id, parent_ten, TSE_LAYER_COLLECTION, 0);
@@ -1468,18 +1480,22 @@ static void outliner_add_layer_collections_recursive(
 		ten->reinsert = outliner_layer_collections_reorder;
 		ten->reinsert_poll = outliner_layer_collections_reorder_poll;
 
-		outliner_add_layer_collections_recursive(soops, &ten->subtree, id, &collection->layer_collections, ten);
-		for (LinkData *link = collection->object_bases.first; link; link = link->next) {
-			Base *base = (Base *)link->data;
-			TreeElement *te_object = outliner_add_element(soops, &ten->subtree, base->object, ten, 0, 0);
-			te_object->directdata = base;
+		outliner_add_layer_collections_recursive(soops, &ten->subtree, id, &collection->layer_collections, ten, show_objects);
+		if (show_objects) {
+			for (LinkData *link = collection->object_bases.first; link; link = link->next) {
+				Base *base = (Base *)link->data;
+				TreeElement *te_object = outliner_add_element(soops, &ten->subtree, base->object, ten, 0, 0);
+				te_object->directdata = base;
+			}
 		}
 		outliner_make_hierarchy(&ten->subtree);
 	}
 }
-static void outliner_add_view_layer(SpaceOops *soops, Scene *scene, ViewLayer *layer)
+
+static void outliner_add_view_layer(SpaceOops *soops, ListBase *tree, TreeElement *parent,
+                                    Scene *scene, ViewLayer *layer, const bool show_objects)
 {
-	outliner_add_layer_collections_recursive(soops, &soops->tree, &scene->id, &layer->layer_collections, NULL);
+	outliner_add_layer_collections_recursive(soops, tree, &scene->id, &layer->layer_collections, parent, show_objects);
 }
 
 static void outliner_scene_collections_reorder(
@@ -2220,28 +2236,17 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
 			lib->id.newid = NULL;
 		
 	}
-	else if (soops->outlinevis == SO_ALL_SCENES) {
+	else if (soops->outlinevis == SO_SCENES) {
 		Scene *sce;
 		for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
 			te = outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
 			tselem = TREESTORE(te);
-			if (sce == scene && show_opened)
-				tselem->flag &= ~TSE_CLOSED;
 
-			FOREACH_SCENE_OBJECT(scene, ob)
-			{
-				outliner_add_element(soops, &te->subtree, ob, te, 0, 0);
+			if (sce == scene && show_opened) {
+				tselem->flag &= ~TSE_CLOSED;
 			}
-			FOREACH_SCENE_OBJECT_END
 
 			outliner_make_hierarchy(&te->subtree);
-
-			/* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
-			FOREACH_SCENE_OBJECT(scene, ob)
-			{
-				ob->id.newid = NULL;
-			}
-			FOREACH_SCENE_OBJECT_END
 		}
 	}
 	else if (soops->outlinevis == SO_GROUPS) {
@@ -2311,7 +2316,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
 			outliner_make_hierarchy(&soops->tree);
 		}
 		else {
-			outliner_add_view_layer(soops, scene, view_layer);
+			outliner_add_view_layer(soops, &soops->tree, NULL, scene, view_layer, true);
 		}
 	}
 	else if (soops->outlinevis == SO_COLLECTIONS) {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 95fd9857b65..1529e6143c3 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -163,7 +163,7 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
 
-	if (!ELEM(soops->outlinevis, SO_ALL_SCENES, SO_GROUPS, SO_VIEW_LAYER, SO_COLLECTIONS)) {
+	if (!ELEM(soops->outlinevis, SO_SCENES, SO_GROUPS, SO_VIEW_LAYER, SO_COLLECTIONS)) {
 		return false;
 	}
 
diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h
index 438bb1dadfe..8e48bbdde1a 100644
--- a/source/blender/makesdna/DNA_outliner_types.h
+++ b/source/blender/makesdna/DNA_outliner_types.h
@@ -104,6 +104,7 @@ enum {
 #define TSE_GP_LAYER        37  /* NO ID */
 #define TSE_LAYER_COLLECTION 38
 #define TSE_SCENE_COLLECTION 39
+#define TSE_LAYER_COLLECTION_BASE 40
 
 
 /* Check whether given TreeStoreElem should have a real ID in its ->id member. */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 2d748a2800e..16ddce72dae 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -330,7 +330,7 @@ typedef enum eSpaceOutliner_StateFilter {
 
 /* SpaceOops->outlinevis */
 typedef enum eSpaceOutliner_Mode {
-	SO_ALL_SCENES     = 0,
+	SO_SCENES         = 0,
 	/* SO_CUR_SCENE      = 1, */  /* deprecated! */
 	/* SO_VISIBLE        = 2, */  /* deprecated! */
 	/* SO_SELECTED       = 3, */  /* deprecated! */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 25434a696b1..b2892f7e9a9 100644
--- 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list