Fix T43831: Image Editor: Render info not displayed
Issue was caused by b62c2a9
and root of it goes to the fact that text
info is stored in the "main" scene, not the currently rendering one.
This is a bit annoying but making it so text and result are coming
from the same scene is a bit dangerous to do now. Will re-visit this
change after the release and see if it might be done in a more clear
fashion.
This commit is contained in:
parent
56c0a3faef
commit
26d7b6c517
Notes:
blender-bot
2023-02-14 09:29:42 +01:00
Referenced by issue #43831, Image Editor: Render info not displayed
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue