4 * ***** BEGIN GPL 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.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
35 #include "MEM_guardedalloc.h"
36 #include "BLO_sys_types.h" // for intptr_t support
37 #include "DNA_node_types.h"
38 #include "DNA_screen_types.h"
39 #include "DNA_space_types.h"
40 #include "DNA_scene_types.h"
41 #include "DNA_sound_types.h"
42 #include "DNA_sequence_types.h"
43 #include "DNA_userdef_types.h"
44 #include "DNA_packedFile_types.h"
46 #include "BKE_global.h"
49 #include "BKE_library.h"
50 #include "BKE_scene.h"
51 #include "BKE_sound.h"
52 #include "BKE_packedFile.h"
53 #include "BKE_utildefines.h"
54 #include "BKE_idprop.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_imasel.h"
65 #include "BIF_keyval.h"
66 #include "BIF_mainqueue.h"
67 #include "BIF_mywindow.h"
68 #include "BIF_meshtools.h"
69 #include "BIF_resources.h"
70 #include "BIF_renderwin.h"
71 #include "BIF_screen.h"
72 #include "BIF_space.h"
73 #include "BIF_toolbox.h"
74 #include "BIF_editseq.h"
76 #include "BIF_butspace.h"
81 /* -----includes for this file specific----- */
83 #include "DNA_image_types.h"
85 #include "BKE_writeavi.h"
86 #include "BKE_writeffmpeg.h"
87 #include "BKE_image.h"
88 #include "BKE_plugin_types.h"
90 #include "BLI_threads.h"
92 #include "BIF_editsound.h"
93 #include "BIF_writeimage.h"
94 #include "BIF_writeavicodec.h"
96 #include "BSE_headerbuttons.h"
97 #include "BSE_sequence.h"
98 #include "BSE_seqeffects.h"
99 #include "BSE_seqscopes.h"
100 #include "BSE_seqaudio.h"
102 #include "RE_pipeline.h"
104 #include "butspace.h" // own module
106 #ifdef WITH_QUICKTIME
107 #include "quicktime_export.h"
112 #include <libavcodec/avcodec.h> /* for PIX_FMT_* and CODEC_ID_* */
113 #include <libavformat/avformat.h>
114 #include <libavcodec/opt.h>
116 static int ffmpeg_preset_sel = 0;
118 extern int is_container(int);
120 extern void makeffmpegstring(char* string);
124 /* here the calls for scene buttons
127 - anim settings, audio
131 void playback_anim(void);
133 /* ************************ SOUND *************************** */
134 static void load_new_sample(char *str) /* called from fileselect */
138 bSample *sample, *newsample;
140 sound = G.buts->lockpoin;
142 /* No Sound or Selected the same sample as we alredy have, just ignore */
143 if (sound==NULL || str==sound->name)
146 if (sizeof(sound->sample->name) < strlen(str)) {
147 error("Path too long: %s", str);
152 sample = sound->sample;
153 strcpy(name, sound->sample->name);
154 strcpy(sound->name, str);
155 sound_set_sample(sound, NULL);
156 sound_initialize_sample(sound);
158 if (sound->sample->type == SAMPLE_INVALID) {
159 error("Not a valid sample: %s", str);
161 newsample = sound->sample;
164 strcpy(sound->name, name);
165 sound_set_sample(sound, sample);
167 // remove invalid sample
169 sound_free_sample(newsample);
170 BLI_remlink(samples, newsample);
171 MEM_freeN(newsample);
175 BIF_undo_push("Load new audio file");
176 allqueue(REDRAWBUTSSCENE, 0);
180 void do_soundbuts(unsigned short event)
188 sound = G.buts->lockpoin;
192 allqueue(REDRAWBUTSSCENE, 0);
195 case B_SOUND_LOAD_SAMPLE:
196 if (sound) strcpy(name, sound->name);
197 else strcpy(name, U.sounddir);
199 activate_fileselect(FILE_SPECIAL, "SELECT WAV FILE", name, load_new_sample);
202 case B_SOUND_PLAY_SAMPLE:
204 if (sound->sample->type != SAMPLE_INVALID) {
205 sound_play_sound(sound);
206 allqueue(REDRAWBUTSSCENE, 0);
211 case B_SOUND_MENU_SAMPLE:
212 if (G.buts->menunr > 0) {
213 sample = BLI_findlink(samples, G.buts->menunr - 1);
214 if (sample && sound && sound->sample != sample) {
215 int wasrelative = (strncmp(sound->name, "//", 2)==0);
217 BLI_strncpy(sound->name, sample->name, sizeof(sound->name));
218 sound_set_sample(sound, sample);
221 BLI_makestringcode(G.sce, sound->name);
223 do_soundbuts(B_SOUND_REDRAW);
228 case B_SOUND_NAME_SAMPLE:
229 load_new_sample(sound->name);
232 case B_SOUND_UNPACK_SAMPLE:
233 if(sound && sound->sample) {
234 sample = sound->sample;
236 if (sample->packedfile) {
237 if (G.fileflags & G_AUTOPACK) {
238 if (okee("Disable AutoPack ?")) {
239 G.fileflags &= ~G_AUTOPACK;
243 if ((G.fileflags & G_AUTOPACK) == 0) {
244 unpackSample(sample, PF_ASK);
247 sound_set_packedfile(sample, newPackedFile(sample->name));
249 allqueue(REDRAWHEADERS, 0);
250 do_soundbuts(B_SOUND_REDRAW);
254 case B_SOUND_COPY_SOUND:
256 tempsound = sound_make_copy(sound);
259 G.buts->lockpoin = (bSound*)id;
260 BIF_undo_push("Copy sound");
261 do_soundbuts(B_SOUND_REDRAW);
267 sound = G.main->sound.first;
271 audio_makestream(sound);
272 sound = (bSound *) sound->id.next;
275 allqueue(REDRAWSEQ, 0);
278 case B_SOUND_RATECHANGED:
280 allqueue(REDRAWBUTSSCENE, 0);
281 allqueue(REDRAWSEQ, 0);
284 case B_SOUND_MIXDOWN:
290 printf("do_soundbuts: unhandled event %d\n", event);
296 static void sound_panel_listener(void)
299 int xco= 100, yco=100;
301 block= uiNewBlock(&curarea->uiblocks, "sound_panel_listener", UI_EMBOSS, UI_HELV, curarea->win);
302 if(uiNewPanel(curarea, block, "Listener", "Sound", 320, 0, 318, 204)==0) return;
304 uiDefBut(block, LABEL, 0, "Game listener settings:",xco,yco,195,20, 0, 0, 0, 0, 0, "");
307 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Volume: ",
308 xco,yco,195,24,&G.listener->gain, 0.0, 1.0, 1.0, 0, "Sets the maximum volume for the overall sound");
311 uiDefBut(block, LABEL, 0, "Game Doppler effect settings:",xco,yco,195,20, 0, 0, 0, 0, 0, "");
314 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Doppler: ",
315 xco,yco,195,24,&G.listener->dopplerfactor, 0.0, 10.0, 1.0, 0, "Use this for scaling the doppler effect");
318 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Velocity: ",
319 xco,yco,195,24,&G.listener->dopplervelocity,0.0,10000.0, 1.0,0, "Sets the propagation speed of sound");
324 static void sound_panel_sequencer(void)
328 char mixrateinfo[256];
330 block= uiNewBlock(&curarea->uiblocks, "sound_panel_sequencer", UI_EMBOSS, UI_HELV, curarea->win);
331 if(uiNewPanel(curarea, block, "Sequencer", "Sound", 640, 0, 318, 204)==0) return;
333 /* audio sequence engine settings ------------------------------------------------------------------ */
338 uiDefBut(block, LABEL, 0, "Audio sequencer settings", xco,yco,295,20, 0, 0, 0, 0, 0, "");
341 sprintf(mixrateinfo, "Mixing/Sync (latency: %d ms)", (int)( (((float)U.mixbufsize)/(float)G.scene->audio.mixrate)*1000.0 ) );
342 uiDefBut(block, LABEL, 0, mixrateinfo, xco,yco,295,20, 0, 0, 0, 0, 0, "");
345 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");
346 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");
347 uiDefBut(block, BUT, B_SOUND_RECALC, "Recalc", xco+160,yco,75,20, 0, 0, 0, 0, 0, "Recalculate samples");
350 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");
351 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");
354 uiDefBut(block, LABEL, 0, "Main mix", xco,yco,295,20, 0, 0, 0, 0, 0, "");
357 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Main (dB): ",
358 xco,yco,235,24,&G.scene->audio.main, -24.0, 6.0, 0, 0, "Set the audio master gain/attenuation in dB");
361 uiDefButBitS(block, TOG, AUDIO_MUTE, 0, "Mute", xco,yco,235,24, &G.scene->audio.flag, 0, 0, 0, 0, "Mute audio from sequencer");
364 uiDefBut(block, BUT, B_SOUND_MIXDOWN, "MIXDOWN", xco,yco,235,24, 0, 0, 0, 0, 0, "Create WAV file from sequenced audio (output goes to render output dir)");
368 static char *make_sample_menu(void)
370 int len= BLI_countlist(samples); /* BKE_sound.h */
377 str= MEM_callocN(32*len, "menu");
379 for(nr=1, sample= samples->first; sample; sample= sample->id.next, nr++) {
380 a+= sprintf(str+a, "|%s %%x%d", sample->id.name+2, nr);
387 static void sound_panel_sound(bSound *sound)
389 static int packdummy=0;
395 block= uiNewBlock(&curarea->uiblocks, "sound_panel_sound", UI_EMBOSS, UI_HELV, curarea->win);
396 if(uiNewPanel(curarea, block, "Sound", "Sound", 0, 0, 318, 204)==0) return;
398 uiDefBut(block, LABEL, 0, "Blender Sound block",10,180,195,20, 0, 0, 0, 0, 0, "");
400 // warning: abuse of texnr here! (ton didnt code!)
401 buttons_active_id(&id, &idfrom);
402 std_libbuttons(block, 10, 160, 0, NULL, B_SOUNDBROWSE2, ID_SO, 0, id, idfrom, &(G.buts->texnr), 1, 0, 0, 0, 0);
406 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");
408 uiSetButLock(sound->id.lib!=0, ERROR_LIBDATA_MESSAGE);
409 sound_initialize_sample(sound);
410 sample = sound->sample;
413 if (sound->sample && sound->sample->len && sound->sample->channels && sound->sample->bits) {
415 if (sound->sample->channels == 1) tmp= "Mono";
416 else if (sound->sample->channels == 2) tmp= "Stereo";
419 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));
420 uiDefBut(block, LABEL, 0, ch, 35,140,225,20, 0, 0, 0, 0, 0, "");
423 uiDefBut(block, LABEL, 0, "Sample: No sample info available.",35,140,225,20, 0, 0, 0, 0, 0, "");
426 /* sample browse buttons */
427 uiBlockBeginAlign(block);
428 strp= make_sample_menu();
430 uiDefButS(block, MENU, B_SOUND_MENU_SAMPLE, strp, 10,120,23,20, &(G.buts->menunr), 0, 0, 0, 0, "Select another loaded sample");
433 uiDefBut(block, TEX, B_SOUND_NAME_SAMPLE, "", 35,120,250,20, sound->name, 0.0, 79.0, 0, 0, "The sample file used by this Sound");
435 if (sound->sample->packedfile) packdummy = 1;
438 uiDefIconButBitI(block, TOG, 1, B_SOUND_UNPACK_SAMPLE, ICON_PACKAGE,
439 285, 120,25,20, &packdummy, 0, 0, 0, 0,"Pack/Unpack this sample");
441 uiBlockBeginAlign(block);
442 uiDefBut(block, BUT, B_SOUND_LOAD_SAMPLE, "Load sample", 10, 95,150,24, 0, 0, 0, 0, 0, "Load a different sample file");
444 uiDefBut(block, BUT, B_SOUND_PLAY_SAMPLE, "Play", 160, 95, 150, 24, 0, 0.0, 0, 0, 0, "Playback sample using settings below");
446 uiBlockBeginAlign(block);
447 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Volume: ",
448 10,70,150,20, &sound->volume, 0.0, 1.0, 0, 0, "Game engine only: Set the volume of this sound");
450 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Pitch: ",
451 160,70,150,20, &sound->pitch, -12.0, 12.0, 0, 0, "Game engine only: Set the pitch of this sound");
454 uiBlockBeginAlign(block);
455 uiDefButBitI(block, TOG, SOUND_FLAGS_LOOP, B_SOUND_REDRAW, "Loop",
456 10, 50, 95, 20, &sound->flags, 0.0, 0.0, 0, 0, "Game engine only: Toggle between looping on/off");
458 if (sound->flags & SOUND_FLAGS_LOOP) {
459 uiDefButBitI(block, TOG, SOUND_FLAGS_BIDIRECTIONAL_LOOP, B_SOUND_REDRAW, "Ping Pong",
460 105, 50, 95, 20, &sound->flags, 0.0, 0.0, 0, 0, "Game engine only: Toggle between A->B and A->B->A looping");
465 /* 3D settings ------------------------------------------------------------------ */
466 uiBlockBeginAlign(block);
468 if (sound->sample->channels == 1) {
469 uiDefButBitI(block, TOG, SOUND_FLAGS_3D, B_SOUND_REDRAW, "3D Sound",
470 10, 10, 90, 20, &sound->flags, 0, 0, 0, 0, "Game engine only: Turns 3D sound on");
472 if (sound->flags & SOUND_FLAGS_3D) {
473 uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Scale: ",
474 100,10,210,20, &sound->attenuation, 0.0, 5.0, 1.0, 0, "Game engine only: Sets the surround scaling factor for this sound");
481 /* ************************* Sequencer *********************** */
483 #define SEQ_PANEL_EDITING 1
484 #define SEQ_PANEL_INPUT 2
485 #define SEQ_PANEL_FILTER 4
486 #define SEQ_PANEL_EFFECT 8
487 #define SEQ_PANEL_PROXY 16
489 static char* seq_panel_blend_modes()
491 static char string[2048];
493 Sequence *last_seq = get_last_seq();
495 sprintf(string, "Blend mode: %%t|%s %%x%d",
496 "Replace", SEQ_BLEND_REPLACE);
499 Blending can only work without effect strips.
500 Otherwise, one would have
501 to decide, what the effect strips IPO should do:
502 - drive the effect _or_
503 - drive the blend mode ?
505 Also: effectdata is used by these implicit effects,
506 so that would collide also.
509 if ( seq_can_blend(last_seq) ) {
512 for (i = SEQ_EFFECT; i <= SEQ_EFFECT_MAX; i++) {
513 if (get_sequence_effect_num_inputs(i) == 2) {
514 sprintf(string + strlen(string),
516 give_seqname_by_type(i), i);
523 static char* seq_panel_scenes()
525 static char rstr[8192];
528 IDnames_to_pupstring(&str, NULL, NULL,
529 &G.main->scene, (ID *)G.scene, NULL);
531 strncpy(rstr, str, 8192);
537 static void seq_update_scenenr(Sequence * seq)
541 if (seq->type != SEQ_SCENE) {
547 sce = G.main->scene.first;
550 if (sce == seq->scene) {
560 static void seq_panel_editing()
562 Sequence *last_seq = get_last_seq();
564 static char strdata[1024];
565 char * str = strdata;
569 block = uiNewBlock(&curarea->uiblocks, "seq_panel_editing",
570 UI_EMBOSS, UI_HELV, curarea->win);
572 if(uiNewPanel(curarea, block, "Edit", "Sequencer",
573 10, 230, 318, 204) == 0) return;
575 uiDefBut(block, LABEL,
576 0, give_seqname(last_seq),
582 70,140,180,19, last_seq->name+2,
583 0.0, 21.0, 100, 0, "");
585 uiDefButI(block, MENU, B_SEQ_BUT_RELOAD, seq_panel_blend_modes(),
586 10, 120, 120, 19, &last_seq->blend_mode,
587 0,0,0,0, "Strip Blend Mode");
589 uiDefButF(block, NUM, B_SEQ_BUT_RELOAD, "Blend:",
590 130, 120, 120, 19, &last_seq->blend_opacity,
591 0.0, 100.0, 100.0, 0,
594 uiDefButBitI(block, TOG, SEQ_MUTE,
595 B_SEQ_BUT_RELOAD_ALL, "Mute",
596 10,100,60,19, &last_seq->flag,
598 "Mute the current strip.");
600 uiDefButBitI(block, TOG, SEQ_LOCK,
602 70,100,60,19, &last_seq->flag,
604 "Lock strip, so that it can't be transformed.");
606 uiDefButBitI(block, TOG, SEQ_IPO_FRAME_LOCKED,
607 B_SEQ_BUT_RELOAD_ALL, "IPO Frame locked",
608 130,100,120,19, &last_seq->flag,
610 "Lock the IPO coordinates to the "
611 "global frame counter.");
613 if (!(last_seq->flag & SEQ_LOCK)) {
614 uiDefButI(block, NUM,
615 B_SEQ_BUT_TRANSFORM, "Start",
616 10, 80, 120, 20, &last_seq->start,
617 -MAXFRAMEF, MAXFRAMEF, 0.0, 0.0, "Start of strip");
618 uiDefButI(block, NUM,
619 B_SEQ_BUT_TRANSFORM, "Chan",
620 130, 80, 120, 20, &last_seq->machine,
621 0.0, MAXSEQ, 0.0, 0.0, "Channel used (Y position)");
623 if (check_single_seq(last_seq) || last_seq->len == 0) {
624 uiDefButI(block, NUM,
625 B_SEQ_BUT_TRANSFORM, "End-Still",
626 130, 60, 120, 19, &last_seq->endstill,
627 0.0, MAXFRAMEF, 0.0, 0.0, "End still");
629 uiDefButI(block, NUM,
630 B_SEQ_BUT_TRANSFORM, "Start-Still",
631 10, 60, 120, 20, &last_seq->startstill,
632 0.0, MAXFRAMEF, 0.0, 0.0, "Start still");
633 uiDefButI(block, NUM,
634 B_SEQ_BUT_TRANSFORM, "End-Still",
635 130, 60, 120, 19, &last_seq->endstill,
636 0.0, MAXFRAMEF, 0.0, 0.0, "End still");
637 uiDefButI(block, NUM,
638 B_SEQ_BUT_TRANSFORM, "Start-Ofs",
639 10, 40, 120, 20, &last_seq->startofs,
640 0.0, last_seq->len - last_seq->endofs,
641 0.0, 0.0, "Start offset");
642 uiDefButI(block, NUM,
643 B_SEQ_BUT_TRANSFORM, "End-Ofs",
644 130, 40, 120, 19, &last_seq->endofs,
645 0.0, last_seq->len - last_seq->startofs,
646 0.0, 0.0, "End offset");
651 if(last_seq->type & SEQ_EFFECT)
652 sprintf(str, "Len: %d\nFrom %d - %d\n", last_seq->len, last_seq->startdisp, last_seq->enddisp-1);
654 sprintf(str, "Len: %d(%d)\n", last_seq->enddisp-last_seq->startdisp, last_seq->len);
658 if(last_seq->type==SEQ_IMAGE) {
659 if (last_seq->len > 1) {
661 StripElem * se= give_stripelem(last_seq, CFRA);
666 if(last_seq->strip) {
667 se= last_seq->strip->stripdata;
668 last= se+last_seq->len-1;
669 if(last_seq->startofs) se+= last_seq->startofs;
670 if(last_seq->endofs) last-= last_seq->endofs;
672 sprintf(str, "First: %s at %d\nLast: %s at %d\n", se->name, last_seq->startdisp, last->name, last_seq->enddisp-1);
674 } else { /* single image */
675 if (last_seq->strip) {
676 sprintf(str, "Len: %d\n", last_seq->enddisp-last_seq->startdisp);
683 if(last_seq->strip) {
684 sprintf(str, "OrigSize: %d x %d\n", last_seq->strip->orx, last_seq->strip->ory);
687 else if(last_seq->type==SEQ_MOVIE) {
688 int sta= last_seq->startofs;
689 int end= last_seq->len-1-last_seq->endofs;
691 sprintf(str, "First: %d at %d\nLast: %d at %d\nCur: %d\n",
692 sta, last_seq->startdisp, end, last_seq->enddisp-1,
693 (G.scene->r.cfra)-last_seq->startdisp);
697 if(last_seq->strip) {
698 sprintf(str, "OrigSize: %d x %d\n",
699 last_seq->strip->orx, last_seq->strip->ory);
702 else if(last_seq->type==SEQ_SCENE) {
703 TStripElem * se= give_tstripelem(last_seq, (G.scene->r.cfra));
704 if(se && last_seq->scene) {
705 sprintf(str, "First: %d\nLast: %d\nCur: %d\n", last_seq->sfra+se->nr, last_seq->sfra, last_seq->sfra+last_seq->len-1);
709 if(last_seq->strip) {
710 sprintf(str, "OrigSize: %d x %d\n",
711 last_seq->strip->orx, last_seq->strip->ory);
714 else if(last_seq->type==SEQ_RAM_SOUND
715 || last_seq->type == SEQ_HD_SOUND) {
717 int sta= last_seq->startofs;
718 int end= last_seq->len-1-last_seq->endofs;
720 sprintf(str, "First: %d at %d\nLast: %d at %d\nCur: %d\n",
721 sta, last_seq->startdisp, end, last_seq->enddisp-1,
722 (G.scene->r.cfra)-last_seq->startdisp);
724 else if(last_seq->type == SEQ_SPEED) {
725 SpeedControlVars * vars =
726 (SpeedControlVars*) last_seq->effectdata;
729 sprintf(str, "Last mapped frame: %d at %d\n",
730 vars->lastValidFrame,
732 + last_seq->startdisp);
739 while ((p = strchr(str, '\n'))) {
741 uiDefBut(block, LABEL, 0, str, 10,yco,240,17, 0,
748 static void seq_panel_input()
750 Sequence *last_seq = get_last_seq();
753 block = uiNewBlock(&curarea->uiblocks, "seq_panel_input",
754 UI_EMBOSS, UI_HELV, curarea->win);
756 if(uiNewPanel(curarea, block, "Input", "Sequencer",
757 10, 230, 318, 204) == 0) return;
759 if (SEQ_HAS_PATH(last_seq)) {
761 B_SEQ_BUT_RELOAD_FILE, "Dir: ",
762 10,140,240,19, last_seq->strip->dir,
763 0.0, 160.0, 100, 0, "");
766 if (last_seq->type == SEQ_IMAGE) {
770 if(last_seq->startdisp >cfra) {
771 cfra = last_seq->startdisp;
772 } else if (last_seq->enddisp <= cfra) {
773 cfra = last_seq->enddisp - 1;
776 se = give_stripelem(last_seq, cfra);
780 B_SEQ_BUT_RELOAD_FILE, "File: ",
781 10, 120, 190,19, se->name,
782 0.0, 80.0, 100, 0, "");
785 } else if (last_seq->type == SEQ_MOVIE ||
786 last_seq->type == SEQ_HD_SOUND ||
787 last_seq->type == SEQ_RAM_SOUND) {
789 B_SEQ_BUT_RELOAD_FILE, "File: ",
790 10,120,190,19, last_seq->strip->stripdata->name,
791 0.0, 80.0, 100, 0, "");
792 } else if (last_seq->type == SEQ_SCENE) {
793 seq_update_scenenr(last_seq);
794 uiDefButI(block, MENU, B_SEQ_BUT_RELOAD_FILE,
796 10, 120, 190, 19, &last_seq->scenenr,
797 0,0,0,0, "Linked Scene");
800 uiDefBut(block, BUT, B_SEQ_BUT_RELOAD_FILE,
802 200,120,50,19, 0, 0, 0, 0, 0,
803 "Reload files/scenes from disk and update strip length.");
805 if (last_seq->type == SEQ_MOVIE
806 || last_seq->type == SEQ_IMAGE
807 || last_seq->type == SEQ_SCENE
808 || last_seq->type == SEQ_META) {
809 uiDefButBitI(block, TOG, SEQ_USE_CROP,
810 B_SEQ_BUT_RELOAD, "Use Crop",
811 10,100,240,19, &last_seq->flag,
813 "Crop image before processing.");
815 if (last_seq->flag & SEQ_USE_CROP) {
816 if (!last_seq->strip->crop) {
817 last_seq->strip->crop =
818 MEM_callocN(sizeof(struct StripCrop),
821 uiDefButI(block, NUM,
822 B_SEQ_BUT_RELOAD, "Top",
824 &last_seq->strip->crop->top,
825 0.0, 4096, 0.0, 0.0, "Top of source image");
826 uiDefButI(block, NUM,
827 B_SEQ_BUT_RELOAD, "Bottom",
829 &last_seq->strip->crop->bottom,
831 "Bottom of source image");
833 uiDefButI(block, NUM,
834 B_SEQ_BUT_RELOAD, "Left",
836 &last_seq->strip->crop->left,
837 0.0, 4096, 0.0, 0.0, "Left");
838 uiDefButI(block, NUM,
839 B_SEQ_BUT_RELOAD, "Right",
841 &last_seq->strip->crop->right,
842 0.0, 4096, 0.0, 0.0, "Right");
845 uiDefButBitI(block, TOG, SEQ_USE_TRANSFORM,
846 B_SEQ_BUT_RELOAD, "Use Translate",
847 10,40,240,19, &last_seq->flag,
849 "Translate image before processing.");
851 if (last_seq->flag & SEQ_USE_TRANSFORM) {
852 if (!last_seq->strip->transform) {
853 last_seq->strip->transform =
855 sizeof(struct StripTransform),
858 uiDefButI(block, NUM,
859 B_SEQ_BUT_RELOAD, "X-Ofs",
861 &last_seq->strip->transform->xofs,
862 -4096.0, 4096, 0.0, 0.0, "X Offset");
863 uiDefButI(block, NUM,
864 B_SEQ_BUT_RELOAD, "Y-Ofs",
866 &last_seq->strip->transform->yofs,
867 -4096.0, 4096, 0.0, 0.0, "Y Offset");
871 uiDefButI(block, NUM,
872 B_SEQ_BUT_RELOAD_FILE, "A-Start",
873 10, 0, 120, 20, &last_seq->anim_startofs,
874 0.0, last_seq->len + last_seq->anim_startofs, 0.0, 0.0,
875 "Animation start offset (trim start)");
876 uiDefButI(block, NUM,
877 B_SEQ_BUT_RELOAD_FILE, "A-End",
878 130, 0, 120, 20, &last_seq->anim_endofs,
879 0.0, last_seq->len + last_seq->anim_endofs, 0.0, 0.0,
880 "Animation end offset (trim end)");
883 if (last_seq->type == SEQ_MOVIE) {
884 uiDefButI(block, NUM, B_SEQ_BUT_RELOAD, "MPEG-Preseek:",
885 10, -20, 240,19, &last_seq->anim_preseek,
887 "On MPEG-seeking preseek this many frames");
892 static void seq_panel_filter_video()
894 Sequence *last_seq = get_last_seq();
896 block = uiNewBlock(&curarea->uiblocks, "seq_panel_filter",
897 UI_EMBOSS, UI_HELV, curarea->win);
899 if(uiNewPanel(curarea, block, "Filter", "Sequencer",
900 10, 230, 318, 204) == 0) return;
903 uiBlockBeginAlign(block);
906 uiDefButBitI(block, TOG, SEQ_MAKE_PREMUL,
907 B_SEQ_BUT_RELOAD, "Premul",
908 10,110,80,19, &last_seq->flag,
910 "Converts RGB values to become premultiplied with Alpha");
912 uiDefButBitI(block, TOG, SEQ_MAKE_FLOAT,
913 B_SEQ_BUT_RELOAD, "Float",
914 90,110,80,19, &last_seq->flag,
916 "Convert input to float data");
918 uiDefButBitI(block, TOG, SEQ_FILTERY,
919 B_SEQ_BUT_RELOAD_FILE, "De-Inter",
920 170,110,80,19, &last_seq->flag,
922 "For video movies to remove fields");
924 uiDefButBitI(block, TOG, SEQ_FLIPX,
925 B_SEQ_BUT_RELOAD, "FlipX",
926 10,90,80,19, &last_seq->flag,
928 "Flip on the X axis");
929 uiDefButBitI(block, TOG, SEQ_FLIPY,
930 B_SEQ_BUT_RELOAD, "FlipY",
931 90,90,80,19, &last_seq->flag,
933 "Flip on the Y axis");
935 uiDefButBitI(block, TOG, SEQ_REVERSE_FRAMES,
936 B_SEQ_BUT_RELOAD, "Flip Time",
937 170,90,80,19, &last_seq->flag,
939 "Reverse frame order");
941 uiDefButF(block, NUM, B_SEQ_BUT_RELOAD, "Mul:",
942 10,70,120,19, &last_seq->mul,
946 uiDefButF(block, NUM, B_SEQ_BUT_RELOAD, "Strobe:",
947 130,70,120,19, &last_seq->strobe,
949 "Only display every nth frame");
951 uiDefButBitI(block, TOG, SEQ_USE_COLOR_BALANCE,
952 B_SEQ_BUT_RELOAD, "Use Color Balance",
953 10,50,240,19, &last_seq->flag,
955 "Activate Color Balance "
956 "(3-Way color correction) on input");
959 if (last_seq->flag & SEQ_USE_COLOR_BALANCE) {
960 if (!last_seq->strip->color_balance) {
962 StripColorBalance * cb
963 = last_seq->strip->color_balance
965 sizeof(struct StripColorBalance),
966 "StripColorBalance");
967 for (c = 0; c < 3; c++) {
974 uiDefBut(block, LABEL, 0, "Lift",
975 10,30,80,19, 0, 0, 0, 0, 0, "");
976 uiDefBut(block, LABEL, 0, "Gamma",
977 90,30,80,19, 0, 0, 0, 0, 0, "");
978 uiDefBut(block, LABEL, 0, "Gain",
979 170,30,80,19, 0, 0, 0, 0, 0, "");
981 uiDefButF(block, COL, B_SEQ_BUT_RELOAD, "Lift",
982 10,10,80,19, last_seq->strip->color_balance->lift,
983 0, 0, 0, 0, "Lift (shadows)");
985 uiDefButF(block, COL, B_SEQ_BUT_RELOAD, "Gamma",
986 90,10,80,19, last_seq->strip->color_balance->gamma,
987 0, 0, 0, 0, "Gamma (midtones)");
989 uiDefButF(block, COL, B_SEQ_BUT_RELOAD, "Gain",
990 170,10,80,19, last_seq->strip->color_balance->gain,
991 0, 0, 0, 0, "Gain (highlights)");
993 uiDefButBitI(block, TOG, SEQ_COLOR_BALANCE_INVERSE_LIFT,
994 B_SEQ_BUT_RELOAD, "Inv Lift",
996 &last_seq->strip->color_balance->flag,
999 uiDefButBitI(block, TOG, SEQ_COLOR_BALANCE_INVERSE_GAMMA,
1000 B_SEQ_BUT_RELOAD, "Inv Gamma",
1002 &last_seq->strip->color_balance->flag,
1005 uiDefButBitI(block, TOG, SEQ_COLOR_BALANCE_INVERSE_GAIN,
1006 B_SEQ_BUT_RELOAD, "Inv Gain",
1008 &last_seq->strip->color_balance->flag,
1014 uiBlockEndAlign(block);
1019 static void seq_panel_filter_audio()
1021 Sequence *last_seq = get_last_seq();
1023 block = uiNewBlock(&curarea->uiblocks, "seq_panel_filter",
1024 UI_EMBOSS, UI_HELV, curarea->win);
1026 if(uiNewPanel(curarea, block, "Filter", "Sequencer",
1027 10, 230, 318, 204) == 0) return;
1029 uiBlockBeginAlign(block);
1030 uiDefButF(block, NUM, B_SEQ_BUT_RELOAD, "Gain (dB):", 10,50,150,19, &last_seq->level, -96.0, 6.0, 100, 0, "");
1031 uiDefButF(block, NUM, B_SEQ_BUT_RELOAD, "Pan:", 10,30,150,19, &last_seq->pan, -1.0, 1.0, 100, 0, "");
1032 uiBlockEndAlign(block);
1035 static void seq_panel_effect()
1037 Sequence *last_seq = get_last_seq();
1039 block = uiNewBlock(&curarea->uiblocks, "seq_panel_effect",
1040 UI_EMBOSS, UI_HELV, curarea->win);
1042 if(uiNewPanel(curarea, block, "Effect", "Sequencer",
1043 10, 230, 318, 204) == 0) return;
1045 if(last_seq->type == SEQ_PLUGIN) {
1050 get_sequence_effect(last_seq);/* make sure, plugin is loaded */
1052 pis= last_seq->plugin;
1053 if(pis->vars==0) return;
1055 varstr= pis->varstr;
1057 for(a=0; a<pis->vars; a++, varstr++) {
1059 yco= 125 - 20*(a % 6)+1;
1060 uiDefBut(block, varstr->type, B_SEQ_BUT_PLUGIN, varstr->name, xco,yco,150,19, &(pis->data[a]), varstr->min, varstr->max, 100, 0, varstr->tip);
1067 uiBlockBeginAlign(block);
1069 if(last_seq->type==SEQ_WIPE){
1070 WipeVars *wipe = (WipeVars *)last_seq->effectdata;
1071 char formatstring[256];
1073 strncpy(formatstring, "Transition Type %t|Single Wipe%x0|Double Wipe %x1|Iris Wipe %x4|Clock Wipe %x5", 255);
1074 uiDefButS(block, MENU,B_SEQ_BUT_EFFECT, formatstring, 10,65,220,22, &wipe->wipetype, 0, 0, 0, 0, "What type of wipe should be performed");
1075 uiDefButF(block, NUM,B_SEQ_BUT_EFFECT,"Blur:", 10,40,220,22, &wipe->edgeWidth,0.0,1.0, 1, 2, "The percent width of the blur edge");
1076 switch(wipe->wipetype){ /*Skip Types that do not require angle*/
1082 uiDefButF(block, NUM,B_SEQ_BUT_EFFECT,"Angle:", 10,15,220,22, &wipe->angle,-90.0,90.0, 1, 2, "The Angle of the Edge");
1084 uiDefButS(block, TOG,B_SEQ_BUT_EFFECT,"Wipe In", 10,-10,220,22, &wipe->forward,0,0, 0, 0, "Controls Primary Direction of Wipe");
1085 } else if(last_seq->type==SEQ_GLOW){
1086 GlowVars *glow = (GlowVars *)last_seq->effectdata;
1088 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "Threshold:", 10,70,150,19, &glow->fMini, 0.0, 1.0, 0, 0, "Trigger Intensity");
1089 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "Clamp:", 10,50,150,19, &glow->fClamp, 0.0, 1.0, 0, 0, "Brightness limit of intensity");
1090 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "Boost factor:", 10,30,150,19, &glow->fBoost, 0.0, 10.0, 0, 0, "Brightness multiplier");
1091 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "Blur distance:", 10,10,150,19, &glow->dDist, 0.5, 20.0, 0, 0, "Radius of glow effect");
1092 uiDefButI(block, NUM, B_NOP, "Quality:", 10,-5,150,19, &glow->dQuality, 1.0, 5.0, 0, 0, "Accuracy of the blur effect");
1093 uiDefButI(block, TOG, B_NOP, "Only boost", 10,-25,150,19, &glow->bNoComp, 0.0, 0.0, 0, 0, "Show the glow buffer only");
1095 else if(last_seq->type==SEQ_TRANSFORM){
1096 TransformVars *transform = (TransformVars *)last_seq->effectdata;
1098 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "xScale Start:", 10,70,150,19, &transform->ScalexIni, 0.0, 10.0, 0, 0, "X Scale Start");
1099 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "xScale End:", 160,70,150,19, &transform->ScalexFin, 0.0, 10.0, 0, 0, "X Scale End");
1100 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "yScale Start:", 10,50,150,19, &transform->ScaleyIni, 0.0, 10.0, 0, 0, "Y Scale Start");
1101 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "yScale End:", 160,50,150,19, &transform->ScaleyFin, 0.0, 10.0, 0, 0, "Y Scale End");
1103 uiDefButI(block, ROW, B_SEQ_BUT_EFFECT, "Percent", 10, 30, 150, 19, &transform->percent, 0.0, 1.0, 0.0, 0.0, "Percent Translate");
1104 uiDefButI(block, ROW, B_SEQ_BUT_EFFECT, "Pixels", 160, 30, 150, 19, &transform->percent, 0.0, 0.0, 0.0, 0.0, "Pixels Translate");
1105 if(transform->percent==1){
1106 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "x Start:", 10,10,150,19, &transform->xIni, -500.0, 500.0, 0, 0, "X Position Start");
1107 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "x End:", 160,10,150,19, &transform->xFin, -500.0, 500.0, 0, 0, "X Position End");
1108 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "y Start:", 10,-10,150,19, &transform->yIni, -500.0, 500.0, 0, 0, "Y Position Start");
1109 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "y End:", 160,-10,150,19, &transform->yFin, -500.0, 500.0, 0, 0, "Y Position End");
1111 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "x Start:", 10,10,150,19, &transform->xIni, -10000.0, 10000.0, 0, 0, "X Position Start");
1112 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "x End:", 160,10,150,19, &transform->xFin, -10000.0, 10000.0, 0, 0, "X Position End");
1113 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "y Start:", 10,-10,150,19, &transform->yIni, -10000.0, 10000.0, 0, 0, "Y Position Start");
1114 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "y End:", 160,-10,150,19, &transform->yFin, -10000.0, 10000.0, 0, 0, "Y Position End");
1120 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "rot Start:",10,-30,150,19, &transform->rotIni, 0.0, 360.0, 0, 0, "Rotation Start");
1121 uiDefButF(block, NUM, B_SEQ_BUT_EFFECT, "rot End:",160,-30,150,19, &transform->rotFin, 0.0, 360.0, 0, 0, "Rotation End");
1123 uiDefButI(block, ROW, B_SEQ_BUT_EFFECT, "No Interpolat", 10, -50, 100, 19, &transform->interpolation, 0.0, 0.0, 0.0, 0.0, "No interpolation");
1124 uiDefButI(block, ROW, B_SEQ_BUT_EFFECT, "Bilinear", 101, -50, 100, 19, &transform->interpolation, 0.0, 1.0, 0.0, 0.0, "Bilinear interpolation");
1125 uiDefButI(block, ROW, B_SEQ_BUT_EFFECT, "Bicubic", 202, -50, 100, 19, &transform->interpolation, 0.0, 2.0, 0.0, 0.0, "Bicubic interpolation");
1126 } else if(last_seq->type==SEQ_COLOR) {
1127 SolidColorVars *colvars = (SolidColorVars *)last_seq->effectdata;
1128 uiDefButF(block, COL, B_SEQ_BUT_RELOAD, "",10,90,150,19, colvars->col, 0, 0, 0, 0, "");
1129 } else if(last_seq->type==SEQ_SPEED){
1130 SpeedControlVars *sp =
1131 (SpeedControlVars *)last_seq->effectdata;
1133 uiDefButF(block, NUM, B_SEQ_BUT_RELOAD, "Global Speed:", 10,70,150,19, &sp->globalSpeed, 0.0, 100.0, 0, 0, "Global Speed");
1135 uiDefButBitI(block, TOG, SEQ_SPEED_INTEGRATE,
1138 10,50,150,19, &sp->flags,
1140 "Interpret the IPO value as a "
1141 "velocity instead of a frame number");
1143 uiDefButBitI(block, TOG, SEQ_SPEED_BLEND,
1145 "Enable frame blending",
1146 10,30,150,19, &sp->flags,
1148 "Blend two frames into the "
1149 "target for a smoother result");
1151 uiDefButBitI(block, TOG, SEQ_SPEED_COMPRESS_IPO_Y,
1153 "IPO value runs from [0..1]",
1154 10,10,150,19, &sp->flags,
1156 "Scale IPO value to get the "
1157 "target frame number.");
1160 uiBlockEndAlign(block);
1163 static void seq_panel_proxy()
1165 Sequence *last_seq = get_last_seq();
1167 block = uiNewBlock(&curarea->uiblocks, "seq_panel_proxy",
1168 UI_EMBOSS, UI_HELV, curarea->win);
1170 if(uiNewPanel(curarea, block, "Proxy", "Sequencer",
1171 10, 230, 318, 204) == 0) return;
1173 uiBlockBeginAlign(block);
1175 uiDefButBitI(block, TOG, SEQ_USE_PROXY,
1176 B_SEQ_BUT_RELOAD, "Use Proxy",
1177 10,140,120,19, &last_seq->flag,
1179 "Use a preview proxy for this strip");
1181 if (last_seq->flag & SEQ_USE_PROXY) {
1182 if (!last_seq->strip->proxy) {
1183 last_seq->strip->proxy =
1184 MEM_callocN(sizeof(struct StripProxy),
1188 uiDefButBitI(block, TOG, SEQ_USE_PROXY_CUSTOM_DIR,
1189 B_SEQ_BUT_RELOAD, "Custom Dir",
1190 130,140,120,19, &last_seq->flag,
1192 "Use a custom directory to store data");
1194 if (last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
1195 uiDefIconBut(block, BUT, B_SEQ_SEL_PROXY_DIR,
1196 ICON_FILESEL, 10, 120, 20, 20, 0, 0, 0, 0, 0,
1197 "Select the directory/name for "
1198 "the proxy storage");
1200 uiDefBut(block, TEX,
1201 B_SEQ_BUT_RELOAD, "Dir: ",
1202 30,120,220,20, last_seq->strip->proxy->dir,
1203 0.0, 160.0, 100, 0, "");
1207 if (last_seq->flag & SEQ_USE_PROXY) {
1208 if (G.scene->r.size == 100) {
1209 uiDefBut(block, LABEL, 0,
1210 "Full render size selected, ",
1211 10,100,240,19, 0, 0, 0, 0, 0, "");
1212 uiDefBut(block, LABEL, 0,
1213 "so no proxy enabled!",
1214 10,80,240,19, 0, 0, 0, 0, 0, "");
1215 } else if (last_seq->type != SEQ_MOVIE
1216 && last_seq->type != SEQ_IMAGE
1217 && !(last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) {
1218 uiDefBut(block, LABEL, 0,
1219 "Cannot proxy this strip without ",
1220 10,100,240,19, 0, 0, 0, 0, 0, "");
1221 uiDefBut(block, LABEL, 0,
1222 "custom directory selection!",
1223 10,80,240,19, 0, 0, 0, 0, 0, "");
1226 uiDefBut(block, BUT, B_SEQ_BUT_REBUILD_PROXY,
1228 10,100,240,19, 0, 0, 0, 0, 0,
1229 "Rebuild proxy for the "
1230 "currently selected strip.");
1234 uiBlockEndAlign(block);
1238 void sequencer_panels()
1240 Sequence *last_seq = get_last_seq();
1244 if(last_seq == NULL) {
1248 type = last_seq->type;
1250 panels = SEQ_PANEL_EDITING;
1252 if (type == SEQ_MOVIE || type == SEQ_IMAGE || type == SEQ_SCENE
1253 || type == SEQ_META) {
1254 panels |= SEQ_PANEL_INPUT | SEQ_PANEL_FILTER | SEQ_PANEL_PROXY;
1257 if (type == SEQ_RAM_SOUND || type == SEQ_HD_SOUND) {
1258 panels |= SEQ_PANEL_FILTER | SEQ_PANEL_INPUT;
1261 if (type == SEQ_PLUGIN || type >= SEQ_EFFECT) {
1262 panels |= SEQ_PANEL_EFFECT | SEQ_PANEL_PROXY;
1265 if (panels & SEQ_PANEL_EDITING) {
1266 seq_panel_editing();
1269 if (panels & SEQ_PANEL_INPUT) {
1273 if (panels & SEQ_PANEL_FILTER) {
1274 if (type == SEQ_RAM_SOUND || type == SEQ_HD_SOUND) {
1275 seq_panel_filter_audio();
1277 seq_panel_filter_video();
1281 if (panels & SEQ_PANEL_EFFECT) {
1285 if (panels & SEQ_PANEL_PROXY) {
1290 static void sel_proxy_dir(char *name)
1292 Sequence *last_seq = get_last_seq();
1293 strcpy(last_seq->strip->proxy->dir, name);
1295 allqueue(REDRAWBUTSSCENE, 0);
1297 BIF_undo_push("Change proxy directory");
1300 void do_sequencer_panels(unsigned short event)
1302 Sequence *last_seq = get_last_seq();
1310 case B_SEQ_BUT_PLUGIN:
1311 case B_SEQ_BUT_EFFECT:
1312 update_changed_seq_and_deps(last_seq, 0, 1);
1314 case B_SEQ_BUT_RELOAD_FILE:
1315 reload_sequence_new_file(last_seq);
1317 case B_SEQ_BUT_REBUILD_PROXY:
1318 seq_proxy_rebuild(last_seq);
1320 case B_SEQ_SEL_PROXY_DIR:
1321 sa= closest_bigger_area();
1322 areawinset(sa->win);
1323 activate_fileselect(FILE_SPECIAL, "SELECT PROXY DIR",
1324 last_seq->strip->proxy->dir,
1327 case B_SEQ_BUT_RELOAD:
1328 case B_SEQ_BUT_RELOAD_ALL:
1329 update_seq_ipo_rect(last_seq);
1330 update_seq_icu_rects(last_seq);
1332 free_imbuf_seq(); // frees all
1335 case B_SEQ_BUT_TRANSFORM:
1336 calc_sequence(last_seq);
1337 if (test_overlap_seq(last_seq))
1338 shuffle_seq(last_seq);
1342 if (event == B_SEQ_BUT_RELOAD_ALL) {
1343 allqueue(REDRAWALL, 0);
1345 allqueue(REDRAWSEQ, 0);
1346 allqueue(REDRAWBUTSSCENE, 0);
1351 /* ************************* SCENE *********************** */
1354 static void output_pic(char *name)
1356 strcpy(G.scene->r.pic, name);
1357 allqueue(REDRAWBUTSSCENE, 0);
1358 BIF_undo_push("Change output picture directory");
1361 static void backbuf_pic(char *name)
1365 strcpy(G.scene->r.backbuf, name);
1366 allqueue(REDRAWBUTSSCENE, 0);
1368 ima= BKE_add_image_file(name);
1370 BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
1372 BIF_undo_push("Change background picture");
1375 static void run_playanim(char *file)
1377 extern char bprogname[]; /* usiblender.c */
1378 char str[FILE_MAX*2]; /* FILE_MAX*2 is a bit arbitary, but this should roughly allow for the args + the max-file-length */
1379 int pos[2], size[2];
1381 /* use current settings for defining position of window. it actually should test image size */
1382 calc_renderwin_rectangle((G.scene->r.xsch*G.scene->r.size)/100,
1383 (G.scene->r.ysch*G.scene->r.size)/100, G.winpos, pos, size);
1385 sprintf(str, "%s -a -s %d -e %d -p %d %d -f %d %g -j %d \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, G.scene->frame_step, file);
1387 sprintf(str, "\"%s\" -a -s %d -e %d -p %d %d -f %d %g -j %d \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, G.scene->frame_step, file);
1392 void playback_anim(void)
1394 char file[FILE_MAX];
1396 if(BKE_imtype_is_movie(G.scene->r.imtype)) {
1397 switch (G.scene->r.imtype) {
1398 #ifdef WITH_QUICKTIME
1405 makeffmpegstring(file);
1409 makeavistring(&G.scene->r, file);
1412 if(BLI_exist(file)) {
1415 else error("Can't find movie: %s", file);
1418 BKE_makepicstring(file, G.scene->r.pic, G.scene->r.sfra, G.scene->r.imtype);
1419 if(BLI_exist(file)) {
1422 else error("Can't find image: %s", file);
1427 static void set_ffmpeg_preset(int preset);
1428 static int ffmpeg_property_add_string(const char * type, const char * str);
1429 static char ffmpeg_option_to_add[255] = "";
1432 void do_render_panels(unsigned short event)
1443 allqueue(REDRAWALL, 0);
1445 case B_SWITCHRENDER:
1446 /* new panels added, so... */
1447 G.buts->re_align= 1;
1448 allqueue(REDRAWBUTSSCENE, 0);
1459 sa= closest_bigger_area();
1460 areawinset(sa->win);
1461 if(G.qual == LR_CTRLKEY)
1462 activate_imageselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic);
1464 activate_fileselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic);
1468 sa= closest_bigger_area();
1469 areawinset(sa->win);
1470 if(G.qual == LR_CTRLKEY)
1471 activate_imageselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
1473 activate_fileselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
1477 G.scene->r.xsch= 720;
1478 G.scene->r.ysch= 576;
1479 G.scene->r.xasp= 54;
1480 G.scene->r.yasp= 51;
1481 G.scene->r.size= 100;
1482 G.scene->r.frs_sec= 25;
1483 G.scene->r.frs_sec_base= 1;
1484 G.scene->r.mode &= ~R_PANORAMA;
1485 G.scene->r.xparts= G.scene->r.yparts= 4;
1487 G.scene->r.ffcodecdata.gop_size = 15;
1489 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
1490 BIF_undo_push("Set PAL");
1491 allqueue(REDRAWBUTSSCENE, 0);
1492 allqueue(REDRAWVIEWCAM, 0);
1495 case B_FILETYPEMENU:
1496 allqueue(REDRAWBUTSSCENE, 0);
1498 if (G.scene->r.imtype == R_FFMPEG) {
1499 if (G.scene->r.ffcodecdata.type <= 0 ||
1500 G.scene->r.ffcodecdata.codec <= 0 ||
1501 G.scene->r.ffcodecdata.audio_codec <= 0 ||
1502 G.scene->r.ffcodecdata.video_bitrate <= 1) {
1503 G.scene->r.ffcodecdata.codec
1504 = CODEC_ID_MPEG2VIDEO;
1505 set_ffmpeg_preset(FFMPEG_PRESET_DVD);
1508 if (G.scene->r.ffcodecdata.audio_codec <= 0) {
1509 G.scene->r.ffcodecdata.audio_codec
1511 G.scene->r.ffcodecdata.audio_bitrate = 128;
1516 #if defined (_WIN32) || defined (__APPLE__)
1517 // fall through to codec settings if this is the first
1518 // time R_AVICODEC is selected for this scene.
1519 if (((G.scene->r.imtype == R_AVICODEC)
1520 && (G.scene->r.avicodecdata == NULL)) ||
1521 ((G.scene->r.imtype == R_QUICKTIME)
1522 && (G.scene->r.qtcodecdata == NULL))) {
1526 #endif /*_WIN32 || __APPLE__ */
1529 #if defined (_WIN32) || defined (__APPLE__)
1530 if ((G.scene->r.imtype == R_QUICKTIME)) { /* || (G.scene->r.qtcodecdata)) */
1531 #ifdef WITH_QUICKTIME
1532 get_qtcodec_settings();
1533 #endif /* WITH_QUICKTIME */
1535 #if defined (_WIN32) && !defined(FREE_WINDOWS)
1537 get_avicodec_settings();
1538 #endif /* _WIN32 && !FREE_WINDOWS */
1539 #endif /* _WIN32 || __APPLE__ */
1543 G.scene->r.xsch= 1920;
1544 G.scene->r.ysch= 1080;
1547 G.scene->r.size= 100;
1548 G.scene->r.mode &= ~R_PANORAMA;
1549 G.scene->r.xparts= G.scene->r.yparts= 4;
1551 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
1552 BIF_undo_push("Set FULL");
1553 allqueue(REDRAWBUTSSCENE, 0);
1554 allqueue(REDRAWVIEWCAM, 0);
1557 G.scene->r.xsch= 1280;
1558 G.scene->r.ysch= 1024;
1561 G.scene->r.size= 100;
1562 G.scene->r.mode &= ~R_PANORAMA;
1563 G.scene->r.xparts= G.scene->r.yparts= 4;
1565 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
1566 BIF_undo_push("Set FULL");
1567 allqueue(REDRAWBUTSSCENE, 0);
1568 allqueue(REDRAWVIEWCAM, 0);
1571 G.scene->r.xsch= 640;
1572 G.scene->r.ysch= 512;
1575 G.scene->r.size= 50;
1576 G.scene->r.mode &= ~R_PANORAMA;
1577 G.scene->r.xparts= G.scene->r.yparts= 2;
1579 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
1580 allqueue(REDRAWVIEWCAM, 0);
1581 allqueue(REDRAWBUTSSCENE, 0);
1584 G.scene->r.xsch= 720;
1585 G.scene->r.ysch= 576;
1586 G.scene->r.xasp= 64;
1587 G.scene->r.yasp= 45;
1588 G.scene->r.size= 100;
1589 G.scene->r.frs_sec= 25;
1590 G.scene->r.frs_sec_base= 1;
1591 G.scene->r.mode &= ~R_PANORAMA;
1592 G.scene->r.xparts= G.scene->r.yparts= 4;
1594 G.scene->r.ffcodecdata.gop_size = 15;
1597 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
1598 BIF_undo_push("Set PAL 16/9");
1599 allqueue(REDRAWVIEWCAM, 0);
1600 allqueue(REDRAWBUTSSCENE, 0);
1603 G.scene->r.xsch= 640;
1604 G.scene->r.ysch= 480;
1605 G.scene->r.xasp= 100;
1606 G.scene->r.yasp= 100;
1607 G.scene->r.size= 100;
1608 G.scene->r.mode &= ~R_PANORAMA;
1609 G.scene->r.xparts= G.scene->r.yparts= 4;
1611 BLI_init_rctf(&G.scene->r.safety, 0.0, 1.0, 0.0, 1.0);
1612 BIF_undo_push("Set PC");
1613 allqueue(REDRAWVIEWCAM, 0);
1614 allqueue(REDRAWBUTSSCENE, 0);
1617 G.scene->r.xsch= 720;
1618 G.scene->r.ysch= 576;
1619 G.scene->r.xasp= 54;
1620 G.scene->r.yasp= 51;
1621 G.scene->r.size= 100;
1622 G.scene->r.mode= R_OSA+R_SHADOW+R_FIELDS+R_SSS;
1623 G.scene->r.imtype= R_TARGA;
1624 G.scene->r.xparts= G.scene->r.yparts= 4;
1626 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
1627 BIF_undo_push("Set Default");
1628 allqueue(REDRAWVIEWCAM, 0);
1629 allqueue(REDRAWBUTSSCENE, 0);
1632 G.scene->r.xsch= 576;
1633 G.scene->r.ysch= 176;
1634 G.scene->r.xasp= 115;
1635 G.scene->r.yasp= 100;
1636 G.scene->r.size= 100;
1637 G.scene->r.mode |= R_PANORAMA;
1638 G.scene->r.xparts= 16;
1639 G.scene->r.yparts= 1;
1641 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
1642 BIF_undo_push("Set Panorama");
1643 allqueue(REDRAWVIEWCAM, 0);
1644 allqueue(REDRAWBUTSSCENE, 0);
1647 G.scene->r.xsch= 720;
1648 G.scene->r.ysch= 480;
1649 G.scene->r.xasp= 10;
1650 G.scene->r.yasp= 11;
1651 G.scene->r.size= 100;
1652 G.scene->r.frs_sec= 30;
1653 G.scene->r.frs_sec_base = 1.001;
1654 G.scene->r.mode &= ~R_PANORAMA;
1655 G.scene->r.xparts= G.scene->r.yparts= 2;
1657 G.scene->r.ffcodecdata.gop_size = 18;
1660 BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
1661 BIF_undo_push("Set NTSC");
1662 allqueue(REDRAWBUTSSCENE, 0);
1663 allqueue(REDRAWVIEWCAM, 0);
1667 id= (ID*) G.scene->set;
1669 if (G.buts->menunr==-2) {
1670 activate_databrowse(id, ID_SCE, 0, B_SETBROWSE, &G.buts->menunr, do_render_panels);
1672 else if (G.buts->menunr>0) {
1673 Scene *newset= (Scene*) BLI_findlink(&G.main->scene, G.buts->menunr-1);
1675 if (newset==G.scene)
1676 error("Can't use the same scene as its own set");
1678 G.scene->set= newset;
1679 if (scene_check_setscene(G.scene)==0)
1680 error("This would create a cycle");
1682 allqueue(REDRAWBUTSSCENE, 0);
1683 allqueue(REDRAWVIEW3D, 0);
1684 BIF_undo_push("Change Set Scene");
1690 allqueue(REDRAWBUTSSCENE, 0);
1691 allqueue(REDRAWVIEW3D, 0);
1692 BIF_undo_push("Clear Set Scene");
1696 allqueue(REDRAWBUTSSCENE, 0);
1699 G.scene->r.mode &= ~R_EDGE;
1700 allqueue(REDRAWBUTSSCENE, 0);
1702 case B_ADD_RENDERLAYER:
1703 if(G.scene->r.actlay==32767) {
1704 scene_add_render_layer(G.scene);
1705 G.scene->r.actlay= BLI_countlist(&G.scene->r.layers) - 1;
1707 allqueue(REDRAWBUTSSCENE, 0);
1708 allqueue(REDRAWNODE, 0);
1711 if(G.scene->nodetree) {
1712 ntreeCompositForceHidden(G.scene->nodetree);
1713 allqueue(REDRAWNODE, 0);
1715 allqueue(REDRAWBUTSSCENE, 0);
1716 allqueue(REDRAWOOPS, 0);
1718 case B_ADD_FFMPEG_AUDIO_OPTION:
1719 if (ffmpeg_property_add_string("audio", ffmpeg_option_to_add)){
1720 *ffmpeg_option_to_add = 0;
1722 allqueue(REDRAWBUTSSCENE, 0);
1724 case B_ADD_FFMPEG_VIDEO_OPTION:
1725 if (ffmpeg_property_add_string("video", ffmpeg_option_to_add)){
1726 *ffmpeg_option_to_add = 0;
1728 allqueue(REDRAWBUTSSCENE, 0);
1734 /* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
1735 static uiBlock *edge_render_menu(void *arg_unused)
1739 block= uiNewBlock(&curarea->uiblocks, "edge render", UI_EMBOSS, UI_HELV, curarea->win);
1741 /* use this for a fake extra empy space around the buttons */
1742 uiDefBut(block, LABEL, 0, "", 0, 0, 220, 115, NULL, 0, 0, 0, 0, "");
1744 uiDefButS(block, NUM, 0,"Eint:", 45,75,175,19, &G.scene->r.edgeint, 0.0, 255.0, 0, 0,
1745 "Sets edge intensity for Toon shading");
1747 /* color settings for the toon shading */
1748 uiDefButF(block, COL, 0, "", 10, 10,30,60, &(G.scene->r.edgeR), 0, 0, 0, B_EDGECOLSLI, "");
1750 uiBlockBeginAlign(block);
1751 uiDefButF(block, NUMSLI, 0, "R ", 45, 50, 175,19, &G.scene->r.edgeR, 0.0, 1.0, B_EDGECOLSLI, 0,
1752 "Color for edges in toon shading mode.");
1753 uiDefButF(block, NUMSLI, 0, "G ", 45, 30, 175,19, &G.scene->r.edgeG, 0.0, 1.0, B_EDGECOLSLI, 0,
1754 "Color for edges in toon shading mode.");
1755 uiDefButF(block, NUMSLI, 0, "B ", 45, 10, 175,19, &G.scene->r.edgeB, 0.0, 1.0, B_EDGECOLSLI, 0,
1756 "Color for edges in toon shading mode.");
1759 uiBlockSetDirection(block, UI_TOP);
1765 /* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
1766 static uiBlock *framing_render_menu(void *arg_unused)
1769 short yco = 267, xco = 0;
1770 int randomcolorindex = 1234;
1772 block= uiNewBlock(&curarea->uiblocks, "framing_options", UI_EMBOSS, UI_HELV, curarea->win);
1774 /* use this for a fake extra empy space around the buttons */
1775 uiDefBut(block, LABEL, 0, "", -5, -10, 295, 300, NULL, 0, 0, 0, 0, "");
1777 uiDefBut(block, LABEL, 0, "Framing:", xco, yco, 68,19, 0, 0, 0, 0, 0, "");
1778 uiBlockBeginAlign(block);
1779 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");
1780 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");
1781 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");
1782 uiBlockEndAlign(block);
1787 uiDefButF(block, COL, 0, "", 0, yco - 58 + 18, 33, 58, &G.scene->framing.col[0], 0, 0, 0, randomcolorindex, "");
1789 uiBlockBeginAlign(block);
1790 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");
1792 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");
1794 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");
1795 uiBlockEndAlign(block);
1798 uiDefBut(block, LABEL, 0, "Fullscreen:", xco, yco-=30, 100, 19, 0, 0.0, 0.0, 0, 0, "");
1799 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");
1800 uiBlockBeginAlign(block);
1801 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.");
1802 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.");
1803 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.");
1804 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.");
1805 uiBlockEndAlign(block);
1807 /* stereo settings */
1808 /* can't use any definition from the game engine here so hardcode it. Change it here when it changes there!
1809 * RAS_IRasterizer has definitions:
1810 * RAS_STEREO_NOSTEREO 1
1811 * RAS_STEREO_QUADBUFFERED 2
1812 * RAS_STEREO_ABOVEBELOW 3
1813 * RAS_STEREO_INTERLACED 4 future
1814 * RAS_STEREO_ANAGLYPH 5
1815 * RAS_STEREO_SIDEBYSIDE 6
1816 * RAS_STEREO_VINTERLACE 7
1819 uiBlockBeginAlign(block);
1820 uiDefButS(block, ROW, 0, "No Stereo", xco, yco-=30, 88, 19, &(G.scene->r.stereomode), 7.0, 1.0, 0, 0, "Disables stereo");
1821 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");
1822 uiDefButS(block, ROW, 0, "Syncdouble", xco+=90, yco, 88, 19, &(G.scene->r.stereomode), 7.0, 3.0, 0, 0, "Enables syncdoubling stereo method");
1823 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");
1824 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");
1825 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");
1827 uiBlockEndAlign(block);
1829 uiBlockBeginAlign(block);
1830 uiDefButS(block, ROW, 0, "Dome", xco-=180, yco-=30, 88, 19, &(G.scene->r.stereomode), 7.0, 8.0, 0, 0, "Enables dome camera");
1831 uiDefButS(block, NUM, 0, "Ang:", xco+=90, yco, 88, 19, &G.scene->r.domeangle, 90.0, 250.0, 0, 0, "Angle (Aperture) of the Dome - it only works in mode 1");
1832 uiDefButS(block, NUM, 0, "Mode:", xco+=90, yco, 88, 19, &G.scene->r.domemode, 1.0, 3.0, 0, 0, "Dome mode - 1 fisheye, 2 truncated, 3 spherical panoramic");
1834 uiDefButF(block, NUM, 0, "Size:", xco-=180, yco-=21, 88, 19, &G.scene->r.domesize, 0.5, 3.5, 0, 0, "Size adjustments");
1835 uiDefButS(block, NUM, 0, "Tes:", xco+=90, yco, 88, 19, &G.scene->r.domeres, 1.0, 8.0, 0, 0, "Tesselation level - 1 to 8");
1836 uiDefButF(block, NUM, 0, "Res:", xco+=90, yco, 88, 19, &G.scene->r.domeresbuf, 0.1, 1.0, 0, 0, "Buffer Resolution - decrease it to increase speed");
1838 uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Warp Data: ", xco-180,yco-=21,268, 19, &G.scene->r.dometext, "Custom Warp Mesh data file");
1839 uiBlockEndAlign(block);
1841 uiBlockSetDirection(block, UI_TOP);
1848 static char* ffmpeg_format_pup(void)
1850 static char string[2048];
1851 char formatstring[2048];
1855 AVOutputFormat* next = first_oformat;
1856 formatstring = "FFMpeg format: %%t";
1857 sprintf(string, formatstring);
1858 formatstring = "|%s %%x%d";
1859 /* FIXME: This should only be generated once */
1860 while (next != NULL) {
1861 if (next->video_codec != CODEC_ID_NONE && !(next->flags & AVFMT_NOFILE)) {
1862 sprintf(string+stroffs, formatstring, next->name, i++);
1863 stroffs += strlen(string+stroffs);
1869 strcpy(formatstring, "FFMpeg format: %%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"
1871 /* ifdef WITH_OGG, disabled, since broken within ffmpeg bundled with blender */
1875 sprintf(string, formatstring,
1876 "MPEG-1", FFMPEG_MPEG1,
1877 "MPEG-2", FFMPEG_MPEG2,
1878 "MPEG-4", FFMPEG_MPEG4,
1880 "Quicktime", FFMPEG_MOV,
1882 "H264", FFMPEG_H264,
1883 "XVid", FFMPEG_XVID,
1885 /* ifdef WITH_OGG, disabled, since broken within ffmpeg bundled with blender */
1892 static char* ffmpeg_preset_pup(void)
1894 static char string[2048];
1895 char formatstring[2048];
1897 strcpy(formatstring, "FFMpeg preset: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
1898 sprintf(string, formatstring,
1899 "", FFMPEG_PRESET_NONE,
1900 "DVD", FFMPEG_PRESET_DVD,
1901 "SVCD", FFMPEG_PRESET_SVCD,
1902 "VCD", FFMPEG_PRESET_VCD,
1903 "DV", FFMPEG_PRESET_DV,
1904 "H264", FFMPEG_PRESET_H264);
1909 static char* ffmpeg_codec_pup(void) {
1910 static char string[2048];
1911 char formatstring[2048];
1912 strcpy(formatstring,
1913 "FFMpeg format: %%t"
1914 "|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d"
1919 sprintf(string, formatstring,
1920 "MPEG1", CODEC_ID_MPEG1VIDEO,
1921 "MPEG2", CODEC_ID_MPEG2VIDEO,
1922 "MPEG4(divx)", CODEC_ID_MPEG4,
1923 "HuffYUV", CODEC_ID_HUFFYUV,
1924 "DV", CODEC_ID_DVVIDEO,
1925 "H264", CODEC_ID_H264,
1926 "XVid", CODEC_ID_XVID,
1928 "Theora", CODEC_ID_THEORA,
1930 "FlashVideo1", CODEC_ID_FLV1);
1935 static char* ffmpeg_audio_codec_pup(void) {
1936 static char string[2048];
1937 char formatstring[2048];
1938 strcpy(formatstring,
1939 "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d"
1944 sprintf(string, formatstring,
1945 "MP2", CODEC_ID_MP2,
1946 "MP3", CODEC_ID_MP3,
1947 "AC3", CODEC_ID_AC3,
1948 "AAC", CODEC_ID_AAC,
1950 "Vorbis", CODEC_ID_VORBIS,
1952 "PCM", CODEC_ID_PCM_S16LE);
1959 static char *imagetype_pup(void)
1961 static char string[1024];
1962 char formatstring[1024];
1963 char appendstring[1024];
1965 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");
1967 strcat(formatstring, "|%s %%x%d"); // add space for Movie
1970 strcat(formatstring, "|%s %%x%d"); // add space for PNG
1971 /* Commented out until implemented
1973 strcat(formatstring, "|%s %%x%d"); // add space for DDS
1976 #ifdef WITH_OPENJPEG
1977 strcat(formatstring, "|%s %%x%d"); // add space for JP2
1980 strcat(formatstring, "|%s %%x%d"); // add space for BMP
1981 strcat(formatstring, "|%s %%x%d"); // add space for Radiance HDR
1982 strcat(formatstring, "|%s %%x%d"); // add space for Cineon
1983 strcat(formatstring, "|%s %%x%d"); // add space for DPX
1986 strcat(formatstring, "|%s %%x%d"); // add space for AVI Codec
1990 strcat(formatstring, "|%s %%x%d"); // Add space for ffmpeg
1992 strcat(formatstring, "|%s %%x%d"); // Add space for frameserver
1994 #ifdef WITH_QUICKTIME
1995 if(G.have_quicktime)
1996 strcat(formatstring, "|%s %%x%d"); // add space for Quicktime
1999 if(G.have_quicktime) {
2000 sprintf(string, formatstring,
2001 "Frameserver", R_FRAMESERVER,
2005 "AVI Raw", R_AVIRAW,
2006 "AVI Jpeg", R_AVIJPEG,
2008 "AVI Codec", R_AVICODEC,
2010 #ifdef WITH_QUICKTIME
2011 "QuickTime", R_QUICKTIME,
2014 "Targa Raw", R_RAWTGA,
2016 /* commented out until implemented
2021 #ifdef WITH_OPENJPEG
2028 "Radiance HDR", R_RADHDR,
2037 sprintf(string, formatstring,
2038 "Frameserver", R_FRAMESERVER,
2042 "AVI Raw", R_AVIRAW,
2043 "AVI Jpeg", R_AVIJPEG,
2045 "AVI Codec", R_AVICODEC,
2048 "Targa Raw", R_RAWTGA,
2053 #ifdef WITH_OPENJPEG
2060 "Radiance HDR", R_RADHDR,
2072 strcpy(formatstring, "|%s %%x%d");
2073 sprintf(appendstring, formatstring, "OpenEXR", R_OPENEXR);
2074 strcat(string, appendstring);
2075 sprintf(appendstring, formatstring, "MultiLayer", R_MULTILAYER);
2076 strcat(string, appendstring);
2079 if (G.have_libtiff) {
2080 strcpy(formatstring, "|%s %%x%d");
2081 sprintf(appendstring, formatstring, "TIFF", R_TIFF);
2082 strcat(string, appendstring);
2089 static char *avicodec_str(void)
2091 static char string[1024];
2093 sprintf(string, "Codec: %s", G.scene->r.avicodecdata->avicodecname);
2099 static void render_panel_output(void)
2106 block= uiNewBlock(&curarea->uiblocks, "render_panel_output", UI_EMBOSS, UI_HELV, curarea->win);
2107 if(uiNewPanel(curarea, block, "Output", "Render", 0, 0, 318, 204)==0) return;
2109 uiBlockBeginAlign(block);
2110 uiDefIconBut(block, BUT, B_FS_PIC, ICON_FILESEL, 10, 190, 20, 20, 0, 0, 0, 0, 0, "Select the directory/name for saving animations");
2111 uiDefBut(block, TEX,0,"", 31, 190, 279, 20,G.scene->r.pic, 0.0,79.0, 0, 0, "Directory/name to save animations, # characters defines the position and length of frame numbers");
2112 uiDefIconBut(block, BUT,B_FS_BACKBUF, ICON_FILESEL, 10, 168, 20, 20, 0, 0, 0, 0, 0, "Select the directory/name for a Backbuf image");
2113 uiDefBut(block, TEX,0,"", 31, 168, 259, 20,G.scene->r.backbuf, 0.0,79.0, 0, 0, "Image to use as background for rendering");
2114 uiDefIconButBitS(block, ICONTOG, R_BACKBUF, B_NOP, ICON_CHECKBOX_HLT-1, 290, 168, 20, 20, &G.scene->r.bufflag, 0.0, 0.0, 0, 0, "Enable/Disable use of Backbuf image");
2115 uiBlockEndAlign(block);
2117 uiDefButBitI(block, TOG, R_EXTENSION, B_NOP, "Extensions", 10, 142, 100, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds filetype extensions to the filename when rendering animations");
2119 uiBlockBeginAlign(block);
2120 uiDefButBitI(block, TOG, R_TOUCH, B_NOP, "Touch", 170, 142, 50, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Create an empty file before rendering each frame, remove if cancelled (and empty)");
2121 uiDefButBitI(block, TOG, R_NO_OVERWRITE, B_NOP, "No Overwrite", 220, 142, 90, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Skip rendering frames when the file exists (image output only)");
2122 uiBlockEndAlign(block);
2125 uiBlockBeginAlign(block);
2126 id= (ID *)G.scene->set;
2127 IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), id, &(G.buts->menunr));
2129 uiDefButS(block, MENU, B_SETBROWSE, strp, 10, 114, 20, 20, &(G.buts->menunr), 0, 0, 0, 0, "Scene to link as a Set");
2133 uiSetButLock(1, NULL);
2134 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, B_NOP, "", 31, 114, 100, 20, &(G.scene->set), "Name of the Set");
2136 uiDefIconBut(block, BUT, B_CLEARSET, ICON_X, 132, 114, 20, 20, 0, 0, 0, 0, 0, "Remove Set link");
2138 uiDefBut(block, LABEL, 0, "No Set Scene", 31, 114, 200, 20, 0, 0, 0, 0, 0, "");
2140 uiBlockEndAlign(block);
2142 uiBlockBeginAlign(block);
2143 uiDefIconButBitI(block, TOGN, R_FIXED_THREADS, B_REDR, ICON_AUTO, 10, 63, 20, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Automatically set the threads to the number of processors on the system");
2144 if ((G.scene->r.mode & R_FIXED_THREADS)==0) {
2145 char thread_str[16];
2146 sprintf(thread_str, " Threads: %d", BLI_system_thread_count());
2147 uiDefBut(block, LABEL, 0, thread_str, 30, 63,80,20, 0, 0, 0, 0, 0, "");
2149 uiDefButS(block, NUM, B_NOP, "Threads:", 30, 63, 80, 20, &G.scene->r.threads, 1, BLENDER_MAX_THREADS, 0, 0, "Amount of threads for render (takes advantage of multi-core and multi-processor computers)");
2151 uiBlockEndAlign(block);
2153 uiBlockSetCol(block, TH_AUTO);
2155 uiBlockBeginAlign(block);
2158 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");
2159 uiBlockEndAlign(block);
2162 uiBlockBeginAlign(block);
2163 uiDefButBitI(block, TOG, R_EXR_TILE_FILE, B_REDR, "Save Buffers", 72, 31, 120, 19, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Save tiles for all RenderLayers and used SceneNodes to files in the temp directory (saves memory, allows Full Sampling)");
2164 if(G.scene->r.scemode & R_EXR_TILE_FILE)
2165 uiDefButBitI(block, TOG, R_FULL_SAMPLE, B_REDR, "FullSample", 192, 31, 118, 19, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Saves for every OSA sample the entire RenderLayer results (Higher quality sampling but slower)");
2166 uiBlockEndAlign(block);
2169 uiDefButS(block, MENU, B_REDR, "Render Display %t|Render Window %x1|Image Editor %x0|Full Screen %x2",
2170 72, 10, 120, 19, &G.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output display");
2172 /* Dither control */
2173 uiDefButF(block, NUM,B_DIFF, "Dither:", 10,89,100,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)");
2175 /* Toon shading buttons */
2176 uiBlockBeginAlign(block);
2177 uiDefButBitI(block, TOG, R_EDGE, B_NOP,"Edge", 115, 89, 60, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon Edge-enhance");
2178 uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 175, 89, 135, 20, "Display Edge settings");
2179 uiBlockEndAlign(block);
2181 uiBlockBeginAlign(block);
2182 uiDefButBitI(block, TOG, R_NO_TEX, B_NOP, "Disable Tex", 115, 63, 75, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Disables Textures for render");
2183 uiDefButBitI(block, TOG, R_FREE_IMAGE, B_NOP, "Free Tex Images", 210, 63, 100, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Frees all Images used by Textures after each render");
2184 uiBlockEndAlign(block);
2187 static void do_bake_func(void *unused_v, void *unused_p)
2189 objects_bake_render_ui(0);
2192 static void render_panel_bake(void)
2197 block= uiNewBlock(&curarea->uiblocks, "render_panel_bake", UI_EMBOSS, UI_HELV, curarea->win);
2198 uiNewPanelTabbed("Anim", "Render");
2199 if(uiNewPanel(curarea, block, "Bake", "Render", 320, 0, 318, 204)==0) return;
2201 but= uiDefBut(block, BUT, B_NOP, "BAKE", 10, 150, 190,40, 0, 0, 0, 0, 0, "Start the bake render for selected Objects");
2202 uiButSetFunc(but, do_bake_func, NULL, NULL);
2204 uiBlockBeginAlign(block);
2205 uiDefButBitS(block, TOG, R_BAKE_TO_ACTIVE, B_DIFF, "Selected to Active", 10,120,190,20,&G.scene->r.bake_flag, 0.0, 0, 0, 0, "Bake shading on the surface of selected objects to the active object");
2206 uiDefButF(block, NUM, B_DIFF, "Dist:", 10,100,95,20,&G.scene->r.bake_maxdist, 0.0, 1000.0, 1, 0, "Maximum distance from active object to other object (in blender units)");
2207 uiDefButF(block, NUM, B_DIFF, "Bias:", 105,100,95,20,&G.scene->r.bake_biasdist, 0.0, 1000.0, 1, 0, "Bias towards faces further away from the object (in blender units)");
2208 uiBlockEndAlign(block);
2210 if(G.scene->r.bake_mode == RE_BAKE_NORMALS)
2211 uiDefButS(block, MENU, B_DIFF, "Normal Space %t|Camera %x0|World %x1|Object %x2|Tangent %x3",
2212 10,70,190,20, &G.scene->r.bake_normal_space, 0, 0, 0, 0, "Choose normal space for baking");
2213 else if(G.scene->r.bake_mode == RE_BAKE_AO || G.scene->r.bake_mode == RE_BAKE_DISPLACEMENT) {
2214 uiDefButBitS(block, TOG, R_BAKE_NORMALIZE, B_DIFF, "Normalized", 10,70,190,20, &G.scene->r.bake_flag, 0.0, 0, 0, 0,
2215 G.scene->r.bake_mode == RE_BAKE_AO ?
2216 "Bake ambient occlusion normalized, without taking into acount material settings":
2217 "Normalized displacement value to fit the 'Dist' range"
2221 uiDefButS(block, MENU, B_NOP, "Quad Split Order%t|Quad Split Auto%x0|Quad Split A (0,1,2) (0,2,3)%x1|Quad Split B (1,2,3) (1,3,0)%x2",
2222 10,10,190,20, &G.scene->r.bake_quad_split, 0, 0, 0, 0, "Method to divide quads (use A or B for external applications that use a fixed order)");
2225 uiBlockBeginAlign(block);
2226 uiDefButBitS(block, TOG, R_BAKE_OSA, B_DIFF, "OSA", 10,120,190,20, &G.scene->r.bake_flag, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
2227 uiDefButS(block, ROW,B_DIFF,"5", 10,100,50,20,&G.scene->r.bake_osa,2.0,5.0, 0, 0, "Sets oversample level to 5");
2228 uiDefButS(block, ROW,B_DIFF,"8", 60,100,45,20,&G.scene->r.bake_osa,2.0,8.0, 0, 0, "Sets oversample level to 8");
2229 uiDefButS(block, ROW,B_DIFF,"11", 105,100,45,20,&G.scene->r.bake_osa,2.0,11.0, 0, 0, "Sets oversample level to 11");
2230 uiDefButS(block, ROW,B_DIFF,"16", 150,100,50,20,&G.scene->r.bake_osa,2.0,16.0, 0, 0, "Sets oversample level to 16");
2232 uiBlockBeginAlign(block);
2233 uiDefButS(block, ROW,B_REDR,"Full Render", 210,170,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_ALL, 0, 0, "");
2234 uiDefButS(block, ROW,B_REDR,"Ambient Occlusion",210,150,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_AO, 0, 0, "");
2235 uiDefButS(block, ROW,B_REDR,"Shadow", 210,130,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_SHADOW, 0, 0, "");
2236 uiDefButS(block, ROW,B_REDR,"Normals", 210,110,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_NORMALS, 0, 0, "");
2237 uiDefButS(block, ROW,B_REDR,"Textures", 210,90,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_TEXTURE, 0, 0, "");
2238 uiDefButS(block, ROW,B_REDR,"Displacement", 210,70,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_DISPLACEMENT, 0, 0, "");
2239 uiBlockEndAlign(block);
2241 uiDefButBitS(block, TOG, R_BAKE_CLEAR, B_DIFF, "Clear", 210,40,120,20,&G.scene->r.bake_flag, 0.0, 0, 0, 0, "Clear Images before baking");
2243 uiDefButS(block, NUM, B_DIFF,"Margin:", 210,10,120,20,&G.scene->r.bake_filter, 0.0, 32.0, 0, 0, "Amount of pixels to extend the baked result with, as post process filter");
2246 static void render_panel_simplify(void)
2250 block= uiNewBlock(&curarea->uiblocks, "render_panel_simplify", UI_EMBOSS, UI_HELV, curarea->win);
2251 uiNewPanelTabbed("Render", "Render");
2252 if(uiNewPanel(curarea, block, "Simplifcation", "Render", 320, 0, 318, 204)==0) return;
2254 uiDefButBitI(block, TOG, R_SIMPLIFY, B_DIFF,"Render Simplification", 10,150,190,20, &G.scene->r.mode, 0, 0, 0, 0, "Enable simplification of scene");
2256 uiBlockBeginAlign(block);
2257 uiDefButI(block, NUM,B_DIFF, "Subsurf:", 10,120,190,20, &G.scene->r.simplify_subsurf, 0.0, 6.0, 0, 0, "Global maximum subsurf level percentage");
2258 uiDefButF(block, NUM,B_DIFF, "Child Particles:", 10,100,190,20, &G.scene->r.simplify_particles, 0.0, 1.0, 0, 0, "Global child particle percentage");
2259 uiBlockEndAlign(block);
2261 uiBlockBeginAlign(block);
2262 uiDefButI(block, NUM,B_DIFF, "Shadow Samples:", 10,70,190,20, &G.scene->r.simplify_shadowsamples, 1.0, 16.0, 0, 0, "Global maximum shadow map samples");
2263 uiDefButF(block, NUM,B_DIFF, "AO and SSS:", 10,50,190,20, &G.scene->r.simplify_aosss, 0.0, 1.0, 0, 0, "Global approximate AO and SSS quality factor");
2264 uiBlockEndAlign(block);
2267 static void render_panel_render(void)
2272 block= uiNewBlock(&curarea->uiblocks, "render_panel_render", UI_EMBOSS, UI_HELV, curarea->win);
2273 if(uiNewPanel(curarea, block, "Render", "Render", 320, 0, 318, 204)==0) return;
2275 uiBlockBeginAlign(block);
2276 uiDefBut(block, BUT,B_DORENDER,"RENDER", 369, 164, 191,37, 0, 0, 0, 0, 0, "Render the current frame (F12)");
2277 #ifndef DISABLE_YAFRAY
2278 /* yafray: on request, render engine menu is back again, and moved to Render panel */
2279 uiDefButS(block, MENU, B_SWITCHRENDER, "Rendering Engine %t|Blender Internal %x0|YafRay %x1",
2280 369, 142, 191, 20, &G.scene->r.renderer, 0, 0, 0, 0, "Choose rendering engine");
2282 uiDefButS(block, MENU, B_SWITCHRENDER, "Rendering Engine %t|Blender Internal %x0",
2283 369, 142, 191, 20, &G.scene->r.renderer, 0, 0, 0, 0, "Choose rendering engine");
2284 #endif /* disable yafray */
2286 uiBlockBeginAlign(block);
2287 if((G.scene->r.scemode & R_FULL_SAMPLE) && (G.scene->r.scemode & R_EXR_TILE_FILE))
2288 uiDefButBitI(block, TOG, R_OSA, B_DIFF, "FSA", 369,109,122,20,&G.scene->r.mode, 0, 0, 0, 0, "Saves all samples, then composites, and then merges (for best Anti-aliasing)");
2290 uiDefButBitI(block, TOG, R_OSA, B_DIFF, "OSA", 369,109,122,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
2291 uiDefButS(block, ROW,B_DIFF,"5", 369,88,29,20,&G.scene->r.osa,2.0,5.0, 0, 0, "Render 5 samples per pixel for smooth edges (Fast)");
2292 uiDefButS(block, ROW,B_DIFF,"8", 400,88,29,20,&G.scene->r.osa,2.0,8.0, 0, 0, "Render 8 samples per pixel for smooth edges (Recommended)");
2293 uiDefButS(block, ROW,B_DIFF,"11", 431,88,29,20,&G.scene->r.osa,2.0,11.0, 0, 0, "Render 11 samples per pixel for smooth edges (High Quality)");
2294 uiDefButS(block, ROW,B_DIFF,"16", 462,88,29,20,&G.scene->r.osa,2.0,16.0, 0, 0, "Render 16 samples per pixel for smooth edges (Highest Quality)");
2295 uiBlockEndAlign(block);
2297 uiBlockBeginAlign(block);
2298 uiDefButBitI(block, TOG, R_MBLUR, B_REDR, "MBLUR", 496,109,64,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Motion Blur calculation");
2299 uiDefButF(block, NUM,B_DIFF,"Bf:", 496,88,64,20,&G.scene->r.blurfac, 0.01, 5.0, 10, 2, "Sets motion blur factor");
2300 uiBlockEndAlign(block);
2302 uiBlockBeginAlign(block);
2303 uiDefButS(block, NUM,B_DIFF,"Xparts:", 369,46,95,29,&G.scene->r.xparts,1.0, 512.0, 0, 0, "Sets the number of horizontal parts to render image in (For panorama sets number of camera slices)");
2304 uiDefButS(block, NUM,B_DIFF,"Yparts:", 465,46,95,29,&G.scene->r.yparts,1.0, 64.0, 0, 0, "Sets the number of vertical parts to render image in");
2305 uiBlockEndAlign(block);
2307 uiBlockBeginAlign(block);
2308 uiDefButS(block, ROW,800,"Sky", 369,13,35,20,&G.scene->r.alphamode,3.0,0.0, 0, 0, "Fill background with sky");
2309 uiDefButS(block, ROW,800,"Premul", 405,13,50,20,&G.scene->r.alphamode,3.0,1.0, 0, 0, "Multiply alpha in advance");
2310 uiDefButS(block, ROW,800,"Key", 456,13,35,20,&G.scene->r.alphamode,3.0,2.0, 0, 0, "Alpha and color values remain unchanged");
2311 uiBlockEndAlign(block);
2313 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 and baking, Use higher values for complex scenes");
2315 uiBlockBeginAlign(block);
2316 uiDefButBitI(block, TOG, R_SHADOW, B_REDR,"Shadow", 565,172,52,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable shadow calculation");
2317 uiDefButBitI(block, TOG, R_SSS, B_REDR,"SSS", 617,172,32,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable subsurface scattering map rendering");
2318 uiDefButBitI(block, TOG, R_PANORAMA, B_REDR,"Pano", 649,172,38,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable panorama rendering (output width is multiplied by Xparts)");
2319 uiDefButBitI(block, TOG, R_ENVMAP, B_REDR,"EnvMap", 565,142,52,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable environment map rendering");
2320 uiDefButBitI(block, TOG, R_RAYTRACE, B_REDR,"Ray",617,142,32,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable ray tracing");
2321 uiDefButBitI(block, TOG, R_RADIO, B_REDR,"Radio", 649,142,38,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable radiosity rendering");
2322 uiBlockEndAlign(block);
2324 uiBlockBeginAlign(block);
2325 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");
2326 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");
2327 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");
2328 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");
2329 uiBlockEndAlign(block);
2331 uiBlockBeginAlign(block);
2332 uiDefButBitI(block, TOG, R_FIELDS, B_REDR,"Fields", 565,55,60,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables field rendering");
2333 uiDefButBitI(block, TOG, R_ODDFIELD, B_REDR,"Odd", 627,55,39,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Odd field first rendering (Default: Even field)");
2334 uiDefButBitI(block, TOG, R_FIELDSTILL, B_REDR,"X", 668,55,19,20,&G.scene->r.mode, 0, 0, 0, 0, "Disables time difference in field calculations");
2336 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);
2337 uiDefButS(block, MENU, B_DIFF,str, 565,34,60,20, &G.scene->r.filtertype, 0, 0, 0, 0, "Set sampling filter for antialiasing");
2338 uiDefButF(block, NUM,B_DIFF,"", 627,34,60,20,&G.scene->r.gauss,0.5, 1.5, 10, 2, "Sets the filter size");
2340 uiDefButBitI(block, TOG, R_BORDER, REDRAWVIEWCAM, "Border", 565,13,122,20, &G.scene->r.mode, 0, 0, 0, 0, "Render a small cut-out of the image (Shift+B to set in the camera view)");
2341 uiBlockEndAlign(block);
2345 static void render_panel_anim(void)
2350 block= uiNewBlock(&curarea->uiblocks, "render_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
2351 if(uiNewPanel(curarea, block, "Anim", "Render", 640, 0, 318, 204)==0) return;
2354 uiDefBut(block, BUT,B_DOANIM,"ANIM", 692,142,192,47, 0, 0, 0, 0, 0, "Render the animation to disk from start to end frame, (Ctrl+F12)");
2356 uiBlockSetCol(block, TH_BUT_SETTING1);
2357 uiBlockBeginAlign(block);
2358 uiDefButBitI(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)");
2359 uiDefButBitI(block, TOG, R_DOCOMP, B_NOP, "Do Composite",692,90,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Uses compositing nodes for output rendering");
2360 uiBlockEndAlign(block);
2362 uiBlockSetCol(block, TH_AUTO);
2363 uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,50,94,33, 0, 0, 0, 0, 0, "Play rendered images/avi animation (Ctrl+F11), (Play Hotkeys: A-Noskip, P-PingPong)");
2364 uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,50,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button");
2366 uiBlockBeginAlign(block);
2367 uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,20,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)");
2368 uiDefButI(block, NUM,REDRAWSEQ,"End:",789,20,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)");
2369 uiDefButI(block, NUM,REDRAWSEQ,"Step:",692,0,192,18, &G.scene->frame_step, 1.0, MAXFRAMEF, 0, 0, "Frame Step");
2370 uiBlockEndAlign(block);
2375 static void ffmpeg_property_del(void *type, void *prop_)
2377 struct IDProperty *prop = (struct IDProperty *) prop_;
2380 if (!G.scene->r.ffcodecdata.properties) {
2384 group = IDP_GetPropertyFromGroup(
2385 G.scene->r.ffcodecdata.properties, (char*) type);
2386 if (group && prop) {
2387 IDP_RemFromGroup(group, prop);
2388 IDP_FreeProperty(prop);
2391 allqueue(REDRAWBUTSSCENE, 0);
2394 static IDProperty * ffmpeg_property_add(
2395 char * type, int opt_index, int parent_index)
2399 const AVOption * parent;
2402 IDPropertyTemplate val;
2406 avcodec_get_context_defaults(&c);
2408 o = c.av_class->option + opt_index;
2409 parent = c.av_class->option + parent_index;
2411 if (!G.scene->r.ffcodecdata.properties) {
2412 IDPropertyTemplate val;
2414 G.scene->r.ffcodecdata.properties
2415 = IDP_New(IDP_GROUP, val, "ffmpeg");
2418 group = IDP_GetPropertyFromGroup(
2419 G.scene->r.ffcodecdata.properties, (char*) type);
2422 IDPropertyTemplate val;
2424 group = IDP_New(IDP_GROUP, val, (char*) type);
2425 IDP_AddToGroup(G.scene->r.ffcodecdata.properties, group);
2429 sprintf(name, "%s:%s", parent->name, o->name);
2431 strcpy(name, o->name);
2434 fprintf(stderr, "ffmpeg_property_add: %s %d %d %s\n",
2435 type, parent_index, opt_index, name);
2437 prop = IDP_GetPropertyFromGroup(group, name);
2443 case FF_OPT_TYPE_INT:
2444 case FF_OPT_TYPE_INT64:
2445 val.i = o->default_val;
2448 case FF_OPT_TYPE_DOUBLE:
2449 case FF_OPT_TYPE_FLOAT:
2450 val.f = o->default_val;
2451 idp_type = IDP_FLOAT;
2453 case FF_OPT_TYPE_STRING:
2455 idp_type = IDP_STRING;
2457 case FF_OPT_TYPE_CONST:
2464 prop = IDP_New(idp_type, val, name);
2465 IDP_AddToGroup(group, prop);
2469 /* not all versions of ffmpeg include that, so here we go ... */
2471 static const AVOption *my_av_find_opt(void *v, const char *name,
2472 const char *unit, int mask, int flags){
2473 AVClass *c= *(AVClass**)v;
2474 const AVOption *o= c->option;
2476 for(;o && o->name; o++){
2477 if(!strcmp(o->name, name) &&
2478 (!unit || (o->unit && !strcmp(o->unit, unit))) &&
2479 (o->flags & mask) == flags )
2485 static int ffmpeg_property_add_string(const char * type, const char * str)
2488 const AVOption * o = 0;
2489 const AVOption * p = 0;
2495 avcodec_get_context_defaults(&c);
2497 strncpy(name_, str, 128);
2500 while (*name == ' ') name++;
2502 param = strchr(name, ':');
2505 param = strchr(name, ' ');
2509 while (*param == ' ') param++;
2512 o = my_av_find_opt(&c, name, NULL, 0, 0);
2516 if (param && o->type == FF_OPT_TYPE_CONST) {
2519 if (param && o->type != FF_OPT_TYPE_CONST && o->unit) {
2520 p = my_av_find_opt(&c, param, o->unit, 0, 0);
2521 prop = ffmpeg_property_add(
2522 (char*) type, p - c.av_class->option,
2523 o - c.av_class->option);
2525 prop = ffmpeg_property_add(
2526 (char*) type, o - c.av_class->option, 0);
2535 switch (prop->type) {
2537 IDP_Int(prop) = atoi(param);
2540 IDP_Float(prop) = atof(param);
2543 strncpy(IDP_String(prop), param, prop->len);
2550 static void ffmpeg_property_add_using_menu(void * type, int opt_indices)
2552 int opt_index = opt_indices & 65535;
2553 int parent_index = opt_indices >> 16;
2555 ffmpeg_property_add((char*) type, opt_index, parent_index);
2557 allqueue(REDRAWBUTSSCENE, 0);
2560 static uiBlock *ffmpeg_property_add_submenu(AVOption * parent, char * type)
2567 int parent_index = 0;
2569 if (strcmp(type, "audio") == 0) {
2570 flags = AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM;
2571 } else if (strcmp(type, "video") == 0) {
2572 flags = AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM;
2577 block= uiNewBlock(&curarea->uiblocks, "ffmpeg_property_add_submenu",
2578 UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
2579 uiBlockSetButmFunc(block, ffmpeg_property_add_using_menu, type);
2581 avcodec_get_context_defaults(&c);
2584 parent_index = (parent - c.av_class->option);
2587 for(o = c.av_class->option; o && o->name; o++){
2589 (strstr(o->help, "experimental")
2590 || strstr(o->help, "obsolete")
2591 || strstr(o->help, "useless")
2592 || strstr(o->help, "deprecated"))) {
2595 if((o->flags & flags) == flags) {
2596 if((!parent && !o->unit)
2597 || (o->unit && parent
2598 && strcmp(o->unit, parent->unit) == 0
2599 && o->type == FF_OPT_TYPE_CONST)) {
2600 uiDefBut(block, BUTM, B_REDR,
2601 (char*) (o->help && o->help[0] ?
2605 (o - c.av_class->option) |
2606 (parent_index << 16),
2613 uiTextBoundsBlock(block, 50);
2614 uiBlockSetDirection(block, UI_RIGHT);
2619 static uiBlock *ffmpeg_property_add_submenu_audio(void* opt)
2621 return ffmpeg_property_add_submenu((AVOption*) opt, "audio");
2624 static uiBlock *ffmpeg_property_add_submenu_video(void* opt)
2626 return ffmpeg_property_add_submenu((AVOption*) opt, "video");
2629 static uiBlock *ffmpeg_property_add_menu(void* type_)
2631 char * type = (char*) type_;
2637 uiBlockFuncFP add_submenu = NULL;
2639 if (strcmp(type, "audio") == 0) {
2640 flags = AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM;
2641 add_submenu = ffmpeg_property_add_submenu_audio;
2642 } else if (strcmp(type, "video") == 0) {
2643 flags = AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM;
2644 add_submenu = ffmpeg_property_add_submenu_video;
2649 block= uiNewBlock(&curarea->uiblocks, "ffmpeg_property_add_menu",
2650 UI_EMBOSSP, UI_HELV, curarea->win);
2652 avcodec_get_context_defaults(&c);
2654 for(o = c.av_class->option; o && o->name; o++){
2655 if((o->flags & flags) == flags) {
2656 if (o->type == FF_OPT_TYPE_CONST) {
2660 (strstr(o->help, "experimental")
2661 || strstr(o->help, "obsolete")
2662 || strstr(o->help, "useless")
2663 || strstr(o->help, "deprecated"))) {
2669 uiDefIconTextBlockBut(
2673 ICON_RIGHTARROW_THIN,
2676 0, yco, 160, 15, "");
2682 uiDefIconTextBlockBut(
2686 ICON_RIGHTARROW_THIN,
2687 "Value / string options",
2688 0, yco, 160, 15, "");
2690 uiTextBoundsBlock(block, 50);
2691 uiBlockSetDirection(block, UI_DOWN);
2696 static int render_panel_ffmpeg_property_option(
2697 uiBlock *block, int xofs, int yofs, IDProperty * curr,
2706 strcpy(name, curr->name);
2707 param = strchr(name, ':');
2713 avcodec_get_context_defaults(&c);
2715 o = my_av_find_opt(&c, param ? param : name, NULL, 0, 0);
2720 switch (curr->type) {
2722 uiDefBut(block, TEX,
2726 0.0, curr->len - 1, 100, 0,
2730 uiDefButF(block, NUM, B_REDR, curr->name,
2731 xofs, yofs, 200, 19,
2733 o->min, o->max, 0, 0, (char*) o->help);
2736 if (o->type == FF_OPT_TYPE_CONST) {
2737 uiDefButBitI(block, TOG, 1, B_REDR,
2739 xofs, yofs, 200, 19,
2741 0, 1, 0,0, (char*) o->help);
2743 uiDefButI(block, NUM, B_REDR, curr->name,
2744 xofs, yofs, 200, 19,
2746 o->min, o->max, 0, 0, (char*) o->help);
2751 but = uiDefIconBut(block, BUT, B_REDR, VICON_X,
2752 xofs + 220, yofs, 16, 16, NULL,
2753 0.0, 0.0, 0.0, 0.0, "Delete property");
2755 uiButSetFunc(but, ffmpeg_property_del, (void*) type, curr);
2762 static int render_panel_ffmpeg_properties(uiBlock *block, const char * type,
2765 short event = B_NOP;
2769 if (strcmp(type, "audio") == 0) {
2770 event = B_ADD_FFMPEG_AUDIO_OPTION;
2771 } else if (strcmp(type, "video") == 0) {
2772 event = B_ADD_FFMPEG_VIDEO_OPTION;
2775 uiDefBut(block, TEX, event, "", xofs, yofs,
2776 170, 19, ffmpeg_option_to_add, 0.0, 255.0, 100, 0,
2777 "FFMPEG option to add");
2779 uiDefBut(block, BUT, event, "Add", xofs+170,yofs,
2780 30, 19, 0, 0, 0, 0, 0,
2781 "Add FFMPEG option");
2783 uiDefBlockBut(block, ffmpeg_property_add_menu, (void*) type,
2784 "Menu", xofs + 200, yofs, 40, 20,
2785 "Add FFMPEG option using menu");
2788 if (G.scene->r.ffcodecdata.properties) {
2793 prop = IDP_GetPropertyFromGroup(
2794 G.scene->r.ffcodecdata.properties, (char*) type);
2796 iter = IDP_GetGroupIterator(prop);
2798 while ((curr = IDP_GroupIterNext(iter)) != NULL) {
2799 yofs = render_panel_ffmpeg_property_option(
2800 block, xofs, yofs, curr, type);
2805 uiNewPanelHeight(block, 204-yofs);
2810 static void set_ffmpeg_preset(int preset)
2812 int isntsc = (G.scene->r.frs_sec != 25);
2814 case FFMPEG_PRESET_VCD:
2815 G.scene->r.ffcodecdata.type = FFMPEG_MPEG1;
2816 G.scene->r.ffcodecdata.video_bitrate = 1150;
2817 G.scene->r.xsch = 352;
2818 G.scene->r.ysch = isntsc ? 240 : 288;
2819 G.scene->r.ffcodecdata.gop_size = isntsc ? 18 : 15;
2820 G.scene->r.ffcodecdata.rc_max_rate = 1150;
2821 G.scene->r.ffcodecdata.rc_min_rate = 1150;
2822 G.scene->r.ffcodecdata.rc_buffer_size = 40*8;
2823 G.scene->r.ffcodecdata.mux_packet_size = 2324;
2824 G.scene->r.ffcodecdata.mux_rate = 2352 * 75 * 8;
2826 case FFMPEG_PRESET_SVCD:
2827 G.scene->r.ffcodecdata.type = FFMPEG_MPEG2;
2828 G.scene->r.ffcodecdata.video_bitrate = 2040;
2829 G.scene->r.xsch = 480;
2830 G.scene->r.ysch = isntsc ? 480 : 576;
2831 G.scene->r.ffcodecdata.gop_size = isntsc ? 18 : 15;
2832 G.scene->r.ffcodecdata.rc_max_rate = 2516;
2833 G.scene->r.ffcodecdata.rc_min_rate = 0;
2834 G.scene->r.ffcodecdata.rc_buffer_size = 224*8;
2835 G.scene->r.ffcodecdata.mux_packet_size = 2324;
2836 G.scene->r.ffcodecdata.mux_rate = 0;
2839 case FFMPEG_PRESET_DVD:
2840 G.scene->r.ffcodecdata.type = FFMPEG_MPEG2;
2841 G.scene->r.ffcodecdata.video_bitrate = 6000;
2842 G.scene->r.xsch = 720;
2843 G.scene->r.ysch = isntsc ? 480 : 576;
2844 G.scene->r.ffcodecdata.gop_size = isntsc ? 18 : 15;
2845 G.scene->r.ffcodecdata.rc_max_rate = 9000;
2846 G.scene->r.ffcodecdata.rc_min_rate = 0;
2847 G.scene->r.ffcodecdata.rc_buffer_size = 224*8;
2848 G.scene->r.ffcodecdata.mux_packet_size = 2048;
2849 G.scene->r.ffcodecdata.mux_rate = 10080000;
2852 case FFMPEG_PRESET_DV:
2853 G.scene->r.ffcodecdata.type = FFMPEG_DV;
2854 G.scene->r.xsch = 720;
2855 G.scene->r.ysch = isntsc ? 480 : 576;
2857 case FFMPEG_PRESET_H264:
2858 G.scene->r.ffcodecdata.type = FFMPEG_AVI;
2859 G.scene->r.ffcodecdata.codec = CODEC_ID_H264;
2860 G.scene->r.ffcodecdata.video_bitrate = 6000;
2861 G.scene->r.ffcodecdata.gop_size = isntsc ? 18 : 15;
2862 G.scene->r.ffcodecdata.rc_max_rate = 9000;
2863 G.scene->r.ffcodecdata.rc_min_rate = 0;
2864 G.scene->r.ffcodecdata.rc_buffer_size = 224*8;
2865 G.scene->r.ffcodecdata.mux_packet_size = 2048;
2866 G.scene->r.ffcodecdata.mux_rate = 10080000;
2868 ffmpeg_property_add_string("video", "coder:vlc");
2869 ffmpeg_property_add_string("video", "flags:loop");
2870 ffmpeg_property_add_string("video", "cmp:chroma");
2871 ffmpeg_property_add_string("video", "partitions:parti4x4");
2872 ffmpeg_property_add_string("video", "partitions:partp8x8");
2873 ffmpeg_property_add_string("video", "partitions:partb8x8");
2874 ffmpeg_property_add_string("video", "me:hex");
2875 ffmpeg_property_add_string("video", "subq:5");
2876 ffmpeg_property_add_string("video", "me_range:16");
2877 ffmpeg_property_add_string("video", "keyint_min:25");
2878 ffmpeg_property_add_string("video", "sc_threshold:40");
2879 ffmpeg_property_add_string("video", "i_qfactor:0.71");
2880 ffmpeg_property_add_string("video", "b_strategy:1");
2886 static void render_panel_ffmpeg_video(void)
2893 block = uiNewBlock(&curarea->uiblocks, "render_panel_ffmpeg_video",
2894 UI_EMBOSS, UI_HELV, curarea->win);
2896 uiNewPanelTabbed("Format", "Render");
2897 if (uiNewPanel(curarea, block, "Video", "Render", 960, 0, 318, 204)== 0)
2900 if (ffmpeg_preset_sel != 0) {
2901 set_ffmpeg_preset(ffmpeg_preset_sel);
2902 ffmpeg_preset_sel = 0;
2903 allqueue(REDRAWBUTSSCENE, 0);
2910 uiDefBut(block, LABEL, B_DIFF, "Format", xcol1, yofs+88,
2911 110, 20, 0, 0, 0, 0, 0, "");
2912 uiDefBut(block, LABEL, B_DIFF, "Preset", xcol2, yofs+88,
2913 110, 20, 0, 0, 0, 0, 0, "");
2914 uiDefButI(block, MENU, B_DIFF, ffmpeg_format_pup(),
2915 xcol1, yofs+66, 110, 20, &G.scene->r.ffcodecdata.type,
2916 0,0,0,0, "output file format");
2917 uiDefButI(block, NUM, B_DIFF, "Bitrate",
2918 xcol1, yofs+44, 110, 20,
2919 &G.scene->r.ffcodecdata.video_bitrate,
2920 1, 14000, 0, 0, "Video bitrate(kb/s)");
2921 uiDefButI(block, NUM, B_DIFF, "Min Rate",
2922 xcol1, yofs+22, 110, 20,
2923 &G.scene->r.ffcodecdata.rc_min_rate,
2924 0, G.scene->r.ffcodecdata.rc_max_rate,
2925 0, 0, "Rate control: min rate(kb/s)");
2926 uiDefButI(block, NUM, B_DIFF, "Max Rate",
2927 xcol1, yofs, 110, 20, &G.scene->r.ffcodecdata.rc_max_rate,
2928 1, 14000, 0, 0, "Rate control: max rate(kb/s)");
2930 uiDefButI(block, NUM, B_DIFF, "Mux Rate",
2931 xcol1, yofs-22, 110, 20,
2932 &G.scene->r.ffcodecdata.mux_rate,
2933 0, 100000000, 0, 0, "Mux rate (bits/s(!))");
2936 uiDefButI(block, MENU, B_REDR, ffmpeg_preset_pup(),
2937 xcol2, yofs+66, 110, 20, &ffmpeg_preset_sel,
2938 0,0,0,0, "Output file format preset selection");
2939 uiDefButI(block, NUM, B_DIFF, "GOP Size",
2940 xcol2, yofs+44, 110, 20, &G.scene->r.ffcodecdata.gop_size,
2941 0, 100, 0, 0, "Distance between key frames");
2942 uiDefButI(block, NUM, B_DIFF, "Buffersize",
2943 xcol2, yofs+22, 110, 20,
2944 &G.scene->r.ffcodecdata.rc_buffer_size,
2945 0, 2000, 0, 0, "Rate control: buffer size (kb)");
2946 uiDefButI(block, NUM, B_DIFF, "Mux PSize",
2947 xcol2, yofs, 110, 20,
2948 &G.scene->r.ffcodecdata.mux_packet_size,
2949 0, 16384, 0, 0, "Mux packet size (byte)");
2951 uiDefButBitI(block, TOG, FFMPEG_AUTOSPLIT_OUTPUT, B_NOP,
2953 xcol2, yofs-22, 110, 20,
2954 &G.scene->r.ffcodecdata.flags,
2955 0, 1, 0,0, "Autosplit output at 2GB boundary.");
2958 if (ELEM4(G.scene->r.ffcodecdata.type, FFMPEG_AVI,
2959 FFMPEG_MOV, FFMPEG_MKV, FFMPEG_OGG)) {
2960 uiDefBut(block, LABEL, 0, "Codec",
2961 xcol1, yofs-44, 110, 20, 0, 0, 0, 0, 0, "");
2962 uiDefButI(block, MENU,B_REDR, ffmpeg_codec_pup(),
2963 xcol1, yofs-66, 110, 20,
2964 &G.scene->r.ffcodecdata.codec,
2965 0,0,0,0, "FFMpeg codec to use");
2968 render_panel_ffmpeg_properties(block, "video", xcol1, yofs-86);
2971 static void render_panel_ffmpeg_audio(void)
2977 block = uiNewBlock(&curarea->uiblocks, "render_panel_ffmpeg_audio", UI_EMBOSS, UI_HELV, curarea->win);
2978 uiNewPanelTabbed("Format", "Render");
2979 if (uiNewPanel(curarea, block, "Audio", "Render", 960, 0, 318, 204) == 0) return;
2984 uiDefButBitI(block, TOG, FFMPEG_MULTIPLEX_AUDIO, B_NOP,
2985 "Multiplex audio", xcol, yofs, 225, 20,
2986 &G.scene->r.ffcodecdata.flags,
2987 0, 1, 0,0, "Interleave audio with the output video");
2988 uiDefBut(block, LABEL, 0, "Codec",
2989 xcol, yofs-22, 225, 20, 0, 0, 0, 0, 0, "");
2990 uiDefButI(block, MENU,B_NOP, ffmpeg_audio_codec_pup(),
2991 xcol, yofs-44, 225, 20,
2992 &G.scene->r.ffcodecdata.audio_codec,
2993 0,0,0,0, "FFMpeg codec to use");
2994 uiDefButI(block, NUM, B_DIFF, "Bitrate",
2995 xcol, yofs-66, 110, 20,
2996 &G.scene->r.ffcodecdata.audio_bitrate,
2997 32, 384, 0, 0, "Audio bitrate(kb/s)");
2999 render_panel_ffmpeg_properties(block, "audio", xcol, yofs-86);
3003 static void render_panel_stamp(void)
3006 int yofs=0, xofs=550;
3008 block= uiNewBlock (&curarea->uiblocks, "render_panel_stamp", UI_EMBOSS, UI_HELV, curarea->win);
3009 uiNewPanelTabbed ("Format", "Render");
3010 if(uiNewPanel (curarea, block, "Stamp", "Render", 960, 0, 318, 204)==0) return;
3012 if (G.scene->r.scemode & R_STAMP_INFO) {
3013 uiBlockBeginAlign(block);
3014 uiDefButBitI(block, TOG, R_STAMP_NOTE, B_REDR, "Note", xofs, yofs, 120, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp user data");
3015 uiDefBut(block, TEX, B_NOP, "", xofs+120, yofs, 180, 19, &G.scene->r.stamp_udata, 0.0, 128.0, 100, 0, "User Note");
3016 uiBlockEndAlign(block);
3017 yofs += 30; /* gap */
3021 /* Order is important for alligning ... grr */
3022 uiBlockBeginAlign(block);
3023 uiDefButBitI(block, TOG, R_STAMP_FILENAME, B_REDR, "Filename", xofs, yofs, 120, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp blend filename");
3025 uiDefButBitI(block, TOG, R_STAMP_SCENE, B_REDR, "Scene", xofs, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp scene name");
3026 uiDefButBitI(block, TOG, R_STAMP_CAMERA, B_REDR, "Camera", xofs+60, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp camera name");
3028 uiDefButBitI(block, TOG, R_STAMP_TIME, B_REDR, "Time", xofs, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp time (HH:MM:SS)");
3029 uiDefButBitI(block, TOG, R_STAMP_DATE, B_REDR, "Date", xofs+60, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp date");
3031 uiDefButBitI(block, TOG, R_STAMP_FRAME, B_REDR, "Frame", xofs, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp frame number");
3032 uiDefButBitI(block, TOG, R_STAMP_MARKER, B_REDR, "Marker", xofs+60, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp the last marker");
3034 uiDefButBitI(block, TOG, R_STAMP_SEQSTRIP, B_REDR, "Sequence Strip", xofs, yofs, 120, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp the forground sequence strip name");
3035 uiBlockEndAlign(block);
3038 /* draw font selector */
3039 if (G.scene->r.stamp & R_STAMP_DRAW) {
3040 uiDefButS(block, MENU, B_REDR, "Stamp Font Size%t|Tiny Text%x1|Small Text%x2|Medium Text%x3|Large Text%x0|Extra Large Text%x4|",
3041 xofs+130, yofs, 170, 19, &G.scene->r.stamp_font_id, 0, 0, 0, 0, "Choose stamp text size");
3043 /* draw fg/bg next to the scene */
3045 uiDefBut(block, LABEL, B_NOP, "Text Color", xofs+130, yofs, 70, 19, 0, 0, 0, 0, 0, "");
3046 uiDefBut(block, LABEL, B_NOP, "Background", xofs+215, yofs, 70, 19, 0, 0, 0, 0, 0, "");
3048 uiDefButF(block, COL, B_NOP, "", xofs+130, yofs, 80, 19, G.scene->r.fg_stamp, 0, 0, 0, 0, "Foreground text color");
3049 uiDefButF(block, COL, B_NOP, "", xofs+220, yofs, 80, 19, G.scene->r.bg_stamp, 0, 0, 0, 0, "Background color");
3051 uiDefButF(block, NUMSLI, B_NOP, "A ", xofs+130, yofs, 170, 19, &G.scene->r.bg_stamp[3], 0, 1.0, 0, 0, "Alpha for text background");