361b01fe6e030ff1ddfb9d94a59c06c231bdd43e
[blender.git] / source / blender / editors / render / render_opengl.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2008 Blender Foundation.
19  * All rights reserved.
20  *
21  *
22  * ***** END GPL LICENSE BLOCK *****
23  */
24
25 /** \file blender/editors/render/render_opengl.c
26  *  \ingroup edrend
27  */
28
29
30 #include <math.h>
31 #include <string.h>
32 #include <stddef.h>
33
34 #include <GL/glew.h>
35
36 #include "MEM_guardedalloc.h"
37
38 #include "BLI_math.h"
39 #include "BLI_blenlib.h"
40 #include "BLI_editVert.h"
41 #include "BLI_dlrbTree.h"
42 #include "BLI_utildefines.h"
43
44 #include "DNA_scene_types.h"
45 #include "DNA_object_types.h"
46
47 #include "BKE_context.h"
48 #include "BKE_image.h"
49 #include "BKE_main.h"
50 #include "BKE_report.h"
51 #include "BKE_scene.h"
52 #include "BKE_writeavi.h"
53
54 #include "WM_api.h"
55 #include "WM_types.h"
56
57 #include "ED_screen.h"
58 #include "ED_view3d.h"
59 #include "ED_image.h"
60
61 #include "RE_pipeline.h"
62 #include "IMB_imbuf_types.h"
63 #include "IMB_imbuf.h"
64
65 #include "RNA_access.h"
66 #include "RNA_define.h"
67
68
69 #include "GPU_extensions.h"
70
71 #include "wm_window.h"
72
73 #include "render_intern.h"
74
75 typedef struct OGLRender {
76         Main *bmain;
77         Render *re;
78         Scene *scene;
79
80         View3D *v3d;
81         RegionView3D *rv3d;
82         ARegion *ar;
83
84         short obcenter_dia_back; /* temp overwrite */
85
86         Image *ima;
87         ImageUser iuser;
88
89         GPUOffScreen *ofs;
90         int sizex, sizey;
91         int write_still;
92
93         ReportList *reports;
94         bMovieHandle *mh;
95         int cfrao, nfra;
96
97         wmTimer *timer; /* use to check if running modal or not (invoke'd or exec'd)*/
98 } OGLRender;
99
100 /* added because v3d is not always valid */
101 static unsigned int screen_opengl_layers(OGLRender *oglrender)
102 {
103         if(oglrender->v3d) {
104                 return oglrender->scene->lay | oglrender->v3d->lay;
105         }
106         else {
107                 return oglrender->scene->lay;
108         }
109 }
110
111 static void screen_opengl_render_apply(OGLRender *oglrender)
112 {
113         Scene *scene= oglrender->scene;
114         ARegion *ar= oglrender->ar;
115         View3D *v3d= oglrender->v3d;
116         RegionView3D *rv3d= oglrender->rv3d;
117         RenderResult *rr;
118         Object *camera= NULL;
119         ImBuf *ibuf;
120         void *lock;
121         float winmat[4][4];
122         int sizex= oglrender->sizex;
123         int sizey= oglrender->sizey;
124         const short view_context= (v3d != NULL);
125
126         rr= RE_AcquireResultRead(oglrender->re);
127         
128         if(view_context) {
129                 GPU_offscreen_bind(oglrender->ofs); /* bind */
130
131                 /* render 3d view */
132                 if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
133                         /*int is_ortho= scene->r.mode & R_ORTHO;*/
134                         camera= v3d->camera;
135                         RE_GetCameraWindow(oglrender->re, camera, scene->r.cfra, winmat);
136                         
137                 }
138                 else {
139                         rctf viewplane;
140                         float clipsta, clipend;
141
142                         int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend);
143                         if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
144                         else  perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
145                 }
146
147                 if((scene->r.mode & R_OSA) == 0) { 
148                         ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
149                         GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, rr->rectf);
150                 }
151                 else {
152                         /* simple accumulation, less hassle then FSAA FBO's */
153 #                       define SAMPLES 5 /* fixed, easy to have more but for now this is ok */
154                         const float jit_ofs[SAMPLES][2] = {{0, 0}, {0.5f, 0.5f}, {-0.5f,-0.5f}, {-0.5f, 0.5f}, {0.5f, -0.5f}};
155                         float winmat_jitter[4][4];
156                         float *accum_buffer= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum1");
157                         float *accum_tmp= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum2");
158                         int j;
159
160                         /* first sample buffer, also initializes 'rv3d->persmat' */
161                         ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
162                         GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_buffer);
163
164                         /* skip the first sample */
165                         for(j=1; j < SAMPLES; j++) {
166                                 copy_m4_m4(winmat_jitter, winmat);
167                                 window_translate_m4(winmat_jitter, rv3d->persmat, jit_ofs[j][0] / sizex, jit_ofs[j][1] / sizey);
168
169                                 ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat_jitter);
170                                 GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_tmp);
171                                 add_vn_vn(accum_buffer, accum_tmp, sizex*sizey*sizeof(float));
172                         }
173
174                         mul_vn_vn_fl(rr->rectf, accum_buffer, sizex*sizey*sizeof(float), 1.0/SAMPLES);
175
176                         MEM_freeN(accum_buffer);
177                         MEM_freeN(accum_tmp);
178                 }
179
180                 GPU_offscreen_unbind(oglrender->ofs); /* unbind */
181         }
182         else {
183                 /* shouldnt suddenly give errors mid-render but possible */
184                 char err_out[256]= "unknown";
185                 ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, err_out);
186                 camera= scene->camera;
187
188                 if(ibuf_view) {
189                         memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
190                         IMB_freeImBuf(ibuf_view);
191                 }
192                 else {
193                         fprintf(stderr, "screen_opengl_render_apply: failed to get buffer, %s\n", err_out);
194                 }
195         }
196         
197         /* rr->rectf is now filled with image data */
198
199         if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
200                 BKE_stamp_buf(scene, camera, NULL, rr->rectf, rr->rectx, rr->recty, 4);
201
202         /* note on color management:
203          *
204          * OpenGL renders into sRGB colors, but render buffers are expected to be
205          * linear if color management is enabled. So we convert to linear here, so
206          * the conversion back to bytes using the color management flag can make it
207          * sRGB again, and so that e.g. openexr saving also saves the correct linear
208          * float buffer. */
209
210         if(oglrender->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
211                 int predivide= 0; /* no alpha */
212
213                 IMB_buffer_float_from_float(rr->rectf, rr->rectf,
214                         4, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, predivide,
215                         oglrender->sizex, oglrender->sizey, oglrender->sizex, oglrender->sizex);
216         }
217
218         RE_ReleaseResult(oglrender->re);
219
220         /* update byte from float buffer */
221         ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
222
223         if(ibuf) {
224                 image_buffer_rect_update(scene, rr, ibuf, NULL);
225
226                 if(oglrender->write_still) {
227                         char name[FILE_MAX];
228                         int ok;
229
230                         if(scene->r.im_format.planes == R_IMF_CHAN_DEPTH_8) {
231                                 IMB_color_to_bw(ibuf);
232                         }
233
234                         BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE);
235                         ok= BKE_write_ibuf(ibuf, name, &scene->r.im_format); /* no need to stamp here */
236                         if(ok)  printf("OpenGL Render written to '%s'\n", name);
237                         else    printf("OpenGL Render failed to write '%s'\n", name);
238                 }
239         }
240         
241         BKE_image_release_ibuf(oglrender->ima, lock);
242 }
243
244 static int screen_opengl_render_init(bContext *C, wmOperator *op)
245 {
246         /* new render clears all callbacks */
247         Scene *scene= CTX_data_scene(C);
248         RenderResult *rr;
249         GPUOffScreen *ofs;
250         OGLRender *oglrender;
251         int sizex, sizey;
252         short is_view_context= RNA_boolean_get(op->ptr, "view_context");
253         const short is_animation= RNA_boolean_get(op->ptr, "animation");
254         const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
255         char err_out[256]= "unknown";
256
257         /* ensure we have a 3d view */
258
259         if(!ED_view3d_context_activate(C)) {
260                 RNA_boolean_set(op->ptr, "view_context", 0);
261                 is_view_context= 0;
262         }
263
264         /* only one render job at a time */
265         if(WM_jobs_test(CTX_wm_manager(C), scene))
266                 return 0;
267         
268         if(!is_view_context && scene->camera==NULL) {
269                 BKE_report(op->reports, RPT_ERROR, "Scene has no camera");
270                 return 0;
271         }
272
273         if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
274                 BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
275                 return 0;
276         }
277
278         /* stop all running jobs, currently previews frustrate Render */
279         WM_jobs_stop_all(CTX_wm_manager(C));
280
281         /* handle UI stuff */
282         WM_cursor_wait(1);
283
284         /* create offscreen buffer */
285         sizex= (scene->r.size*scene->r.xsch)/100;
286         sizey= (scene->r.size*scene->r.ysch)/100;
287
288         /* corrects render size with actual size, not every card supports non-power-of-two dimensions */
289         ofs= GPU_offscreen_create(sizex, sizey, err_out);
290
291         if(!ofs) {
292                 BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer, %s", err_out);
293                 return 0;
294         }
295
296         /* allocate opengl render */
297         oglrender= MEM_callocN(sizeof(OGLRender), "OGLRender");
298         op->customdata= oglrender;
299
300         oglrender->ofs= ofs;
301         oglrender->sizex= sizex;
302         oglrender->sizey= sizey;
303         oglrender->bmain= CTX_data_main(C);
304         oglrender->scene= scene;
305
306         oglrender->write_still= is_write_still && !is_animation;
307
308         oglrender->obcenter_dia_back = U.obcenter_dia;
309         U.obcenter_dia = 0;
310
311         if(is_view_context) {
312                 oglrender->v3d= CTX_wm_view3d(C);
313                 oglrender->ar= CTX_wm_region(C);
314                 oglrender->rv3d= CTX_wm_region_view3d(C);
315
316                 /* MUST be cleared on exit */
317                 oglrender->scene->customdata_mask_modal = (ED_view3d_datamask(oglrender->scene, oglrender->v3d) |
318                                                            ED_view3d_object_datamask(oglrender->scene) );
319
320                 /* apply immediately incase we're rendeing from a script,
321                  * running notifiers again will overwrite */
322                 oglrender->scene->customdata_mask |= oglrender->scene->customdata_mask_modal;
323
324         }
325
326         /* create render */
327         oglrender->re= RE_NewRender(scene->id.name);
328
329         /* create image and image user */
330         oglrender->ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
331         BKE_image_signal(oglrender->ima, NULL, IMA_SIGNAL_FREE);
332         BKE_image_backup_render(oglrender->scene, oglrender->ima);
333
334         oglrender->iuser.scene= scene;
335         oglrender->iuser.ok= 1;
336
337         /* create render result */
338         RE_InitState(oglrender->re, NULL, &scene->r, NULL, sizex, sizey, NULL);
339
340         rr= RE_AcquireResultWrite(oglrender->re);
341         if(rr->rectf==NULL)
342                 rr->rectf= MEM_callocN(sizeof(float)*4*sizex*sizey, "screen_opengl_render_init rect");
343         RE_ReleaseResult(oglrender->re);
344
345         return 1;
346 }
347
348 static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
349 {
350         Main *bmain= CTX_data_main(C);
351         Scene *scene= oglrender->scene;
352
353         if(oglrender->mh) {
354                 if(BKE_imtype_is_movie(scene->r.im_format.imtype))
355                         oglrender->mh->end_movie();
356         }
357
358         if(oglrender->timer) { /* exec will not have a timer */
359                 scene->r.cfra= oglrender->cfrao;
360                 scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
361
362                 WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer);
363         }
364
365         WM_cursor_wait(0);
366         WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, oglrender->scene);
367
368         U.obcenter_dia = oglrender->obcenter_dia_back;
369
370         GPU_offscreen_free(oglrender->ofs);
371
372         oglrender->scene->customdata_mask_modal= 0;
373
374         MEM_freeN(oglrender);
375 }
376
377 static int screen_opengl_render_cancel(bContext *C, wmOperator *op)
378 {
379         screen_opengl_render_end(C, op->customdata);
380
381         return OPERATOR_CANCELLED;
382 }
383
384 /* share between invoke and exec */
385 static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
386 {
387         /* initialize animation */
388         OGLRender *oglrender;
389         Scene *scene;
390
391         oglrender= op->customdata;
392         scene= oglrender->scene;
393
394         oglrender->reports= op->reports;
395         oglrender->mh= BKE_get_movie_handle(scene->r.im_format.imtype);
396         if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
397                 if(!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) {
398                         screen_opengl_render_end(C, oglrender);
399                         return 0;
400                 }
401         }
402
403         oglrender->cfrao= scene->r.cfra;
404         oglrender->nfra= PSFRA;
405         scene->r.cfra= PSFRA;
406
407         return 1;
408 }
409 static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
410 {
411         Main *bmain= CTX_data_main(C);
412         OGLRender *oglrender= op->customdata;
413         Scene *scene= oglrender->scene;
414         ImBuf *ibuf;
415         void *lock;
416         char name[FILE_MAX];
417         int ok= 0;
418         const short  view_context= (oglrender->v3d != NULL);
419         Object *camera= NULL;
420
421         /* update animated image textures for gpu, etc,
422          * call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
423         ED_image_update_frame(bmain, scene->r.cfra);
424
425         /* go to next frame */
426         while(CFRA<oglrender->nfra) {
427                 unsigned int lay= screen_opengl_layers(oglrender);
428
429                 if(lay & 0xFF000000)
430                         lay &= 0xFF000000;
431
432                 scene_update_for_newframe(bmain, scene, lay);
433                 CFRA++;
434         }
435
436         scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
437
438         if(view_context) {
439                 if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
440                         /* since scene_update_for_newframe() is used rather
441                          * then ED_update_for_newframe() the camera needs to be set */
442                         if(scene_camera_switch_update(scene)) {
443                                 oglrender->v3d->camera= scene->camera;
444                         }
445
446                         camera= oglrender->v3d->camera;
447                 }
448         }
449         else {
450                 scene_camera_switch_update(scene);
451
452                 camera= scene->camera;
453         }
454
455         /* render into offscreen buffer */
456         screen_opengl_render_apply(oglrender);
457
458         /* save to disk */
459         ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
460
461         if(ibuf) {
462                 /* color -> greyscale */
463                 /* editing directly would alter the render view */
464                 if(scene->r.im_format.planes == R_IMF_PLANES_BW) {
465                         ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
466                         IMB_color_to_bw(ibuf_bw);
467                         // IMB_freeImBuf(ibuf); /* owned by the image */
468                         ibuf= ibuf_bw;
469                 }
470                 else {
471                         /* this is lightweight & doesnt re-alloc the buffers, only do this
472                          * to save the correct bit depth since the image is always RGBA */
473                         ImBuf *ibuf_cpy= IMB_allocImBuf(ibuf->x, ibuf->y, scene->r.im_format.planes, 0);
474                         ibuf_cpy->rect= ibuf->rect;
475                         ibuf_cpy->rect_float= ibuf->rect_float;
476                         ibuf_cpy->zbuf_float= ibuf->zbuf_float;
477                         ibuf= ibuf_cpy;
478                 }
479
480                 if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
481                         ok= oglrender->mh->append_movie(&scene->r, CFRA, (int*)ibuf->rect, oglrender->sizex, oglrender->sizey, oglrender->reports);
482                         if(ok) {
483                                 printf("Append frame %d", scene->r.cfra);
484                                 BKE_reportf(op->reports, RPT_INFO, "Appended frame: %d", scene->r.cfra);
485                         }
486                 }
487                 else {
488                         BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
489                         ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format);
490
491                         if(ok==0) {
492                                 printf("Write error: cannot save %s\n", name);
493                                 BKE_reportf(op->reports, RPT_ERROR, "Write error: cannot save %s", name);
494                         }
495                         else {
496                                 printf("Saved: %s", name);
497                                 BKE_reportf(op->reports, RPT_INFO, "Saved file: %s", name);
498                         }
499                 }
500
501                 /* imbuf knows which rects are not part of ibuf */
502                 IMB_freeImBuf(ibuf);
503         }
504
505         BKE_image_release_ibuf(oglrender->ima, lock);
506
507         /* movie stats prints have no line break */
508         printf("\n");
509
510         /* go to next frame */
511         oglrender->nfra += scene->r.frame_step;
512         scene->r.cfra++;
513
514         /* stop at the end or on error */
515         if(scene->r.cfra > PEFRA || !ok) {
516                 screen_opengl_render_end(C, op->customdata);
517                 return 0;
518         }
519
520         return 1;
521 }
522
523
524 static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *event)
525 {
526         OGLRender *oglrender= op->customdata;
527         int anim= RNA_boolean_get(op->ptr, "animation");
528         int ret;
529
530         switch(event->type) {
531                 case ESCKEY:
532                         /* cancel */
533                         screen_opengl_render_end(C, op->customdata);
534                         return OPERATOR_FINISHED;
535                 case TIMER:
536                         /* render frame? */
537                         if(oglrender->timer == event->customdata)
538                                 break;
539                 default:
540                         /* nothing to do */
541                         return OPERATOR_RUNNING_MODAL;
542         }
543
544         /* run first because screen_opengl_render_anim_step can free oglrender */
545         WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, oglrender->scene);
546         
547         if(anim == 0) {
548                 screen_opengl_render_apply(op->customdata);
549                 screen_opengl_render_end(C, op->customdata);
550                 return OPERATOR_FINISHED;
551         }
552         else
553                 ret= screen_opengl_render_anim_step(C, op);
554
555         /* stop at the end or on error */
556         if(ret == 0) {
557                 return OPERATOR_FINISHED;
558         }
559
560         return OPERATOR_RUNNING_MODAL;
561 }
562
563 static int screen_opengl_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
564 {
565         OGLRender *oglrender;
566         int anim= RNA_boolean_get(op->ptr, "animation");
567
568         if(!screen_opengl_render_init(C, op))
569                 return OPERATOR_CANCELLED;
570
571         if(anim) {
572                 if(!screen_opengl_render_anim_initialize(C, op))
573                         return OPERATOR_CANCELLED;
574         }
575         
576         oglrender= op->customdata;
577         render_view_open(C, event->x, event->y);
578         
579         WM_event_add_modal_handler(C, op);
580         oglrender->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
581         
582         return OPERATOR_RUNNING_MODAL;
583 }
584
585 /* executes blocking render */
586 static int screen_opengl_render_exec(bContext *C, wmOperator *op)
587 {
588         const short is_animation= RNA_boolean_get(op->ptr, "animation");
589
590         if(!screen_opengl_render_init(C, op))
591                 return OPERATOR_CANCELLED;
592
593         if(!is_animation) { /* same as invoke */
594                 /* render image */
595                 screen_opengl_render_apply(op->customdata);
596                 screen_opengl_render_end(C, op->customdata);
597
598                 return OPERATOR_FINISHED;
599         }
600         else {
601                 int ret= 1;
602
603                 if(!screen_opengl_render_anim_initialize(C, op))
604                         return OPERATOR_CANCELLED;
605
606                 while(ret) {
607                         ret= screen_opengl_render_anim_step(C, op);
608                 }
609         }
610
611         // no redraw needed, we leave state as we entered it
612 //      ED_update_for_newframe(C, 1);
613         WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, CTX_data_scene(C));
614
615         return OPERATOR_FINISHED;
616 }
617
618 void RENDER_OT_opengl(wmOperatorType *ot)
619 {
620         /* identifiers */
621         ot->name= "OpenGL Render";
622         ot->description= "OpenGL render active viewport";
623         ot->idname= "RENDER_OT_opengl";
624
625         /* api callbacks */
626         ot->invoke= screen_opengl_render_invoke;
627         ot->exec= screen_opengl_render_exec; /* blocking */
628         ot->modal= screen_opengl_render_modal;
629         ot->cancel= screen_opengl_render_cancel;
630
631         ot->poll= ED_operator_screenactive;
632
633         RNA_def_boolean(ot->srna, "animation", 0, "Animation", "Render files from the animation range of this scene");
634         RNA_def_boolean(ot->srna, "write_still", 0, "Write Image", "Save rendered the image to the output path (used only when animation is disabled)");
635         RNA_def_boolean(ot->srna, "view_context", 1, "View Context", "Use the current 3D view for rendering, else use scene settings");
636 }
637
638 /* function for getting an opengl buffer from a View3D, used by sequencer */
639 // extern void *sequencer_view3d_cb;