UI: Improved Preview Feedback and Reduced Flickering #108486

Merged
Julian Eisel merged 5 commits from Harley/blender:BrowserWait into main 2023-06-19 12:24:50 +02:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit 6d23dd43ec - Show all commits

View File

@ -1627,8 +1627,9 @@ 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)) {
if (entry->typeflag & FILE_TYPE_BLENDERLIB &&
((entry->flags & FILE_ENTRY_BLENDERLIB_NO_PREVIEW) || (entry->typeflag & FILE_TYPE_DIR)))
Harley marked this conversation as resolved Outdated

This makes the if statement unnecessarily complex and the comment above has no relation to this. Try to make if statements check one coherent condition, not multiple ones. So better make this a separate if statement with its own return.

This makes the `if` statement unnecessarily complex and the comment above has no relation to this. Try to make `if` statements check one coherent condition, not multiple ones. So better make this a separate `if` statement with its own `return`.
{
return;
}

View File

@ -358,7 +358,8 @@ 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);
Harley marked this conversation as resolved Outdated

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.

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.
ED_area_tag_refresh(area);
}
break;