Prevent non-button space used as a SPACE_BUTS from template_preview

This commit is contained in:
Sergey Sharybin
2015-11-10 13:00:53 +05:00
parent b3184640fe
commit 54a04effff

View File

@@ -614,7 +614,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
ID *id = (ID *)idp;
ID *parent = (ID *)parentp;
MTex *slot = (MTex *)slotp;
SpaceButs *sbuts = sa->spacedata.first;
SpaceButs *sbuts = CTX_wm_space_buts(C);
ShaderPreview *sp = WM_jobs_customdata(wm, sa);
rcti newrect;
int ok;
@@ -639,11 +639,13 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
/* start a new preview render job if signalled through sbuts->preview,
* 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) ||
if ((sbuts != NULL && sbuts->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;
if (sbuts != NULL) {
sbuts->preview = 0;
}
ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER);
}
}