32 std::unique_ptr<AssetMetaData> metadata,
35 relative_identifier_(relative_asset_path),
44 throw std::invalid_argument(
"Passed ID is not an asset");
50 if (
const ExternalAsset *extern_asset = std::get_if<ExternalAsset>(&asset_);
51 extern_asset && extern_asset->preview_)
70 ExternalAsset &extern_asset = std::get<ExternalAsset>(asset_);
87 return std::get<ExternalAsset>(asset_).preview_;
95 return std::get<ExternalAsset>(asset_).name;
103 return ID_Type(std::get<ExternalAsset>(asset_).id_type);
109 return *
id->asset_data;
111 return *std::get<ExternalAsset>(asset_).metadata_;
124 return relative_identifier_;
132 owner_asset_library_.root_path().c_str(),
141 char blend_path[ 1282];
151 return owner_asset_library_.import_method_;
156 if (!owner_asset_library_.import_method_) {
159 return owner_asset_library_.may_override_import_method_;
164 return owner_asset_library_.use_relative_path_;
169 return this->
is_local_id() ? std::get<ID *>(asset_) :
nullptr;
174 return std::holds_alternative<ID *>(asset_);
179 return owner_asset_library_;
Main runtime representation of an asset.
bool BKE_blendfile_library_path_explode(const char *path, char *r_dir, char **r_group, char **r_name)
int BKE_icon_preview_ensure(struct ID *id, struct PreviewImage *preview)
const char * BKE_idtype_idcode_to_name(short idcode)
const char * BKE_id_name(const ID &id)
PreviewImage * BKE_previewimg_id_get(const ID *id)
PreviewImage * BKE_previewimg_cached_thumbnail_read(const char *name, const char *filepath, int source, bool force_update)
void BKE_previewimg_cached_release(const char *name)
#define BLI_path_join(...)
ID and Library types, which are fundamental for SDNA.
constexpr bool endswith(StringRef suffix) const
AssetRepresentation(StringRef relative_asset_path, StringRef name, int id_type, std::unique_ptr< AssetMetaData > metadata, AssetLibrary &owner_asset_library)
PreviewImage * get_preview() const
std::string full_path() const
AssetLibrary & owner_asset_library() const
friend class AssetLibrary
AssetMetaData & get_metadata() const
ID_Type get_id_type() const
StringRefNull library_relative_identifier() const
AssetWeakReference make_weak_reference() const
std::string full_library_path() const
bool get_use_relative_path() const
std::optional< eAssetImportMethod > get_import_method() const
StringRefNull get_name() const
bool may_override_import_method() const
void ensure_previewable()