diff --git a/source/blender/editors/asset/intern/asset_library_reference_enum.cc b/source/blender/editors/asset/intern/asset_library_reference_enum.cc index 826d6ac446a..ed79d3afa84 100644 --- a/source/blender/editors/asset/intern/asset_library_reference_enum.cc +++ b/source/blender/editors/asset/intern/asset_library_reference_enum.cc @@ -20,6 +20,8 @@ #include "UI_resources.hh" #include "RNA_define.hh" +#include "RNA_enum_types.hh" +#include "RNA_prototypes.h" #include "ED_asset_library.h" @@ -78,25 +80,16 @@ const EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf(const bool int totitem = 0; if (include_generated) { - const EnumPropertyItem generated_items[] = { - {ASSET_LIBRARY_ALL, "ALL", 0, "All", "Show assets from all of the listed asset libraries"}, - RNA_ENUM_ITEM_SEPR, - {ASSET_LIBRARY_LOCAL, - "LOCAL", - ICON_CURRENT_FILE, - "Current File", - "Show the assets currently available in this Blender session"}, - {ASSET_LIBRARY_ESSENTIALS, - "ESSENTIALS", - 0, - "Essentials", - "Show the basic building blocks and utilities coming with Blender"}, - {0, nullptr, 0, nullptr, nullptr}, - }; - /* Add predefined libraries that are generated and not simple directories that can be written * to. */ - RNA_enum_items_add(&item, &totitem, generated_items); + BLI_assert(rna_enum_asset_library_type_items[0].value == ASSET_LIBRARY_ALL); + RNA_enum_item_add(&item, &totitem, &rna_enum_asset_library_type_items[0]); + RNA_enum_item_add_separator(&item, &totitem); + + BLI_assert(rna_enum_asset_library_type_items[1].value == ASSET_LIBRARY_LOCAL); + RNA_enum_item_add(&item, &totitem, &rna_enum_asset_library_type_items[1]); + BLI_assert(rna_enum_asset_library_type_items[2].value == ASSET_LIBRARY_ESSENTIALS); + RNA_enum_item_add(&item, &totitem, &rna_enum_asset_library_type_items[2]); } /* Add separator if needed. */ diff --git a/source/blender/makesrna/intern/rna_asset.cc b/source/blender/makesrna/intern/rna_asset.cc index dfa08819e7a..c1fa7cf9d78 100644 --- a/source/blender/makesrna/intern/rna_asset.cc +++ b/source/blender/makesrna/intern/rna_asset.cc @@ -20,10 +20,18 @@ #include "rna_internal.h" const EnumPropertyItem rna_enum_asset_library_type_items[] = { - {ASSET_LIBRARY_LOCAL, "LOCAL", 0, "Local", ""}, - {ASSET_LIBRARY_ALL, "ALL", 0, "All", ""}, - {ASSET_LIBRARY_ESSENTIALS, "ESSENTIALS", 0, "Essentials", ""}, - {ASSET_LIBRARY_CUSTOM, "CUSTOM", 0, "Custom", ""}, + {ASSET_LIBRARY_ALL, "ALL", 0, "All", "Show assets from all of the listed asset libraries"}, + {ASSET_LIBRARY_LOCAL, + "LOCAL", + 0, + "Current File", + "Show the assets currently available in this Blender session"}, + {ASSET_LIBRARY_ESSENTIALS, + "ESSENTIALS", + 0, + "Essentials", + "Show the basic building blocks and utilities coming with Blender"}, + {ASSET_LIBRARY_CUSTOM, "CUSTOM", 0, "Custom", "All external 'normal' asset repositories"}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -701,7 +709,7 @@ PropertyRNA *rna_def_asset_library_reference_common(StructRNA *srna, const char *set) { PropertyRNA *prop = RNA_def_property(srna, "asset_library_reference", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, rna_enum_dummy_NULL_items); + RNA_def_property_enum_items(prop, rna_enum_asset_library_type_items); RNA_def_property_enum_funcs(prop, get, set, "rna_asset_library_reference_itemf"); return prop;