WIP: Basic support for registering asset shelf as a type in BPY #104991

Closed
Julian Eisel wants to merge 73 commits from JulianEisel:temp-asset-shelf-type-bpy into asset-shelf

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 3cd93ace24 - Show all commits

View File

@ -3900,10 +3900,14 @@ static void filelist_readjob_all_asset_library(FileListReadJob *job_params,
if (job_params->only_main_data) { if (job_params->only_main_data) {
return; return;
} }
/* TODO propertly update progress? */
/* Count how many asset libraries need to be loaded, for progress reporting. Not very precise. */
int library_count = 0;
asset_system::AssetLibrary::foreach_loaded([&library_count](auto &) { library_count++; }, false);
BLI_assert(filelist->asset_library != nullptr); BLI_assert(filelist->asset_library != nullptr);
int libraries_done_count = 0;
/* The "All" asset library was loaded, which means all other asset libraries are also loaded. /* The "All" asset library was loaded, which means all other asset libraries are also loaded.
* Load their assets from disk into the "All" library. */ * Load their assets from disk into the "All" library. */
asset_system::AssetLibrary::foreach_loaded( asset_system::AssetLibrary::foreach_loaded(
@ -3917,7 +3921,12 @@ static void filelist_readjob_all_asset_library(FileListReadJob *job_params,
job_params->load_asset_library = &nested_library; job_params->load_asset_library = &nested_library;
BLI_strncpy(filelist->filelist.root, root_path.c_str(), sizeof(filelist->filelist.root)); BLI_strncpy(filelist->filelist.root, root_path.c_str(), sizeof(filelist->filelist.root));
filelist_readjob_recursive_dir_add_items(true, job_params, stop, do_update, progress); float progress_this = 0.0f;
filelist_readjob_recursive_dir_add_items(
true, job_params, stop, do_update, &progress_this);
libraries_done_count++;
*progress = float(libraries_done_count) / library_count;
}, },
false); false);
} }