Fix #36555: preview render in properties editor did not get cancelled and
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 28 Aug 2013 19:22:48 +0000 (19:22 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 28 Aug 2013 19:22:48 +0000 (19:22 +0000)
restarted fast enough on resizing the editor, especially noticeable with
e.g. luxrender which does a progressive refining render.

source/blender/editors/render/render_preview.c
source/blender/makesrna/intern/rna_object.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_jobs.c

index 4bd8a7d426a87476e8a99ac549208c93bd24bbb6..2bf8a48edc4664fb0e79dbe1d446a791fae57c27 100644 (file)
@@ -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);
index e71d1d22c4b65215830212cdfa58741b552a3d73..4c04b0de71ed3365e960ed844e0c05c3f0895aff 100644 (file)
@@ -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
index 8894be111e7e08ff09c7bfa9c2ee2ce481e32cb7..2a8358f832ab9199514c9d55485e7f46fd5a1ba9 100644 (file)
@@ -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 *);
index c6e067dc2f9f4b88e500893e491d366a97e2f66d..188ad251b8ae96189f3981a39bf5f3c1cada11a5 100644 (file)
@@ -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;