Brush Assets: Add catalog option to asset pushing operator #118382

Merged
Hans Goudey merged 26 commits from HooglyBoogly/blender:brush-assets-save-catalog-option into brush-assets-project 2024-02-21 14:03:41 +01:00
1 changed files with 2 additions and 4 deletions
Showing only changes of commit 4a187a1389 - Show all commits

View File

@ -1271,6 +1271,8 @@ static asset_system::AssetCatalog &asset_library_ensure_catalog(
static asset_system::AssetCatalog &asset_library_ensure_catalogs_in_path(
asset_system::AssetLibrary &library, const asset_system::AssetCatalogPath &path)
{
/* Adding multiple catalogs in a path at a time with #AssetCatalogService::create_catalog()
* doesn't work; add each potentially new catalog in the hierarchy manually here. */
asset_system::AssetCatalogPath parent = "";
path.iterate_components([&](StringRef component_name, bool is_last_component) {

Creating a catalog with missing parent catalogs should work fine, the parents would be created with create_missing_catalogs(). Is this not working for you?

Creating a catalog with missing parent catalogs should work fine, the parents would be created with `create_missing_catalogs()`. Is this not working for you?

No, that's the infinite recursion I was mentioning in chat. It creates the missing parent catalogs with a null catalog ID and an empty simple name. If you want, you should be able to reproduce it by calling asset_library_ensure_catalog instead of asset_library_ensure_catalogs_in_path below.

No, that's the infinite recursion I was mentioning in chat. It creates the missing parent catalogs with a null catalog ID and an empty simple name. If you want, you should be able to reproduce it by calling `asset_library_ensure_catalog` instead of `asset_library_ensure_catalogs_in_path` below.
asset_library_ensure_catalog(library, parent / component_name);
@ -1418,8 +1420,6 @@ static void visit_asset_catalog_for_search_fn(
return;
}
// asset_system::AssetLibrary *library = asset::list::library_get_once_available(
// user_library_to_library_ref(*user_library));
asset_system::AssetLibrary *library = AS_asset_library_load(
CTX_data_main(C), user_library_to_library_ref(*user_library));
if (!library) {
@ -1428,8 +1428,6 @@ static void visit_asset_catalog_for_search_fn(
asset_system::AssetCatalogTree &full_tree = *library->catalog_service->get_catalog_tree();
full_tree.foreach_item([&](const asset_system::AssetCatalogTreeItem &item) {
// StringPropertySearchVisitParams visit_params{};
// visit_params.text = item.catalog_path();
visit_fn(StringPropertySearchVisitParams{item.catalog_path().str(), std::nullopt});
});
}