Fix asset list not providing some previews

Fixes preview images not showing up in asset-view templates or the in
development asset shelf.

The sliding-window optimization to only load previews that are in view
(or close to it) can't really be used by the asset-list API, since
figuring out what's actually in view is a bit tricky. So we have to
ensure all previews are loaded for now.
This commit is contained in:
Julian Eisel
2023-05-16 17:43:09 +02:00
parent 74b5e62d2a
commit 122adc9e69

View File

@@ -218,9 +218,10 @@ void AssetList::ensurePreviewsJob(const bContext *C)
int numfiles = filelist_files_ensure(files);
filelist_cache_previews_set(files, true);
filelist_file_cache_slidingwindow_set(files, 128);
/* TODO fetch all previews for now. */
filelist_file_cache_block(files, numfiles / 2);
/* Add one extra entry to ensure nothing is lost because of integer division. */
filelist_file_cache_slidingwindow_set(files, numfiles / 2 + 1);
filelist_file_cache_block(files, 0);
filelist_cache_previews_update(files);
{