diff options
-rw-r--r-- | source/blender/editors/include/ED_render.h | 1 | ||||
-rw-r--r-- | source/blender/editors/render/render_internal.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 2 |
4 files changed, 27 insertions, 6 deletions
diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index de3843c91eb..293621c3d19 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -55,6 +55,7 @@ void ED_render_scene_update(struct Main *bmain, struct Scene *scene, int updated void ED_viewport_render_kill_jobs(struct wmWindowManager *wm, struct Main *bmain, bool free_database); struct Scene *ED_render_job_get_scene(const struct bContext *C); +struct Scene *ED_render_job_get_current_scene(const struct bContext *C); /* Render the preview * diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 8fcd91b7791..1c9f32697d4 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -1617,7 +1617,17 @@ Scene *ED_render_job_get_scene(const bContext *C) RenderJob *rj = (RenderJob *)WM_jobs_customdata_from_type(wm, WM_JOB_TYPE_RENDER); if (rj) - return rj->current_scene; + return rj->scene; return NULL; } + +Scene *ED_render_job_get_current_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->current_scene; + } + return NULL; +} diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 7c5aa349fa0..d03f3c157a9 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -68,6 +68,7 @@ #include "ED_gpencil.h" #include "ED_image.h" #include "ED_mask.h" +#include "ED_render.h" #include "ED_screen.h" #include "UI_interface.h" @@ -79,20 +80,29 @@ #include "image_intern.h" -static void draw_render_info(Scene *scene, Image *ima, ARegion *ar, float zoomx, float zoomy) +static void draw_render_info(const bContext *C, + Scene *scene, + Image *ima, + ARegion *ar, + float zoomx, + float zoomy) { RenderResult *rr; Render *re = RE_GetRender(scene->id.name); RenderData *rd = RE_engine_get_render_data(re); + Scene *stats_scene = ED_render_job_get_scene(C); + if (stats_scene == NULL) { + stats_scene = CTX_data_scene(C); + } - rr = BKE_image_acquire_renderresult(scene, ima); + rr = BKE_image_acquire_renderresult(stats_scene, ima); if (rr && rr->text) { float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f}; ED_region_info_draw(ar, rr->text, 1, fill_color); } - BKE_image_release_renderresult(scene, ima); + BKE_image_release_renderresult(stats_scene, ima); if (re) { int total_tiles; @@ -851,7 +861,7 @@ void draw_image_main(const bContext *C, ARegion *ar) /* render info */ if (ima && show_render) - draw_render_info(sima->iuser.scene, ima, ar, zoomx, zoomy); + draw_render_info(C, sima->iuser.scene, ima, ar, zoomx, zoomy); } bool ED_space_image_show_cache(SpaceImage *sima) diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index af1502509f5..bd3d76bbaba 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -693,7 +693,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar) /* put scene context variable in iuser */ 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); + Scene *render_scene = ED_render_job_get_current_scene(C); if (render_scene) sima->iuser.scene = render_scene; else |