diff options
author | Julian Eisel <julian@blender.org> | 2021-12-02 20:52:12 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-12-02 21:14:50 +0300 |
commit | e38532773bedfed2e1a404677a1212132ad8eda2 (patch) | |
tree | 3ae6252cd95ed9f76d91dbae78a4ed4831a8913d /source/blender | |
parent | 27b70428c1b1be6db4d66af2be5a7726c4690331 (diff) |
Asset Browser: Nest all catalogs under the "All" item
This makes the relation to the catalogs and the behavior more clear.
Part of T93582.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_file/asset_catalog_tree_view.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/editors/space_file/asset_catalog_tree_view.cc b/source/blender/editors/space_file/asset_catalog_tree_view.cc index 2b1bcb3ae0d..7d81693b39d 100644 --- a/source/blender/editors/space_file/asset_catalog_tree_view.cc +++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc @@ -79,7 +79,7 @@ class AssetCatalogTreeView : public ui::AbstractTreeView { ui::BasicTreeViewItem &build_catalog_items_recursive(ui::TreeViewItemContainer &view_parent_item, AssetCatalogTreeItem &catalog); - void add_all_item(); + AssetCatalogTreeViewAllItem &add_all_item(); void add_unassigned_item(); bool is_active_catalog(CatalogID catalog_id) const; }; @@ -197,11 +197,12 @@ AssetCatalogTreeView::AssetCatalogTreeView(::AssetLibrary *library, void AssetCatalogTreeView::build_tree() { - add_all_item(); + AssetCatalogTreeViewAllItem &all_item = add_all_item(); + all_item.set_collapsed(false); if (catalog_tree_) { - catalog_tree_->foreach_root_item([this](AssetCatalogTreeItem &item) { - ui::BasicTreeViewItem &child_view_item = build_catalog_items_recursive(*this, item); + catalog_tree_->foreach_root_item([this, &all_item](AssetCatalogTreeItem &item) { + ui::BasicTreeViewItem &child_view_item = build_catalog_items_recursive(all_item, item); /* Open root-level items by default. */ child_view_item.set_collapsed(false); @@ -225,7 +226,7 @@ ui::BasicTreeViewItem &AssetCatalogTreeView::build_catalog_items_recursive( return view_item; } -void AssetCatalogTreeView::add_all_item() +AssetCatalogTreeViewAllItem &AssetCatalogTreeView::add_all_item() { FileAssetSelectParams *params = params_; @@ -237,6 +238,7 @@ void AssetCatalogTreeView::add_all_item() }); item.set_is_active_fn( [params]() { return params->asset_catalog_visibility == FILE_SHOW_ASSETS_ALL_CATALOGS; }); + return item; } void AssetCatalogTreeView::add_unassigned_item() |