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.
This commit is contained in:
Julian Eisel 2020-12-15 12:56:02 +01:00
parent 9caeb9dfc7
commit 7dc8db7cd1
1 changed files with 10 additions and 2 deletions

View File

@ -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;