diff options
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 4b51a50d096..601b1fa8e72 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -44,11 +44,13 @@ #include "BKE_colortools.h" #include "BKE_context.h" +#include "BKE_editmesh.h" #include "BKE_image.h" #include "BKE_layer.h" #include "BKE_library.h" #include "BKE_scene.h" #include "BKE_screen.h" +#include "BKE_material.h" #include "DEG_depsgraph.h" @@ -425,17 +427,20 @@ 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); + BMFace *efa = BM_mesh_active_face_get(em->bm, sloppy, selected); - if (tf) { + if (efa) { /* don't need to check for pin here, see above */ - sima->image = tf->tpage; + Image *image = BKE_object_material_edit_image_get(obedit, efa->mat_nr); + + sima->image = image; - if ((sima->flag & SI_EDITTILE) == 0) { - sima->curtile = tf->tile; + MTexPoly *tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); + if (tf) { + if ((sima->flag & SI_EDITTILE) == 0) { + sima->curtile = tf->tile; + } } } } |