diff options
Diffstat (limited to 'source/blender/editors/render/render_preview.c')
-rw-r--r-- | source/blender/editors/render/render_preview.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 35130988aba..fbabdc2f3c1 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -1208,19 +1208,13 @@ static void icon_preview_startjob_all_sizes(void *customdata, IconPreview *ip = (IconPreview *)customdata; IconPreviewSize *cur_size; - /* Wait 2s to start rendering icon previews, to not bog down user interaction. - * Particularly important for heavy scenes and Eevee using OpenGL that blocks - * the user interface drawing. */ - for (int i = 0; i < 20; i++) { - PIL_sleep_ms(100); - if (*stop) { - return; - } - } - for (cur_size = ip->sizes.first; cur_size; cur_size = cur_size->next) { PreviewImage *prv = ip->owner; + if (*stop) { + break; + } + if (prv->tag & PRV_TAG_DEFFERED_DELETE) { /* Non-thread-protected reading is not an issue here. */ continue; @@ -1265,10 +1259,6 @@ static void icon_preview_startjob_all_sizes(void *customdata, common_preview_startjob(sp, stop, do_update, progress); shader_preview_free(sp); - - if (*stop) { - break; - } } } @@ -1350,8 +1340,13 @@ void ED_preview_icon_render( BLI_freelistN(&ip.sizes); } -void ED_preview_icon_job( - const bContext *C, void *owner, ID *id, unsigned int *rect, int sizex, int sizey) +void ED_preview_icon_job(const bContext *C, + void *owner, + ID *id, + unsigned int *rect, + int sizex, + int sizey, + const bool delay) { wmJob *wm_job; IconPreview *ip, *old_ip; @@ -1363,7 +1358,7 @@ void ED_preview_icon_job( CTX_wm_window(C), owner, "Icon Preview", - WM_JOB_EXCL_RENDER | WM_JOB_SUSPEND, + WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW); ip = MEM_callocN(sizeof(IconPreview), "icon preview"); @@ -1396,6 +1391,10 @@ void ED_preview_icon_job( /* setup job */ WM_jobs_customdata_set(wm_job, ip, icon_preview_free); WM_jobs_timer(wm_job, 0.1, NC_WINDOW, NC_WINDOW); + /* Wait 2s to start rendering icon previews, to not bog down user interaction. + * Particularly important for heavy scenes and Eevee using OpenGL that blocks + * the user interface drawing. */ + WM_jobs_delay_start(wm_job, (delay) ? 2.0 : 0.0); WM_jobs_callbacks(wm_job, icon_preview_startjob_all_sizes, NULL, NULL, icon_preview_endjob); WM_jobs_start(CTX_wm_manager(C), wm_job); |