48 return std::string(dir_normalized);
55 "top level directory must be given for on-disk asset library");
57 std::string top_dir_trailing_slash = normalize_directory_path(top_level_directory);
60 if (lib_uptr_ptr !=
nullptr) {
61 CLOG_INFO(&
LOG, 2,
"get \"%s\" (cached)", top_dir_trailing_slash.c_str());
70 lib->on_blend_save_handler_register();
71 lib->load(top_dir_trailing_slash);
74 CLOG_INFO(&
LOG, 2,
"get \"%s\" (loaded)", top_dir_trailing_slash.c_str());
95 instance_ = std::make_unique<AssetLibraryService>();
139 if (asset_lib_uptr->catalog_service->has_unsaved_changes()) {
void BKE_blender_atexit_register(void(*func)(void *user_data), void *user_data)
void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt)
void BKE_callback_remove(bCallbackFuncStore *funcstore, eCbEvent evt)
#define BLI_assert_msg(a, msg)
File and directory operations.
void BLI_path_normalize_dir(const char *relabase, char *dir) ATTR_NONNULL(2)
#define STRNCPY(dst, src)
#define CLOG_INFO(clg_ref, level,...)
ValueIterator values() const
void add_new(const Key &key, const Value &value)
const Value * lookup_ptr(const Key &key) const
constexpr bool is_empty() const
constexpr const char * c_str() const
AssetLibrary * get_asset_library_current_file()
bool has_any_unsaved_catalogs() const
static AssetLibraryService * get()
static bool atexit_handler_registered_
AssetLibrary * get_asset_library_on_disk(StringRefNull top_level_directory)
static std::unique_ptr< AssetLibraryService > instance_
std::unique_ptr< AssetLibrary > AssetLibraryPtr
void app_handler_register()
bCallbackFuncStore on_load_callback_store_
void app_handler_unregister()
AssetLibraryPtr current_file_library_
static void allocate_service_instance()
Map< std::string, AssetLibraryPtr > on_disk_libraries_
static void on_blendfile_load(struct Main *, struct PointerRNA **, const int, void *)
void(* func)(struct Main *, struct PointerRNA **, int num_pointers, void *arg)