Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/asset_catalog_tree_view.cc
| Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | void AssetCatalogTreeView::build_tree() | ||||
| add_unassigned_item(); | add_unassigned_item(); | ||||
| } | } | ||||
| ui::BasicTreeViewItem &AssetCatalogTreeView::build_catalog_items_recursive( | ui::BasicTreeViewItem &AssetCatalogTreeView::build_catalog_items_recursive( | ||||
| ui::TreeViewItemContainer &view_parent_item, AssetCatalogTreeItem &catalog) | ui::TreeViewItemContainer &view_parent_item, AssetCatalogTreeItem &catalog) | ||||
| { | { | ||||
| ui::BasicTreeViewItem &view_item = view_parent_item.add_tree_item<AssetCatalogTreeViewItem>( | ui::BasicTreeViewItem &view_item = view_parent_item.add_tree_item<AssetCatalogTreeViewItem>( | ||||
| &catalog); | &catalog); | ||||
| view_item.is_active([this, &catalog]() { return is_active_catalog(catalog.get_catalog_id()); }); | view_item.set_is_active_fn( | ||||
| [this, &catalog]() { return is_active_catalog(catalog.get_catalog_id()); }); | |||||
| catalog.foreach_child([&view_item, this](AssetCatalogTreeItem &child) { | catalog.foreach_child([&view_item, this](AssetCatalogTreeItem &child) { | ||||
| build_catalog_items_recursive(view_item, child); | build_catalog_items_recursive(view_item, child); | ||||
| }); | }); | ||||
| return view_item; | return view_item; | ||||
| } | } | ||||
| void AssetCatalogTreeView::add_all_item() | void AssetCatalogTreeView::add_all_item() | ||||
| { | { | ||||
| FileAssetSelectParams *params = params_; | FileAssetSelectParams *params = params_; | ||||
| AssetCatalogTreeViewAllItem &item = add_tree_item<AssetCatalogTreeViewAllItem>(IFACE_("All"), | AssetCatalogTreeViewAllItem &item = add_tree_item<AssetCatalogTreeViewAllItem>(IFACE_("All"), | ||||
| ICON_HOME); | ICON_HOME); | ||||
| item.on_activate([params](ui::BasicTreeViewItem & /*item*/) { | item.set_on_activate_fn([params](ui::BasicTreeViewItem & /*item*/) { | ||||
| params->asset_catalog_visibility = FILE_SHOW_ASSETS_ALL_CATALOGS; | params->asset_catalog_visibility = FILE_SHOW_ASSETS_ALL_CATALOGS; | ||||
| WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr); | WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr); | ||||
| }); | }); | ||||
| item.is_active( | item.set_is_active_fn( | ||||
| [params]() { return params->asset_catalog_visibility == FILE_SHOW_ASSETS_ALL_CATALOGS; }); | [params]() { return params->asset_catalog_visibility == FILE_SHOW_ASSETS_ALL_CATALOGS; }); | ||||
| } | } | ||||
| void AssetCatalogTreeView::add_unassigned_item() | void AssetCatalogTreeView::add_unassigned_item() | ||||
| { | { | ||||
| FileAssetSelectParams *params = params_; | FileAssetSelectParams *params = params_; | ||||
| AssetCatalogTreeViewUnassignedItem &item = add_tree_item<AssetCatalogTreeViewUnassignedItem>( | AssetCatalogTreeViewUnassignedItem &item = add_tree_item<AssetCatalogTreeViewUnassignedItem>( | ||||
| IFACE_("Unassigned"), ICON_FILE_HIDDEN); | IFACE_("Unassigned"), ICON_FILE_HIDDEN); | ||||
| item.on_activate([params](ui::BasicTreeViewItem & /*item*/) { | item.set_on_activate_fn([params](ui::BasicTreeViewItem & /*item*/) { | ||||
| params->asset_catalog_visibility = FILE_SHOW_ASSETS_WITHOUT_CATALOG; | params->asset_catalog_visibility = FILE_SHOW_ASSETS_WITHOUT_CATALOG; | ||||
| WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr); | WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr); | ||||
| }); | }); | ||||
| item.is_active( | item.set_is_active_fn( | ||||
| [params]() { return params->asset_catalog_visibility == FILE_SHOW_ASSETS_WITHOUT_CATALOG; }); | [params]() { return params->asset_catalog_visibility == FILE_SHOW_ASSETS_WITHOUT_CATALOG; }); | ||||
| } | } | ||||
| bool AssetCatalogTreeView::is_active_catalog(CatalogID catalog_id) const | bool AssetCatalogTreeView::is_active_catalog(CatalogID catalog_id) const | ||||
| { | { | ||||
| return (params_->asset_catalog_visibility == FILE_SHOW_ASSETS_FROM_CATALOG) && | return (params_->asset_catalog_visibility == FILE_SHOW_ASSETS_FROM_CATALOG) && | ||||
| (params_->catalog_id == catalog_id); | (params_->catalog_id == catalog_id); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 436 Lines • Show Last 20 Lines | |||||