64 if (*stop || request.
cancel) {
73 std::string asset_file = entry.online_info.asset_file();
83 sizeof(asset_identifier),
88 entry.datablock_info.name);
94 (*existing)->online_info_set(std::move(entry.online_info));
96 (*existing)->remote_file_status_set(entry.remote_file_status);
102 ListBaseT<FileListInternEntry> entries = {
nullptr};
107 &entry.datablock_info,
118 entry.free_name =
true;
130 const auto wait_for_pages_fn = [&]() {
132 if (*stop || request.
cancel) {
150 std::this_thread::sleep_for(std::chrono::milliseconds(10));
181 already_downloaded_assets.
add(asset.library_relative_identifier(), &asset);
184 float progress_on_disk = 0.0;
195 *progress = progress_on_disk * 0.1f;
204 std::this_thread::sleep_for(std::chrono::milliseconds(20));
206 if (*stop || request.
cancel) {
218 if (*stop || request.
cancel) {
223 job_params, request, stop, do_update, progress, already_downloaded_assets);
265 std::unique_ptr<RemoteLibraryRequest> request = std::make_unique<RemoteLibraryRequest>();
266 request->dirpath =
library.cache_dirpath;
316 "reading callback for a single remote library should only have a single remote "
317 "library request registered (check what the starting callback is requesting)");
Main runtime representation of an asset.
#define BLI_string_join(...)
#define FILE_MAX_LIBEXTRA
#define USER_EXPERIMENTAL_TEST(userdef, member)
#define BLI_assert_msg(a, msg)
const Value * lookup_ptr(const Key &key) const
bool add(const Key &key, const Value &value)
void load_or_reload_catalogs()
eAssetLibraryType library_type() const
StringRefNull name() const
static std::optional< bool > metafiles_in_place(StringRef url)
static std::optional< RemoteLibraryLoadingStatus::Status > status(StringRef url)
static std::optional< TimePoint > last_new_pages_time(StringRef url)
static std::optional< FileSystemTimePoint > loading_start_time(const StringRef url)
static bool handle_timeout(StringRef url)
#define FILEDIR_NBR_ENTRIES_UNSET
void remote_library_request_download(const RemoteLibraryDefinitionRef &library_definition)
std::string remote_library_top_meta_file_path(const RemoteLibraryDefinitionRef &library)
bool read_remote_listing(StringRefNull root_dirpath, StringRefNull asset_library_name, ReportList &reports, RemoteListingEntryProcessFn process_fn, RemoteListingWaitForPagesFn wait_fn=nullptr, std::optional< Timestamp > ignore_before_timestamp=std::nullopt)
const char * BKE_idtype_idcode_to_name(short idcode)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static void filelist_start_job_remote_asset_library(FileListReadJob *job_params)
static void filelist_remote_asset_library_update_loading_flags(RemoteLibraryRequest &request, StringRef remote_url)
char * STRNCPY(char(&dst)[N], const char *src)
static void filelist_readjob_remote_asset_library(FileListReadJob *job_params, bool *stop, bool *do_update, float *progress)
@ FL_ASSETS_INCLUDE_ONLINE
@ ASSET_LIBRARY_USE_REMOTE_URL
int BLI_path_normalize_dir(char *dir, size_t dir_maxncpy) ATTR_NONNULL(1)
void remote_asset_library_request(FileListReadJob *job_params, const asset_system::RemoteLibraryDefinitionRef &library)
struct bUserAssetLibrary * BKE_preferences_asset_library_find_index(const struct UserDef *userdef, int index) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
bool is_filtered_asset_library(FileListInternEntry *file, const char *root, FileListFilter *filter)
void prepare_filter_asset_library(const FileList *filelist, FileListFilter *filter)
void BLI_path_slash_native(char *path) ATTR_NONNULL(1)
void remote_asset_library_load(FileListReadJob *job_params, RemoteLibraryRequest &request, bool *stop, bool *do_update, float *progress)
bool filelist_checkdir_return_always_valid(const FileList *, char[1024+258], const bool)
void filelist_set_readjob_remote_asset_library(FileList *filelist)
void filelist_readjob_load_asset_library_data(FileListReadJob *job_params, bool *do_update)
static void filelist_readjob_remote_asset_library_index_read(FileListReadJob *job_params, RemoteLibraryRequest &request, const bool *stop, bool *do_update, float *, Map< StringRef, asset_system::AssetRepresentation * > &already_downloaded_assets)
const char * fileentry_uiname(const char *root, FileListInternEntry *entry, char *buff)
void filelist_readjob_list_lib_add_datablock(FileListReadJob *job_params, ListBaseT< FileListInternEntry > *entries, BLODataBlockInfo *datablock_info, const bool prefix_relpath_with_group_name, const int idcode, const char *group_name, const std::optional< asset_system::OnlineAssetInfo > online_asset_info=std::nullopt)
@ FILELIST_TAGS_APPLY_FUZZY_SEARCH
bool BLI_is_dir(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void filelist_timer_step_remote_asset_library(FileListReadJob *job_params)
FileUID filelist_uid_generate(FileList *filelist)
void filelist_readjob_recursive_dir_add_items(const bool do_lib, FileListReadJob *job_params, const bool *stop, bool *do_update, float *progress)
static bUserAssetLibrary * lookup_remote_library(const FileListReadJob *job_params)
bool BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool filelist_readjob_append_entries(FileListReadJob *job_params, ListBaseT< FileListInternEntry > *from_entries, int from_entries_num)
ListBaseT< struct FileListInternEntry > entries
char cur_relbase[1024+258]
asset_system::AssetLibrary * load_asset_library
std::optional< std::function< void(asset_system::AssetRepresentation &)> > on_asset_added
Map< std::string, std::unique_ptr< RemoteLibraryRequest > > remote_library_requests
void(*) prepare_filter_fn(const FileList *filelist, FileListFilter *filter)
void(*) timer_step_fn(FileListReadJob *job_params)
bool(*) check_dir_fn(const FileList *filelist, char dirpath[FILE_MAX_LIBEXTRA], const bool do_change)
void(*) start_job_fn(FileListReadJob *job_params)
AssetLibraryReference * asset_library_ref
void(*) read_job_fn(FileListReadJob *job_params, bool *stop, bool *do_update, float *progress)
bool(*) filter_fn(FileListInternEntry *file, const char *root, FileListFilter *filter)
std::atomic< bool > metafiles_in_place
std::atomic< bool > is_downloading
std::atomic< bool > cancel
asset_system::RemoteLibraryLoadingStatus::TimePoint last_new_pages_time
std::optional< asset_system::RemoteLibraryLoadingStatus::FileSystemTimePoint > request_time
std::atomic< bool > new_pages_available