From 122adc9e69dee574c47ba321eb99cf8066fdee44 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 16 May 2023 17:43:09 +0200 Subject: [PATCH] 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. --- source/blender/editors/asset/intern/asset_list.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/asset/intern/asset_list.cc b/source/blender/editors/asset/intern/asset_list.cc index 401a0b5382f..17d9e134660 100644 --- a/source/blender/editors/asset/intern/asset_list.cc +++ b/source/blender/editors/asset/intern/asset_list.cc @@ -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); {