Brush Assets: Show new catalog in asset shelf when duplicating brush #120531

Merged
Hans Goudey merged 5 commits from HooglyBoogly/blender:brush-assets-duplicate-show-catalog into brush-assets-project 2024-04-26 18:36:37 +02:00
3 changed files with 6 additions and 10 deletions
Showing only changes of commit 968b9e40de - Show all commits

View File

@ -88,6 +88,8 @@ void type_unlink(const Main &bmain, const AssetShelfType &shelf_type);
int tile_width(const AssetShelfSettings &settings);
int tile_height(const AssetShelfSettings &settings);
AssetShelf *active_shelf_from_area(const ScrArea *area);
int context(const bContext *C, const char *member, bContextDataResult *result);
} // namespace blender::ed::asset::shelf

View File

@ -562,7 +562,7 @@ void region_blend_write(BlendWriter *writer, ARegion *region)
/** \name Asset Shelf Context
* \{ */
static AssetShelf *active_shelf_from_area(const ScrArea *area)
AssetShelf *active_shelf_from_area(const ScrArea *area)
{
const ARegion *shelf_region = BKE_area_find_region_type(area, RGN_TYPE_ASSET_SHELF);
if (!shelf_region) {

View File

@ -47,6 +47,7 @@
#include "ED_asset_list.hh"
#include "ED_asset_mark_clear.hh"
#include "ED_asset_menu_utils.hh"
#include "ED_asset_shelf.hh"
#include "ED_image.hh"
#include "ED_paint.hh"
#include "ED_screen.hh"
@ -891,16 +892,9 @@ static void show_catalog_in_asset_shelf(const bContext &C, const StringRefNull c
if (!area) {
return;
}
HooglyBoogly marked this conversation as resolved Outdated

Code here is duplicated from active_shelf_from_area(), better make this shared.

Code here is duplicated from `active_shelf_from_area()`, better make this shared.
const ARegion *shelf_region = BKE_area_find_region_type(area, RGN_TYPE_ASSET_SHELF);
if (!shelf_region) {
return;
}
if (shelf_region->flag & RGN_FLAG_POLL_FAILED) {
return;
}
const RegionAssetShelf &shelf = *static_cast<const RegionAssetShelf *>(shelf_region->regiondata);
const AssetShelf *shelf = asset::shelf::active_shelf_from_area(area);
if (!BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled(
&U, shelf.active_shelf->idname, catalog_path.c_str()))
&U, shelf->idname, catalog_path.c_str()))
{
return;
}