[Bf-blender-cvs] [c56bbf60d85] blender2.8: Outliner: reorganize collection related display modes.

Brecht Van Lommel noreply at git.blender.org
Tue Apr 24 14:04:35 CEST 2018


Commit: c56bbf60d85f502e4fecef70060e0d450be2c239
Author: Brecht Van Lommel
Date:   Mon Apr 23 20:39:05 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBc56bbf60d85f502e4fecef70060e0d450be2c239

Outliner: reorganize collection related display modes.

* "Scenes" now shows for each scene lists of all view layers, collections and
  objects contained in it. This is the place to see all collections and objects
  in the scene even if they are not used in any view layer. Objects are nested
  according to parenting here.
* "Collections" now shows all collections in the view layer, and the objects
  in those collections. Objects are not nested by parenting, only collections
  since it would be too confusing if the children are in a different collection.
* "Groups" is unchanged.
* "View Layer" was removed, replaced by "Collections".

Part of T54790.

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

M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/editors/space_outliner/outliner_collections.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_outliner/outliner_edit.c
M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_ops.c
M	source/blender/editors/space_outliner/outliner_select.c
M	source/blender/editors/space_outliner/outliner_tools.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_280.c b/source/blender/blenloader/intern/versioning_280.c
index 15f43f02150..f036d018a03 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -513,7 +513,7 @@ void do_versions_after_linking_280(Main *main)
 					if (view_layer->spacetype == SPACE_OUTLINER) {
 						SpaceOops *soutliner = (SpaceOops *)view_layer;
 
-						soutliner->outlinevis = SO_VIEW_LAYER;
+						soutliner->outlinevis = SO_COLLECTIONS;
 
 						if (BLI_listbase_count_at_most(&layer->layer_collections, 2) == 1) {
 							if (soutliner->treestore == NULL) {
@@ -927,10 +927,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 							          SO_SEQUENCE,
 							          SO_DATABLOCKS,
 							          SO_ID_ORPHANS,
-							          SO_VIEW_LAYER,
 							          SO_COLLECTIONS))
 							{
-								so->outlinevis = SO_VIEW_LAYER;
+								so->outlinevis = SO_COLLECTIONS;
 							}
 						}
 					}
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 7c3bccd1385..fd2b463f91b 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -86,17 +86,6 @@ static int collections_editor_poll(bContext *C)
 	return (so != NULL) && (so->outlinevis == SO_COLLECTIONS);
 }
 
-static int view_layer_editor_poll(bContext *C)
-{
-	SpaceOops *so = CTX_wm_space_outliner(C);
-	return (so != NULL) && (so->outlinevis == SO_VIEW_LAYER);
-}
-
-static int outliner_either_collection_editor_poll(bContext *C)
-{
-	SpaceOops *so = CTX_wm_space_outliner(C);
-	return (so != NULL) && (ELEM(so->outlinevis, SO_VIEW_LAYER, SO_COLLECTIONS));
-}
 
 static int outliner_objects_collection_poll(bContext *C)
 {
@@ -113,7 +102,7 @@ static int outliner_objects_collection_poll(bContext *C)
 		return 0;
 	}
 
-	return ELEM(so->outlinevis, SO_VIEW_LAYER, SO_COLLECTIONS, SO_GROUPS);
+	return ELEM(so->outlinevis, SO_COLLECTIONS, SO_GROUPS);
 }
 
 /* -------------------------------------------------------------------- */
