New export through plugin scheme for yafray. It is working on linux and mac os x
[blender.git] / source / blender / src / buttons_scene.c
1 /**
2  * $Id: 
3  *
4  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. The Blender
10  * Foundation also sells licenses for use in proprietary software under
11  * the Blender License.  See http://www.blender.org/BL/ for information
12  * about this.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  *
23  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
24  * All rights reserved.
25  *
26  * The Original Code is: all of this file.
27  *
28  * Contributor(s): none yet.
29  *
30  * ***** END GPL/BL DUAL LICENSE BLOCK *****
31  */
32
33 #include <time.h>
34 #include <math.h>
35 #include <stdlib.h>
36 #include <string.h>
37
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif
41
42 #ifdef WIN32
43 #include "BLI_winstuff.h"
44 #endif
45
46 #include "MEM_guardedalloc.h"
47 #include "DNA_screen_types.h"
48 #include "DNA_space_types.h"
49 #include "DNA_scene_types.h"
50 #include "DNA_sound_types.h"
51 #include "DNA_userdef_types.h"
52 #include "DNA_packedFile_types.h"
53
54 #include "BKE_global.h"
55 #include "BKE_main.h"
56 #include "BKE_library.h"
57 #include "BKE_sound.h"
58 #include "BKE_packedFile.h"
59 #include "BKE_utildefines.h"
60
61 #include "BLI_blenlib.h"
62
63 #include "BSE_filesel.h"
64
65 #include "BIF_gl.h"
66 #include "BIF_graphics.h"
67 #include "BIF_keyval.h"
68 #include "BIF_mainqueue.h"
69 #include "BIF_resources.h"
70 #include "BIF_screen.h"
71 #include "BIF_mywindow.h"
72 #include "BIF_space.h"
73 #include "BIF_glutil.h"
74 #include "BIF_interface.h"
75 #include "BIF_toolbox.h"
76
77 #include "BIF_butspace.h"
78
79 #include "mydevice.h"
80 #include "blendef.h"
81
82 /* -----includes for this file specific----- */
83
84 #include "render.h"
85 #include "DNA_image_types.h"
86 #include "BKE_writeavi.h"
87 #include "BKE_image.h"
88 #include "BIF_renderwin.h"
89 #include "BIF_writeimage.h"
90 #include "BIF_writeavicodec.h"
91 #include "BIF_editsound.h"
92 #include "BSE_seqaudio.h"
93 #include "BSE_headerbuttons.h"
94 #include "butspace.h" // own module
95
96 #ifdef WITH_QUICKTIME
97 #include "quicktime_export.h"
98 #endif
99
100
101 /* here the calls for scene buttons
102    - render
103    - world
104    - anim settings, audio
105 */
106
107
108 /* ************************ SOUND *************************** */
109 static void load_new_sample(char *str)  /* called from fileselect */
110 {
111         char name[FILE_MAXDIR+FILE_MAXFILE];
112         bSound *sound;
113         bSample *sample, *newsample;
114
115         sound = G.buts->lockpoin;
116
117         if (sound) {
118                 // save values
119                 sample = sound->sample;
120                 strcpy(name, sound->sample->name);
121
122                 strcpy(sound->name, str);
123                 sound_set_sample(sound, NULL);
124                 sound_initialize_sample(sound);
125
126                 if (sound->sample->type == SAMPLE_INVALID) {
127                         error("Not a valid sample: %s", str);
128
129                         newsample = sound->sample;
130
131                         // restore values
132                         strcpy(sound->name, name);
133                         sound_set_sample(sound, sample);
134
135                         // remove invalid sample
136
137                         sound_free_sample(newsample);
138                         BLI_remlink(samples, newsample);
139                         MEM_freeN(newsample);
140                 }
141         }
142
143         allqueue(REDRAWBUTSSCENE, 0);
144
145 }
146
147
148 void do_soundbuts(unsigned short event)
149 {
150         char name[FILE_MAXDIR+FILE_MAXFILE];
151         bSound *sound;
152         bSample *sample;
153         bSound* tempsound;
154         ID *id;
155         
156         sound = G.buts->lockpoin;
157         
158         switch(event) {
159         case B_SOUND_REDRAW:
160                 allqueue(REDRAWBUTSSCENE, 0);
161                 break;
162
163         case B_SOUND_LOAD_SAMPLE:
164                 if (sound) strcpy(name, sound->name);
165                 else strcpy(name, U.sounddir);
166                         
167                 activate_fileselect(FILE_SPECIAL, "SELECT WAV FILE", name, load_new_sample);
168                 break;
169
170         case B_SOUND_PLAY_SAMPLE:
171                 if (sound) {
172                         if (sound->sample->type != SAMPLE_INVALID) {
173                                 sound_play_sound(sound);
174                                 allqueue(REDRAWBUTSSCENE, 0);
175                         }
176                 }
177                 break;
178
179         case B_SOUND_MENU_SAMPLE:
180                 if (G.buts->menunr == -2) {
181                         if (sound) {
182                                 activate_databrowse((ID *)sound->sample, ID_SAMPLE, 0, B_SOUND_MENU_SAMPLE, &G.buts->menunr, do_soundbuts);
183                         }
184                 } else if (G.buts->menunr > 0) {
185                         sample = BLI_findlink(samples, G.buts->menunr - 1);
186                         if (sample && sound) {
187                                 BLI_strncpy(sound->name, sample->name, sizeof(sound->name));
188                                 sound_set_sample(sound, sample);
189                                 do_soundbuts(B_SOUND_REDRAW);
190                         }
191                 }
192                         
193                 break;
194         case B_SOUND_NAME_SAMPLE:
195                 load_new_sample(sound->name);
196                 break;
197         
198         case B_SOUND_UNPACK_SAMPLE:
199                 if(sound && sound->sample) {
200                         sample = sound->sample;
201                         
202                         if (sample->packedfile) {
203                                 if (G.fileflags & G_AUTOPACK) {
204                                         if (okee("Disable AutoPack ?")) {
205                                                 G.fileflags &= ~G_AUTOPACK;
206                                         }
207                                 }
208                                 
209                                 if ((G.fileflags & G_AUTOPACK) == 0) {
210                                         unpackSample(sample, PF_ASK);
211                                 }
212                         } else {
213                                 sound_set_packedfile(sample, newPackedFile(sample->name));
214                         }
215                         allqueue(REDRAWHEADERS, 0);
216                         do_soundbuts(B_SOUND_REDRAW);
217                 }
218                 break;
219
220         case B_SOUND_COPY_SOUND:
221                 if (sound) {
222                         tempsound = sound_make_copy(sound);
223                         sound = tempsound;
224                         id = &sound->id;
225                         G.buts->lockpoin = (bSound*)id;
226                         do_soundbuts(B_SOUND_REDRAW);
227                 }
228                 break;
229
230         case B_SOUND_RECALC:
231                 waitcursor(1);
232                 sound = G.main->sound.first;
233                 while (sound) {
234                         MEM_freeN(sound->stream);
235                         sound->stream = 0;
236                         audio_makestream(sound);
237                         sound = (bSound *) sound->id.next;
238                 }
239                 waitcursor(0);
240                 allqueue(REDRAWSEQ, 0);
241                 break;
242
243         case B_SOUND_RATECHANGED:
244
245                 allqueue(REDRAWBUTSSCENE, 0);
246                 allqueue(REDRAWSEQ, 0);
247                 break;
248
249         case B_SOUND_MIXDOWN:
250                 audio_mixdown();
251                 break;
252
253         default: 
254                 if (G.f & G_DEBUG) {
255                         printf("do_soundbuts: unhandled event %d\n", event);
256                 }
257         }
258 }
259
260
261 static void sound_panel_listener(void)
262 {
263         uiBlock *block;
264         int xco= 100, yco=100, mixrate;
265         char mixrateinfo[256];
266         
267         block= uiNewBlock(&curarea->uiblocks, "sound_panel_listener", UI_EMBOSS, UI_HELV, curarea->win);
268         if(uiNewPanel(curarea, block, "Listener", "Sound", 320, 0, 318, 204)==0) return;
269
270         mixrate = sound_get_mixrate();
271         sprintf(mixrateinfo, "Game Mixrate: %d Hz", mixrate);
272         uiDefBut(block, LABEL, 0, mixrateinfo, xco,yco,295,20, 0, 0, 0, 0, 0, "");
273
274         yco -= 30;
275         uiDefBut(block, LABEL, 0, "Game listener settings:",xco,yco,195,20, 0, 0, 0, 0, 0, "");
276
277         yco -= 30;
278         uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Volume: ",
279                 xco,yco,195,24,&G.listener->gain, 0.0, 1.0, 1.0, 0, "Sets the maximum volume for the overall sound");
280         
281         yco -= 30;
282         uiDefBut(block, LABEL, 0, "Game Doppler effect settings:",xco,yco,195,20, 0, 0, 0, 0, 0, "");
283
284         yco -= 30;
285         uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Doppler: ",
286         xco,yco,195,24,&G.listener->dopplervelocity, 0.0, 10.0, 1.0, 0, "Use this for scaling the doppler effect");
287
288         
289 }
290
291 static void sound_panel_sequencer(void)
292 {
293         uiBlock *block;
294         short xco, yco;
295         char mixrateinfo[256];
296         
297         block= uiNewBlock(&curarea->uiblocks, "sound_panel_sequencer", UI_EMBOSS, UI_HELV, curarea->win);
298         if(uiNewPanel(curarea, block, "Sequencer", "Sound", 640, 0, 318, 204)==0) return;
299
300         /* audio sequence engine settings ------------------------------------------------------------------ */
301
302         xco = 1010;
303         yco = 195;
304
305         uiDefBut(block, LABEL, 0, "Audio sequencer settings", xco,yco,295,20, 0, 0, 0, 0, 0, "");
306
307         yco -= 25;
308         sprintf(mixrateinfo, "Mixing/Sync (latency: %d ms)", (int)( (((float)U.mixbufsize)/(float)G.scene->audio.mixrate)*1000.0 ) );
309         uiDefBut(block, LABEL, 0, mixrateinfo, xco,yco,295,20, 0, 0, 0, 0, 0, "");
310
311         yco -= 25;              
312         uiDefButI(block, ROW, B_SOUND_RATECHANGED, "44.1 kHz",  xco,yco,75,20, &G.scene->audio.mixrate, 2.0, 44100.0, 0, 0, "Mix at 44.1 kHz");
313         uiDefButI(block, ROW, B_SOUND_RATECHANGED, "48.0 kHz",          xco+80,yco,75,20, &G.scene->audio.mixrate, 2.0, 48000.0, 0, 0, "Mix at 48 kHz");
314         uiDefBut(block, BUT, B_SOUND_RECALC, "Recalc",          xco+160,yco,75,20, 0, 0, 0, 0, 0, "Recalculate samples");
315
316         yco -= 25;
317         uiDefButS(block, TOG|BIT|1, B_SOUND_CHANGED, "Sync",    xco,yco,115,20, &G.scene->audio.flag, 0, 0, 0, 0, "Use sample clock for syncing animation to audio");
318         uiDefButS(block, TOG|BIT|2, B_SOUND_CHANGED, "Scrub",           xco+120,yco,115,20, &G.scene->audio.flag, 0, 0, 0, 0, "Scrub when changing frames");
319
320         yco -= 25;
321         uiDefBut(block, LABEL, 0, "Main mix", xco,yco,295,20, 0, 0, 0, 0, 0, "");
322
323         yco -= 25;              
324         uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Main (dB): ",
325                 xco,yco,235,24,&G.scene->audio.main, -24.0, 6.0, 0, 0, "Set the audio master gain/attenuation in dB");
326
327         yco -= 25;
328         uiDefButS(block, TOG|BIT|0, 0, "Mute",  xco,yco,235,24, &G.scene->audio.flag, 0, 0, 0, 0, "Mute audio from sequencer");         
329         
330         yco -= 35;
331         uiDefBut(block, BUT, B_SOUND_MIXDOWN, "MIXDOWN",        xco,yco,235,24, 0, 0, 0, 0, 0, "Create WAV file from sequenced audio");
332         
333 }
334
335 static void sound_panel_sound(bSound *sound)
336 {
337         static int packdummy=0;
338         ID *id, *idfrom;
339         uiBlock *block;
340         bSample *sample;
341         char *strp, str[32], ch[256];
342
343         block= uiNewBlock(&curarea->uiblocks, "sound_panel_sound", UI_EMBOSS, UI_HELV, curarea->win);
344         if(uiNewPanel(curarea, block, "Sound", "Sound", 0, 0, 318, 204)==0) return;
345         
346         uiDefBut(block, LABEL, 0, "Blender Sound block",10,180,195,20, 0, 0, 0, 0, 0, "");
347         
348         // warning: abuse of texnr here! (ton didnt code!)
349         buttons_active_id(&id, &idfrom);
350         std_libbuttons(block, 10, 160, 0, NULL, B_SOUNDBROWSE2, id, idfrom, &(G.buts->texnr), 1, 0, 0, 0, 0);
351
352         if (sound) {
353         
354                 uiDefBut(block, BUT, B_SOUND_COPY_SOUND, "Copy sound", 220,160,90,20, 0, 0, 0, 0, 0, "Make another copy (duplicate) of the current sound");
355
356                 uiSetButLock(sound->id.lib!=0, "Can't edit library data");
357                 sound_initialize_sample(sound);
358                 sample = sound->sample;
359
360                 /* info string */
361                 if (sound->sample && sound->sample->len) {
362                         char *tmp;
363                         if (sound->sample->channels == 1) tmp= "Mono";
364                         else if (sound->sample->channels == 2) tmp= "Stereo";
365                         else tmp= "Unknown";
366                         
367                         sprintf(ch, "Sample: %s, %d bit, %d Hz, %d samples", tmp, sound->sample->bits, sound->sample->rate, (sound->sample->len/(sound->sample->bits/8)/sound->sample->channels));
368                         uiDefBut(block, LABEL, 0, ch,                   35,140,225,20, 0, 0, 0, 0, 0, "");
369                 }
370                 else {
371                         uiDefBut(block, LABEL, 0, "Sample: No sample info available.",35,140,225,20, 0, 0, 0, 0, 0, "");
372                 }
373
374                 /* sample browse buttons */
375
376                 id= (ID *)sound->sample;
377                 IDnames_to_pupstring(&strp, NULL, NULL, samples, id, &(G.buts->menunr));
378                 if (strp[0]) uiDefButS(block, MENU, B_SOUND_MENU_SAMPLE, strp, 10,120,23,20, &(G.buts->menunr), 0, 0, 0, 0, "Select another loaded sample");
379                 MEM_freeN(strp);
380                 
381                 uiDefBut(block, TEX, B_SOUND_NAME_SAMPLE, "",           35,120,225,20, sound->name, 0.0, 79.0, 0, 0, "The sample file used by this Sound");
382                 
383                 sprintf(str, "%d", sample->id.us);
384                 uiDefBut(block, BUT, B_SOUND_UNLINK_SAMPLE, str,        260,120,25,20, 0, 0, 0, 0, 0, "The number of users");
385                 
386                 if (sound->sample->packedfile) packdummy = 1;
387                 else packdummy = 0;
388                 
389                 uiDefIconButI(block, TOG|BIT|0, B_SOUND_UNPACK_SAMPLE, ICON_PACKAGE,
390                         285, 120,25,24, &packdummy, 0, 0, 0, 0,"Pack/Unpack this sample");
391                 
392                 uiDefBut(block, BUT, B_SOUND_LOAD_SAMPLE, "Load sample", 10, 95,150,24, 0, 0, 0, 0, 0, "Load a different sample file");
393
394                 uiDefBut(block, BUT, B_SOUND_PLAY_SAMPLE, "Play",       160, 95, 150, 24, 0, 0.0, 0, 0, 0, "Playback sample using settings below");
395                 
396                 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Volume: ",
397                         10,70,150,20, &sound->volume, 0.0, 1.0, 0, 0, "Set the volume of this sound");
398
399                 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Pitch: ",
400                         160,70,150,20, &sound->pitch, -12.0, 12.0, 0, 0, "Set the pitch of this sound");
401
402                 /* looping */
403                 uiDefButI(block, TOG|BIT|SOUND_FLAGS_LOOP_BIT, B_SOUND_REDRAW, "Loop",
404                         10, 50, 95, 20, &sound->flags, 0.0, 0.0, 0, 0, "Toggle between looping on/off");
405
406                 if (sound->flags & SOUND_FLAGS_LOOP) {
407                         uiDefButI(block, TOG|BIT|SOUND_FLAGS_BIDIRECTIONAL_LOOP_BIT, B_SOUND_REDRAW, "Ping Pong",
408                                 105, 50, 95, 20, &sound->flags, 0.0, 0.0, 0, 0, "Toggle between A->B and A->B->A looping");
409                         
410                 }
411         
412
413                 /* 3D settings ------------------------------------------------------------------ */
414
415                 if (sound->sample->channels == 1) {
416                         uiDefButI(block, TOG|BIT|SOUND_FLAGS_3D_BIT, B_SOUND_REDRAW, "3D Sound",
417                                 10, 10, 90, 20, &sound->flags, 0, 0, 0, 0, "Turns 3D sound on");
418                         
419                         if (sound->flags & SOUND_FLAGS_3D) {
420                                 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Scale: ",
421                                         100,10,210,20, &sound->attenuation, 0.0, 5.0, 1.0, 0, "Sets the surround scaling factor for this sound");
422                                 
423                         }
424                 }
425         }
426 }
427
428
429 /* ************************* SCENE *********************** */
430
431
432 static void output_pic(char *name)
433 {
434         strcpy(G.scene->r.pic, name);
435         allqueue(REDRAWBUTSSCENE, 0);
436 }
437
438 static void backbuf_pic(char *name)
439 {
440         Image *ima;
441         
442         strcpy(G.scene->r.backbuf, name);
443         allqueue(REDRAWBUTSSCENE, 0);
444
445         ima= add_image(name);
446         if(ima) {
447                 free_image_buffers(ima);        /* force read again */
448                 ima->ok= 1;
449         }
450 }
451
452 static void ftype_pic(char *name)
453 {
454         strcpy(G.scene->r.ftype, name);
455         allqueue(REDRAWBUTSSCENE, 0);
456 }
457
458
459 static void scene_change_set(Scene *sc, Scene *set) {
460         if (sc->set!=set) {
461                 sc->set= set;
462                 
463                 allqueue(REDRAWBUTSSCENE, 0);
464                 allqueue(REDRAWVIEW3D, 0);
465         }
466 }
467
468 static void run_playanim(char *file) {
469         extern char bprogname[];        /* usiblender.c */
470         char str[FILE_MAXDIR+FILE_MAXFILE];
471         int pos[2], size[2];
472
473         calc_renderwin_rectangle(R.winpos, pos, size);
474
475         sprintf(str, "%s -a -p %d %d \"%s\"", bprogname, pos[0], pos[1], file);
476         system(str);
477 }
478
479 void do_render_panels(unsigned short event)
480 {
481         ScrArea *sa;
482         ID *id;
483         char file[FILE_MAXDIR+FILE_MAXFILE];
484
485         switch(event) {
486
487         case B_DORENDER:
488                 BIF_do_render(0);
489                 break;
490         case B_RTCHANGED:
491                 allqueue(REDRAWALL, 0);
492                 break;
493         case B_PLAYANIM:
494 #ifdef WITH_QUICKTIME
495                 if(G.scene->r.imtype == R_QUICKTIME)
496                         makeqtstring(file);
497                 else
498 #endif
499                         makeavistring(file);
500                 if(BLI_exist(file)) {
501                         run_playanim(file);
502                 }
503                 else {
504                         makepicstring(file, G.scene->r.sfra);
505                         if(BLI_exist(file)) {
506                                 run_playanim(file);
507                         }
508                         else error("Can't find image: %s", file);
509                 }
510                 break;
511                 
512         case B_DOANIM:
513                 BIF_do_render(1);
514                 break;
515         
516         case B_FS_PIC:
517                 sa= closest_bigger_area();
518                 areawinset(sa->win);
519                 if(G.qual == LR_CTRLKEY)
520                         activate_imageselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic);
521                 else
522                         activate_fileselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic);
523                 break;
524
525         case B_FS_BACKBUF:
526                 sa= closest_bigger_area();
527                 areawinset(sa->win);
528                 if(G.qual == LR_CTRLKEY)
529                         activate_imageselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
530                 else
531                         activate_fileselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
532                 break;
533
534         case B_FS_FTYPE:
535                 sa= closest_bigger_area();
536                 areawinset(sa->win);
537                 if(G.qual == LR_CTRLKEY)
538                         activate_imageselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
539                 else
540                         activate_fileselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
541                 break;
542         
543         case B_PR_PAL:
544                 G.scene->r.xsch= 720;
545                 G.scene->r.ysch= 576;
546                 G.scene->r.xasp= 54;
547                 G.scene->r.yasp= 51;
548                 G.scene->r.size= 100;
549                 G.scene->r.frs_sec= 25;
550                 G.scene->r.mode &= ~R_PANORAMA;
551                 G.scene->r.xparts=  G.scene->r.yparts= 1;
552                 
553                 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
554                 allqueue(REDRAWBUTSSCENE, 0);
555                 allqueue(REDRAWVIEWCAM, 0);
556                 break;
557
558 #ifdef WITH_QUICKTIME
559         case B_FILETYPEMENU:
560                 allqueue(REDRAWBUTSSCENE, 0);
561 #if defined (_WIN32) || defined (__APPLE__)
562                 // fall through to codec settings if this is the first
563                 // time R_AVICODEC is selected for this scene.
564                 if (((G.scene->r.imtype == R_AVICODEC) 
565                          && (G.scene->r.avicodecdata == NULL)) ||
566                         ((G.scene->r.imtype == R_QUICKTIME) 
567                          && (G.scene->r.qtcodecdata == NULL))) {
568                 } else {
569                   break;
570                 }
571 #else /* libquicktime */
572                 if(G.scene->r.imtype == R_QUICKTIME) {
573                         /* i'm not sure if this should be here... */
574                         /* set default quicktime codec */
575                         if (!G.scene->r.qtcodecdata) {
576                                 G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData),   "QtCodecData");
577                                 qtcodec_idx = 1;
578                         }
579                         
580                         qt_init_codecs();
581                         if (qtcodec_idx < 1) qtcodec_idx = 1;   
582                         
583                         G.scene->r.qtcodecdata->fourcc =  qtcodecidx_to_fcc(qtcodec_idx-1);
584                         qt_init_codecdata(G.scene->r.qtcodecdata);
585 /* I'm not sure if this is really needed, so don't remove it yet */
586 #if 0
587                         /* get index of codec that can handle a given fourcc */
588                         if (qtcodec_idx < 1)
589                                 qtcodec_idx = get_qtcodec_idx(G.scene->r.qtcodecdata->fourcc)+1;
590
591                         /* no suitable codec found, alert user */
592                         if (qtcodec_idx < -1) {
593                                 error("no suitable codec found!");
594                                 qtcodec_idx = 1;
595                         }
596 #endif /* 0 */
597                 }
598 #endif /*_WIN32 || __APPLE__ */
599
600         case B_SELECTCODEC:
601 #if defined (_WIN32) || defined (__APPLE__)
602                 if ((G.scene->r.imtype == R_QUICKTIME)) { /* || (G.scene->r.qtcodecdata)) */
603                         get_qtcodec_settings();
604                 }
605 #ifdef _WIN32
606                 else
607                         get_avicodec_settings();
608 #endif /* _WIN32 */
609 #else /* libquicktime */
610                 if (!G.scene->r.qtcodecdata) {
611                         G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData),  "QtCodecData");
612                         qtcodec_idx = 1;
613                 }
614                 if (qtcodec_idx < 1) {
615                         qtcodec_idx = 1;
616                         qt_init_codecs();
617                 }
618
619                 G.scene->r.qtcodecdata->fourcc = qtcodecidx_to_fcc(qtcodec_idx-1);
620                 /* if the selected codec differs from the previous one, reinit it */
621                 qt_init_codecdata(G.scene->r.qtcodecdata);      
622                 allqueue(REDRAWBUTSSCENE, 0);
623 #endif /* _WIN32 || __APPLE__ */
624                 break;
625 #endif /* WITH_QUICKTIME */
626
627         case B_PR_FULL:
628                 G.scene->r.xsch= 1280;
629                 G.scene->r.ysch= 1024;
630                 G.scene->r.xasp= 1;
631                 G.scene->r.yasp= 1;
632                 G.scene->r.size= 100;
633                 G.scene->r.mode &= ~R_PANORAMA;
634                 G.scene->r.xparts=  G.scene->r.yparts= 1;
635
636                 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
637                 allqueue(REDRAWBUTSSCENE, 0);
638                 allqueue(REDRAWVIEWCAM, 0);
639                 break;
640         case B_PR_PRV:
641                 G.scene->r.xsch= 640;
642                 G.scene->r.ysch= 512;
643                 G.scene->r.xasp= 1;
644                 G.scene->r.yasp= 1;
645                 G.scene->r.size= 50;
646                 G.scene->r.mode &= ~R_PANORAMA;
647                 G.scene->r.xparts=  G.scene->r.yparts= 1;
648
649                 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
650                 allqueue(REDRAWVIEWCAM, 0);
651                 allqueue(REDRAWBUTSSCENE, 0);
652                 break;
653         case B_PR_CDI:
654                 G.scene->r.xsch= 384;
655                 G.scene->r.ysch= 280;
656                 G.scene->r.xasp= 1;
657                 G.scene->r.yasp= 1;
658                 G.scene->r.size= 100;
659                 G.scene->r.mode &= ~R_PANORAMA;
660                 G.scene->r.xparts=  G.scene->r.yparts= 1;
661
662                 BLI_init_rctf(&G.scene->r.safety, 0.15, 0.85, 0.15, 0.85);
663                 allqueue(REDRAWVIEWCAM, 0);
664                 allqueue(REDRAWBUTSSCENE, 0);
665                 break;
666         case B_PR_PAL169:
667                 G.scene->r.xsch= 720;
668                 G.scene->r.ysch= 576;
669                 G.scene->r.xasp= 64;
670                 G.scene->r.yasp= 45;
671                 G.scene->r.size= 100;
672                 G.scene->r.frs_sec= 25;
673                 G.scene->r.mode &= ~R_PANORAMA;
674                 G.scene->r.xparts=  G.scene->r.yparts= 1;
675
676                 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
677                 allqueue(REDRAWVIEWCAM, 0);
678                 allqueue(REDRAWBUTSSCENE, 0);
679                 break;
680         case B_PR_D2MAC:
681                 G.scene->r.xsch= 1024;
682                 G.scene->r.ysch= 576;
683                 G.scene->r.xasp= 1;
684                 G.scene->r.yasp= 1;
685                 G.scene->r.size= 50;
686                 G.scene->r.mode &= ~R_PANORAMA;
687                 G.scene->r.xparts=  G.scene->r.yparts= 1;
688
689                 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
690                 allqueue(REDRAWVIEWCAM, 0);
691                 allqueue(REDRAWBUTSSCENE, 0);
692                 break;
693         case B_PR_MPEG:
694                 G.scene->r.xsch= 368;
695                 G.scene->r.ysch= 272;
696                 G.scene->r.xasp= 105;
697                 G.scene->r.yasp= 100;
698                 G.scene->r.size= 100;
699                 G.scene->r.mode &= ~R_PANORAMA;
700                 G.scene->r.xparts=  G.scene->r.yparts= 1;
701
702                 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
703                 allqueue(REDRAWVIEWCAM, 0);
704                 allqueue(REDRAWBUTSSCENE, 0);
705                 break;
706         case B_PR_PC:
707                 G.scene->r.xsch= 640;
708                 G.scene->r.ysch= 480;
709                 G.scene->r.xasp= 100;
710                 G.scene->r.yasp= 100;
711                 G.scene->r.size= 100;
712                 G.scene->r.mode &= ~R_PANORAMA;
713                 G.scene->r.xparts=  G.scene->r.yparts= 1;
714
715                 BLI_init_rctf(&G.scene->r.safety, 0.0, 1.0, 0.0, 1.0);
716                 allqueue(REDRAWVIEWCAM, 0);
717                 allqueue(REDRAWBUTSSCENE, 0);
718                 break;
719         case B_PR_PRESET:
720                 G.scene->r.xsch= 720;
721                 G.scene->r.ysch= 576;
722                 G.scene->r.xasp= 54;
723                 G.scene->r.yasp= 51;
724                 G.scene->r.size= 100;
725                 G.scene->r.mode= R_OSA+R_SHADOW+R_FIELDS;
726                 G.scene->r.imtype= R_TARGA;
727                 G.scene->r.xparts=  G.scene->r.yparts= 1;
728
729                 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
730                 allqueue(REDRAWVIEWCAM, 0);
731                 allqueue(REDRAWBUTSSCENE, 0);
732                 break;
733         case B_PR_PANO:
734                 G.scene->r.xsch= 36;
735                 G.scene->r.ysch= 176;
736                 G.scene->r.xasp= 115;
737                 G.scene->r.yasp= 100;
738                 G.scene->r.size= 100;
739                 G.scene->r.mode |= R_PANORAMA;
740                 G.scene->r.xparts=  16;
741                 G.scene->r.yparts= 1;
742
743                 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
744                 allqueue(REDRAWVIEWCAM, 0);
745                 allqueue(REDRAWBUTSSCENE, 0);
746                 break;
747         case B_PR_NTSC:
748                 G.scene->r.xsch= 720;
749                 G.scene->r.ysch= 480;
750                 G.scene->r.xasp= 10;
751                 G.scene->r.yasp= 11;
752                 G.scene->r.size= 100;
753                 G.scene->r.frs_sec= 30;
754                 G.scene->r.mode &= ~R_PANORAMA;
755                 G.scene->r.xparts=  G.scene->r.yparts= 1;
756                 
757                 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
758                 allqueue(REDRAWBUTSSCENE, 0);
759                 allqueue(REDRAWVIEWCAM, 0);
760                 break;
761
762         case B_SETBROWSE:
763                 id= (ID*) G.scene->set;
764                 
765                 if (G.buts->menunr==-2) {
766                          activate_databrowse(id, ID_SCE, 0, B_SETBROWSE, &G.buts->menunr, do_render_panels);
767                 } else if (G.buts->menunr>0) {
768                         Scene *newset= (Scene*) BLI_findlink(&G.main->scene, G.buts->menunr-1);
769                         
770                         if (newset==G.scene)
771                                 error("Not allowed");
772                         else if (newset)
773                                 scene_change_set(G.scene, newset);
774                 }  
775                 break;
776         case B_CLEARSET:
777                 scene_change_set(G.scene, NULL);
778                 break;
779         }
780 }
781
782 static uiBlock *edge_render_menu(void *arg_unused)
783 {
784         uiBlock *block;
785         
786         block= uiNewBlock(&curarea->uiblocks, "edge render", UI_EMBOSS, UI_HELV, curarea->win);
787                 
788         /* use this for a fake extra empy space around the buttons */
789         uiDefBut(block, LABEL, 0, "",  285, -20, 230, 120, NULL,  0, 0, 0, 0, "");
790         
791         uiDefButS(block, NUM, 0,"Eint:",  295,50,70,19,  &G.scene->r.edgeint, 0.0, 255.0, 0, 0,
792                   "Sets edge intensity for Toon shading");
793         uiDefButI(block, TOG, 0,"Shift", 365,50,70,19,  &G.compat, 0, 0, 0, 0,
794                   "For unified renderer: use old offsets for edges");
795         uiDefButI(block, TOG, 0,"All",          435,50,70,19,  &G.notonlysolid, 0, 0, 0, 0,
796                   "For unified renderer: also consider transparent faces for toon shading");
797
798         /* colour settings for the toon shading */
799         uiDefButF(block, COL, B_EDGECOLSLI, "", 295,-10,30,60,  &(G.scene->r.edgeR), 0, 0, 0, 0, "");
800         
801         uiDefButF(block, NUMSLI, 0, "R ",   325, 30, 180,19,   &G.scene->r.edgeR, 0.0, 1.0, B_EDGECOLSLI, 0,
802                   "For unified renderer: Colour for edges in toon shading mode.");
803         uiDefButF(block, NUMSLI, 0, "G ",  325, 10, 180,19,  &G.scene->r.edgeG, 0.0, 1.0, B_EDGECOLSLI, 0,
804                   "For unified renderer: Colour for edges in toon shading mode.");
805         uiDefButF(block, NUMSLI, 0, "B ",  325, -10, 180,19,  &G.scene->r.edgeB, 0.0, 1.0, B_EDGECOLSLI, 0,
806                   "For unified renderer: Colour for edges in toon shading mode.");
807
808         uiDefButS(block, NUM, 0,"AntiShift",   365,70,140,19,  &(G.scene->r.same_mat_redux), 0, 255.0, 0, 0,
809                   "For unified renderer: reduce intensity on boundaries "
810                   "with identical materials with this number.");
811         
812         uiBlockSetDirection(block, UI_TOP);
813         
814         return block;
815 }
816
817 static uiBlock *post_render_menu(void *arg_unused)
818 {
819         uiBlock *block;
820         
821         block= uiNewBlock(&curarea->uiblocks, "post render", UI_EMBOSS, UI_HELV, curarea->win);
822                 
823         /* use this for a fake extra empy space around the buttons */
824         uiDefBut(block, LABEL, 0, "",                   -10, 10, 200, 80, NULL, 0, 0, 0, 0, "");
825         
826         uiDefButF(block, NUMSLI, 0,"Add:",              0,60,180,19,  &G.scene->r.postadd, -1.0, 1.0, 0, 0, "");
827         uiDefButF(block, NUMSLI, 0,"Mul:",              0,40,180,19,  &G.scene->r.postmul, 0.01, 4.0, 0, 0, "");
828         uiDefButF(block, NUMSLI, 0,"Gamma:",            0,20,180,19,  &G.scene->r.postgamma, 0.2, 2.0, 0, 0, "");
829
830         uiBlockSetDirection(block, UI_TOP);
831         
832         return block;
833 }
834
835
836 static uiBlock *framing_render_menu(void *arg_unused)
837 {
838         uiBlock *block;
839         short yco = 60, xco = 0;
840         int randomcolorindex = 1234;
841
842         block= uiNewBlock(&curarea->uiblocks, "framing_options", UI_EMBOSS, UI_HELV, curarea->win);
843
844         /* use this for a fake extra empy space around the buttons */
845         uiDefBut(block, LABEL, 0, "",                   -10, -10, 300, 100, NULL, 0, 0, 0, 0, "");
846
847         uiDefBut(block, LABEL, B_NOP, "Framing:", xco, yco, 68,19, 0, 0, 0, 0, 0, "");
848         uiDefButC(block, ROW, 0, "Stretch",     xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_SCALE , 0, 0, "Stretch or squeeze the viewport to fill the display window");
849         uiDefButC(block, ROW, 0, "Expose",      xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_EXTEND, 0, 0, "Show the entire viewport in the display window, viewing more horizontally or vertically");
850         uiDefButC(block, ROW, 0, "Bars",            xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_BARS  , 0, 0, "Show the entire viewport in the display window, using bar horizontally or vertically");
851
852         yco -= 20;
853         xco = 35;
854
855         uiDefButF(block, COL, randomcolorindex, "",                0, yco - 58 + 18, 33, 58, &G.scene->framing.col[0], 0, 0, 0, 0, "");
856
857         uiDefButF(block, NUMSLI, 0, "R ", xco,yco,243,18, &G.scene->framing.col[0], 0.0, 1.0, randomcolorindex, 0, "Set the red component of the bars");
858         yco -= 20;
859         uiDefButF(block, NUMSLI, 0, "G ", xco,yco,243,18, &G.scene->framing.col[1], 0.0, 1.0, randomcolorindex, 0, "Set the green component of the bars");
860         yco -= 20;
861         uiDefButF(block, NUMSLI, 0, "B ", xco,yco,243,18, &G.scene->framing.col[2], 0.0, 1.0, randomcolorindex, 0, "Set the blue component of the bars");
862
863         uiBlockSetDirection(block, UI_TOP);
864
865         return block;
866 }
867
868
869 static char *imagetype_pup(void)
870 {
871         static char string[1024];
872         char formatstring[1024];
873
874         strcpy(formatstring, "Save image as: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
875
876 #ifdef __sgi
877         strcat(formatstring, "|%s %%x%d");      // add space for Movie
878 #endif
879
880         strcat(formatstring, "|%s %%x%d");      // add space for PNG
881         strcat(formatstring, "|%s %%x%d");      // add space for BMP
882
883 #ifdef _WIN32
884         strcat(formatstring, "|%s %%x%d");      // add space for AVI Codec
885 #endif
886
887 #ifdef WITH_QUICKTIME
888         if(G.have_quicktime)
889                 strcat(formatstring, "|%s %%x%d");      // add space for Quicktime
890 #endif
891
892         if(G.have_quicktime) {
893                 sprintf(string, formatstring,
894                         "AVI Raw",        R_AVIRAW,
895                         "AVI Jpeg",       R_AVIJPEG,
896 #ifdef _WIN32
897                         "AVI Codec",      R_AVICODEC,
898 #endif
899 #ifdef WITH_QUICKTIME
900                         "QuickTime",      R_QUICKTIME,
901 #endif
902                         "Targa",          R_TARGA,
903                         "Targa Raw",      R_RAWTGA,
904                         "PNG",            R_PNG,
905                         "BMP",            R_BMP,
906                         "Jpeg",           R_JPEG90,
907                         "HamX",           R_HAMX,
908                         "Iris",           R_IRIS,
909                         "Iris + Zbuffer", R_IRIZ,
910                         "Ftype",          R_FTYPE,
911                         "Movie",          R_MOVIE
912                 );
913         } else {
914                 sprintf(string, formatstring,
915                         "AVI Raw",        R_AVIRAW,
916                         "AVI Jpeg",       R_AVIJPEG,
917 #ifdef _WIN32
918                         "AVI Codec",      R_AVICODEC,
919 #endif
920                         "Targa",          R_TARGA,
921                         "Targa Raw",      R_RAWTGA,
922                         "PNG",            R_PNG,
923                         "BMP",            R_BMP,
924                         "Jpeg",           R_JPEG90,
925                         "HamX",           R_HAMX,
926                         "Iris",           R_IRIS,
927                         "Iris + Zbuffer", R_IRIZ,
928                         "Ftype",          R_FTYPE,
929                         "Movie",          R_MOVIE
930                 );
931         }
932
933         return (string);
934 }
935
936 #ifdef _WIN32
937 static char *avicodec_str(void)
938 {
939         static char string[1024];
940
941         sprintf(string, "Codec: %s", G.scene->r.avicodecdata->avicodecname);
942
943         return string;
944 }
945 #endif
946
947 static void render_panel_output(void)
948 {
949         ID *id;
950         int a,b;
951         uiBlock *block;
952         char *strp;
953
954
955         block= uiNewBlock(&curarea->uiblocks, "render_panel_output", UI_EMBOSS, UI_HELV, curarea->win);
956         if(uiNewPanel(curarea, block, "Output", "Render", 0, 0, 318, 204)==0) return;
957         
958         uiBlockBeginAlign(block);
959         uiDefIconBut(block, BUT, B_FS_PIC, ICON_FILESEL,        8, 170, 20, 19, 0, 0, 0, 0, 0, "Open Fileselect to get Pics dir/name");
960         uiDefBut(block, TEX,0,"",                                                       30, 170, 268, 19,G.scene->r.pic, 0.0,79.0, 0, 0, "Directory/name to save rendered Pics to");
961         uiDefIconBut(block, BUT,B_FS_BACKBUF, ICON_FILESEL, 8, 148, 20, 19, 0, 0, 0, 0, 0, "Open Fileselect to get Backbuf image");
962         uiDefBut(block, TEX,0,"",                                                       30, 148, 268, 19,G.scene->r.backbuf, 0.0,79.0, 0, 0, "Image to use as background for rendering");
963         uiDefIconBut(block, BUT,B_FS_FTYPE, ICON_FILESEL,       8, 125, 20, 19, 0, 0, 0, 0, 0, "Open Fileselect to get Ftype image");
964         uiDefBut(block, TEX,0,"",                                                       30, 125, 268, 19,G.scene->r.ftype,0.0,79.0, 0, 0, "Image to use with FTYPE Image type");
965         
966         
967         /* SET BUTTON */
968         uiBlockBeginAlign(block);
969         id= (ID *)G.scene->set;
970         IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), id, &(G.buts->menunr));
971         if(strp[0])
972                 uiDefButS(block, MENU, B_SETBROWSE, strp, 8, 96, 20, 19, &(G.buts->menunr), 0, 0, 0, 0, "Scene to link as a Set");
973         MEM_freeN(strp);
974
975         if(G.scene->set) {
976                 uiSetButLock(1, NULL);
977                 uiDefIDPoinBut(block, test_scenepoin_but, 0, "",        29, 96, 100, 19, &(G.scene->set), "Name of the Set");
978                 uiClearButLock();
979                 uiDefIconBut(block, BUT, B_CLEARSET, ICON_X,            131, 96, 20, 19, 0, 0, 0, 0, 0, "Remove Set link");
980         }
981         uiBlockEndAlign(block);
982
983         uiBlockSetCol(block, TH_BUT_SETTING1);
984         uiDefButS(block, TOG|BIT|0, 0,"Backbuf",        8, 70, 62, 19, &G.scene->r.bufflag, 0, 0, 0, 0, "Enable/Disable use of Backbuf image"); 
985         uiBlockSetCol(block, TH_AUTO);
986                 
987         uiBlockBeginAlign(block);
988         for(b=2; b>=0; b--)
989                 for(a=0; a<3; a++)
990                         uiDefButS(block, TOG|BIT|(3*b+a), 800,"",       (short)(9+18*a),(short)(7+12*b),16,10, &R.winpos, 0, 0, 0, 0, "Render window placement on screen");
991
992         uiBlockBeginAlign(block);
993         uiDefButS(block, ROW, B_REDR, "DispView",       72, 7, 65, 19, &R.displaymode, 0.0, (float)R_DISPLAYVIEW, 0, 0, "Sets render output to display in 3D view");
994         uiDefButS(block, ROW, B_REDR, "DispWin",        139, 7, 62, 19, &R.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output to display in a seperate window");
995         uiBlockEndAlign(block);
996
997         uiDefButS(block, TOG|BIT|4, 0, "Extensions",    228, 8, 67, 18, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds extensions to the output when rendering animations");
998
999         /* Toon shading buttons */
1000         uiBlockBeginAlign(block);
1001         uiDefButI(block, TOG|BIT|5, 0,"Edge",   154, 70, 47, 19, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon shading");
1002         uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings |>> ", 204, 70, 93, 19, "Display edge settings");
1003         uiBlockEndAlign(block);
1004
1005         /* unified render buttons */
1006         if(G.scene->r.mode & R_UNIFIED) {
1007                 uiDefBlockBut(block, post_render_menu, NULL, "Post process |>> ", 205, 48, 92, 19, "Only for unified render");
1008                 if (G.scene->r.mode & R_GAMMA) {
1009                         uiDefButF(block, NUMSLI, 0,"Gamma:",            8, 48, 143, 19,
1010                                          &(G.scene->r.gamma), 0.2, 5.0, B_GAMMASLI, 0,
1011                                          "The gamma value for blending oversampled images (1.0 = no correction).");
1012                 }
1013         }
1014 }
1015
1016 static void render_panel_render(void)
1017 {
1018         uiBlock *block;
1019
1020
1021         block= uiNewBlock(&curarea->uiblocks, "render_panel_render", UI_EMBOSS, UI_HELV, curarea->win);
1022         if(uiNewPanel(curarea, block, "Render", "Render", 320, 0, 318, 204)==0) return;
1023
1024         uiBlockBeginAlign(block);
1025         uiDefBut(block, BUT,B_DORENDER,"RENDER",        369, 164, 192,37, 0, 0, 0, 0, 0, "Start the rendering");
1026         /* yafray: on request, render engine menu is back again, and moved to Render panel */
1027         uiDefButS(block, MENU, B_REDR, "Rendering Engine %t|Blender Internal %x0|YafRay %x1", 
1028                                                                                                 369, 142, 192, 20, &G.scene->r.renderer, 0, 0, 0, 0, "Choose rendering engine");        
1029
1030         uiBlockBeginAlign(block);
1031         uiDefButI(block, TOG|BIT|0, 0, "OSA",           369,110,122,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
1032         uiDefButS(block, ROW,B_DIFF,"5",                        369,86,28,20,&G.scene->r.osa,2.0,5.0, 0, 0, "Sets oversample level to 5");
1033         uiDefButS(block, ROW,B_DIFF,"8",                        397,86,28,20,&G.scene->r.osa,2.0,8.0, 0, 0, "Sets oversample level to 8 (Recommended)");
1034         uiDefButS(block, ROW,B_DIFF,"11",                       425,86,33,20,&G.scene->r.osa,2.0,11.0, 0, 0, "Sets oversample level to 11");
1035         uiDefButS(block, ROW,B_DIFF,"16",                       458,86,33,20,&G.scene->r.osa,2.0,16.0, 0, 0, "Sets oversample level to 16");
1036
1037         uiBlockBeginAlign(block);
1038         uiDefButI(block, TOG|BIT|14, 0, "MBLUR",        495,110,66,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Motion Blur calculation");
1039         uiDefButF(block, NUM,B_DIFF,"Bf:",                      495,86,65,20,&G.scene->r.blurfac, 0.01, 5.0, 10, 2, "Sets motion blur factor");
1040
1041         uiBlockBeginAlign(block);
1042         uiDefButS(block, NUM,B_DIFF,"Xparts:",          369,42,99,31,&G.scene->r.xparts,1.0, 64.0, 0, 0, "Sets the number of horizontal parts to render image in (For panorama sets number of camera slices)");
1043         uiDefButS(block, NUM,B_DIFF,"Yparts:",          472,42,86,31,&G.scene->r.yparts,1.0, 64.0, 0, 0, "Sets the number of vertical parts to render image in");
1044
1045         uiBlockBeginAlign(block);
1046         uiDefButS(block, ROW,800,"Sky",         369,11,30,24,&G.scene->r.alphamode,3.0,0.0, 0, 0, "Fill background with sky");
1047         uiDefButS(block, ROW,800,"Premul",      400,11,50,24,&G.scene->r.alphamode,3.0,1.0, 0, 0, "Multiply alpha in advance");
1048         uiDefButS(block, ROW,800,"Key",         450,11,40,24,&G.scene->r.alphamode,3.0,2.0, 0, 0, "Alpha and colour values remain unchanged");
1049         uiBlockEndAlign(block);
1050         
1051         if(G.scene->r.mode & R_RAYTRACE)
1052                 uiDefButS(block, MENU, B_DIFF,"Octree resolution %t|64 %x64|128 %x128|256 %x256|512 %x512",     495,11,66,24,&G.scene->r.ocres,0.0,0.0, 0, 0, "Octree resolution for ray tracing");
1053
1054         uiBlockBeginAlign(block);
1055         uiDefButI(block, TOG|BIT|1,0,"Shadow",  565,171,61,30, &G.scene->r.mode, 0, 0, 0, 0, "Enable shadow calculation");
1056         uiDefButI(block, TOG|BIT|4,0,"EnvMap",  626,171,61,30, &G.scene->r.mode, 0, 0, 0, 0, "Enable environment map rendering");
1057         uiDefButI(block, TOG|BIT|10,0,"Pano",   565,142,41,28, &G.scene->r.mode, 0, 0, 0, 0, "Enable panorama rendering (output width is multiplied by Xparts)");
1058         uiDefButI(block, TOG|BIT|16,B_REDR,"Ray",606,142,35,28, &G.scene->r.mode, 0, 0, 0, 0, "Enable ray tracing");
1059         uiDefButI(block, TOG|BIT|8,0,"Radio",   641,142,46,28, &G.scene->r.mode, 0, 0, 0, 0, "Enable radiosity rendering");
1060         
1061         uiBlockBeginAlign(block);
1062         uiDefButS(block, ROW,B_DIFF,"100%",                     565,110,121,20,&G.scene->r.size,1.0,100.0, 0, 0, "Set render size to defined size");
1063         uiDefButS(block, ROW,B_DIFF,"75%",                      565,86,36,20,&G.scene->r.size,1.0,75.0, 0, 0, "Set render size to 3/4 of defined size");
1064         uiDefButS(block, ROW,B_DIFF,"50%",                      604,86,40,20,&G.scene->r.size,1.0,50.0, 0, 0, "Set render size to 1/2 of defined size");
1065         uiDefButS(block, ROW,B_DIFF,"25%",                      647,86,39,20,&G.scene->r.size,1.0,25.0, 0, 0, "Set render size to 1/4 of defined size");
1066
1067         uiBlockBeginAlign(block);
1068         uiDefButI(block, TOG|BIT|6,0,"Fields",  564,50,60,23,&G.scene->r.mode, 0, 0, 0, 0, "Enables field rendering");
1069         uiDefButI(block, TOG|BIT|13,0,"Odd",    624,50,40,23,&G.scene->r.mode, 0, 0, 0, 0, "Enables Odd field first rendering (Default: Even field)");
1070         uiDefButI(block, TOG|BIT|7,0,"x",               665,50,20,23,&G.scene->r.mode, 0, 0, 0, 0, "Disables time difference in field calculations");
1071
1072         uiDefButI(block, TOG|BIT|17,0,"Gauss",  564,30,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Gaussian sampling filter for antialiasing");
1073         uiDefButF(block, NUM,B_DIFF,"",                 624,30,60,20,&G.scene->r.gauss,0.5, 1.5, 100, 2, "Sets the Gaussian filter size");
1074         
1075         uiDefButI(block, TOG|BIT|9,REDRAWVIEWCAM, "Border",     564,10,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Render a small cut-out of the image");
1076         uiDefButI(block, TOG|BIT|2,0, "Gamma",  624,10,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Enable gamma correction");
1077
1078
1079 }
1080
1081 static void render_panel_anim(void)
1082 {
1083         uiBlock *block;
1084
1085
1086         block= uiNewBlock(&curarea->uiblocks, "render_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
1087         if(uiNewPanel(curarea, block, "Anim", "Render", 640, 0, 318, 204)==0) return;
1088
1089
1090         uiDefBut(block, BUT,B_DOANIM,"ANIM",            692,142,192,47, 0, 0, 0, 0, 0, "Start rendering a sequence");
1091         
1092         uiBlockSetCol(block, TH_BUT_SETTING1);
1093         uiBlockBeginAlign(block);
1094         uiDefButS(block, TOG|BIT|0, 0, "Do Sequence",   692,114,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Enables sequence output rendering (Default: 3D rendering)");
1095         uiDefButS(block, TOG|BIT|1, 0, "Render Daemon", 692,90,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Let external network render current scene");
1096         uiBlockEndAlign(block);
1097         
1098         uiBlockSetCol(block, TH_AUTO);
1099         uiDefBut(block, BUT,B_PLAYANIM, "PLAY", 692,40,94,33, 0, 0, 0, 0, 0, "Play animation of rendered images/avi (searches Pics: field)");
1100         uiDefButS(block, NUM, B_RTCHANGED, "rt:",       790,40,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button");
1101         
1102         uiBlockBeginAlign(block);
1103         uiDefButS(block, NUM,REDRAWSEQ,"Sta:",  692,10,94,24, &G.scene->r.sfra,1.0,18000.0, 0, 0, "The start frame of the animation");
1104         uiDefButS(block, NUM,REDRAWSEQ,"End:",  790,10,95,24, &G.scene->r.efra,1.0,18000.0, 0, 0, "The end  frame of the animation");
1105         uiBlockEndAlign(block);
1106 }
1107
1108 static void render_panel_format(void)
1109 {
1110         uiBlock *block;
1111         int yofs;
1112
1113
1114         block= uiNewBlock(&curarea->uiblocks, "render_panel_format", UI_EMBOSS, UI_HELV, curarea->win);
1115         if(uiNewPanel(curarea, block, "Format", "Render", 960, 0, 318, 204)==0) return;
1116         uiDefBlockBut(block, framing_render_menu, NULL, 
1117                                   "Game framing settings |>> ", 
1118                                   892, 169, 227, 20, "Display game framing settings");
1119         /* uiDefIconTextBlockBut(block, framing_render_menu, NULL, 
1120                                                    ICON_BLOCKBUT_CORNER, 
1121                                                    "Game framing settings", 
1122                                                    892, 169, 227, 20, 
1123                                                    "Display game framing settings"); */
1124
1125         uiBlockBeginAlign(block);
1126         uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeX:",    892 ,136,112,27, &G.scene->r.xsch, 4.0, 10000.0, 0, 0, "The image width in pixels");
1127         uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeY:",    1007,136,112,27, &G.scene->r.ysch, 4.0,10000.0, 0, 0, "The image height in scanlines");
1128         uiDefButS(block, NUM,REDRAWVIEWCAM,"AspX:",     892 ,114,112,20, &G.scene->r.xasp, 1.0,200.0, 0, 0, "The horizontal aspect ratio");
1129         uiDefButS(block, NUM,REDRAWVIEWCAM,"AspY:",     1007,114,112,20, &G.scene->r.yasp, 1.0,200.0, 0, 0, "The vertical aspect ratio");
1130         uiBlockEndAlign(block);
1131
1132         yofs = 54;
1133
1134 #ifdef __sgi
1135         yofs = 76;
1136         uiDefButS(block, NUM,B_DIFF,"MaxSize:", 892,32,165,20, &G.scene->r.maximsize, 0.0, 500.0, 0, 0, "Maximum size per frame to save in an SGI movie");
1137         uiDefButI(block, TOG|BIT|12,0,"Cosmo", 1059,32,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Attempt to save SGI movies using Cosmo hardware");
1138 #endif
1139
1140         uiDefButS(block, MENU,B_FILETYPEMENU,imagetype_pup(),   892,yofs,174,20, &G.scene->r.imtype, 0, 0, 0, 0, "Images are saved in this file format");
1141         uiDefButI(block, TOG|BIT|11,0, "Crop",          1068,yofs,51,20, &G.scene->r.mode, 0, 0, 0, 0, "Exclude border rendering from total image");
1142
1143         yofs -= 22;
1144
1145         if(G.scene->r.quality==0) G.scene->r.quality= 90;
1146
1147 #ifdef WITH_QUICKTIME
1148         if (G.scene->r.imtype == R_AVICODEC || G.scene->r.imtype == R_QUICKTIME) {
1149 #else /* WITH_QUICKTIME */
1150         if (0) {
1151 #endif
1152                 if(G.scene->r.imtype == R_QUICKTIME) {
1153 #ifdef WITH_QUICKTIME
1154 #if defined (_WIN32) || defined (__APPLE__)
1155                         //glColor3f(0.65, 0.65, 0.7);
1156                         //glRecti(892,yofs+46,892+225,yofs+45+20);
1157                         if(G.scene->r.qtcodecdata == NULL)
1158                                 uiDefBut(block, LABEL, 0, "Codec: not set",  892,yofs+44,225,20, 0, 0, 0, 0, 0, "");
1159                         else
1160                                 uiDefBut(block, LABEL, 0, G.scene->r.qtcodecdata->qtcodecname,  892,yofs+44,225,20, 0, 0, 0, 0, 0, "");
1161                         uiDefBut(block, BUT,B_SELECTCODEC, "Set codec",  892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for Quicktime");
1162 #else /* libquicktime */
1163                         if (!G.scene->r.qtcodecdata) G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData), "QtCodecData");
1164                         uiDefButI(block, MENU, B_SELECTCODEC, qtcodecs_pup(), 892,yofs, 112, 20, &qtcodec_idx, 0, 0, 0, 0, "Codec");
1165                         /* make sure the codec stored in G.scene->r.qtcodecdata matches the selected
1166                          * one, especially if it's not set.. */
1167                         if (!G.scene->r.qtcodecdata->fourcc) {
1168                                 G.scene->r.qtcodecdata->fourcc = qtcodecidx_to_fcc(qtcodec_idx-1);
1169                                 qt_init_codecdata(G.scene->r.qtcodecdata);      
1170                         }
1171
1172                         yofs -= 22;
1173                         uiDefBlockBut(block, qtcodec_menu, NULL, "Codec Settings |>> ", 892,yofs, 227, 20, "Edit Codec settings for QuickTime");
1174                         yofs +=22;
1175
1176 #endif /* libquicktime */
1177 #endif /* WITH_QUICKTIME */
1178                 } else {
1179 #ifdef _WIN32
1180                         //glColor3f(0.65, 0.65, 0.7);
1181                         //glRecti(892,yofs+46,892+225,yofs+45+20);
1182                         if(G.scene->r.avicodecdata == NULL)
1183                                 uiDefBut(block, LABEL, 0, "Codec: not set.",  892,yofs+43,225,20, 0, 0, 0, 0, 0, "");
1184                         else
1185                                 uiDefBut(block, LABEL, 0, avicodec_str(),  892,yofs+43,225,20, 0, 0, 0, 0, 0, "");
1186 #endif
1187                         uiDefBut(block, BUT,B_SELECTCODEC, "Set codec",  892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for AVI");
1188                 }
1189         } else {
1190                 uiDefButS(block, NUM,0, "Quality:",           892,yofs,112,20, &G.scene->r.quality, 10.0, 100.0, 0, 0, "Quality setting for JPEG images, AVI Jpeg and SGI movies");
1191         }
1192         uiDefButS(block, NUM,REDRAWALL,"Frs/sec:",   1006,yofs,113,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
1193
1194
1195         uiBlockBeginAlign(block);
1196         uiDefButS(block, ROW,B_DIFF,"BW",                       892, 10,74,19, &G.scene->r.planes, 5.0,(float)R_PLANESBW, 0, 0, "Images are saved with BW (grayscale) data");
1197         uiDefButS(block, ROW,B_DIFF,"RGB",                  968, 10,74,19, &G.scene->r.planes, 5.0,(float)R_PLANES24, 0, 0, "Images are saved with RGB (color) data");
1198         uiDefButS(block, ROW,B_DIFF,"RGBA",                1044, 10,75,19, &G.scene->r.planes, 5.0,(float)R_PLANES32, 0, 0, "Images are saved with RGB and Alpha data (if supported)");
1199
1200         uiBlockBeginAlign(block);
1201         uiDefBut(block, BUT,B_PR_PAL, "PAL",            1146,170,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x576, Aspect ratio - 54x51, 25 fps");
1202         uiDefBut(block, BUT,B_PR_NTSC, "NTSC",          1146,150,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x480, Aspect ratio - 10x11, 30 fps");
1203         uiDefBut(block, BUT,B_PR_PRESET, "Default",     1146,130,100,18, 0, 0, 0, 0, 0, "Same as PAL, with render settings (OSA, Shadows, Fields)");
1204         uiDefBut(block, BUT,B_PR_PRV, "Preview",        1146,110,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x512, Render size 50%");
1205         uiDefBut(block, BUT,B_PR_PC, "PC",                      1146,90,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x480, Aspect ratio - 100x100");
1206         uiDefBut(block, BUT,B_PR_PAL169, "PAL 16:9",1146,70,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x576, Aspect ratio - 64x45");
1207         uiDefBut(block, BUT,B_PR_PANO, "PANO",          1146,50,100,18, 0, 0, 0, 0, 0, "Standard panorama settings");
1208         uiDefBut(block, BUT,B_PR_FULL, "FULL",          1146,30,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 1280x1024, Aspect ratio - 1x1");
1209         uiDefButI(block, TOG|BIT|15, B_REDR, "Unified Renderer", 1146,10,100,18,  &G.scene->r.mode, 0, 0, 0, 0, "Use the unified renderer.");
1210         uiBlockEndAlign(block);
1211 }
1212
1213
1214 /* yafray: global illumination options panel */
1215 static void render_panel_yafrayGI()
1216 {
1217         uiBlock *block;
1218
1219         block= uiNewBlock(&curarea->uiblocks, "render_panel_yafrayGI", UI_EMBOSS, UI_HELV, curarea->win);
1220         uiNewPanelTabbed("Render", "Render");
1221         if(uiNewPanel(curarea, block, "YafRay GI", "Render", 320, 0, 318, 204)==0) return;
1222
1223         // label to force a boundbox for buttons not to be centered
1224         uiDefBut(block, LABEL, 0, " ", 305,180,10,10, 0, 0, 0, 0, 0, "");
1225
1226         uiDefBut(block, LABEL, 0, "Method", 5,175,70,20, 0, 1.0, 0, 0, 0, "");
1227         uiDefButS(block, MENU, B_REDR, "GiMethod %t|None %x0|SkyDome %x1|Full %x2 |", 70,175,89,20, &G.scene->r.GImethod, 0, 0, 0, 0, "Global Illumination Method");
1228         uiDefBut(block, LABEL, 0, "Quality", 5,150,70,20, 0, 1.0, 0, 0, 0, "");
1229         uiDefButS(block, MENU, B_REDR, "GiQuality %t|None %x0|Low %x1|Medium %x2 |High %x3|Higher %x4|Best %x5|", 
1230                         70,150,89,20, &G.scene->r.GIquality, 0, 0, 0, 0, "Global Illumination Quality");
1231
1232         if (G.scene->r.GImethod>0) {
1233                 if (G.scene->r.GIpower==0) G.scene->r.GIpower=1;
1234                 uiDefButF(block, NUM, 0, "Power:", 5,10,154,20, &G.scene->r.GIpower, 0.01, 100.0, 10, 0, "GI lighting intensity scale, 1 is normal");
1235         }
1236         
1237
1238         if (G.scene->r.GImethod==2) 
1239         {
1240                 if (G.scene->r.GIdepth==0) G.scene->r.GIdepth=2;
1241                 uiDefButI(block, NUM, 0, "Depth:", 180,175,110,20, &G.scene->r.GIdepth, 1.0, 8.0, 10, 10, "Number of bounces of the indirect light");
1242                 uiDefButI(block, NUM, 0, "CDepth:", 180,150,110,20, &G.scene->r.GIcausdepth, 1.0, 8.0, 10, 10, "Number of bounces inside objects (for caustics)");
1243                 uiDefButS(block,TOG|BIT|0, B_REDR, "Cache",70,125,89,20, &G.scene->r.GIcache, 0, 0, 0, 0, "Cache irradiance samples (faster)");
1244                 uiDefButS(block,TOG|BIT|0, B_REDR, "Photons",180,125,89,20, &G.scene->r.GIphotons, 0, 0, 0, 0, "Use global photons to help in GI");
1245                 if (G.scene->r.GIcache) 
1246                 {
1247                         uiDefBut(block, LABEL, 0, "Cache parameters:", 5,105,130,20, 0, 1.0, 0, 0, 0, "");
1248                         if (G.scene->r.GIshadowquality==0.0) G.scene->r.GIshadowquality=0.9;
1249                         uiDefButF(block, NUM, 0,"ShadQu:", 5,85,154,20, &(G.scene->r.GIshadowquality), 0.01, 1.0 ,1,0, "Sets the shadow quality, keep it under 0.95 :-) ");
1250                         if (G.scene->r.GIpixelspersample==0) G.scene->r.GIpixelspersample=10;
1251                         uiDefButI(block, NUM, 0, "Prec:",       5,60,75,20, &G.scene->r.GIpixelspersample, 1, 50, 10, 10, "Maximum number of pixels without samples, the lower the better and slower");
1252                         uiDefButS(block,TOG|BIT|0, 0, "Gradient", 84,60,75,20, &G.scene->r.GIgradient, 0, 0, 0, 0, "Try to smooth lighting using a gradient");
1253                         if (G.scene->r.GIrefinement==0) G.scene->r.GIrefinement=1.0;
1254                         uiDefButF(block, NUM, 0, "Refinement:", 5,35,154,20, &G.scene->r.GIrefinement, 0.001, 1.0, 1, 0, "Threshold to refine shadows EXPERIMENTAL. 1 = no refinement");
1255                 }
1256                 if (G.scene->r.GIphotons) 
1257                 {
1258                         uiDefBut(block, LABEL, 0, "Photon parameters:", 170,105,130,20, 0, 1.0, 0, 0, 0, "");
1259                         if(G.scene->r.GIphotoncount==0) G.scene->r.GIphotoncount=100000;
1260                         uiDefButI(block, NUM, 0, "Count:", 170,85,140,20, &G.scene->r.GIphotoncount, 
1261                                         0, 10000000, 10, 10, "Number of photons to shoot");
1262                         if(G.scene->r.GIphotonradius==0.0) G.scene->r.GIphotonradius=1.0;
1263                         uiDefButF(block, NUMSLI, 0,"Radius:", 170,60,140,20,    &(G.scene->r.GIphotonradius), 
1264                                         0.00001, 100.0 ,0,0, "Radius to search for photons to mix (blur)");
1265                         if(G.scene->r.GImixphotons==0) G.scene->r.GImixphotons=100;
1266                         uiDefButI(block, NUM, 0, "MixCount:", 170,35,140,20, &G.scene->r.GImixphotons, 
1267                                         0, 1000, 10, 10, "Number of photons to shoot");
1268                         uiDefButS(block,TOG|BIT|0, B_REDR, "Tune Photons",170,10,140,20, &G.scene->r.GIdirect, 
1269                                         0, 0, 0, 0, "Show the photonmap directly in the render for tuning");
1270                 }
1271         }
1272 }
1273
1274 /* yafray: global  options panel */
1275 static void render_panel_yafrayGlobal()
1276 {
1277         uiBlock *block;
1278
1279         block= uiNewBlock(&curarea->uiblocks, "render_panel_yafrayGlobal", UI_EMBOSS, UI_HELV, curarea->win);
1280         uiNewPanelTabbed("Render", "Render");
1281         if(uiNewPanel(curarea, block, "YafRay", "Render", 320, 0, 318, 204)==0) return;
1282
1283         // label to force a boundbox for buttons not to be centered
1284         uiDefBut(block, LABEL, 0, " ", 305,180,10,10, 0, 0, 0, 0, 0, "");
1285
1286         uiDefButF(block, NUMSLI, 0,"Bi ", 5,35,150,20,  &(G.scene->r.YF_raybias), 
1287                                 0.0, 10.0 ,0,0, "Shadow ray bias to avoid self shadowing");
1288   uiDefButI(block, NUM, 0, "Raydepth ", 5,60,150,20,
1289                                 &G.scene->r.YF_raydepth, 1.0, 80.0, 10, 10, "Maximum render ray depth from the camera");
1290         uiDefButF(block, NUMSLI, 0, "Gam ", 5,10,150,20, &G.scene->r.YF_gamma, 0.001, 5.0, 0, 0, "Gamma correction, 1 is off");
1291         uiDefButF(block, NUMSLI, 0, "Exp ", 160,10,150,20,&G.scene->r.YF_exposure, 0.0, 10.0, 0, 0, "Exposure adjustment, 0 is off");
1292         
1293   uiDefButI(block, NUM, 0, "Processors:", 160,35,150,20,
1294                                 &G.scene->r.YF_numprocs, 1.0, 8.0, 10, 10, "Number of processors to use");
1295
1296         /*AA Settings*/
1297
1298         uiDefButS(block,TOGN|BIT|0, B_REDR, "Auto AA",5,110,150,20, &G.scene->r.YF_AA, 
1299                                         0, 0, 0, 0, "Set AA using OSA and GI quality, disable for manual control");
1300         uiDefButS(block,TOGN|BIT|0, B_REDR, "xml",175,110,75,20, &G.scene->r.YFexportxml, 
1301                                         0, 0, 0, 0, "Export to an xml file and call yafray isntead of plugin");
1302         if(G.scene->r.YF_AA){
1303                 uiDefButI(block, NUM, 0, "AA Passes ", 5,85,150,20,
1304                                 &G.scene->r.YF_AApasses, 0, 64, 10, 10, "AA Passes");
1305             uiDefButI(block, NUM, 0, "AA Samples ", 160,85,150,20,
1306                                 &G.scene->r.YF_AAsamples, 0, 2048, 10, 10, "AA Samples");
1307         }
1308 }
1309
1310
1311 void render_panels()
1312 {
1313
1314         render_panel_output();
1315         render_panel_render();
1316         render_panel_anim();
1317         render_panel_format();
1318         /* yafray: GI & Global panel, only available when yafray enabled for rendering */
1319         if (G.scene->r.renderer==R_YAFRAY) {
1320                 if (G.scene->r.YF_gamma==0.0) G.scene->r.YF_gamma=1.0;
1321                 if (G.scene->r.YF_raybias==0.0) G.scene->r.YF_raybias=0.001;
1322                 if (G.scene->r.YF_raydepth==0) G.scene->r.YF_raydepth=5;
1323                 render_panel_yafrayGlobal();
1324                 render_panel_yafrayGI();
1325         }
1326
1327 }
1328
1329 /* --------------------------------------------- */
1330
1331 void anim_panels()
1332 {
1333         uiBlock *block;
1334
1335         block= uiNewBlock(&curarea->uiblocks, "anim_panel", UI_EMBOSS, UI_HELV, curarea->win);
1336         if(uiNewPanel(curarea, block, "Anim", "Anim", 0, 0, 318, 204)==0) return;
1337
1338         uiDefButS(block, NUM,REDRAWSEQ,"Sta:",  320,17,93,27,&G.scene->r.sfra,1.0,18000.0, 0, 0, "Specify the start frame of the animation");
1339         uiDefButS(block, NUM,REDRAWSEQ,"End:",  416,17,95,27,&G.scene->r.efra,1.0,18000.0, 0, 0, "Specify the end frame of the animation");
1340
1341         uiDefButS(block, NUM,B_FRAMEMAP,"Map Old:",     320,69,93,22,&G.scene->r.framapto,1.0,900.0, 0, 0, "Specify old map value in frames");
1342         uiDefButS(block, NUM,B_FRAMEMAP,"Map New:",     416,69,95,22,&G.scene->r.images,1.0,900.0, 0, 0, "Specify new map value in frames");
1343
1344         uiDefButS(block, NUM,REDRAWSEQ,"Frs/sec:",   320,47,93,19, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
1345
1346         uiDefButS(block, TOG|BIT|1, B_SOUND_CHANGED, "Sync",    416,47,95,19, &G.scene->audio.flag, 0, 0, 0, 0, "Use sample clock for syncing animation to audio");
1347
1348
1349 }
1350
1351 /* --------------------------------------------- */
1352
1353 void sound_panels()
1354 {
1355         bSound *sound;
1356
1357         sound = G.buts->lockpoin;
1358         if ((sound) && (sound->flags & SOUND_FLAGS_SEQUENCE)) sound = NULL;
1359
1360         sound_panel_sound(sound);
1361         sound_panel_listener();
1362         sound_panel_sequencer();
1363 }
1364
1365
1366