forked from bartvdbraak/blender
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:
parent
841fe45df9
commit
2c31bce47f
@ -587,6 +587,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
|
|||||||
ID *parent = (ID *)parentp;
|
ID *parent = (ID *)parentp;
|
||||||
MTex *slot = (MTex *)slotp;
|
MTex *slot = (MTex *)slotp;
|
||||||
SpaceButs *sbuts = sa->spacedata.first;
|
SpaceButs *sbuts = sa->spacedata.first;
|
||||||
|
ShaderPreview *sp = WM_jobs_customdata(wm, sa);
|
||||||
rcti newrect;
|
rcti newrect;
|
||||||
int ok;
|
int ok;
|
||||||
int newx = BLI_rcti_size_x(rect);
|
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;
|
*rect = newrect;
|
||||||
|
|
||||||
/* start a new preview render job if signalled through sbuts->preview,
|
/* 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) ||
|
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;
|
sbuts->preview = 0;
|
||||||
ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER);
|
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);
|
rna_Object_internal_update(bmain, scene, ptr);
|
||||||
WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, ptr->id.data);
|
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
|
/* 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);
|
int WM_jobs_test(struct wmWindowManager *wm, void *owner, int job_type);
|
||||||
float WM_jobs_progress(struct wmWindowManager *wm, void *owner);
|
float WM_jobs_progress(struct wmWindowManager *wm, void *owner);
|
||||||
char *WM_jobs_name(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 *);
|
int WM_jobs_is_running(struct wmJob *);
|
||||||
void *WM_jobs_customdata_get(struct wmJob *);
|
void *WM_jobs_customdata_get(struct wmJob *);
|
||||||
|
@ -255,6 +255,17 @@ char *WM_jobs_name(wmWindowManager *wm, void *owner)
|
|||||||
return NULL;
|
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)
|
int WM_jobs_is_running(wmJob *wm_job)
|
||||||
{
|
{
|
||||||
return wm_job->running;
|
return wm_job->running;
|
||||||
|
Loading…
Reference in New Issue
Block a user