Fix #36555: preview render in properties editor did not get cancelled and

restarted fast enough on resizing the editor, especially noticeable with
e.g. luxrender which does a progressive refining render.
This commit is contained in:
Brecht Van Lommel 2013-08-28 19:22:48 +00:00
parent 841fe45df9
commit 2c31bce47f
4 changed files with 18 additions and 2 deletions

@ -587,6 +587,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
ID *parent = (ID *)parentp;
MTex *slot = (MTex *)slotp;
SpaceButs *sbuts = sa->spacedata.first;
ShaderPreview *sp = WM_jobs_customdata(wm, sa);
rcti newrect;
int ok;
int newx = BLI_rcti_size_x(rect);
@ -608,9 +609,11 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
*rect = newrect;
/* start a new preview render job if signalled through sbuts->preview,
* or if no render result was found and no preview render job is running */
* if no render result was found and no preview render job is running,
* or if the job is running and the size of preview changed */
if ((sbuts->spacetype == SPACE_BUTS && sbuts->preview) ||
(!ok && !WM_jobs_test(wm, sa, WM_JOB_TYPE_RENDER_PREVIEW)))
(!ok && !WM_jobs_test(wm, sa, WM_JOB_TYPE_RENDER_PREVIEW)) ||
(sp && (ABS(sp->sizex - newx) >= 2 || ABS(sp->sizey - newy) > 2)))
{
sbuts->preview = 0;
ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER);

@ -903,6 +903,7 @@ static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
rna_Object_internal_update(bmain, scene, ptr);
WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, ptr->id.data);
WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL);
}
/* why does this have to be so complicated?, can't all this crap be

@ -386,6 +386,7 @@ struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, void
int WM_jobs_test(struct wmWindowManager *wm, void *owner, int job_type);
float WM_jobs_progress(struct wmWindowManager *wm, void *owner);
char *WM_jobs_name(struct wmWindowManager *wm, void *owner);
void *WM_jobs_customdata(struct wmWindowManager *wm, void *owner);
int WM_jobs_is_running(struct wmJob *);
void *WM_jobs_customdata_get(struct wmJob *);

@ -255,6 +255,17 @@ char *WM_jobs_name(wmWindowManager *wm, void *owner)
return NULL;
}
void *WM_jobs_customdata(wmWindowManager *wm, void *owner)
{
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
if (wm_job)
return WM_jobs_customdata_get(wm_job);
return NULL;
}
int WM_jobs_is_running(wmJob *wm_job)
{
return wm_job->running;