Brush asset shelf popup #119217
|
@ -9,6 +9,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "BLI_function_ref.hh"
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
struct ARegion;
|
||||
struct ARegionType;
|
||||
|
@ -64,6 +65,8 @@ void settings_blend_read_data(BlendDataReader *reader, AssetShelfSettings &setti
|
|||
void settings_set_active_catalog(AssetShelfSettings &settings,
|
||||
const asset_system::AssetCatalogPath &path,
|
||||
bool is_popup = false);
|
||||
blender::StringRef settings_get_active_catalog_path(const AssetShelfSettings &settings,
|
||||
const bool is_popup = false);
|
||||
void settings_set_all_catalog_active(AssetShelfSettings &settings, bool is_popup = false);
|
||||
bool settings_is_active_catalog(const AssetShelfSettings &settings,
|
||||
const asset_system::AssetCatalogPath &path,
|
||||
|
|
|
@ -179,8 +179,11 @@ void AssetView::set_catalog_filter(
|
|||
}
|
||||
|
||||
static std::optional<asset_system::AssetCatalogFilter> catalog_filter_from_shelf_settings(
|
||||
const StringRef catalog_path, const asset_system::AssetLibrary &library)
|
||||
const AssetShelfSettings &settings,
|
||||
const asset_system::AssetLibrary &library,
|
||||
const bool is_popup)
|
||||
{
|
||||
StringRef catalog_path = settings_get_active_catalog_path(settings, is_popup);
|
||||
if (catalog_path.is_empty()) {
|
||||
return {};
|
||||
}
|
||||
|
@ -298,10 +301,8 @@ void build_asset_view(uiLayout &layout,
|
|||
|
||||
const bool is_popup = region.regiontype == RGN_TYPE_TEMPORARY;
|
||||
std::unique_ptr asset_view = std::make_unique<AssetView>(library_ref, shelf, is_popup);
|
||||
const StringRef active_catalog_path = is_popup ? shelf.settings.active_catalog_path_popup :
|
||||
shelf.settings.active_catalog_path;
|
||||
asset_view->set_catalog_filter(
|
||||
catalog_filter_from_shelf_settings(active_catalog_path, *library));
|
||||
catalog_filter_from_shelf_settings(shelf.settings, *library, is_popup));
|
||||
asset_view->set_tile_size(tile_width, tile_height);
|
||||
|
||||
uiBlock *block = uiLayoutGetBlock(&layout);
|
||||
|
|
|
@ -84,6 +84,11 @@ void settings_set_active_catalog(AssetShelfSettings &settings,
|
|||
*active_catalog_path = BLI_strdupn(path.c_str(), path.length());
|
||||
}
|
||||
|
||||
StringRef settings_get_active_catalog_path(const AssetShelfSettings &settings, const bool is_popup)
|
||||
{
|
||||
return is_popup ? settings.active_catalog_path_popup : settings.active_catalog_path;
|
||||
}
|
||||
|
||||
void settings_set_all_catalog_active(AssetShelfSettings &settings, const bool is_popup)
|
||||
{
|
||||
const char **active_catalog_path = is_popup ? &settings.active_catalog_path_popup :
|
||||
|
|
Loading…
Reference in New Issue