# Asset System: Asset Library Loader Moved to [T103188: Asset System: Asset Library Loader](https://developer.blender.org/T103188). - All loader methods should be expected to run in a thread. - Loaders may instantiate and use other loaders. E.g. a `CurrentFileAssetLibraryLoader`. ```cpp class AbstractAssetLibraryLoader { /** The asset library to load into. */ AssetLibrary &library_; public: AssetLibraryLoader(AssetLibrary &library); virtual ~AssetLibraryLoader() = default; virtual load_asset_representations() const = 0; virtual load_asset_preview(const AssetRepresentation &asset) const = 0; virtual load_catalog_definitions() const = 0; /** Actually load the asset for applying or import. */ virtual load_asset(const AssetRepresentation &asset) const = 0; protected: AssetRepresentation &add_asset_representation(AssetIdentifier identifier, ID &) const; AssetRepresentation &add_asset_representation( AssetIdentifier identifier, /* Name to be presented to the user. */ StringRef name, unique_ptr<AssetMetaData> metadata) const; void add_asset_catalog_definition_file( AssetCatalogDefinitionFile &definiton_file, /* Optional to support writing catalogs back. Otherwise catalogs are read-only. */ unique_ptr<AbstractAssetCatalogDefinitionWriter> writer = nullptr) const; }; ``` ```cpp class AssetLibrary { /* ... */ /** The loader for this asset library. */ unique_ptr<AbstractAssetLibraryLoader> loader_; public: AssetLibrary(unique_ptr<AbstractAssetLibraryLoader> loader); static AssetLibrary *load(unique_ptr<AbstractAssetLibraryLoader> loader); }; ``` ## Future - Register libraries? ```cpp void AssetSystem::register_library( StringRef ui_name, AssetLibraryLocation default_location, unique_ptr<AbstractAssetLibraryLoader> loader); ```