diff options
Diffstat (limited to 'source/blender/editors/space_image/image_edit.c')
-rw-r--r-- | source/blender/editors/space_image/image_edit.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 5eaefcc9bb2..96c3f55df92 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -34,17 +34,20 @@ #include "DNA_scene_types.h" #include "BLI_rect.h" +#include "BLI_listbase.h" #include "BKE_colortools.h" #include "BKE_context.h" +#include "BKE_editmesh.h" #include "BKE_global.h" #include "BKE_image.h" -#include "BKE_editmesh.h" #include "BKE_library.h" #include "BKE_main.h" #include "IMB_imbuf_types.h" +#include "DEG_depsgraph.h" + #include "ED_image.h" /* own include */ #include "ED_mesh.h" #include "ED_screen.h" @@ -62,11 +65,8 @@ Image *ED_space_image(SpaceImage *sima) } /* called to assign images to UV faces */ -void ED_space_image_set(Main *bmain, SpaceImage *sima, Scene *scene, Object *obedit, Image *ima) +void ED_space_image_set(Main *bmain, SpaceImage *sima, Scene *UNUSED(scene), Object *obedit, Image *ima) { - /* context may be NULL, so use global */ - ED_uvedit_assign_image(bmain, scene, obedit, ima, sima->image); - /* change the space ima after because uvedit_face_visible_test uses the space ima * to check if the face is displayed in UV-localview */ sima->image = ima; @@ -303,17 +303,19 @@ bool ED_image_slot_cycle(struct Image *image, int direction) BLI_assert(ELEM(direction, -1, 1)); - for (i = 1; i < IMA_MAX_RENDER_SLOT; i++) { - slot = (cur + ((direction == -1) ? -i : i)) % IMA_MAX_RENDER_SLOT; - if (slot < 0) slot += IMA_MAX_RENDER_SLOT; + int num_slots = BLI_listbase_count(&image->renderslots); + for (i = 1; i < num_slots; i++) { + slot = (cur + ((direction == -1) ? -i : i)) % num_slots; + if (slot < 0) slot += num_slots; - if (image->renders[slot] || slot == image->last_render_slot) { + RenderSlot *render_slot = BKE_image_get_renderslot(image, slot); + if ((render_slot && render_slot->render) || slot == image->last_render_slot) { image->render_slot = slot; break; } } - if (i == IMA_MAX_RENDER_SLOT) { + if (i == num_slots) { image->render_slot = ((cur == 1) ? 0 : 1); } @@ -359,8 +361,14 @@ bool ED_space_image_show_paint(SpaceImage *sima) bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) { - if (sima && (ED_space_image_show_render(sima) || ED_space_image_show_paint(sima))) - return false; + if (sima) { + if (ED_space_image_show_render(sima)) { + return false; + } + if (sima->mode != SI_MODE_UV) { + return false; + } + } if (obedit && obedit->type == OB_MESH) { struct BMEditMesh *em = BKE_editmesh_from_object(obedit); @@ -375,10 +383,10 @@ bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) } /* matches clip function */ -bool ED_space_image_check_show_maskedit(Scene *scene, SpaceImage *sima) +bool ED_space_image_check_show_maskedit(SpaceImage *sima, ViewLayer *view_layer) { /* check editmode - this is reserved for UV editing */ - Object *ob = OBACT; + Object *ob = OBACT(view_layer); if (ob && ob->mode & OB_MODE_EDIT && ED_space_image_show_uvedit(sima, ob)) { return false; } @@ -391,8 +399,8 @@ bool ED_space_image_maskedit_poll(bContext *C) SpaceImage *sima = CTX_wm_space_image(C); if (sima) { - Scene *scene = CTX_data_scene(C); - return ED_space_image_check_show_maskedit(scene, sima); + ViewLayer *view_layer = CTX_data_view_layer(C); + return ED_space_image_check_show_maskedit(sima, view_layer); } return false; |