Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-23 21:39:05 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-24 15:01:51 +0300
commitc56bbf60d85f502e4fecef70060e0d450be2c239 (patch)
tree6ab0eb774498b637c23dbf9768392e41ba63d461 /source
parentd67b120f172290fc7a1b4cfb5432e03017426f6e (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/versioning_280.c5
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c23
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c43
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c13
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h2
-rw-r--r--source/blender/editors/space_outliner/outliner_ops.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c7
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c191
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c6
-rw-r--r--source/blender/makesdna/DNA_outliner_types.h7
-rw-r--r--source/blender/makesdna/DNA_space_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_space.c6
13 files changed, 96 insertions, 214 deletions
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_find(SpaceOops *soops, ARegion *ar, const wmEvent *event)
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 73f450e9392..800f36d35a0 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -781,7 +781,12 @@ eOLDrawState tree_element_type_active(
case TSE_CONSTRAINT:
return tree_element_active_constraint(C, scene, view_layer, te, tselem, set);
case TSE_R_LAYER:
- return tree_element_active_renderlayer(C, scene, view_layer, te, tselem, set);
+ if (soops->outlinevis == SO_SCENES) {
+ return tree_element_active_renderlayer(C, scene, view_layer, te, tselem, set);
+ }
+ else {
+ return OL_DRAWSEL_NONE;
+ }
case TSE_POSEGRP:
return tree_element_active_posegroup(C, scene, view_layer, te, tselem, set);
case TSE_SEQUENCE:
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 89c0712c217..f51acff3ba2 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -2080,7 +2080,7 @@ static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soop
else if (datalevel == TSE_DRIVER_BASE) {
/* do nothing... no special ops needed yet */
}
- else if (ELEM(datalevel, TSE_R_LAYER_BASE, TSE_R_LAYER, TSE_R_PASS)) {
+ else if (ELEM(datalevel, TSE_R_LAYER_BASE, TSE_R_LAYER)) {
/*WM_operator_name_call(C, "OUTLINER_OT_renderdata_operation", WM_OP_INVOKE_REGION_WIN, NULL)*/
}
else if (datalevel == TSE_ID_BASE) {
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index cd171bbc8ce..60473853e18 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -94,10 +94,12 @@
static void outliner_add_layer_collections_recursive(
SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten,
const bool show_objects);
+static TreeElement *outliner_add_scene_collection_recursive(
+ SpaceOops *soops, ListBase *tree, Scene *scene, SceneCollection *scene_collection, TreeElement *parent_ten);
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);
+static void outliner_make_object_parent_hierarchy(ListBase *lb);
/* ********************************************************* */
/* Persistent Data */
@@ -253,98 +255,6 @@ static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curB
}
}
-/* -------------------------------------------------------- */
-
-#define LOG2I(x) (int)(log(x) / M_LN2)
-
-static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, ViewLayer *view_layer)
-{
- TreeStoreElem *tselem = NULL;
- TreeElement *te = NULL;
-
- /* log stuff is to convert bitflags (powers of 2) to small integers,
- * in order to not overflow short tselem->nr */
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_COMBINED));
- te->name = IFACE_("Combined");
- te->directdata = &view_layer->passflag;
-
- /* save cpu cycles, but we add the first to invoke an open/close triangle */
- tselem = TREESTORE(tenla);
- if (tselem->flag & TSE_CLOSED)
- return;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z));
- te->name = IFACE_("Z");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_VECTOR));
- te->name = IFACE_("Vector");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_NORMAL));
- te->name = IFACE_("Normal");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_UV));
- te->name = IFACE_("UV");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_MIST));
- te->name = IFACE_("Mist");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXOB));
- te->name = IFACE_("Index Object");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXMA));
- te->name = IFACE_("Index Material");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_RGBA));
- te->name = IFACE_("Color");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_DIFFUSE));
- te->name = IFACE_("Diffuse");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SPEC));
- te->name = IFACE_("Specular");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SHADOW));
- te->name = IFACE_("Shadow");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_AO));
- te->name = IFACE_("AO");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFLECT));
- te->name = IFACE_("Reflection");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFRACT));
- te->name = IFACE_("Refraction");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDIRECT));
- te->name = IFACE_("Indirect");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_ENVIRONMENT));
- te->name = IFACE_("Environment");
- te->directdata = &view_layer->passflag;
-
- te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_EMIT));
- te->name = IFACE_("Emit");
- te->directdata = &view_layer->passflag;
-}
-
-#undef LOG2I
-
static bool outliner_animdata_test(AnimData *adt)
{
if (adt)
@@ -382,31 +292,36 @@ static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce,
static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
{
- ViewLayer *view_layer;
+ /* View layers */
TreeElement *tenla = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
- int a;
-
tenla->name = IFACE_("View Layers");
+
+ ViewLayer *view_layer;
+ int a;
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;
+ }
- 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);
+ /* Collections */
+ outliner_add_scene_collection_recursive(soops, lb, sce, sce->collection, NULL);
- 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);
+ /* Objects */
+ tenla = outliner_add_element(soops, lb, sce, te, TSE_SCENE_OBJECTS_BASE, 0);
+ tenla->name = IFACE_("Objects");
+ FOREACH_SCENE_OBJECT_BEGIN(sce, ob)
+ {
+ outliner_add_element(soops, &tenla->subtree, ob, NULL, 0, 0);
}
+ FOREACH_SCENE_OBJECT_END;
+ outliner_make_object_parent_hierarchy(&tenla->subtree);
- // TODO: move this to the front?
+ /* Animation Data */
if (outliner_animdata_test(sce->adt))
outliner_add_element(soops, lb, sce, te, TSE_ANIM_DATA, 0);
+ /* Grease Pencil */
outliner_add_element(soops, lb, sce->gpd, te, 0, 0);
}
@@ -1475,7 +1390,6 @@ static void outliner_add_layer_collections_recursive(
te_object->directdata = base;
}
}
- outliner_make_hierarchy(&ten->subtree);
}
}
@@ -1544,9 +1458,16 @@ static bool outliner_scene_collections_reorder_poll(
return true;
}
-BLI_INLINE void outliner_add_scene_collection_init(TreeElement *te, SceneCollection *collection)
+BLI_INLINE void outliner_add_scene_collection_init(TreeElement *te, Scene *scene, SceneCollection *collection)
{
- te->name = collection->name;
+ if (collection == scene->collection) {
+ // Don't display name of master collection
+ te->name = IFACE_("Collections");
+ }
+ else {
+ te->name = collection->name;
+ }
+
te->directdata = collection;
te->reinsert = outliner_scene_collections_reorder;
te->reinsert_poll = outliner_scene_collections_reorder_poll;
@@ -1561,38 +1482,32 @@ BLI_INLINE void outliner_add_scene_collection_objects(
}
static TreeElement *outliner_add_scene_collection_recursive(
- SpaceOops *soops, ListBase *tree, ID *id, SceneCollection *scene_collection, TreeElement *parent_ten)
+ SpaceOops *soops, ListBase *tree, Scene *scene, SceneCollection *scene_collection, TreeElement *parent_ten)
{
- TreeElement *ten = outliner_add_element(soops, tree, id, parent_ten, TSE_SCENE_COLLECTION, 0);
- outliner_add_scene_collection_init(ten, scene_collection);
- outliner_add_scene_collection_objects(soops, &ten->subtree, scene_collection, ten);
+ TreeElement *ten = outliner_add_element(soops, tree, &scene->id, parent_ten, TSE_SCENE_COLLECTION, 0);
+ outliner_add_scene_collection_init(ten, scene, scene_collection);
+
+ if (soops->outlinevis != SO_SCENES) {
+ outliner_add_scene_collection_objects(soops, &ten->subtree, scene_collection, ten);
+ }
for (SceneCollection *scene_collection_nested = scene_collection->scene_collections.first;
scene_collection_nested != NULL;
scene_collection_nested = scene_collection_nested->next)
{
- outliner_add_scene_collection_recursive(soops, &ten->subtree, id, scene_collection_nested, ten);
+ outliner_add_scene_collection_recursive(soops, &ten->subtree, scene, scene_collection_nested, ten);
}
- outliner_make_hierarchy(&ten->subtree);
return ten;
}
-static void outliner_add_collections(SpaceOops *soops, Scene *scene)
-{
- SceneCollection *master_collection = BKE_collection_master(&scene->id);
- TreeElement *ten = outliner_add_scene_collection_recursive(soops, &soops->tree, &scene->id, master_collection, NULL);
- /* Master Collection should always be expanded. */
- TREESTORE(ten)->flag &= ~TSE_CLOSED;
-}
-
/* ======================================================= */
/* Generic Tree Building helpers - order these are called is top to bottom */
/* Hierarchy --------------------------------------------- */
/* make sure elements are correctly nested */
-static void outliner_make_hierarchy(ListBase *lb)
+static void outliner_make_object_parent_hierarchy(ListBase *lb)
{
TreeElement *te, *ten, *tep;
TreeStoreElem *tselem;
@@ -2234,14 +2149,13 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
tselem->flag &= ~TSE_CLOSED;
}
- outliner_make_hierarchy(&te->subtree);
+ outliner_make_object_parent_hierarchy(&te->subtree);
}
}
else if (soops->outlinevis == SO_GROUPS) {
Group *group;
for (group = mainvar->group.first; group; group = group->id.next) {
te = outliner_add_element(soops, &soops->tree, group, NULL, 0, 0);
- outliner_make_hierarchy(&te->subtree);
}
}
else if (soops->outlinevis == SO_SEQUENCE) {
@@ -2283,29 +2197,22 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
else if (soops->outlinevis == SO_ID_ORPHANS) {
outliner_add_orphaned_datablocks(mainvar, soops);
}
- else if (soops->outlinevis == SO_VIEW_LAYER) {
+ else if (soops->outlinevis == SO_COLLECTIONS) {
+ int a = BLI_findindex(&scene->view_layers, view_layer);
+ TreeElement *tenlay = outliner_add_element(soops, &soops->tree, scene, te, TSE_R_LAYER, a);
+ tenlay->name = view_layer->name;
+ tenlay->directdata = &view_layer->flag;
+ TREESTORE(tenlay)->flag &= ~TSE_CLOSED;
+
if ((soops->filter & SO_FILTER_ENABLE) && (soops->filter & SO_FILTER_NO_COLLECTION)) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- TreeElement *te_object = outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
+ TreeElement *te_object = outliner_add_element(soops, &tenlay->subtree, base->object, NULL, 0, 0);
te_object->directdata = base;
}
- outliner_make_hierarchy(&soops->tree);
- }
- else {
- outliner_add_view_layer(soops, &soops->tree, NULL, scene, view_layer, true);
- }
- }
- else if (soops->outlinevis == SO_COLLECTIONS) {
- if ((soops->filter & SO_FILTER_ENABLE) && (soops->filter & SO_FILTER_NO_COLLECTION)) {
- FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
- {
- outliner_add_element(soops, &soops->tree, ob, NULL, 0, 0);
- }
- FOREACH_SCENE_OBJECT_END;
- outliner_make_hierarchy(&soops->tree);
+ outliner_make_object_parent_hierarchy(&tenlay->subtree);
}
else {
- outliner_add_collections(soops, scene);
+ outliner_add_view_layer(soops, &tenlay->subtree, NULL, scene, view_layer, true);
}
}
else {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index a0bdb53d398..5c4d2b98055 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_SCENES, SO_GROUPS, SO_VIEW_LAYER, SO_COLLECTIONS)) {
+ if (!ELEM(soops->outlinevis, SO_SCENES, SO_GROUPS, SO_COLLECTIONS)) {
return false;
}
@@ -176,7 +176,7 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *
switch (te->idcode) {
case ID_SCE:
- return (ELEM(tselem->type, TSE_R_LAYER_BASE, TSE_R_LAYER, TSE_R_PASS));
+ return (ELEM(tselem->type, TSE_R_LAYER_BASE, TSE_R_LAYER));
case ID_OB:
return (ELEM(tselem->type, TSE_MODIFIER_BASE, TSE_CONSTRAINT_BASE));
/* Other codes to ignore? */
@@ -437,7 +437,7 @@ static void outliner_main_region_message_subscribe(
.notify = ED_region_do_msg_notify_tag_redraw,
};
- if (ELEM(soops->outlinevis, SO_VIEW_LAYER, SO_COLLECTIONS)) {
+ if (soops->outlinevis == SO_COLLECTIONS) {
WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw);
}
}
diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h
index 8e48bbdde1a..b968bcebeb5 100644
--- a/source/blender/makesdna/DNA_outliner_types.h
+++ b/source/blender/makesdna/DNA_outliner_types.h
@@ -84,7 +84,7 @@ enum {
#define TSE_PROXY 18
#define TSE_R_LAYER_BASE 19
#define TSE_R_LAYER 20
-#define TSE_R_PASS 21
+/* #define TSE_R_PASS 21 */ /* UNUSED */
#define TSE_LINKED_MAT 22
/* NOTE, is used for light group */
#define TSE_LINKED_LAMP 23
@@ -102,9 +102,10 @@ enum {
#define TSE_KEYMAP_ITEM 35 /* NO ID */
#define TSE_ID_BASE 36 /* NO ID */
#define TSE_GP_LAYER 37 /* NO ID */
-#define TSE_LAYER_COLLECTION 38
-#define TSE_SCENE_COLLECTION 39
+#define TSE_LAYER_COLLECTION 38
+#define TSE_SCENE_COLLECTION 39
#define TSE_LAYER_COLLECTION_BASE 40
+#define TSE_SCENE_OBJECTS_BASE 41
/* 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 61bae6828b2..c312a95c626 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -341,8 +341,7 @@ typedef enum eSpaceOutliner_Mode {
/* SO_USERDEF = 12, */ /* deprecated! */
/* SO_KEYMAP = 13, */ /* deprecated! */
SO_ID_ORPHANS = 14,
- SO_VIEW_LAYER = 15,
- SO_COLLECTIONS = 16,
+ SO_COLLECTIONS = 15,
} eSpaceOutliner_Mode;
/* SpaceOops->storeflag */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 8f95daf9f69..7b73125e738 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2007,10 +2007,8 @@ static void rna_def_space_outliner(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem display_mode_items[] = {
- {SO_VIEW_LAYER, "VIEW_LAYER", 0, "View Layer", "Display the collections of the active view layer"},
- {SO_COLLECTIONS, "COLLECTIONS", 0, "Collections", "Display all collections based on the "
- "master collection hierarchy"},
- {SO_SCENES, "SCENES", 0, "Scenes", "Display composition related data in all scenes"},
+ {SO_COLLECTIONS, "COLLECTIONS", 0, "Collections", "Display collections in the view layer"},
+ {SO_SCENES, "SCENES", 0, "Scenes", "Display scenes and their view layers, collections and objects"},
{SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their data-blocks"},
{SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence data-blocks"},
{SO_LIBRARIES, "LIBRARIES", 0, "Blender File", "Display data of current file and linked libraries"},