38 if (temp_lib_context_) {
45 return asset_->local_id();
50 const char *asset_name = asset_->get_name().c_str();
51 std::string blend_file_path = asset_->full_library_path();
54 &bmain, blend_file_path.c_str(), id_type, asset_name, &reports);
56 if (temp_lib_context_ ==
nullptr || temp_lib_context_->temp_id ==
nullptr) {
58 &reports,
RPT_ERROR,
"Unable to load %s from %s", asset_name, blend_file_path.c_str());
62 BLI_assert(
GS(temp_lib_context_->temp_id->name) == id_type);
63 return temp_lib_context_->temp_id;
72 return reinterpret_cast<AssetTempIDConsumer *
>(
73 MEM_new<AssetTemporaryIDConsumer>(__func__,
asset));
87 if (!(consumer_ && bmain && reports)) {
95 return consumer->
import_id(id_type, *bmain, *reports);
Main runtime representation of an asset.
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
external readfile function prototypes.
TempLibraryContext * BLO_library_temp_load_id(Main *real_main, const char *blend_file_path, short idcode, const char *idname, ReportList *reports)
void BLO_library_temp_free(TempLibraryContext *temp_lib_ctx)
ID and Library types, which are fundamental for SDNA.
Read Guarded memory(de)allocation.
NonCopyable(const NonCopyable &other)=delete
NonMovable(NonMovable &&other)=delete
ID * import_id(ID_Type id_type, Main &bmain, ReportList &reports)
~AssetTemporaryIDConsumer()
AssetTemporaryIDConsumer(const asset_system::AssetRepresentation *asset)
AssetTempIDConsumer * temp_id_consumer_create(const blender::asset_system::AssetRepresentation *asset)
ID * temp_id_consumer_ensure_local_id(AssetTempIDConsumer *consumer, ID_Type id_type, Main *bmain, ReportList *reports)
void temp_id_consumer_free(AssetTempIDConsumer **consumer)