UI: Don't render missing linked material previews, avoids UI freezing

Opening the material selector after reloading files could cause long UI
freezes, because some linked in materials don't have the preview stored
in the source file. So Blender would keep rerendering it after every
file load, which may involve compiling OpenGL shaders, which again
freezes the UI typically. This was reported as quite an issue for the
Heist Production by the Blender Studio.

Don't render these missing material previews from linked data-blocks
anymore.

Differential Revision: https://developer.blender.org/D16538

Reviewed by: Brecht Van Lommel, Jeroen Bakker
This commit is contained in:
Julian Eisel 2022-11-23 11:37:02 +01:00
parent c464fd724b
commit 571f373155
1 changed files with 8 additions and 0 deletions

View File

@ -1605,6 +1605,14 @@ static void icon_preview_startjob_all_sizes(void *customdata,
continue;
}
/* Workaround: Skip preview renders for linked IDs. Preview rendering can be slow and even
* freeze the UI (e.g. on Eevee shader compilation). And since the result will never be stored
* in a file, it's done every time the file is reloaded, so this becomes a frequent annoyance.
*/
if (!use_solid_render_mode && ip->id && ID_IS_LINKED(ip->id)) {
continue;
}
#ifndef NDEBUG
{
int size_index = icon_previewimg_size_index_get(cur_size, prv);