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