diff options
author | Sebastian Herholz <sebastian.herholz@intel.com> | 2022-11-09 11:13:08 +0300 |
---|---|---|
committer | Sebastian Herholz <sebastian.herholz@intel.com> | 2022-11-09 11:13:08 +0300 |
commit | 98398f5a5da09955543efa47a84b51d5a03b8574 (patch) | |
tree | 2c7f0edaafa7b62fcaa4ab30583a54c8877d8221 /source/blender/blenkernel/intern/asset_library.cc | |
parent | 3e3ec87846b264a87b50431abb4180e4f0f2193c (diff) | |
parent | 638bf05a23e1ef7dddd3b5d42d9521d8849a4375 (diff) |
Merge branch 'master' into cycles_path_guidingcycles_path_guiding
Diffstat (limited to 'source/blender/blenkernel/intern/asset_library.cc')
-rw-r--r-- | source/blender/blenkernel/intern/asset_library.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/asset_library.cc b/source/blender/blenkernel/intern/asset_library.cc index 968873cbcbe..b8420af1168 100644 --- a/source/blender/blenkernel/intern/asset_library.cc +++ b/source/blender/blenkernel/intern/asset_library.cc @@ -10,6 +10,7 @@ #include "BKE_main.h" #include "BKE_preferences.h" +#include "BLI_fileops.h" #include "BLI_path_util.h" #include "DNA_asset_types.h" @@ -19,6 +20,13 @@ bool blender::bke::AssetLibrary::save_catalogs_when_file_is_saved = true; +blender::bke::AssetLibrary *BKE_asset_library_load(const Main *bmain, + const AssetLibraryReference &library_reference) +{ + blender::bke::AssetLibraryService *service = blender::bke::AssetLibraryService::get(); + return service->get_asset_library(bmain, library_reference); +} + /** * Loading an asset library at this point only means loading the catalogs. Later on this should * invoke reading of asset representations too. @@ -172,4 +180,26 @@ void AssetLibrary::refresh_catalog_simplename(struct AssetMetaData *asset_data) } STRNCPY(asset_data->catalog_simple_name, catalog->simple_name.c_str()); } + +Vector<AssetLibraryReference> all_valid_asset_library_refs() +{ + Vector<AssetLibraryReference> result; + int i; + LISTBASE_FOREACH_INDEX (const bUserAssetLibrary *, asset_library, &U.asset_libraries, i) { + if (!BLI_is_dir(asset_library->path)) { + continue; + } + AssetLibraryReference library_ref{}; + library_ref.custom_library_index = i; + library_ref.type = ASSET_LIBRARY_CUSTOM; + result.append(library_ref); + } + + AssetLibraryReference library_ref{}; + library_ref.custom_library_index = -1; + library_ref.type = ASSET_LIBRARY_LOCAL; + result.append(library_ref); + return result; +} + } // namespace blender::bke |