UI: Improved Preview Feedback and Reduced Flickering #108486
|
@ -1627,8 +1627,15 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry
|
|||
/* If we know this is an external ID without a preview, skip loading the preview. Can save quite
|
||||
* some time in heavy files, because otherwise for each missing preview and for each preview
|
||||
* reload, we'd reopen the .blend to look for the preview. */
|
||||
if (entry->typeflag & FILE_TYPE_BLENDERLIB &&
|
||||
((entry->flags & FILE_ENTRY_BLENDERLIB_NO_PREVIEW) || (entry->typeflag & FILE_TYPE_DIR)))
|
||||
if ((entry->typeflag & FILE_TYPE_BLENDERLIB) &&
|
||||
(entry->flags & FILE_ENTRY_BLENDERLIB_NO_PREVIEW))
|
||||
Harley marked this conversation as resolved
Outdated
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* External ID that is also a directory is never previewed. */
|
||||
if ((entry->typeflag & (FILE_TYPE_BLENDERLIB | FILE_TYPE_DIR)) ==
|
||||
(FILE_TYPE_BLENDERLIB | FILE_TYPE_DIR))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2605,7 +2612,6 @@ bool filelist_cache_previews_update(FileList *filelist)
|
|||
/* Move ownership over icon. */
|
||||
entry->preview_icon_id = preview->icon_id;
|
||||
preview->icon_id = 0;
|
||||
changed = true;
|
||||
}
|
||||
else {
|
||||
/* We want to avoid re-processing this entry continuously!
|
||||
|
@ -2614,6 +2620,7 @@ bool filelist_cache_previews_update(FileList *filelist)
|
|||
entry->flags |= FILE_ENTRY_INVALID_PREVIEW;
|
||||
}
|
||||
entry->flags &= ~FILE_ENTRY_PREVIEW_LOADING;
|
||||
changed = true;
|
||||
}
|
||||
else {
|
||||
BKE_icon_delete(preview->icon_id);
|
||||
|
|
|
@ -358,8 +358,7 @@ static void file_listener(const wmSpaceTypeListenerParams *listener_params)
|
|||
ED_area_tag_refresh(area);
|
||||
break;
|
||||
case ND_SPACE_FILE_PREVIEW:
|
||||
if (sfile->files) {
|
||||
filelist_cache_previews_update(sfile->files);
|
||||
if (sfile->files && filelist_cache_previews_update(sfile->files)) {
|
||||
ED_area_tag_refresh(area);
|
||||
Harley marked this conversation as resolved
Outdated
Julian Eisel
commented
I would leave this where it is and simply set the I would leave this where it is and simply set the `changed` bool in `filelist_cache_previews_update()` to true when removing the `FILE_ENTRY_PREVIEW_LOADING` flag. This can avoid a bunch of unnecessary redraws/refreshes.
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
This makes the
if
statement unnecessarily complex and the comment above has no relation to this. Try to makeif
statements check one coherent condition, not multiple ones. So better make this a separateif
statement with its ownreturn
.