diff options
Diffstat (limited to 'source/blender/editors/space_outliner/tree/tree_display_view_layer.cc')
-rw-r--r-- | source/blender/editors/space_outliner/tree/tree_display_view_layer.cc | 63 |
1 files changed, 43 insertions, 20 deletions
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); + } } } |