@@ -279,7 +268,7 @@ void OUTLINER_OT_collection_link(wmOperatorType *ot)
  */
 static int collection_unlink_poll(bContext *C)
 {
-	if (view_layer_editor_poll(C) == 0) {
+	if (collections_editor_poll(C) == 0) {
 		return 0;
 	}
 
@@ -973,7 +962,7 @@ void OUTLINER_OT_collection_objects_select(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = collection_objects_select_exec;
-	ot->poll = view_layer_editor_poll;
+	ot->poll = collections_editor_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1023,10 +1012,10 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
 	}
 
 	switch (soops->outlinevis) {
-		case SO_COLLECTIONS:
+		case SO_SCENES:
 			BKE_collection_duplicate(TREESTORE(te)->id, (SceneCollection *)te->directdata);
 			break;
-		case SO_VIEW_LAYER:
+		case SO_COLLECTIONS:
 		case SO_GROUPS:
 			BKE_layer_collection_duplicate(TREESTORE(te)->id, (LayerCollection *)te->directdata);
 			break;
@@ -1047,7 +1036,7 @@ void OUTLINER_OT_collection_duplicate(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = collection_duplicate_exec;
-	ot->poll = outliner_either_collection_editor_poll;
+	ot->poll = collections_editor_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 04602e53697..765c77e4906 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -440,42 +440,16 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
 	for (te = lb->first; te; te = te->next) {
 		tselem = TREESTORE(te);
 		if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
-			/* scene render layers and passes have toggle-able flags too! */
-			if (tselem->type == TSE_R_LAYER) {
+			if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) {
+				/* View layer render toggle. */
 				UI_block_emboss_set(block, UI_EMBOSS_NONE);
 				
-				bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, VIEW_LAYER_RENDER, 0, ICON_CHECKBOX_HLT - 1,
-				                      (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
-				                      UI_UNIT_Y, te->directdata, 0, 0, 0, 0, TIP_("Render this RenderLayer"));
-				UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
-				UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-				
-				UI_block_emboss_set(block, UI_EMBOSS);
-			}
-			else if (tselem->type == TSE_R_PASS) {
-				int *layflag = te->directdata;
-				int passflag = 1 << tselem->nr;
-				
-				UI_block_emboss_set(block, UI_EMBOSS_NONE);
-				
-				
-				bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, passflag, 0, ICON_CHECKBOX_HLT - 1,
-				                      (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
-				                      UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Render this Pass"));
+				bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, VIEW_LAYER_RENDER, 0, ICON_RESTRICT_RENDER_OFF,
+				                      (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X,
+				                      UI_UNIT_Y, te->directdata, 0, 0, 0, 0, TIP_("Use view layer for rendering"));
 				UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
 				UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
 				
-				layflag++;  /* is lay_xor */
-				if (ELEM(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT,
-				          SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT))
-				{
-					bt = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, passflag, 0, (*layflag & passflag) ? ICON_DOT : ICON_BLANK1,
-					                      (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
-					                      UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Exclude this Pass from Combined"));
-					UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
-					UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-				}
-				
 				UI_block_emboss_set(block, UI_EMBOSS);
 			}
 			else if (tselem->type == TSE_MODIFIER) {
@@ -1067,6 +1041,9 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
 			case TSE_R_LAYER_BASE:
 				ICON_DRAW(ICON_RENDERLAYERS);
 				break;
+			case TSE_SCENE_OBJECTS_BASE:
+				ICON_DRAW(ICON_OUTLINER_OB_GROUP_INSTANCE);
+				break;
 			case TSE_R_LAYER:
 				ICON_DRAW(ICON_RENDERLAYERS);
 				break;
@@ -1419,8 +1396,8 @@ static void outliner_draw_tree_element(
 			te->flag |= TE_ACTIVE; // for lookup in display hierarchies
 		}
 		
-		if ((soops->outlinevis == SO_COLLECTIONS) && (tselem->type == TSE_SCENE_COLLECTION) && (te->parent == NULL)) {
-			/* Master collection can't expand/collapse. */
+		if ((soops->outlinevis == SO_COLLECTIONS) && (tselem->type == TSE_R_LAYER)) {
+			/* View layer in collections 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 */
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index f5d117922c0..2447a7e4a60 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -261,11 +261,11 @@ static void do_item_rename(const Scene *scene, ARegion *ar, TreeElement *te, Tre
 	bool add_textbut = false;
 
 	/* can't rename rna datablocks entries or listbases */
-	if (ELEM(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE)) {
+	if (ELEM(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE, TSE_SCENE_OBJECTS_BASE)) {
 		/* do nothing */;
 	}
 	else if (ELEM(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
-	              TSE_DRIVER_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
+	              TSE_DRIVER_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE))
 	{
 		BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
 	}
@@ -2084,7 +2084,14 @@ static int outliner_parenting_poll(bContext *C)
 	SpaceOops *soops = CTX_wm_space_outliner(C);
 
 	if (soops) {
-		return ELEM(soops->outlinevis, SO_VIEW_LAYER, SO_COLLECTIONS, SO_GROUPS);
+		if (soops->outlinevis == SO_SCENES) {
+			return true;
+		}
+
+		if (soops->outlinevis == SO_COLLECTIONS) {
+			return ((soops->filter & SO_FILTER_ENABLE) &&
+			        (soops->filter & SO_FILTER_NO_COLLECTION));
+		}
 	}
 
 	return false;
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 6bee26a0cf4..a0de3a06556 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -161,7 +161,7 @@ typedef enum {
 
 /* The outliner display modes that support the filter system.
  * Note: keep it synced with space_outliner.py */
-#define SUPPORT_FILTER_OUTLINER(soops_) ELEM((soops_)->outlinevis, SO_VIEW_LAYER, SO_COLLECTIONS)
+#define SUPPORT_FILTER_OUTLINER(soops_) ((soops_)->outlinevis == SO_COLLECTIONS)
 
 /* Outliner Searching --
  *
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 543a0b0f8d7..2c4670d9ea3 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -67,7 +67,7 @@ static int outliner_item_drag_drop_poll(bContext *C)
 	SpaceOops *soops = CTX_wm_space_outliner(C);
 	return ED_operator_outliner_active(C) &&
 	       /* Only collection display modes supported for now. Others need more design work */
-	       ELEM(soops->outlinevis, SO_VIEW_LAYER, SO_COLLECTIONS, SO_GROUPS);
+	       ELEM(soops->outlinevis, SO_COLLECTIONS, SO_GROUPS);
 }
 
 static TreeElement *outliner_item_drag_element_f

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list