WIP: Brush assets project #106303
|
@ -505,7 +505,7 @@ void ui_rna_collection_search_update_fn(
|
|||
}
|
||||
|
||||
cis->index = items_list.size();
|
||||
cis->iconid = ICON_NONE;
|
||||
cis->iconid = visit_params.icon_id.value_or(ICON_NONE);
|
||||
cis->is_id = false;
|
||||
cis->name_prefix_offset = 0;
|
||||
cis->has_sep_char = visit_params.info.has_value();
|
||||
|
|
|
@ -59,10 +59,13 @@
|
|||
|
||||
#include "BLT_translation.hh"
|
||||
|
||||
#include "AS_asset_catalog_path.hh"
|
||||
#include "AS_asset_catalog_tree.hh"
|
||||
#include "AS_asset_library.hh"
|
||||
#include "AS_asset_representation.hh"
|
||||
|
||||
#include "UI_resources.hh"
|
||||
|
||||
#include "curves_sculpt_intern.hh"
|
||||
#include "paint_intern.hh"
|
||||
#include "sculpt_intern.hh"
|
||||
|
@ -1185,7 +1188,7 @@ static void visit_asset_catalog_for_search_fn(
|
|||
const bContext *C,
|
||||
PointerRNA *ptr,
|
||||
PropertyRNA * /*prop*/,
|
||||
const char * /*edit_text*/,
|
||||
const char *edit_text,
|
||||
FunctionRef<void(StringPropertySearchVisitParams)> visit_fn)
|
||||
{
|
||||
const bUserAssetLibrary *user_library = get_asset_library_from_prop(*ptr);
|
||||
|
@ -1199,6 +1202,13 @@ static void visit_asset_catalog_for_search_fn(
|
|||
return;
|
||||
}
|
||||
|
||||
if (edit_text && edit_text[0] != '\0') {
|
||||
asset_system::AssetCatalogPath edit_path = edit_text;
|
||||
if (!library->catalog_service().find_catalog_by_path(edit_path)) {
|
||||
visit_fn(StringPropertySearchVisitParams{edit_path.str(), std::nullopt, ICON_ADD});
|
||||
}
|
||||
}
|
||||
|
||||
const asset_system::AssetCatalogTree &full_tree = library->catalog_service().catalog_tree();
|
||||
full_tree.foreach_item([&](const asset_system::AssetCatalogTreeItem &item) {
|
||||
visit_fn(StringPropertySearchVisitParams{item.catalog_path().str(), std::nullopt});
|
||||
|
|
|
@ -546,6 +546,7 @@ struct StringPropertySearchVisitParams {
|
|||
std::string text;
|
||||
/** Additional information to display. */
|
||||
std::optional<std::string> info;
|
||||
std::optional<int> icon_id;
|
||||
};
|
||||
|
||||
enum eStringPropertySearchFlag {
|
||||
|
|
Loading…
Reference in New Issue