Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r--source/blender/editors/space_image/image_ops.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 2011649fda6..4a2dd52384c 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
@@ -1791,6 +1791,51 @@ void IMAGE_OT_record_composite(wmOperatorType *ot)
ot->poll= space_image_poll;
}
+/********************* cycle render slot operator *********************/
+
+static int cycle_render_slot_poll(bContext *C)
+{
+ Image *ima= CTX_data_edit_image(C);
+
+ return (ima && ima->type == IMA_TYPE_R_RESULT);
+}
+
+static int cycle_render_slot_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ int a, slot, cur= RE_GetViewSlot();
+
+ for(a=1; a<RE_SLOT_MAX; a++) {
+ slot= (cur+a)%RE_SLOT_MAX;
+
+ if(RE_GetRender(scene->id.name, slot)) {
+ RE_SetViewSlot(slot);
+ break;
+ }
+ }
+
+ if(a == RE_SLOT_MAX)
+ RE_SetViewSlot((cur == 1)? 0: 1);
+
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Cycle Render Slot";
+ ot->idname= "IMAGE_OT_cycle_render_slot";
+
+ /* api callbacks */
+ ot->exec= cycle_render_slot_exec;
+ ot->poll= cycle_render_slot_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/******************** TODO ********************/
/* XXX notifier? */
@@ -1843,3 +1888,4 @@ void BIF_image_update_frame(void)
}
#endif
+