From 7dc8db7cd135e7b26fccc1cc6728cac8b510de70 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 15 Dec 2020 12:56:02 +0100 Subject: Fix failing assert when generating material preview The `!BKE_previewimg_is_finished()` in `icon_preview_startjob_all_sizes()` would fail. Caused by 990bd9acf243ae. We have to be more picky about tagging previews as unfinished after file read. But we also have to consider files stored in old versions and set the unfinished tag as needed. --- source/blender/blenkernel/intern/icons.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/icons.cc b/source/blender/blenkernel/intern/icons.cc index 4bd850094f0..48f5e11778c 100644 --- a/source/blender/blenkernel/intern/icons.cc +++ b/source/blender/blenkernel/intern/icons.cc @@ -659,8 +659,16 @@ void BKE_previewimg_blend_read(BlendDataReader *reader, PreviewImage *prv) } prv->gputexture[i] = NULL; /* For now consider previews read from file as finished to not confuse File Browser preview - * loading. That could be smarter and check if there's a preview job running instead. */ - prv->flag[i] &= ~PRV_UNFINISHED; + * loading. That could be smarter and check if there's a preview job running instead. + * If the preview is tagged as changed, it needs to be updated anyway, so don't remove the tag. + */ + if ((prv->flag[i] & PRV_CHANGED) == 0) { + BKE_previewimg_finish(prv, i); + } + else { + /* Only for old files that didn't write the flag . */ + prv->flag[i] |= PRV_UNFINISHED; + } } prv->icon_id = 0; prv->tag = 0; -- cgit v1.2.3