4 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
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
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.
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.
23 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
24 * All rights reserved.
26 * The Original Code is: all of this file.
28 * Contributor(s): none yet.
30 * ***** END GPL/BL DUAL LICENSE BLOCK *****
38 #include "MEM_guardedalloc.h"
39 #include "DNA_node_types.h"
40 #include "DNA_screen_types.h"
41 #include "DNA_space_types.h"
42 #include "DNA_scene_types.h"
43 #include "DNA_sound_types.h"
44 #include "DNA_userdef_types.h"
45 #include "DNA_packedFile_types.h"
47 #include "BKE_global.h"
50 #include "BKE_library.h"
51 #include "BKE_scene.h"
52 #include "BKE_sound.h"
53 #include "BKE_packedFile.h"
54 #include "BKE_utildefines.h"
56 #include "BLI_blenlib.h"
58 #include "BSE_filesel.h"
61 #include "BIF_graphics.h"
62 #include "BIF_glutil.h"
63 #include "BIF_interface.h"
64 #include "BIF_keyval.h"
65 #include "BIF_mainqueue.h"
66 #include "BIF_mywindow.h"
67 #include "BIF_resources.h"
68 #include "BIF_renderwin.h"
69 #include "BIF_screen.h"
70 #include "BIF_space.h"
71 #include "BIF_toolbox.h"
73 #include "BIF_butspace.h"
78 /* -----includes for this file specific----- */
80 #include "DNA_image_types.h"
81 #include "BKE_writeavi.h"
82 #include "BKE_image.h"
83 #include "BIF_writeimage.h"
84 #include "BIF_writeavicodec.h"
85 #include "BIF_editsound.h"
86 #include "BSE_seqaudio.h"
87 #include "BSE_headerbuttons.h"
89 #include "butspace.h" // own module
92 #include "quicktime_export.h"
96 /* here the calls for scene buttons
99 - anim settings, audio
103 void playback_anim(void);
105 /* ************************ SOUND *************************** */
106 static void load_new_sample(char *str) /* called from fileselect */
108 char name[FILE_MAXDIR+FILE_MAXFILE];
110 bSample *sample, *newsample;
112 sound = G.buts->lockpoin;
116 sample = sound->sample;
117 strcpy(name, sound->sample->name);
119 strcpy(sound->name, str);
120 sound_set_sample(sound, NULL);
121 sound_initialize_sample(sound);
123 if (sound->sample->type == SAMPLE_INVALID) {
124 error("Not a valid sample: %s", str);
126 newsample = sound->sample;
129 strcpy(sound->name, name);
130 sound_set_sample(sound, sample);
132 // remove invalid sample
134 sound_free_sample(newsample);
135 BLI_remlink(samples, newsample);
136 MEM_freeN(newsample);
140 BIF_undo_push("Load new audio file");
141 allqueue(REDRAWBUTSSCENE, 0);
146 void do_soundbuts(unsigned short event)
148 char name[FILE_MAXDIR+FILE_MAXFILE];
154 sound = G.buts->lockpoin;
158 allqueue(REDRAWBUTSSCENE, 0);
161 case B_SOUND_LOAD_SAMPLE:
162 if (sound) strcpy(name, sound->name);
163 else strcpy(name, U.sounddir);
165 activate_fileselect(FILE_SPECIAL, "SELECT WAV FILE", name, load_new_sample);
168 case B_SOUND_PLAY_SAMPLE:
170 if (sound->sample->type != SAMPLE_INVALID) {
171 sound_play_sound(sound);
172 allqueue(REDRAWBUTSSCENE, 0);
177 case B_SOUND_MENU_SAMPLE:
178 if (G.buts->menunr == -2) {
180 activate_databrowse((ID *)sound->sample, ID_SAMPLE, 0, B_SOUND_MENU_SAMPLE, &G.buts->menunr, do_soundbuts);
182 } else if (G.buts->menunr > 0) {
183 sample = BLI_findlink(samples, G.buts->menunr - 1);
184 if (sample && sound) {
185 BLI_strncpy(sound->name, sample->name, sizeof(sound->name));
186 sound_set_sample(sound, sample);
187 do_soundbuts(B_SOUND_REDRAW);
192 case B_SOUND_NAME_SAMPLE:
193 load_new_sample(sound->name);
196 case B_SOUND_UNPACK_SAMPLE:
197 if(sound && sound->sample) {
198 sample = sound->sample;
200 if (sample->packedfile) {
201 if (G.fileflags & G_AUTOPACK) {
202 if (okee("Disable AutoPack ?")) {
203 G.fileflags &= ~G_AUTOPACK;
207 if ((G.fileflags & G_AUTOPACK) == 0) {
208 unpackSample(sample, PF_ASK);
211 sound_set_packedfile(sample, newPackedFile(sample->name));
213 allqueue(REDRAWHEADERS, 0);
214 do_soundbuts(B_SOUND_REDRAW);
218 case B_SOUND_COPY_SOUND:
220 tempsound = sound_make_copy(sound);
223 G.buts->lockpoin = (bSound*)id;
224 BIF_undo_push("Copy sound");
225 do_soundbuts(B_SOUND_REDRAW);
231 sound = G.main->sound.first;
235 audio_makestream(sound);
236 sound = (bSound *) sound->id.next;
239 allqueue(REDRAWSEQ, 0);
242 case B_SOUND_RATECHANGED:
244 allqueue(REDRAWBUTSSCENE, 0);
245 allqueue(REDRAWSEQ, 0);
248 case B_SOUND_MIXDOWN:
254 printf("do_soundbuts: unhandled event %d\n", event);
260 static void sound_panel_listener(void)
263 int xco= 100, yco=100, mixrate;
264 char mixrateinfo[256];
266 block= uiNewBlock(&curarea->uiblocks, "sound_panel_listener", UI_EMBOSS, UI_HELV, curarea->win);
267 if(uiNewPanel(curarea, block, "Listener", "Sound", 320, 0, 318, 204)==0) return;
269 mixrate = sound_get_mixrate();
270 sprintf(mixrateinfo, "Game Mixrate: %d Hz", mixrate);
271 uiDefBut(block, LABEL, 0, mixrateinfo, xco,yco,295,20, 0, 0, 0, 0, 0, "");
274 uiDefBut(block, LABEL, 0, "Game listener settings:",xco,yco,195,20, 0, 0, 0, 0, 0, "");
277 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Volume: ",
278 xco,yco,195,24,&G.listener->gain, 0.0, 1.0, 1.0, 0, "Sets the maximum volume for the overall sound");
281 uiDefBut(block, LABEL, 0, "Game Doppler effect settings:",xco,yco,195,20, 0, 0, 0, 0, 0, "");
284 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Doppler: ",
285 xco,yco,195,24,&G.listener->dopplerfactor, 0.0, 10.0, 1.0, 0, "Use this for scaling the doppler effect");
288 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Velocity: ",
289 xco,yco,195,24,&G.listener->dopplervelocity,0.0,10000.0, 1.0,0, "Sets the propagation speed of sound");
294 static void sound_panel_sequencer(void)
298 char mixrateinfo[256];
300 block= uiNewBlock(&curarea->uiblocks, "sound_panel_sequencer", UI_EMBOSS, UI_HELV, curarea->win);
301 if(uiNewPanel(curarea, block, "Sequencer", "Sound", 640, 0, 318, 204)==0) return;
303 /* audio sequence engine settings ------------------------------------------------------------------ */
308 uiDefBut(block, LABEL, 0, "Audio sequencer settings", xco,yco,295,20, 0, 0, 0, 0, 0, "");
311 sprintf(mixrateinfo, "Mixing/Sync (latency: %d ms)", (int)( (((float)U.mixbufsize)/(float)G.scene->audio.mixrate)*1000.0 ) );
312 uiDefBut(block, LABEL, 0, mixrateinfo, xco,yco,295,20, 0, 0, 0, 0, 0, "");
315 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");
316 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");
317 uiDefBut(block, BUT, B_SOUND_RECALC, "Recalc", xco+160,yco,75,20, 0, 0, 0, 0, 0, "Recalculate samples");
320 uiDefButBitS(block, TOG, AUDIO_SYNC, B_SOUND_CHANGED, "Sync", xco,yco,115,20, &G.scene->audio.flag, 0, 0, 0, 0, "Use sample clock for syncing animation to audio");
321 uiDefButBitS(block, TOG, AUDIO_SCRUB, B_SOUND_CHANGED, "Scrub", xco+120,yco,115,20, &G.scene->audio.flag, 0, 0, 0, 0, "Scrub when changing frames");
324 uiDefBut(block, LABEL, 0, "Main mix", xco,yco,295,20, 0, 0, 0, 0, 0, "");
327 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Main (dB): ",
328 xco,yco,235,24,&G.scene->audio.main, -24.0, 6.0, 0, 0, "Set the audio master gain/attenuation in dB");
331 uiDefButBitS(block, TOG, AUDIO_MUTE, 0, "Mute", xco,yco,235,24, &G.scene->audio.flag, 0, 0, 0, 0, "Mute audio from sequencer");
334 uiDefBut(block, BUT, B_SOUND_MIXDOWN, "MIXDOWN", xco,yco,235,24, 0, 0, 0, 0, 0, "Create WAV file from sequenced audio");
338 static void sound_panel_sound(bSound *sound)
340 static int packdummy=0;
344 char *strp, str[32], ch[256];
346 block= uiNewBlock(&curarea->uiblocks, "sound_panel_sound", UI_EMBOSS, UI_HELV, curarea->win);
347 if(uiNewPanel(curarea, block, "Sound", "Sound", 0, 0, 318, 204)==0) return;
349 uiDefBut(block, LABEL, 0, "Blender Sound block",10,180,195,20, 0, 0, 0, 0, 0, "");
351 // warning: abuse of texnr here! (ton didnt code!)
352 buttons_active_id(&id, &idfrom);
353 std_libbuttons(block, 10, 160, 0, NULL, B_SOUNDBROWSE2, ID_SO, 0, id, idfrom, &(G.buts->texnr), 1, 0, 0, 0, 0);
357 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");
359 uiSetButLock(sound->id.lib!=0, "Can't edit library data");
360 sound_initialize_sample(sound);
361 sample = sound->sample;
364 if (sound->sample && sound->sample->len) {
366 if (sound->sample->channels == 1) tmp= "Mono";
367 else if (sound->sample->channels == 2) tmp= "Stereo";
370 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));
371 uiDefBut(block, LABEL, 0, ch, 35,140,225,20, 0, 0, 0, 0, 0, "");
374 uiDefBut(block, LABEL, 0, "Sample: No sample info available.",35,140,225,20, 0, 0, 0, 0, 0, "");
377 /* sample browse buttons */
379 id= (ID *)sound->sample;
380 IDnames_to_pupstring(&strp, NULL, NULL, samples, id, &(G.buts->menunr));
381 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");
384 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");
386 sprintf(str, "%d", sample->id.us);
387 uiDefBut(block, BUT, B_SOUND_UNLINK_SAMPLE, str, 260,120,25,20, 0, 0, 0, 0, 0, "The number of users");
389 if (sound->sample->packedfile) packdummy = 1;
392 uiDefIconButBitI(block, TOG, 1, B_SOUND_UNPACK_SAMPLE, ICON_PACKAGE,
393 285, 120,25,24, &packdummy, 0, 0, 0, 0,"Pack/Unpack this sample");
395 uiDefBut(block, BUT, B_SOUND_LOAD_SAMPLE, "Load sample", 10, 95,150,24, 0, 0, 0, 0, 0, "Load a different sample file");
397 uiDefBut(block, BUT, B_SOUND_PLAY_SAMPLE, "Play", 160, 95, 150, 24, 0, 0.0, 0, 0, 0, "Playback sample using settings below");
399 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Volume: ",
400 10,70,150,20, &sound->volume, 0.0, 1.0, 0, 0, "Game engine only: Set the volume of this sound");
402 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Pitch: ",
403 160,70,150,20, &sound->pitch, -12.0, 12.0, 0, 0, "Game engine only: Set the pitch of this sound");
406 uiDefButBitI(block, TOG, SOUND_FLAGS_LOOP, B_SOUND_REDRAW, "Loop",
407 10, 50, 95, 20, &sound->flags, 0.0, 0.0, 0, 0, "Game engine only: Toggle between looping on/off");
409 if (sound->flags & SOUND_FLAGS_LOOP) {
410 uiDefButBitI(block, TOG, SOUND_FLAGS_BIDIRECTIONAL_LOOP, B_SOUND_REDRAW, "Ping Pong",
411 105, 50, 95, 20, &sound->flags, 0.0, 0.0, 0, 0, "Game engine only: Toggle between A->B and A->B->A looping");
416 /* 3D settings ------------------------------------------------------------------ */
418 if (sound->sample->channels == 1) {
419 uiDefButBitI(block, TOG, SOUND_FLAGS_3D, B_SOUND_REDRAW, "3D Sound",
420 10, 10, 90, 20, &sound->flags, 0, 0, 0, 0, "Game engine only: Turns 3D sound on");
422 if (sound->flags & SOUND_FLAGS_3D) {
423 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Scale: ",
424 100,10,210,20, &sound->attenuation, 0.0, 5.0, 1.0, 0, "Game engine only: Sets the surround scaling factor for this sound");
432 /* ************************* SCENE *********************** */
435 static void output_pic(char *name)
437 strcpy(G.scene->r.pic, name);
438 allqueue(REDRAWBUTSSCENE, 0);
439 BIF_undo_push("Change output picture directory");
442 static void backbuf_pic(char *name)
446 strcpy(G.scene->r.backbuf, name);
447 allqueue(REDRAWBUTSSCENE, 0);
449 ima= add_image(name);
451 free_image_buffers(ima); /* force read again */
454 BIF_undo_push("Change background picture");
457 static void ftype_pic(char *name)
459 strcpy(G.scene->r.ftype, name);
460 allqueue(REDRAWBUTSSCENE, 0);
463 static void scene_chain_cleanup(Scene *sc) {
465 sc->dirty = SCE_CLEAN;
470 static void scene_change_set(Scene *sc, Scene *set) {
471 Scene *scene = G.main->scene.first;
472 int clean = SCE_CLEAN;
476 while(breakout==0 && scene) {
477 Scene *setchain = scene;
478 while(breakout==0 && setchain) {
479 clean = setchain->dirty;
480 if(clean == SCE_DIRTY) {
481 /* we have not reached yet end of chain, and we
482 * encountered dirty node - we have a cycle.
483 * sc->set = 0, clean the chain and break out.
485 error("Can't change set. It would create a loop!");
488 scene_chain_cleanup(scene);
493 setchain->dirty = SCE_DIRTY;
494 setchain = setchain->set;
499 scene_chain_cleanup(scene);
500 scene = scene->id.next;
504 allqueue(REDRAWBUTSSCENE, 0);
505 allqueue(REDRAWVIEW3D, 0);
506 BIF_undo_push("Change set Scene");
510 static void run_playanim(char *file) {
511 extern char bprogname[]; /* usiblender.c */
512 char str[FILE_MAXDIR+FILE_MAXFILE];
515 /* image size not so relevant for now */
516 calc_renderwin_rectangle(640, 480, G.winpos, pos, size);
518 sprintf(str, "%s -a -p %d %d \"%s\"", bprogname, pos[0], pos[1], file);
522 void playback_anim(void)
524 char file[FILE_MAXDIR+FILE_MAXFILE];
526 #ifdef WITH_QUICKTIME
527 if(G.scene->r.imtype == R_QUICKTIME)
531 makeavistring(&G.scene->r, file);
532 if(BLI_exist(file)) {
536 BKE_makepicstring(file, G.scene->r.sfra);
537 if(BLI_exist(file)) {
540 else error("Can't find image: %s", file);
544 void do_render_panels(unsigned short event)
555 allqueue(REDRAWALL, 0);
558 /* new panels added, so... */
560 allqueue(REDRAWBUTSSCENE, 0);
571 sa= closest_bigger_area();
573 if(G.qual == LR_CTRLKEY)
574 activate_imageselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic);
576 activate_fileselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic);
580 sa= closest_bigger_area();
582 if(G.qual == LR_CTRLKEY)
583 activate_imageselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
585 activate_fileselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
589 sa= closest_bigger_area();
591 if(G.qual == LR_CTRLKEY)
592 activate_imageselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
594 activate_fileselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
598 G.scene->r.xsch= 720;
599 G.scene->r.ysch= 576;
602 G.scene->r.size= 100;
603 G.scene->r.frs_sec= 25;
604 G.scene->r.mode &= ~R_PANORAMA;
605 G.scene->r.xparts= G.scene->r.yparts= 4;
607 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
608 BIF_undo_push("Set PAL");
609 allqueue(REDRAWBUTSSCENE, 0);
610 allqueue(REDRAWVIEWCAM, 0);
614 allqueue(REDRAWBUTSSCENE, 0);
615 #if defined (_WIN32) || defined (__APPLE__)
616 // fall through to codec settings if this is the first
617 // time R_AVICODEC is selected for this scene.
618 if (((G.scene->r.imtype == R_AVICODEC)
619 && (G.scene->r.avicodecdata == NULL)) ||
620 ((G.scene->r.imtype == R_QUICKTIME)
621 && (G.scene->r.qtcodecdata == NULL))) {
625 #endif /*_WIN32 || __APPLE__ */
628 #if defined (_WIN32) || defined (__APPLE__)
629 if ((G.scene->r.imtype == R_QUICKTIME)) { /* || (G.scene->r.qtcodecdata)) */
630 #ifdef WITH_QUICKTIME
631 get_qtcodec_settings();
632 #endif /* WITH_QUICKTIME */
634 #if defined (_WIN32) && !defined(FREE_WINDOWS)
636 get_avicodec_settings();
637 #endif /* _WIN32 && !FREE_WINDOWS */
638 #endif /* _WIN32 || __APPLE__ */
642 G.scene->r.xsch= 1280;
643 G.scene->r.ysch= 1024;
646 G.scene->r.size= 100;
647 G.scene->r.mode &= ~R_PANORAMA;
648 G.scene->r.xparts= G.scene->r.yparts= 4;
650 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
651 BIF_undo_push("Set FULL");
652 allqueue(REDRAWBUTSSCENE, 0);
653 allqueue(REDRAWVIEWCAM, 0);
656 G.scene->r.xsch= 640;
657 G.scene->r.ysch= 512;
661 G.scene->r.mode &= ~R_PANORAMA;
662 G.scene->r.xparts= G.scene->r.yparts= 4;
664 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
665 allqueue(REDRAWVIEWCAM, 0);
666 allqueue(REDRAWBUTSSCENE, 0);
669 G.scene->r.xsch= 384;
670 G.scene->r.ysch= 280;
673 G.scene->r.size= 100;
674 G.scene->r.mode &= ~R_PANORAMA;
675 G.scene->r.xparts= G.scene->r.yparts= 4;
677 BLI_init_rctf(&G.scene->r.safety, 0.15, 0.85, 0.15, 0.85);
678 allqueue(REDRAWVIEWCAM, 0);
679 allqueue(REDRAWBUTSSCENE, 0);
682 G.scene->r.xsch= 720;
683 G.scene->r.ysch= 576;
686 G.scene->r.size= 100;
687 G.scene->r.frs_sec= 25;
688 G.scene->r.mode &= ~R_PANORAMA;
689 G.scene->r.xparts= G.scene->r.yparts= 4;
691 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
692 BIF_undo_push("Set PAL 16/9");
693 allqueue(REDRAWVIEWCAM, 0);
694 allqueue(REDRAWBUTSSCENE, 0);
697 G.scene->r.xsch= 1024;
698 G.scene->r.ysch= 576;
702 G.scene->r.mode &= ~R_PANORAMA;
703 G.scene->r.xparts= G.scene->r.yparts= 4;
705 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
706 allqueue(REDRAWVIEWCAM, 0);
707 allqueue(REDRAWBUTSSCENE, 0);
710 G.scene->r.xsch= 368;
711 G.scene->r.ysch= 272;
712 G.scene->r.xasp= 105;
713 G.scene->r.yasp= 100;
714 G.scene->r.size= 100;
715 G.scene->r.mode &= ~R_PANORAMA;
716 G.scene->r.xparts= G.scene->r.yparts= 4;
718 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
719 allqueue(REDRAWVIEWCAM, 0);
720 allqueue(REDRAWBUTSSCENE, 0);
723 G.scene->r.xsch= 640;
724 G.scene->r.ysch= 480;
725 G.scene->r.xasp= 100;
726 G.scene->r.yasp= 100;
727 G.scene->r.size= 100;
728 G.scene->r.mode &= ~R_PANORAMA;
729 G.scene->r.xparts= G.scene->r.yparts= 4;
731 BLI_init_rctf(&G.scene->r.safety, 0.0, 1.0, 0.0, 1.0);
732 BIF_undo_push("Set PC");
733 allqueue(REDRAWVIEWCAM, 0);
734 allqueue(REDRAWBUTSSCENE, 0);
737 G.scene->r.xsch= 720;
738 G.scene->r.ysch= 576;
741 G.scene->r.size= 100;
742 G.scene->r.mode= R_OSA+R_SHADOW+R_FIELDS;
743 G.scene->r.imtype= R_TARGA;
744 G.scene->r.xparts= G.scene->r.yparts= 4;
746 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
747 BIF_undo_push("Set Default");
748 allqueue(REDRAWVIEWCAM, 0);
749 allqueue(REDRAWBUTSSCENE, 0);
753 G.scene->r.ysch= 176;
754 G.scene->r.xasp= 115;
755 G.scene->r.yasp= 100;
756 G.scene->r.size= 100;
757 G.scene->r.mode |= R_PANORAMA;
758 G.scene->r.xparts= 16;
759 G.scene->r.yparts= 1;
761 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
762 BIF_undo_push("Set Panorama");
763 allqueue(REDRAWVIEWCAM, 0);
764 allqueue(REDRAWBUTSSCENE, 0);
767 G.scene->r.xsch= 720;
768 G.scene->r.ysch= 480;
771 G.scene->r.size= 100;
772 G.scene->r.frs_sec= 30;
773 G.scene->r.mode &= ~R_PANORAMA;
774 G.scene->r.xparts= G.scene->r.yparts= 2;
776 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
777 BIF_undo_push("Set NTSC");
778 allqueue(REDRAWBUTSSCENE, 0);
779 allqueue(REDRAWVIEWCAM, 0);
783 id= (ID*) G.scene->set;
785 if (G.buts->menunr==-2) {
786 activate_databrowse(id, ID_SCE, 0, B_SETBROWSE, &G.buts->menunr, do_render_panels);
787 } else if (G.buts->menunr>0) {
788 Scene *newset= (Scene*) BLI_findlink(&G.main->scene, G.buts->menunr-1);
791 error("Not allowed");
793 scene_change_set(G.scene, newset);
797 scene_change_set(G.scene, NULL);
801 /* copy is needed... not so nice, but how better? */
802 // R.r.postgamma= G.scene->r.postgamma;
803 // R.r.postigamma= 1.0/R.r.postgamma;
804 // R.r.postadd= G.scene->r.postadd;
805 // R.r.postmul= G.scene->r.postmul;
806 // R.r.posthue= G.scene->r.posthue;
807 // R.r.postsat= G.scene->r.postsat;
808 // R.r.dither_intensity= G.scene->r.dither_intensity;
810 // _floatbuffer_to_output();
811 // BIF_redraw_render_rect();
815 G.scene->r.mode &= ~R_ZBLUR;
816 allqueue(REDRAWBUTSSCENE, 0);
819 G.scene->r.mode &= ~R_EDGE;
820 allqueue(REDRAWBUTSSCENE, 0);
822 case B_ADD_RENDERLAYER:
823 if(G.scene->r.actlay==32767) {
824 scene_add_render_layer(G.scene);
825 G.scene->r.actlay= BLI_countlist(&G.scene->r.layers) - 1;
827 allqueue(REDRAWBUTSSCENE, 0);
828 allqueue(REDRAWNODE, 0);
832 /* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
833 static uiBlock *edge_render_menu(void *arg_unused)
837 block= uiNewBlock(&curarea->uiblocks, "edge render", UI_EMBOSS, UI_HELV, curarea->win);
839 /* use this for a fake extra empy space around the buttons */
840 uiDefBut(block, LABEL, 0, "", 290, -15, 220, 115, NULL, 0, 0, 0, 0, "");
842 uiBlockBeginAlign(block);
843 uiDefButS(block, NUM, 0,"Eint:", 370,75,135,19, &G.scene->r.edgeint, 0.0, 255.0, 0, 0,
844 "Sets edge intensity for Toon shading");
845 uiDefButS(block, NUM, 0,"AntiShift",370,55,135,19, &(G.scene->r.same_mat_redux), 0, 255.0, 0, 0,
846 "For unified renderer: reduce intensity on boundaries "
847 "with identical materials with this number.");
849 uiBlockBeginAlign(block);
850 uiDefButI(block, TOG, 0,"Shift", 295,75,70,19, &G.compat, 0, 0, 0, 0,
851 "For unified renderer: use old offsets for edges");
852 uiDefButI(block, TOG, 0,"All", 295,55,70,19, &G.notonlysolid, 0, 0, 0, 0,
853 "For unified renderer: also consider transparent faces for toon shading");
854 uiBlockEndAlign(block);
856 /* colour settings for the toon shading */
857 uiDefButF(block, COL, 0, "", 295,-10,30,60, &(G.scene->r.edgeR), 0, 0, 0, B_EDGECOLSLI, "");
859 uiBlockBeginAlign(block);
860 uiDefButF(block, NUMSLI, 0, "R ", 330, 30, 175,19, &G.scene->r.edgeR, 0.0, 1.0, B_EDGECOLSLI, 0,
861 "For unified renderer: Colour for edges in toon shading mode.");
862 uiDefButF(block, NUMSLI, 0, "G ", 330, 10, 175,19, &G.scene->r.edgeG, 0.0, 1.0, B_EDGECOLSLI, 0,
863 "For unified renderer: Colour for edges in toon shading mode.");
864 uiDefButF(block, NUMSLI, 0, "B ", 330, -10, 175,19, &G.scene->r.edgeB, 0.0, 1.0, B_EDGECOLSLI, 0,
865 "For unified renderer: Colour for edges in toon shading mode.");
868 uiBlockSetDirection(block, UI_TOP);
873 /* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
874 static uiBlock *post_render_menu(void *arg_unused)
878 block= uiNewBlock(&curarea->uiblocks, "post render", UI_EMBOSS, UI_HELV, curarea->win);
880 /* use this for a fake extra empy space around the buttons */
881 uiDefBut(block, LABEL, 0, "", -10, -10, 200, 120, NULL, 0, 0, 0, 0, "");
882 uiBlockBeginAlign(block);
883 uiDefButF(block, NUMSLI, 0, "Add:", 0,80,180,19, &G.scene->r.postadd, -1.0, 1.0, 0, 0, "");
884 uiDefButF(block, NUMSLI, 0, "Mul:", 0,60,180,19, &G.scene->r.postmul, 0.01, 4.0, 0, 0, "");
885 uiDefButF(block, NUMSLI, 0, "Gamma:", 0,40,180,19, &G.scene->r.postgamma, 0.1, 4.0, 0, 0, "");
886 uiDefButF(block, NUMSLI, 0, "Hue:", 0,20,180,19, &G.scene->r.posthue, -0.5, 0.5, 0, 0, "");
887 uiDefButF(block, NUMSLI, 0, "Sat:", 0, 0,180,19, &G.scene->r.postsat, 0.0, 4.0, 0, 0, "");
889 uiBlockSetDirection(block, UI_TOP);
891 addqueue(curarea->win, UI_BUT_EVENT, B_FBUF_REDO);
896 /* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
897 static uiBlock *framing_render_menu(void *arg_unused)
900 short yco = 190, xco = 0;
901 int randomcolorindex = 1234;
903 block= uiNewBlock(&curarea->uiblocks, "framing_options", UI_EMBOSS, UI_HELV, curarea->win);
905 /* use this for a fake extra empy space around the buttons */
906 uiDefBut(block, LABEL, 0, "", -5, -10, 295, 224, NULL, 0, 0, 0, 0, "");
908 uiDefBut(block, LABEL, 0, "Framing:", xco, yco, 68,19, 0, 0, 0, 0, 0, "");
909 uiBlockBeginAlign(block);
910 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");
911 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");
912 uiDefButC(block, ROW, 0, "Letterbox", 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");
913 uiBlockEndAlign(block);
918 uiDefButF(block, COL, 0, "", 0, yco - 58 + 18, 33, 58, &G.scene->framing.col[0], 0, 0, 0, randomcolorindex, "");
920 uiBlockBeginAlign(block);
921 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");
923 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");
925 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");
926 uiBlockEndAlign(block);
929 uiDefBut(block, LABEL, 0, "Fullscreen:", xco, yco-=30, 100, 19, 0, 0.0, 0.0, 0, 0, "");
930 uiDefButS(block, TOG, 0, "Fullscreen", xco+70, yco, 68, 19, &G.scene->r.fullscreen, 0.0, 0.0, 0, 0, "Starts player in a new fullscreen display");
931 uiBlockBeginAlign(block);
932 uiDefButS(block, NUM, 0, "X:", xco+40, yco-=27, 100, 19, &G.scene->r.xplay, 10.0, 2000.0, 0, 0, "Displays current X screen/window resolution. Click to change.");
933 uiDefButS(block, NUM, 0, "Y:", xco+140, yco, 100, 19, &G.scene->r.yplay, 10.0, 2000.0, 0, 0, "Displays current Y screen/window resolution. Click to change.");
934 uiDefButS(block, NUM, 0, "Freq:", xco+40, yco-=21, 100, 19, &G.scene->r.freqplay, 10.0, 2000.0, 0, 0, "Displays clock frequency of fullscreen display. Click to change.");
935 uiDefButS(block, NUM, 0, "Bits:", xco+140, yco, 100, 19, &G.scene->r.depth, 8.0, 32.0, 800.0, 0, "Displays bit depth of full screen display. Click to change.");
936 uiBlockEndAlign(block);
938 /* stereo settings */
939 /* can't use any definition from the game engine here so hardcode it. Change it here when it changes there!
940 * RAS_IRasterizer has definitions:
941 * RAS_STEREO_NOSTEREO 1
942 * RAS_STEREO_QUADBUFFERED 2
943 * RAS_STEREO_ABOVEBELOW 3
944 * RAS_STEREO_INTERLACED 4 future
945 * RAS_STEREO_ANAGLYPH 5
946 * RAS_STEREO_SIDEBYSIDE 6
947 * RAS_STEREO_VINTERLACE 7
949 uiBlockBeginAlign(block);
950 uiDefButS(block, ROW, 0, "No Stereo", xco, yco-=30, 88, 19, &(G.scene->r.stereomode), 7.0, 1.0, 0, 0, "Disables stereo");
951 uiDefButS(block, ROW, 0, "Pageflip", xco+=90, yco, 88, 19, &(G.scene->r.stereomode), 7.0, 2.0, 0, 0, "Enables hardware pageflip stereo method");
952 uiDefButS(block, ROW, 0, "Syncdouble", xco+=90, yco, 88, 19, &(G.scene->r.stereomode), 7.0, 3.0, 0, 0, "Enables syncdoubling stereo method");
953 uiDefButS(block, ROW, 0, "Anaglyph", xco-=180, yco-=21, 88, 19, &(G.scene->r.stereomode), 7.0, 5.0, 0, 0, "Enables anaglyph (Red-Blue) stereo method");
954 uiDefButS(block, ROW, 0, "Side by Side", xco+=90, yco, 88, 19, &(G.scene->r.stereomode), 7.0, 6.0, 0, 0, "Enables side by side left and right images");
955 uiDefButS(block, ROW, 0, "V Interlace", xco+=90, yco, 88, 19, &(G.scene->r.stereomode), 7.0, 7.0, 0, 0, "Enables interlaced vertical strips for autostereo display");
957 uiBlockEndAlign(block);
959 uiBlockSetDirection(block, UI_TOP);
965 static char *imagetype_pup(void)
967 static char string[1024];
968 char formatstring[1024];
969 char appendstring[1024];
971 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");
974 strcat(formatstring, "|%s %%x%d"); // add space for Movie
977 strcat(formatstring, "|%s %%x%d"); // add space for PNG
978 strcat(formatstring, "|%s %%x%d"); // add space for BMP
979 strcat(formatstring, "|%s %%x%d"); // add space for Radiance HDR
982 strcat(formatstring, "|%s %%x%d"); // add space for AVI Codec
985 #ifdef WITH_QUICKTIME
987 strcat(formatstring, "|%s %%x%d"); // add space for Quicktime
990 if(G.have_quicktime) {
991 sprintf(string, formatstring,
993 "AVI Jpeg", R_AVIJPEG,
995 "AVI Codec", R_AVICODEC,
997 #ifdef WITH_QUICKTIME
998 "QuickTime", R_QUICKTIME,
1001 "Targa Raw", R_RAWTGA,
1007 "Iris + Zbuffer", R_IRIZ,
1008 "Radiance HDR", R_RADHDR
1014 sprintf(string, formatstring,
1015 "AVI Raw", R_AVIRAW,
1016 "AVI Jpeg", R_AVIJPEG,
1018 "AVI Codec", R_AVICODEC,
1021 "Targa Raw", R_RAWTGA,
1027 "Iris + Zbuffer", R_IRIZ,
1028 "Radiance HDR", R_RADHDR
1036 strcpy(formatstring, "|%s %%x%d");
1037 sprintf(appendstring, formatstring, "OpenEXR", R_OPENEXR);
1038 strcat(string, appendstring);
1041 if (G.have_libtiff) {
1042 strcpy(formatstring, "|%s %%x%d");
1043 sprintf(appendstring, formatstring, "TIFF", R_TIFF);
1044 strcat(string, appendstring);
1051 static char *avicodec_str(void)
1053 static char string[1024];
1055 sprintf(string, "Codec: %s", G.scene->r.avicodecdata->avicodecname);
1061 static void render_panel_output(void)
1069 block= uiNewBlock(&curarea->uiblocks, "render_panel_output", UI_EMBOSS, UI_HELV, curarea->win);
1070 if(uiNewPanel(curarea, block, "Output", "Render", 0, 0, 318, 204)==0) return;
1072 uiBlockBeginAlign(block);
1073 uiDefIconBut(block, BUT, B_FS_PIC, ICON_FILESEL, 10, 190, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get Pics dir/name");
1074 uiDefBut(block, TEX,0,"", 31, 190, 279, 20,G.scene->r.pic, 0.0,79.0, 0, 0, "Directory/name to save rendered Pics to");
1075 uiDefIconBut(block, BUT,B_FS_BACKBUF, ICON_FILESEL, 10, 168, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get Backbuf image");
1076 uiDefBut(block, TEX,0,"", 31, 168, 279, 20,G.scene->r.backbuf, 0.0,79.0, 0, 0, "Image to use as background for rendering");
1077 uiDefIconBut(block, BUT,B_FS_FTYPE, ICON_FILESEL, 10, 146, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get Ftype image");
1078 uiDefBut(block, TEX,0,"", 31, 146, 279, 20,G.scene->r.ftype,0.0,79.0, 0, 0, "Image to use with FTYPE Image type");
1079 uiBlockEndAlign(block);
1083 uiBlockBeginAlign(block);
1084 id= (ID *)G.scene->set;
1085 IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), id, &(G.buts->menunr));
1087 uiDefButS(block, MENU, B_SETBROWSE, strp, 10, 120, 20, 20, &(G.buts->menunr), 0, 0, 0, 0, "Scene to link as a Set");
1091 uiSetButLock(1, NULL);
1092 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 0, "", 31, 120, 100, 20, &(G.scene->set), "Name of the Set");
1094 uiDefIconBut(block, BUT, B_CLEARSET, ICON_X, 132, 120, 20, 20, 0, 0, 0, 0, 0, "Remove Set link");
1096 uiBlockEndAlign(block);
1098 uiBlockSetCol(block, TH_BUT_SETTING1);
1099 uiDefButBitS(block, TOG, R_BACKBUF, B_NOP,"Backbuf", 10, 94, 80, 20, &G.scene->r.bufflag, 0, 0, 0, 0, "Enable/Disable use of Backbuf image");
1100 uiDefButBitI(block, TOG, R_THREADS, B_NOP,"Threads", 10, 68, 80, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable/Disable render in two threads");
1101 uiBlockSetCol(block, TH_AUTO);
1103 uiBlockBeginAlign(block);
1106 uiDefButBitS(block, TOG, 1<<(3*b+a), 800,"", (short)(10+18*a),(short)(10+14*b),16,12, &G.winpos, 0, 0, 0, 0, "Render window placement on screen");
1107 uiBlockEndAlign(block);
1109 uiBlockBeginAlign(block);
1110 uiDefButS(block, ROW, B_REDR, "DispWin", 72, 10, 60, 20, &G.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output to display in a seperate window");
1111 uiDefButS(block, ROW, B_REDR, "DispView", 134, 10, 60, 20, &G.displaymode, 0.0, (float)R_DISPLAYVIEW, 0, 0, "Sets render output to display in 3D view");
1112 uiBlockEndAlign(block);
1114 uiDefButBitS(block, TOG, R_EXTENSION, 0, "Extensions", 205, 10, 105, 19, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds extensions to the output when rendering animations");
1116 /* Dither control */
1117 uiDefButF(block, NUM,B_DIFF, "Dither:", 205,31,105,19, &G.scene->r.dither_intensity, 0.0, 2.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)");
1119 /* Toon shading buttons */
1120 uiBlockBeginAlign(block);
1121 uiDefButBitI(block, TOG, R_EDGE, 0,"Edge", 100, 94, 70, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon edge shading");
1122 uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 170, 94, 140, 20, "Display edge settings");
1124 /* postprocess render buttons */
1125 uiBlockBeginAlign(block);
1127 // uiDefIconTextButBitI(block, TOG, R_FBUF, B_NOP, ICON_IMAGE_DEHLT," Fbuf", 100, 68, 70, 20, &G.scene->r.mode, 0, 0, 0, 0, "Keep RGBA float buffer after render; buffer available");
1129 // uiDefButBitI(block, TOG, R_FBUF, 0,"Fbuf", 100, 68, 70, 20, &G.scene->r.mode, 0, 0, 0, 0, "Keep RGBA float buffer after render, no buffer available now");
1130 uiDefBlockBut(block, post_render_menu, NULL, "Post process", 170, 68, 140, 20, "Applies on RGBA floats while render or with Fbuf available");
1131 uiBlockEndAlign(block);
1133 /* removed, for time being unified and normal render will use same gamma for blending (2.0) */
1134 //if (G.scene->r.mode & R_GAMMA) {
1135 // uiDefButF(block, NUMSLI, B_NOP,"Gamma:", 10, 68, 142, 20,
1136 // &(G.scene->r.gamma), 0.2, 5.0, B_GAMMASLI, 0,
1137 // "The gamma value for blending oversampled images (1.0 = no correction).");
1141 static void render_panel_render(void)
1146 block= uiNewBlock(&curarea->uiblocks, "render_panel_render", UI_EMBOSS, UI_HELV, curarea->win);
1147 if(uiNewPanel(curarea, block, "Render", "Render", 320, 0, 318, 204)==0) return;
1149 uiBlockBeginAlign(block);
1150 uiDefBut(block, BUT,B_DORENDER,"RENDER", 369, 164, 191,37, 0, 0, 0, 0, 0, "Start the rendering");
1151 /* yafray: on request, render engine menu is back again, and moved to Render panel */
1152 uiDefButS(block, MENU, B_SWITCHRENDER, "Rendering Engine %t|Blender Internal %x0|YafRay %x1",
1153 369, 142, 191, 20, &G.scene->r.renderer, 0, 0, 0, 0, "Choose rendering engine");
1155 uiBlockBeginAlign(block);
1156 uiDefButBitI(block, TOG, R_OSA, 0, "OSA", 369,109,122,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
1157 uiDefButS(block, ROW,B_DIFF,"5", 369,88,29,20,&G.scene->r.osa,2.0,5.0, 0, 0, "Sets oversample level to 5");
1158 uiDefButS(block, ROW,B_DIFF,"8", 400,88,29,20,&G.scene->r.osa,2.0,8.0, 0, 0, "Sets oversample level to 8 (Recommended)");
1159 uiDefButS(block, ROW,B_DIFF,"11", 431,88,29,20,&G.scene->r.osa,2.0,11.0, 0, 0, "Sets oversample level to 11");
1160 uiDefButS(block, ROW,B_DIFF,"16", 462,88,29,20,&G.scene->r.osa,2.0,16.0, 0, 0, "Sets oversample level to 16");
1161 uiBlockEndAlign(block);
1163 uiBlockBeginAlign(block);
1164 uiDefButBitI(block, TOG, R_MBLUR, 0, "MBLUR", 496,109,64,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Motion Blur calculation");
1165 uiDefButF(block, NUM,B_DIFF,"Bf:", 496,88,64,20,&G.scene->r.blurfac, 0.01, 5.0, 10, 2, "Sets motion blur factor");
1166 uiBlockEndAlign(block);
1168 uiBlockBeginAlign(block);
1169 uiDefButS(block, NUM,B_DIFF,"Xparts:", 369,46,95,29,&G.scene->r.xparts,2.0, 64.0, 0, 0, "Sets the number of horizontal parts to render image in (For panorama sets number of camera slices)");
1170 uiDefButS(block, NUM,B_DIFF,"Yparts:", 465,46,95,29,&G.scene->r.yparts,2.0, 64.0, 0, 0, "Sets the number of vertical parts to render image in");
1171 uiBlockEndAlign(block);
1173 uiBlockBeginAlign(block);
1174 uiDefButS(block, ROW,800,"Sky", 369,13,35,20,&G.scene->r.alphamode,3.0,0.0, 0, 0, "Fill background with sky");
1175 uiDefButS(block, ROW,800,"Premul", 405,13,50,20,&G.scene->r.alphamode,3.0,1.0, 0, 0, "Multiply alpha in advance");
1176 uiDefButS(block, ROW,800,"Key", 456,13,35,20,&G.scene->r.alphamode,3.0,2.0, 0, 0, "Alpha and colour values remain unchanged");
1177 uiBlockEndAlign(block);
1179 if(G.scene->r.mode & R_RAYTRACE)
1180 uiDefButS(block, MENU, B_DIFF,"Octree resolution %t|64 %x64|128 %x128|256 %x256|512 %x512", 496,13,64,20,&G.scene->r.ocres,0.0,0.0, 0, 0, "Octree resolution for ray tracing");
1182 uiBlockBeginAlign(block);
1183 uiDefButBitI(block, TOG, R_SHADOW, 0,"Shadow", 565,172,60,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable shadow calculation");
1184 uiDefButBitI(block, TOG, R_ENVMAP, 0,"EnvMap", 627,172,60,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable environment map rendering");
1185 uiDefButBitI(block, TOG, R_PANORAMA, 0,"Pano", 565,142,40,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable panorama rendering (output width is multiplied by Xparts)");
1186 uiDefButBitI(block, TOG, R_RAYTRACE, B_REDR,"Ray",606,142,40,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable ray tracing");
1187 uiDefButBitI(block, TOG, R_RADIO, 0,"Radio", 647,142,40,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable radiosity rendering");
1188 uiBlockEndAlign(block);
1190 uiBlockBeginAlign(block);
1191 uiDefButS(block, ROW,B_DIFF,"100%", 565,109,122,20,&G.scene->r.size,1.0,100.0, 0, 0, "Set render size to defined size");
1192 uiDefButS(block, ROW,B_DIFF,"75%", 565,88,40,20,&G.scene->r.size,1.0,75.0, 0, 0, "Set render size to 3/4 of defined size");
1193 uiDefButS(block, ROW,B_DIFF,"50%", 606,88,40,20,&G.scene->r.size,1.0,50.0, 0, 0, "Set render size to 1/2 of defined size");
1194 uiDefButS(block, ROW,B_DIFF,"25%", 647,88,40,20,&G.scene->r.size,1.0,25.0, 0, 0, "Set render size to 1/4 of defined size");
1195 uiBlockEndAlign(block);
1197 uiBlockBeginAlign(block);
1198 uiDefButBitI(block, TOG, R_FIELDS, 0,"Fields", 565,55,60,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables field rendering");
1199 uiDefButBitI(block, TOG, R_ODDFIELD, 0,"Odd", 627,55,39,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Odd field first rendering (Default: Even field)");
1200 uiDefButBitI(block, TOG, R_FIELDSTILL, 0,"X", 668,55,19,20,&G.scene->r.mode, 0, 0, 0, 0, "Disables time difference in field calculations");
1202 sprintf(str, "Filter%%t|Box %%x%d|Tent %%x%d|Quad %%x%d|Cubic %%x%d|Gauss %%x%d|CatRom %%x%d|Mitch %%x%d", R_FILTER_BOX, R_FILTER_TENT, R_FILTER_QUAD, R_FILTER_CUBIC, R_FILTER_GAUSS, R_FILTER_CATROM, R_FILTER_MITCH);
1203 uiDefButS(block, MENU, B_DIFF,str, 565,34,60,20, &G.scene->r.filtertype, 0, 0, 0, 0, "Set sampling filter for antialiasing");
1204 uiDefButF(block, NUM,B_DIFF,"", 627,34,60,20,&G.scene->r.gauss,0.5, 1.5, 10, 2, "Sets the filter size");
1206 uiDefButBitI(block, TOG, R_BORDER, REDRAWVIEWCAM, "Border", 565,13,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Render a small cut-out of the image");
1207 uiDefButBitI(block, TOG, R_GAMMA, B_REDR, "Gamma", 627,13,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Enable gamma correction");
1208 uiBlockEndAlign(block);
1212 static void render_panel_anim(void)
1217 block= uiNewBlock(&curarea->uiblocks, "render_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
1218 if(uiNewPanel(curarea, block, "Anim", "Render", 640, 0, 318, 204)==0) return;
1221 uiDefBut(block, BUT,B_DOANIM,"ANIM", 692,142,192,47, 0, 0, 0, 0, 0, "Start rendering a sequence");
1223 uiBlockSetCol(block, TH_BUT_SETTING1);
1224 uiBlockBeginAlign(block);
1225 uiDefButBitS(block, TOG, R_DOSEQ, B_NOP, "Do Sequence",692,114,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Enables sequence output rendering (Default: 3D rendering)");
1226 uiDefButBitS(block, TOG, R_DOCOMP, B_NOP, "Do Composit",692,90,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Uses compositing nodes for output rendering");
1227 uiBlockEndAlign(block);
1229 uiBlockSetCol(block, TH_AUTO);
1230 uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,40,94,33, 0, 0, 0, 0, 0, "Play animation of rendered images/avi (searches Pics: field)");
1231 uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,40,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button");
1233 uiBlockBeginAlign(block);
1234 uiDefButS(block, NUM,REDRAWSEQ,"Sta:",692,10,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation");
1235 uiDefButS(block, NUM,REDRAWSEQ,"End:",789,10,95,24, &G.scene->r.efra,1.0,MAXFRAMEF, 0, 0, "The end frame of the animation");
1236 uiBlockEndAlign(block);
1239 static void render_panel_format(void)
1245 block= uiNewBlock(&curarea->uiblocks, "render_panel_format", UI_EMBOSS, UI_HELV, curarea->win);
1246 if(uiNewPanel(curarea, block, "Format", "Render", 960, 0, 318, 204)==0) return;
1247 uiDefBlockBut(block, framing_render_menu, NULL,
1248 "Game framing settings",
1249 892, 169, 227, 20, "Display game framing settings");
1250 /* uiDefIconTextBlockBut(block, framing_render_menu, NULL,
1251 ICON_BLOCKBUT_CORNER,
1252 "Game framing settings",
1254 "Display game framing settings"); */
1256 uiBlockBeginAlign(block);
1257 uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeX:", 892 ,136,112,27, &G.scene->r.xsch, 4.0, 10000.0, 0, 0, "The image width in pixels");
1258 uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeY:", 1007,136,112,27, &G.scene->r.ysch, 4.0,10000.0, 0, 0, "The image height in scanlines");
1259 uiDefButS(block, NUM,REDRAWVIEWCAM,"AspX:", 892 ,114,112,20, &G.scene->r.xasp, 1.0,200.0, 0, 0, "The horizontal aspect ratio");
1260 uiDefButS(block, NUM,REDRAWVIEWCAM,"AspY:", 1007,114,112,20, &G.scene->r.yasp, 1.0,200.0, 0, 0, "The vertical aspect ratio");
1261 uiBlockEndAlign(block);
1267 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");
1268 uiDefButBitI(block, TOG, R_COSMO, 0,"Cosmo", 1059,32,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Attempt to save SGI movies using Cosmo hardware");
1272 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");
1273 uiDefButBitI(block, TOG, R_MOVIECROP, B_DIFF, "Crop", 1068,yofs,51,20, &G.scene->r.mode, 0, 0, 0, 0, "Exclude border rendering from total image");
1277 if(G.scene->r.quality==0) G.scene->r.quality= 90;
1279 #ifdef WITH_QUICKTIME
1280 if (G.scene->r.imtype == R_AVICODEC || G.scene->r.imtype == R_QUICKTIME) {
1281 #else /* WITH_QUICKTIME */
1284 if(G.scene->r.imtype == R_QUICKTIME) {
1285 #ifdef WITH_QUICKTIME
1286 #if defined (_WIN32) || defined (__APPLE__)
1287 //glColor3f(0.65, 0.65, 0.7);
1288 //glRecti(892,yofs+46,892+225,yofs+45+20);
1289 if(G.scene->r.qtcodecdata == NULL)
1290 uiDefBut(block, LABEL, 0, "Codec: not set", 892,yofs+44,225,20, 0, 0, 0, 0, 0, "");
1292 uiDefBut(block, LABEL, 0, G.scene->r.qtcodecdata->qtcodecname, 892,yofs+44,225,20, 0, 0, 0, 0, 0, "");
1293 uiDefBut(block, BUT,B_SELECTCODEC, "Set codec", 892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for Quicktime");
1295 #endif /* WITH_QUICKTIME */
1298 //glColor3f(0.65, 0.65, 0.7);
1299 //glRecti(892,yofs+46,892+225,yofs+45+20);
1300 if(G.scene->r.avicodecdata == NULL)
1301 uiDefBut(block, LABEL, 0, "Codec: not set.", 892,yofs+43,225,20, 0, 0, 0, 0, 0, "");
1303 uiDefBut(block, LABEL, 0, avicodec_str(), 892,yofs+43,225,20, 0, 0, 0, 0, 0, "");
1305 uiDefBut(block, BUT,B_SELECTCODEC, "Set codec", 892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for AVI");
1309 else if (G.scene->r.imtype == R_OPENEXR ) {
1310 if (G.scene->r.quality > 5) G.scene->r.quality = 0;
1312 uiBlockBeginAlign(block);
1313 uiDefButBitS(block, TOG, R_OPENEXR_HALF, B_NOP,"Half", 892,yofs+44,60,20, &G.scene->r.subimtype, 0, 0, 0, 0, "Use 16 bits float 'Half' type");
1314 uiDefButBitS(block, TOG, R_OPENEXR_ZBUF, B_NOP,"Zbuf", 952,yofs+44,60,20, &G.scene->r.subimtype, 0, 0, 0, 0, "Save the zbuffer as 32 bits unsigned int");
1315 uiBlockEndAlign(block);
1317 uiDefButS(block, MENU,B_NOP, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4",
1318 892,yofs,112,20, &G.scene->r.quality, 0, 0, 0, 0, "Set codec settings for OpenEXR");
1322 if(G.scene->r.quality < 5) G.scene->r.quality = 90; /* restore from openexr */
1324 uiDefButS(block, NUM,B_DIFF, "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");
1326 uiDefButS(block, NUM,B_FRAMEMAP,"Frs/sec:", 1006,yofs,113,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
1329 uiBlockBeginAlign(block);
1330 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");
1331 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");
1332 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)");
1334 uiBlockBeginAlign(block);
1335 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");
1336 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");
1337 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)");
1338 uiDefBut(block, BUT,B_PR_PRV, "Preview", 1146,110,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x512, Render size 50%");
1339 uiDefBut(block, BUT,B_PR_PC, "PC", 1146,90,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x480, Aspect ratio - 100x100");
1340 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");
1341 uiDefBut(block, BUT,B_PR_PANO, "PANO", 1146,50,100,18, 0, 0, 0, 0, 0, "Standard panorama settings");
1342 uiDefBut(block, BUT,B_PR_FULL, "FULL", 1146,30,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 1280x1024, Aspect ratio - 1x1");
1343 uiDefButBitI(block, TOG, R_UNIFIED, B_REDR, "Unified Renderer", 1146,10,100,18, &G.scene->r.mode, 0, 0, 0, 0, "Use the unified renderer.");
1344 uiBlockEndAlign(block);
1348 /* yafray: global illumination options panel */
1349 static void render_panel_yafrayGI()
1353 block= uiNewBlock(&curarea->uiblocks, "render_panel_yafrayGI", UI_EMBOSS, UI_HELV, curarea->win);
1354 uiNewPanelTabbed("Render", "Render");
1355 if(uiNewPanel(curarea, block, "YafRay GI", "Render", 320, 0, 318, 204)==0) return;
1357 // label to force a boundbox for buttons not to be centered
1358 uiDefBut(block, LABEL, 0, " ", 305,180,10,10, 0, 0, 0, 0, 0, "");
1360 uiDefBut(block, LABEL, 0, "Method", 5,175,70,20, 0, 1.0, 0, 0, 0, "");
1361 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");
1363 uiDefBut(block, LABEL, 0, "Quality", 5,150,70,20, 0, 1.0, 0, 0, 0, "");
1364 uiDefButS(block, MENU, B_REDR, "GiQuality %t|None %x0|Low %x1|Medium %x2 |High %x3|Higher %x4|Best %x5|Use Blender AO settings %x6", 70,150,89,20, &G.scene->r.GIquality, 0, 0, 0, 0, "Global Illumination Quality");
1366 if (G.scene->r.GImethod>0) {
1367 uiDefButF(block, NUM, B_DIFF, "EmitPwr:", 5,35,154,20, &G.scene->r.GIpower, 0.01, 100.0, 10, 0, "arealight, material emit and background intensity scaling, 1 is normal");
1368 if (G.scene->r.GImethod==2) uiDefButF(block, NUM, B_DIFF, "GI Pwr:", 5,10,154,20, &G.scene->r.GIindirpower, 0.01, 100.0, 10, 0, "GI indirect lighting intensity scaling, 1 is normal");
1371 if (G.scene->r.GImethod>0)
1373 if (G.scene->r.GIdepth==0) G.scene->r.GIdepth=2;
1375 if (G.scene->r.GImethod==2) {
1376 uiDefButI(block, NUM, B_DIFF, "Depth:", 180,175,110,20, &G.scene->r.GIdepth, 1.0, 100.0, 10, 10, "Number of bounces of the indirect light");
1377 uiDefButI(block, NUM, B_DIFF, "CDepth:", 180,150,110,20, &G.scene->r.GIcausdepth, 1.0, 100.0, 10, 10, "Number of bounces inside objects (for caustics)");
1378 uiDefButBitS(block, TOG, 1, B_REDR, "Photons",210,125,100,20, &G.scene->r.GIphotons, 0, 0, 0, 0, "Use global photons to help in GI");
1381 uiDefButBitS(block, TOG, 1, B_REDR, "Cache",6,125,95,20, &G.scene->r.GIcache, 0, 0, 0, 0, "Cache occlusion/irradiance samples (faster)");
1382 if (G.scene->r.GIcache)
1384 uiDefButBitS(block,TOG, 1, B_REDR, "NoBump",108,125,95,20, &G.scene->r.YF_nobump, 0, 0, 0, 0, "Don't use bumpnormals for cache (faster, but no bumpmapping in total indirectly lit areas)");
1385 uiDefBut(block, LABEL, 0, "Cache parameters:", 5,105,130,20, 0, 1.0, 0, 0, 0, "");
1386 if (G.scene->r.GIshadowquality==0.0) G.scene->r.GIshadowquality=0.9;
1387 uiDefButF(block, NUM, B_DIFF,"ShadQu:", 5,85,154,20, &(G.scene->r.GIshadowquality), 0.01, 1.0 ,1,0, "Sets the shadow quality, keep it under 0.95 :-) ");
1388 if (G.scene->r.GIpixelspersample==0) G.scene->r.GIpixelspersample=10;
1389 uiDefButI(block, NUM, B_DIFF, "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");
1390 if (G.scene->r.GIrefinement==0) G.scene->r.GIrefinement=1.0;
1391 uiDefButF(block, NUM, B_DIFF, "Ref:", 84,60,75,20, &G.scene->r.GIrefinement, 0.001, 1.0, 1, 0, "Threshold to refine shadows EXPERIMENTAL. 1 = no refinement");
1394 if (G.scene->r.GImethod==2) {
1395 if (G.scene->r.GIphotons)
1397 uiDefBut(block, LABEL, 0, "Photon parameters:", 170,105,130,20, 0, 1.0, 0, 0, 0, "");
1398 if(G.scene->r.GIphotoncount==0) G.scene->r.GIphotoncount=100000;
1399 uiDefButI(block, NUM, B_DIFF, "Count:", 170,85,140,20, &G.scene->r.GIphotoncount,
1400 0, 10000000, 10, 10, "Number of photons to shoot");
1401 if(G.scene->r.GIphotonradius==0.0) G.scene->r.GIphotonradius=1.0;
1402 uiDefButF(block, NUMSLI, B_DIFF,"Radius:", 170,60,140,20, &(G.scene->r.GIphotonradius),
1403 0.00001, 100.0 ,0,0, "Radius to search for photons to mix (blur)");
1404 if(G.scene->r.GImixphotons==0) G.scene->r.GImixphotons=100;
1405 uiDefButI(block, NUM, B_DIFF, "MixCount:", 170,35,140,20, &G.scene->r.GImixphotons,
1406 0, 1000, 10, 10, "Number of photons to mix");
1407 uiDefButBitS(block, TOG, 1, B_REDR, "Tune Photons",170,10,140,20, &G.scene->r.GIdirect,
1408 0, 0, 0, 0, "Show the photonmap directly in the render for tuning");
1415 /* yafray: global options panel */
1416 static void render_panel_yafrayGlobal()
1420 block= uiNewBlock(&curarea->uiblocks, "render_panel_yafrayGlobal", UI_EMBOSS, UI_HELV, curarea->win);
1421 uiNewPanelTabbed("Render", "Render");
1422 if(uiNewPanel(curarea, block, "YafRay", "Render", 320, 0, 318, 204)==0) return;
1424 // label to force a boundbox for buttons not to be centered
1425 uiDefBut(block, LABEL, 0, " ", 305,180,10,10, 0, 0, 0, 0, 0, "");
1427 uiDefButBitS(block, TOGN, 1, B_REDR, "xml", 5,180,75,20, &G.scene->r.YFexportxml,
1428 0, 0, 0, 0, "Export to an xml file and call yafray instead of plugin");
1430 uiDefButF(block, NUMSLI, B_DIFF,"Bi ", 5,35,150,20, &(G.scene->r.YF_raybias),
1431 0.0, 10.0 ,0,0, "Shadow ray bias to avoid self shadowing");
1432 uiDefButI(block, NUM, B_DIFF, "Raydepth ", 5,60,150,20,
1433 &G.scene->r.YF_raydepth, 1.0, 80.0, 10, 10, "Maximum render ray depth from the camera");
1434 uiDefButF(block, NUMSLI, B_DIFF, "Gam ", 5,10,150,20, &G.scene->r.YF_gamma, 0.001, 5.0, 0, 0, "Gamma correction, 1 is off");
1435 uiDefButF(block, NUMSLI, B_DIFF, "Exp ", 160,10,150,20,&G.scene->r.YF_exposure, 0.0, 10.0, 0, 0, "Exposure adjustment, 0 is off");
1437 uiDefButI(block, NUM, B_DIFF, "Processors:", 160,60,150,20, &G.scene->r.YF_numprocs, 1.0, 8.0, 10, 10, "Number of processors to use");
1440 uiDefButBitS(block, TOGN, 1, B_REDR, "Auto AA", 5,140,150,20, &G.scene->r.YF_AA,
1441 0, 0, 0, 0, "Set AA using OSA and GI quality, disable for manual control");
1442 uiDefButBitS(block, TOGN, 1, B_DIFF, "Clamp RGB", 160,140,150,20, &G.scene->r.YF_clamprgb, 1.0, 8.0, 10, 10, "For AA on fast high contrast changes. Not advisable for Bokeh! Dulls lens shape detail.");
1443 if(G.scene->r.YF_AA){
1444 uiDefButI(block, NUM, B_DIFF, "AA Passes ", 5,115,150,20, &G.scene->r.YF_AApasses, 0, 64, 10, 10, "Number of AA passes (0 is no AA)");
1445 uiDefButI(block, NUM, B_DIFF, "AA Samples ", 160,115,150,20, &G.scene->r.YF_AAsamples, 0, 2048, 10, 10, "Number of samples per pass");
1446 uiDefButF(block, NUMSLI, B_DIFF, "Psz ", 5,90,150,20, &G.scene->r.YF_AApixelsize, 1.0, 2.0, 0, 0, "AA pixel filter size");
1447 uiDefButF(block, NUMSLI, B_DIFF, "Thr ", 160,90,150,20, &G.scene->r.YF_AAthreshold, 0.000001, 1.0, 0, 0, "AA threshold");
1452 static void render_panel_sfx(void)
1456 block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_dof", UI_EMBOSS, UI_HELV, curarea->win);
1457 uiNewPanelTabbed("Output", "Render");
1458 if(uiNewPanel(curarea, block, "Post Effects", "Render", 320, 0, 318, 204)==0) return;
1460 uiBlockBeginAlign(block);
1461 uiDefButBitI(block, TOG, R_ZBLUR,B_SET_ZBLUR,"Zblur", 10,180,140,20,&G.scene->r.mode,0,0, 0, 0, "Apply blur based on depth values in z-buffer");
1462 uiDefButF(block, NUM,B_DIFF, "ZMin:", 10,160,140,20, &G.scene->r.zmin, 0.0, 1.0, 0, 0, "Specify the start distance with maximum blur");
1463 uiDefButF(block, NUM,B_DIFF, "Focus:", 10,140,140,20, &G.scene->r.focus, 0.0, 1.0, 0, 0, "Specify the focus distance (not blurred)");
1464 uiDefButF(block, NUM,B_DIFF, "Blur:", 10,120,140,20, &G.scene->r.zblur, 1.0, 100.0, 0, 0, "Specify the maximum blur radius");
1465 uiDefButF(block, NUM,B_DIFF, "Gamma:", 10,100,140,20, &G.scene->r.zgamma, 0.05, 2.0, 0, 0, "Use Gamma corrected addition of colors");
1466 uiDefButF(block, NUM,B_DIFF, "Sigma:", 10,80,140,20, &G.scene->r.zsigma, 1.0, 20.0, 0, 0, "Filter type control, higher value is stronger gaussian");
1468 /* Toon shading buttons */
1469 uiBlockBeginAlign(block);
1470 uiDefButBitI(block, TOG, R_EDGE, B_SET_EDGE, "Edge", 160, 180, 150, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon edge shading");
1471 uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 160, 160, 150, 20, "Display edge settings");
1473 /* postprocess render buttons */
1474 uiBlockBeginAlign(block);
1476 uiDefIconTextButI(block, TOG, R_FBUF, B_NOP, ICON_IMAGE_DEHLT," Fbuf", 160, 130, 150, 20, &G.scene->r.mode, 0, 0, 0, 0, "Keep RGBA float buffer after render; buffer available");
1478 uiDefButBitI(block, TOG, R_FBUF, 0,"Fbuf", 160, 130, 150, 20, &G.scene->r.mode, 0, 0, 0, 0, "Keep RGBA float buffer after render, no buffer available now");
1479 uiDefBlockBut(block, post_render_menu, NULL, "Post process", 160, 110, 150, 20, "Applies on RGBA floats while render or with Fbuf available");
1480 uiBlockEndAlign(block);
1482 /* Dither control */
1483 uiDefButF(block, NUM,B_DIFF, "Dither:", 160,80,150,20, &G.scene->r.dither_intensity, 0.0, 2.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)");
1488 static void layer_copy_func(void *lay_v, void *lay_p)
1490 unsigned int *lay= lay_p;
1491 int laybit= (int)lay_v;
1493 if(G.qual & LR_SHIFTKEY) {
1494 if(*lay==0) *lay= 1<<laybit;
1499 copy_view3d_lock(REDRAW);
1500 allqueue(REDRAWBUTSSCENE, 0);
1503 static void delete_scene_layer_func(void *srl_v, void *unused1)
1505 if(BLI_countlist(&G.scene->r.layers)>1) {
1506 BLI_remlink(&G.scene->r.layers, srl_v);
1508 G.scene->r.actlay= 0;
1510 allqueue(REDRAWBUTSSCENE, 0);
1511 allqueue(REDRAWNODE, 0);
1515 static void rename_scene_layer_func(void *srl_v, void *unused_v)
1517 if(G.scene->nodetree) {
1518 SceneRenderLayer *srl= srl_v;
1520 for(node= G.scene->nodetree->nodes.first; node; node= node->next) {
1521 if(node->type==CMP_NODE_R_RESULT) {
1522 if(node->custom1==G.scene->r.actlay)
1523 BLI_strncpy(node->name, srl->name, NODE_MAXSTR);
1527 allqueue(REDRAWNODE, 0);
1530 static char *scene_layer_menu(void)
1532 SceneRenderLayer *srl;
1533 int len= 32 + 32*BLI_countlist(&G.scene->r.layers);
1535 char *str= MEM_callocN(len, "menu layers");
1537 strcpy(str, "ADD NEW %x32767");
1539 for(nr=0, srl= G.scene->r.layers.first; srl; srl= srl->next, nr++) {
1540 a+= sprintf(str+a, "|%s %%x%d", srl->name, nr);
1546 static void draw_3d_layer_buttons(uiBlock *block, unsigned int *poin, short xco, short yco, short dx, short dy, int event)
1551 uiBlockBeginAlign(block);
1552 for(a=0; a<5; a++) {
1553 bt= uiDefButBitI(block, TOG, 1<<a, B_NOP, "", (short)(xco+a*(dx/2)), yco+dy/2, (short)(dx/2), (short)(dy/2), poin, 0, 0, 0, 0, "");
1554 uiButSetFunc(bt, layer_copy_func, (void *)a, poin);
1556 for(a=0; a<5; a++) {
1557 bt=uiDefButBitI(block, TOG, 1<<(a+10), B_NOP, "", (short)(xco+a*(dx/2)), yco, (short)(dx/2), (short)(dy/2), poin, 0, 0, 0, 0, "");
1558 uiButSetFunc(bt, layer_copy_func, (void *)(a+10), poin);
1562 uiBlockBeginAlign(block);
1563 for(a=5; a<10; a++) {
1564 bt=uiDefButBitI(block, TOG, 1<<a, B_NOP, "", (short)(xco+a*(dx/2)), yco+dy/2, (short)(dx/2), (short)(dy/2), poin, 0, 0, 0, 0, "");
1565 uiButSetFunc(bt, layer_copy_func, (void *)a, poin);
1567 for(a=5; a<10; a++) {
1568 bt=uiDefButBitI(block, TOG, 1<<(a+10), B_NOP, "", (short)(xco+a*(dx/2)), yco, (short)(dx/2), (short)(dy/2), poin, 0, 0, 0, 0, "");
1569 uiButSetFunc(bt, layer_copy_func, (void *)(a+10), poin);
1572 uiBlockEndAlign(block);
1575 static void render_panel_layers(void)
1579 SceneRenderLayer *srl= BLI_findlink(&G.scene->r.layers, G.scene->r.actlay);
1582 block= uiNewBlock(&curarea->uiblocks, "render_panel_layers", UI_EMBOSS, UI_HELV, curarea->win);
1583 uiNewPanelTabbed("Output", "Render");
1584 if(uiNewPanel(curarea, block, "Render Layers", "Render", 320, 0, 318, 204)==0) return;
1586 /* first, as reminder, the scene layers */
1587 uiDefBut(block, LABEL, 0, "Scene:", 10,170,100,20, NULL, 0, 0, 0, 0, "");
1589 draw_3d_layer_buttons(block, &G.scene->lay, 130, 170, 35, 30, B_LAY);
1591 /* layer menu, name, delete button */
1592 uiBlockBeginAlign(block);
1593 strp= scene_layer_menu();
1594 uiDefButS(block, MENU, B_ADD_RENDERLAYER, strp, 10,130,23,20, &(G.scene->r.actlay), 0, 0, 0, 0, "Choose Active Render Layer");
1597 bt= uiDefBut(block, TEX, REDRAWNODE, "", 33,130,252,20, srl->name, 0.0, 31.0, 0, 0, "");
1598 uiButSetFunc(bt, rename_scene_layer_func, srl, NULL);
1599 bt=uiDefIconBut(block, BUT, B_NOP, ICON_X, 285, 130, 25, 20, 0, 0, 0, 0, 0, "Deletes current Render Layer");
1600 uiButSetFunc(bt, delete_scene_layer_func, srl, NULL);
1601 uiBlockEndAlign(block);
1603 /* RenderLayer visible-layers */
1604 uiDefBut(block, LABEL, 0, "Layer:", 10,95,100,20, NULL, 0, 0, 0, 0, "");
1605 draw_3d_layer_buttons(block, &srl->lay, 130, 95, 35, 30, B_NOP);
1607 uiBlockBeginAlign(block);
1608 uiDefButBitS(block, TOG, SCE_LAY_SOLID, B_NOP,"Solid", 10, 70, 75, 20, &srl->layflag, 0, 0, 0, 0, "Render Solid faces in this Layer");
1609 uiDefButBitS(block, TOG, SCE_LAY_ZTRA, B_NOP,"Ztra", 85, 70, 75, 20, &srl->layflag, 0, 0, 0, 0, "Render Z-Transparent faces in this Layer");
1610 uiDefButBitS(block, TOG, SCE_LAY_HALO, B_NOP,"Halo", 160, 70, 75, 20, &srl->layflag, 0, 0, 0, 0, "Render Halos in this Layer");
1611 uiDefButBitS(block, TOG, SCE_LAY_STRAND, B_NOP,"Strand", 235, 70, 75, 20, &srl->layflag, 0, 0, 0, 0, "Render Particle Strands in this Layer");
1612 uiBlockEndAlign(block);
1614 uiDefBut(block, LABEL, 0, "Passes:", 10,30,150,20, NULL, 0, 0, 0, 0, "");
1615 uiBlockBeginAlign(block);
1616 uiDefButBitS(block, TOG, SCE_PASS_COMBINED, B_NOP,"Combined", 130, 30, 155, 20, &srl->passflag, 0, 0, 0, 0, "Deliver full combined RGBA buffer");
1617 uiDefButBitS(block, TOG, SCE_PASS_Z, B_NOP,"Z", 285, 30, 25, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Z values pass");
1619 uiDefButBitS(block, TOG, SCE_PASS_DIFFUSE, B_NOP,"Diff",10, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
1620 uiDefButBitS(block, TOG, SCE_PASS_SPEC, B_NOP,"Spec", 55, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
1621 uiDefButBitS(block, TOG, SCE_PASS_SHADOW, B_NOP,"Shad", 100, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
1622 uiDefButBitS(block, TOG, SCE_PASS_AO, B_NOP,"AO", 145, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
1623 uiDefButBitS(block, TOG, SCE_PASS_MIRROR, B_NOP,"Mirr", 185, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
1624 uiDefButBitS(block, TOG, SCE_PASS_NORMAL, B_NOP,"Nor", 230, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
1625 uiDefButBitS(block, TOG, SCE_PASS_VECTOR, B_NOP,"Vec", 270, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
1628 void render_panels()
1631 render_panel_output();
1632 // render_panel_sfx();
1633 render_panel_layers();
1634 render_panel_render();
1635 render_panel_anim();
1636 render_panel_format();
1637 /* yafray: GI & Global panel, only available when yafray enabled for rendering */
1638 if (G.scene->r.renderer==R_YAFRAY) {
1639 if (G.scene->r.YF_gamma==0.0) G.scene->r.YF_gamma=1.0;
1640 if (G.scene->r.YF_raybias==0.0) G.scene->r.YF_raybias=0.001;
1641 if (G.scene->r.YF_raydepth==0) G.scene->r.YF_raydepth=5;
1642 if (G.scene->r.YF_AApixelsize==0.0) G.scene->r.YF_AApixelsize=1.5;
1643 if (G.scene->r.YF_AAthreshold==0.0) G.scene->r.YF_AAthreshold=0.05;
1644 if (G.scene->r.GIpower==0.0) G.scene->r.GIpower=1.0;
1645 if (G.scene->r.GIindirpower==0.0) G.scene->r.GIindirpower=1.0;
1646 render_panel_yafrayGlobal();
1647 render_panel_yafrayGI();
1652 /* --------------------------------------------- */
1658 block= uiNewBlock(&curarea->uiblocks, "anim_panel", UI_EMBOSS, UI_HELV, curarea->win);
1659 if(uiNewPanel(curarea, block, "Anim", "Anim", 0, 0, 318, 204)==0) return;
1661 uiBlockBeginAlign(block);
1662 uiDefButS(block, NUM,B_FRAMEMAP,"Map Old:", 10,160,150,20,&G.scene->r.framapto,1.0,900.0, 0, 0, "Specify old mapping value in frames");
1663 uiDefButS(block, NUM,B_FRAMEMAP,"Map New:", 160,160,150,20,&G.scene->r.images,1.0,900.0, 0, 0, "Specify how many frames the Map Old will last");
1665 uiBlockBeginAlign(block);
1666 uiDefButS(block, NUM,B_FRAMEMAP,"Frs/sec:", 10,130,150,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
1667 uiDefButBitS(block, TOG, AUDIO_SYNC, B_SOUND_CHANGED, "Sync",160,130,150,20, &G.scene->audio.flag, 0, 0, 0, 0, "Use sample clock for syncing animation to audio");
1669 uiBlockBeginAlign(block);
1670 uiDefButS(block, NUM,REDRAWSEQ,"Sta:", 10,100,150,20,&G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "Specify the start frame of the animation");
1671 uiDefButS(block, NUM,REDRAWSEQ,"End:", 160,100,150,20,&G.scene->r.efra,1.0,MAXFRAMEF, 0, 0, "Specify the end frame of the animation");
1677 /* --------------------------------------------- */
1683 /* paranoia check */
1684 sound = G.buts->lockpoin;
1685 if(sound && GS(sound->id.name)!=ID_SO) {
1687 G.buts->lockpoin= NULL;
1690 sound_panel_sound(sound);
1691 sound_panel_listener();
1692 sound_panel_sequencer();