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
diff options
context:
space:
mode:
authorDalai Felinto <dalai@blender.org>2021-06-25 18:12:10 +0300
committerDalai Felinto <dalai@blender.org>2021-06-28 10:34:44 +0300
commitbb2648ebf0022186bdd27e451194388d1fd4cce0 (patch)
treefd0fea92ce48ff812bd5b2abd5cc891ddf0251ae /source/blender/editors/space_outliner
parent2ff490f9e3d61cfc5e18f1eb660aff80da7d021a (diff)
Outliner: View Layers filter for View Layer Mode
This option allow users to see the view layer in context to the others. It is particularly useful to see which view layers have which collections enabled, and their render settings (holdout, ...). This option is off by default. Differential Revision: https://developer.blender.org/D11708
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c3
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c1
-rw-r--r--source/blender/editors/space_outliner/tree/tree_display_view_layer.cc63
3 files changed, 46 insertions, 21 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index cb61e548d53..4fe29d4e9bd 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1090,7 +1090,8 @@ static void outliner_draw_restrictbuts(uiBlock *block,
RestrictPropertiesActive props_active = props_active_parent;
if (te->ys + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && te->ys <= region->v2d.cur.ymax) {
- if (tselem->type == TSE_R_LAYER && (space_outliner->outlinevis == SO_SCENES)) {
+ if (tselem->type == TSE_R_LAYER &&
+ ELEM(space_outliner->outlinevis, SO_SCENES, SO_VIEW_LAYER)) {
if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) {
/* View layer render toggle. */
ViewLayer *layer = te->directdata;
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 728be1ccaaf..a2032fa1dc0 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -331,6 +331,7 @@ static SpaceLink *outliner_create(const ScrArea *UNUSED(area), const Scene *UNUS
space_outliner->outlinevis = SO_VIEW_LAYER;
space_outliner->sync_select_dirty |= WM_OUTLINER_SYNC_SELECT_FROM_ALL;
space_outliner->flag = SO_SYNC_SELECT | SO_MODE_COLUMN;
+ space_outliner->filter = SO_FILTER_NO_VIEW_LAYERS;
/* header */
region = MEM_callocN(sizeof(ARegion), "header for outliner");
diff --git a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc
index f00cf3c34c0..f6cf951498c 100644
--- a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc
@@ -71,33 +71,56 @@ ListBase TreeDisplayViewLayer::buildTree(const TreeSourceData &source_data)
{
ListBase tree = {nullptr};
- view_layer_ = source_data.view_layer;
+ Scene *scene = source_data.scene;
show_objects_ = !(space_outliner_.filter & SO_FILTER_NO_OBJECT);
const bool show_children = (space_outliner_.filter & SO_FILTER_NO_CHILDREN) == 0;
- if (space_outliner_.filter & SO_FILTER_NO_COLLECTION) {
- /* Show objects in the view layer. */
- for (Base *base : List<Base>(view_layer_->object_bases)) {
- TreeElement *te_object = outliner_add_element(
- &space_outliner_, &tree, base->object, nullptr, TSE_SOME_ID, 0);
- te_object->directdata = base;
+ for (auto *view_layer : ListBaseWrapper<ViewLayer>(scene->view_layers)) {
+ if (space_outliner_.filter & SO_FILTER_NO_VIEW_LAYERS) {
+ if (view_layer != source_data.view_layer) {
+ continue;
+ }
}
- if (show_children) {
- outliner_make_object_parent_hierarchy(&tree);
+ TreeElement &te_view_layer = *outliner_add_element(
+ &space_outliner_, &tree, scene, nullptr, TSE_R_LAYER, 0);
+ TREESTORE(&te_view_layer)->flag &= ~TSE_CLOSED;
+ te_view_layer.name = view_layer->name;
+ te_view_layer.directdata = view_layer;
+ view_layer_ = view_layer;
+
+ if (space_outliner_.filter & SO_FILTER_NO_COLLECTION) {
+ /* Show objects in the view layer. */
+ for (Base *base : List<Base>(view_layer_->object_bases)) {
+ TreeElement *te_object = outliner_add_element(&space_outliner_,
+ &te_view_layer.subtree,
+ base->object,
+ &te_view_layer,
+ TSE_SOME_ID,
+ 0);
+ te_object->directdata = base;
+ }
+
+ if (show_children) {
+ outliner_make_object_parent_hierarchy(&tree);
+ }
}
- }
- else {
- /* Show collections in the view layer. */
- TreeElement &ten = *outliner_add_element(
- &space_outliner_, &tree, source_data.scene, nullptr, TSE_VIEW_COLLECTION_BASE, 0);
- ten.name = IFACE_("Scene Collection");
- TREESTORE(&ten)->flag &= ~TSE_CLOSED;
-
- add_view_layer(ten.subtree, ten);
- if (show_children) {
- add_layer_collection_objects_children(ten);
+ else {
+ /* Show collections in the view layer. */
+ TreeElement &ten = *outliner_add_element(&space_outliner_,
+ &te_view_layer.subtree,
+ source_data.scene,
+ &te_view_layer,
+ TSE_VIEW_COLLECTION_BASE,
+ 0);
+ ten.name = IFACE_("Scene Collection");
+ TREESTORE(&ten)->flag &= ~TSE_CLOSED;
+
+ add_view_layer(ten.subtree, ten);
+ if (show_children) {
+ add_layer_collection_objects_children(ten);
+ }
}
}