diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-11-15 23:13:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-11-15 23:14:47 +0300 |
commit | 603b867588f7940378950fefaffc9dfe0c67c2c7 (patch) | |
tree | 6caf12570d6f04cd6e57157e5589b97d9677cafa /source/blender/editors/space_image/image_ops.c | |
parent | 0d267737e23ba7032377a1aa2884d40a14025a39 (diff) |
UI: support cycling for image space menus
also remove arrow buttons.
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index a07d274b69b..380ccebba30 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -3280,22 +3280,12 @@ static int image_cycle_render_slot_poll(bContext *C) static int image_cycle_render_slot_exec(bContext *C, wmOperator *op) { Image *ima = CTX_data_edit_image(C); - int a, slot, cur = ima->render_slot; - const bool use_reverse = RNA_boolean_get(op->ptr, "reverse"); + const int direction = RNA_boolean_get(op->ptr, "reverse") ? -1 : 1; - for (a = 1; a < IMA_MAX_RENDER_SLOT; a++) { - slot = (cur + (use_reverse ? -a : a)) % IMA_MAX_RENDER_SLOT; - if (slot < 0) slot += IMA_MAX_RENDER_SLOT; - - if (ima->renders[slot] || slot == ima->last_render_slot) { - ima->render_slot = slot; - break; - } + if (!ED_image_slot_cycle(ima, direction)) { + return OPERATOR_CANCELLED; } - if (a == IMA_MAX_RENDER_SLOT) - ima->render_slot = ((cur == 1) ? 0 : 1); - WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL); /* no undo push for browsing existing */ |