Revision: 61033 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61033 Author: lukastoenne Date: 2013-10-31 17:20:31 +0000 (Thu, 31 Oct 2013) Log Message: ----------- Fix #37261 Rendering a Render Layer from another scene doesn't update.
The scene pointer used for looking up the appropriate source of render result images in the image editor was always taken from context. This means that render results for a different scene would never be displayed in the image editor. To give feedback on running renders, try to get the running render job's scene pointer in the image editor for render result type images. This only happens during rendering, apart from that the regular context scene result is displayed. Modified Paths: -------------- trunk/blender/source/blender/editors/include/ED_render.h trunk/blender/source/blender/editors/render/render_internal.c trunk/blender/source/blender/editors/space_image/space_image.c trunk/blender/source/blender/windowmanager/WM_api.h trunk/blender/source/blender/windowmanager/intern/wm_jobs.c Modified: trunk/blender/source/blender/editors/include/ED_render.h =================================================================== --- trunk/blender/source/blender/editors/include/ED_render.h 2013-10-31 17:13:40 UTC (rev 61032) +++ trunk/blender/source/blender/editors/include/ED_render.h 2013-10-31 17:20:31 UTC (rev 61033) @@ -55,6 +55,7 @@ void ED_render_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa); void ED_viewport_render_kill_jobs(const struct bContext *C, bool free_database); +struct Scene *ED_render_job_get_scene(const struct bContext *C); /* render_preview.c */ Modified: trunk/blender/source/blender/editors/render/render_internal.c =================================================================== --- trunk/blender/source/blender/editors/render/render_internal.c 2013-10-31 17:13:40 UTC (rev 61032) +++ trunk/blender/source/blender/editors/render/render_internal.c 2013-10-31 17:20:31 UTC (rev 61033) @@ -1237,3 +1237,13 @@ } } +Scene *ED_render_job_get_scene(const bContext *C) +{ + wmWindowManager *wm = CTX_wm_manager(C); + RenderJob *rj = (RenderJob *)WM_jobs_customdata_from_type(wm, WM_JOB_TYPE_RENDER); + + if (rj) + return rj->scene; + + return NULL; +} Modified: trunk/blender/source/blender/editors/space_image/space_image.c =================================================================== --- trunk/blender/source/blender/editors/space_image/space_image.c 2013-10-31 17:13:40 UTC (rev 61032) +++ trunk/blender/source/blender/editors/space_image/space_image.c 2013-10-31 17:20:31 UTC (rev 61033) @@ -56,6 +56,7 @@ #include "ED_mask.h" #include "ED_mesh.h" #include "ED_node.h" +#include "ED_render.h" #include "ED_space_api.h" #include "ED_screen.h" #include "ED_uvedit.h" @@ -653,7 +654,16 @@ glClear(GL_COLOR_BUFFER_BIT); /* put scene context variable in iuser */ - sima->iuser.scene = scene; + if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) { + /* for render result, try to use the currently rendering scene */ + Scene *render_scene = ED_render_job_get_scene(C); + if (render_scene) + sima->iuser.scene = render_scene; + else + sima->iuser.scene = scene; + } + else + sima->iuser.scene = scene; /* we set view2d from own zoom and offset each time */ image_main_area_set_view2d(sima, ar); Modified: trunk/blender/source/blender/windowmanager/WM_api.h =================================================================== --- trunk/blender/source/blender/windowmanager/WM_api.h 2013-10-31 17:13:40 UTC (rev 61032) +++ trunk/blender/source/blender/windowmanager/WM_api.h 2013-10-31 17:20:31 UTC (rev 61033) @@ -378,6 +378,7 @@ 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); +void *WM_jobs_customdata_from_type(struct wmWindowManager *wm, int job_type); int WM_jobs_is_running(struct wmJob *); void *WM_jobs_customdata_get(struct wmJob *); Modified: trunk/blender/source/blender/windowmanager/intern/wm_jobs.c =================================================================== --- trunk/blender/source/blender/windowmanager/intern/wm_jobs.c 2013-10-31 17:13:40 UTC (rev 61032) +++ trunk/blender/source/blender/windowmanager/intern/wm_jobs.c 2013-10-31 17:20:31 UTC (rev 61033) @@ -166,22 +166,27 @@ } /* finds: - * if type, compare for it, otherwise any matching job + * if type or owner, compare for it, otherwise any matching job */ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type) { wmJob *wm_job; - for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) - if (wm_job->owner == owner) { - - if (job_type) { - if ( wm_job->job_type == job_type) - return wm_job; - } - else + if (owner && job_type) { + for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) + if (wm_job->owner == owner && wm_job->job_type == job_type) return wm_job; - } + } + else if (owner) { + for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) + if (wm_job->owner == owner) + return wm_job; + } + else if (job_type) { + for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) + if (wm_job->job_type == job_type) + return wm_job; + } return NULL; } @@ -263,7 +268,16 @@ return WM_jobs_customdata_get(wm_job); return NULL; +} +void *WM_jobs_customdata_from_type(wmWindowManager *wm, int job_type) +{ + wmJob *wm_job = wm_job_find(wm, NULL, job_type); + + if (wm_job) + return WM_jobs_customdata_get(wm_job); + + return NULL; } int WM_jobs_is_running(wmJob *wm_job) _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs