diff options
Diffstat (limited to 'source/blender/editors/space_image/space_image.c')
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 6ddf78290aa..bac3b9f8df7 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -89,6 +89,18 @@ static void image_scopes_tag_refresh(ScrArea *sa) sima->scopes.ok = 0; } +static void image_user_refresh_scene(const bContext *C, SpaceImage *sima) +{ + 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_current_scene(C); + if (render_scene) { + sima->iuser.scene = render_scene; + return; + } + } + sima->iuser.scene = CTX_data_scene(C); +} /* ******************** manage regions ********************* */ @@ -422,12 +434,9 @@ static void image_refresh(const bContext *C, ScrArea *sa) } else { /* old shading system, we set texface */ - MTexPoly *tf; - - if (em && EDBM_mtexpoly_check(em)) { - tf = EDBM_mtexpoly_active_get(em, NULL, sloppy, selected); - - if (tf) { + if (em && EDBM_uv_check(em)) { + MTexPoly *tf; + if (EDBM_uv_active_face_get(em, sloppy, selected, &tf)) { /* don't need to check for pin here, see above */ sima->image = tf->tpage; @@ -699,17 +708,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - /* 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_current_scene(C); - if (render_scene) - sima->iuser.scene = render_scene; - else - sima->iuser.scene = scene; - } - else - sima->iuser.scene = scene; + image_user_refresh_scene(C, sima); /* we set view2d from own zoom and offset each time */ image_main_region_set_view2d(sima, ar); @@ -763,14 +762,14 @@ static void image_main_region_draw(const bContext *C, ARegion *ar) /* ED_space_image_get* will acquire image buffer which requires * lock here by the same reason why lock is needed in draw_image_main */ - BLI_lock_thread(LOCK_DRAW_IMAGE); + BLI_thread_lock(LOCK_DRAW_IMAGE); } ED_space_image_get_size(sima, &width, &height); ED_space_image_get_aspect(sima, &aspx, &aspy); if (show_viewer) - BLI_unlock_thread(LOCK_DRAW_IMAGE); + BLI_thread_unlock(LOCK_DRAW_IMAGE); ED_mask_draw_region(mask, ar, sima->mask_info.draw_flag, @@ -961,6 +960,11 @@ static void image_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar) static void image_header_region_draw(const bContext *C, ARegion *ar) { + ScrArea *sa = CTX_wm_area(C); + SpaceImage *sima = sa->spacedata.first; + + image_user_refresh_scene(C, sima); + ED_region_header(C, ar); } |