diff options
Diffstat (limited to 'source/blender/src/editseq.c')
-rw-r--r-- | source/blender/src/editseq.c | 508 |
1 files changed, 259 insertions, 249 deletions
diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index adc31eb0b52..1ac23530d03 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -43,7 +43,7 @@ #else #include <io.h> #include "BLI_winstuff.h" -#endif +#endif #include <sys/types.h> #include "MEM_guardedalloc.h" @@ -96,7 +96,7 @@ Sequence *last_seq=0; char last_imagename[80]= "/"; -char last_sounddir[80]= ""; +char last_sounddir[80]= ""; /* void transform_seq(int mode); already in BIF_editseq.h */ @@ -108,13 +108,13 @@ static void shuffle_seq(Sequence *); static void change_plugin_seq(char *str) /* called from fileselect */ { /* extern Sequence *last_seq; already done few lines before !!!*/ - + if(last_seq && last_seq->type!=SEQ_PLUGIN) return; - + free_plugin_seq(last_seq->plugin); - + last_seq->plugin= (PluginSeq *)add_plugin_seq(str, last_seq->name+2); - + last_seq->machine= MAX3(last_seq->seq1->machine, last_seq->seq2->machine, last_seq->seq3->machine); if( test_overlap_seq(last_seq) ) shuffle_seq(last_seq); } @@ -125,30 +125,30 @@ void boundbox_seq(void) Sequence *seq; Editing *ed; float min[2], max[2]; - + ed= G.scene->ed; if(ed==0) return; - + min[0]= 0.0; max[0]= EFRA+1; min[1]= 0.0; max[1]= 8.0; - + seq= ed->seqbasep->first; while(seq) { - + if( min[0] > seq->startdisp-1) min[0]= seq->startdisp-1; if( max[0] < seq->enddisp+1) max[0]= seq->enddisp+1; if( max[1] < seq->machine+2.0) max[1]= seq->machine+2.0; - + seq= seq->next; } - + G.v2d->tot.xmin= min[0]; G.v2d->tot.xmax= max[0]; G.v2d->tot.ymin= min[1]; G.v2d->tot.ymax= max[1]; - + } Sequence *find_nearest_seq(int *hand) @@ -157,20 +157,20 @@ Sequence *find_nearest_seq(int *hand) Editing *ed; float x, y, facx, facy; short mval[2]; - + *hand= 0; - + ed= G.scene->ed; if(ed==0) return 0; - + getmouseco_areawin(mval); areamouseco_to_ipoco(G.v2d, mval, &x, &y); - + seq= ed->seqbasep->first; while(seq) { if(seq->machine == (int)y) { if(seq->startdisp<=x && seq->enddisp>=x) { - + if(seq->type < SEQ_EFFECT) { if( seq->handsize+seq->startdisp >=x ) { /* within triangle? */ @@ -183,7 +183,7 @@ Sequence *find_nearest_seq(int *hand) facy= (y - 0.5 - (int)y)/0.3; if( facx+facy < 1.0 ) *hand= 1; } - + } else if( -seq->handsize+seq->enddisp <=x ) { /* within triangle? */ @@ -198,7 +198,7 @@ Sequence *find_nearest_seq(int *hand) } } } - + return seq; } } @@ -214,12 +214,12 @@ void clear_last_seq(void) Editing *ed; StripElem *se; int a; - + if(last_seq) { - + ed= G.scene->ed; if(ed==0) return; - + WHILE_SEQ(&ed->seqbase) { if(seq==last_seq || (last_seq->ipo && seq->ipo==last_seq->ipo)) { a= seq->len; @@ -245,7 +245,7 @@ static int test_overlap_seq(Sequence *test) ed= G.scene->ed; if(ed==0) return 0; - + seq= ed->seqbasep->first; while(seq) { if(seq!=test) { @@ -277,10 +277,10 @@ static void shuffle_seq(Sequence *test) if(seq->flag & SELECT) a++; seq= seq->next; } - + if(a<2 && test->type==SEQ_IMAGE) { start= test->start; - + for(a= 1; a<50; a++) { test->start= start+a; calc_sequence(test); @@ -291,13 +291,13 @@ static void shuffle_seq(Sequence *test) } test->start= start; } - + test->machine++; calc_sequence(test); while( test_overlap_seq(test) ) { if(test->machine >= MAXSEQ) { error("There is no more space to add a sequence strip"); - + BLI_remlink(ed->seqbasep, test); free_sequence(test); return; @@ -314,7 +314,7 @@ static void deselect_all_seq(void) ed= G.scene->ed; if(ed==0) return; - + WHILE_SEQ(ed->seqbasep) { seq->flag &= SEQ_DESEL; } @@ -324,16 +324,16 @@ static void deselect_all_seq(void) static void recurs_sel_seq(Sequence *seqm) { Sequence *seq; - + seq= seqm->seqbase.first; while(seq) { - + if(seqm->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL)) seq->flag &= SEQ_DESEL; else if(seqm->flag & SELECT) seq->flag |= SELECT; else seq->flag &= SEQ_DESEL; - + if(seq->seqbase.first) recurs_sel_seq(seq); - + seq= seq->next; } } @@ -343,22 +343,22 @@ void swap_select_seq(void) Sequence *seq; Editing *ed; int sel=0; - + ed= G.scene->ed; if(ed==0) return; - + WHILE_SEQ(ed->seqbasep) { if(seq->flag & SELECT) sel= 1; } END_SEQ - + WHILE_SEQ(ed->seqbasep) { /* always deselect all to be sure */ seq->flag &= SEQ_DESEL; if(sel==0) seq->flag |= SELECT; } END_SEQ - + allqueue(REDRAWSEQ, 0); } @@ -366,14 +366,14 @@ void mouse_select_seq(void) { Sequence *seq; int hand; - + seq= find_nearest_seq(&hand); - + if(G.qual==0) deselect_all_seq(); - + if(seq) { last_seq= seq; - + if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) { if(seq->strip) { strcpy(last_imagename, seq->strip->dir); @@ -384,7 +384,7 @@ void mouse_select_seq(void) strcpy(last_sounddir, seq->strip->dir); } } - + if(G.qual==0) { seq->flag |= SELECT; if(hand==1) seq->flag |= SEQ_LEFTSEL; @@ -410,11 +410,11 @@ void mouse_select_seq(void) } recurs_sel_seq(seq); } - + force_draw(); - + if(last_seq) allqueue(REDRAWIPO, 0); - + std_rmouse_transform(transform_seq); } @@ -422,21 +422,21 @@ static Sequence *alloc_sequence(int cfra, int machine) { Editing *ed; Sequence *seq; - + ed= G.scene->ed; - + seq= MEM_callocN( sizeof(Sequence), "addseq"); BLI_addtail(ed->seqbasep, seq); - + last_seq= seq; - + *( (short *)seq->name )= ID_SEQ; seq->name[2]= 0; - + seq->flag= SELECT; seq->start= cfra; seq->machine= machine; - + return seq; } @@ -456,25 +456,25 @@ static Sequence *sfile_to_sequence(SpaceFile *sfile, int cfra, int machine, int } } } - + if(last) { - /* if not, a file handed to us? */ + /* if not, a file handed to us? */ if(totsel==0 && sfile->file[0]) totsel= 1; } - + if(totsel==0) return 0; - + /* make seq */ seq= alloc_sequence(cfra, machine); seq->len= totsel; - + if(totsel==1) { seq->startstill= 25; seq->endstill= 24; } calc_sequence(seq); - + /* strip and stripdata */ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); strip->len= totsel; @@ -511,21 +511,21 @@ static void sfile_to_mv_sequence(SpaceFile *sfile, int cfra, int machine) StripElem *se; int totframe, a; char str[256]; - + totframe= 0; strcpy(str, sfile->dir); strcat(str, sfile->file); - + /* is it a movie? */ anim = openanim(str, IB_rect); if(anim==0) { error("The selected file is not a movie"); return; } - + totframe= IMB_anim_get_duration(anim); - + /* make seq */ seq= alloc_sequence(cfra, machine); seq->len= totframe; @@ -533,7 +533,7 @@ static void sfile_to_mv_sequence(SpaceFile *sfile, int cfra, int machine) seq->anim= anim; calc_sequence(seq); - + /* strip and stripdata */ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); strip->len= totframe; @@ -567,7 +567,7 @@ static Sequence *sfile_to_snd_sequence(SpaceFile *sfile, int cfra, int machine) strcpy(str, sfile->dir); strcat(str, sfile->file); - + sound= sound_new_sound(str); if (!sound || sound->sample->type == SAMPLE_INVALID) { error("Unsupported audio format"); @@ -580,7 +580,7 @@ static Sequence *sfile_to_snd_sequence(SpaceFile *sfile, int cfra, int machine) sound->id.us=1; sound->flags |= SOUND_FLAGS_SEQUENCE; audio_makestream(sound); - + totframe= (int) ( ((float)(sound->streamlen-1)/( (float)G.scene->audio.mixrate*4.0 ))* (float)G.scene->r.frs_sec); /* make seq */ @@ -590,7 +590,7 @@ static Sequence *sfile_to_snd_sequence(SpaceFile *sfile, int cfra, int machine) seq->sound = sound; calc_sequence(seq); - + /* strip and stripdata */ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); strip->len= totframe; @@ -609,7 +609,7 @@ static Sequence *sfile_to_snd_sequence(SpaceFile *sfile, int cfra, int machine) /* last active name */ strcpy(last_sounddir, seq->strip->dir); - + return seq; } @@ -619,10 +619,10 @@ static void add_image_strips(char *name) struct direntry *files; float x, y; int a, totfile, cfra, machine; - short mval[2]; + short mval[2]; deselect_all_seq(); - + /* restore windowmatrices */ areawinset(curarea->win); drawseqspace(curarea, curarea->spacedata.first); @@ -651,38 +651,38 @@ static void add_image_strips(char *name) strcat(sfile->dir, files[a].relname); strcat(sfile->dir,"/"); read_dir(sfile); - + /* select all */ swapselect_file(sfile); - + if ( sfile_to_sequence(sfile, cfra, machine, 0) ) machine++; - + parent(sfile); } } } - + sfile->filelist= files; sfile->totfile= totfile; - + /* read directory itself */ sfile_to_sequence(sfile, cfra, machine, 1); waitcursor(0); - + transform_seq('g'); -} +} static void add_movie_strip(char *name) { SpaceFile *sfile; float x, y; int cfra, machine; - short mval[2]; + short mval[2]; deselect_all_seq(); - + /* restore windowmatrices */ areawinset(curarea->win); drawseqspace(curarea, curarea->spacedata.first); @@ -703,10 +703,10 @@ static void add_movie_strip(char *name) sfile_to_mv_sequence(sfile, cfra, machine); waitcursor(0); - + transform_seq('g'); -} +} static void add_sound_strip(char *name) { @@ -746,7 +746,7 @@ static void reload_sound_strip(char *name) if(last_seq==0 || last_seq->type!=SEQ_SOUND) return; seqact= last_seq; /* last_seq changes in alloc_sequence */ - + /* search sfile */ sfile= scrarea_find_space_of_type(curarea, SPACE_FILE); if(sfile==0) return; @@ -760,10 +760,10 @@ static void reload_sound_strip(char *name) free_strip(seqact->strip); seqact->strip= seq->strip; - + seqact->len= seq->len; calc_sequence(seqact); - + seq->strip= 0; free_sequence(seq); BLI_remlink(ed->seqbasep, seq); @@ -788,7 +788,7 @@ static void reload_image_strip(char *name) if(last_seq==0 || last_seq->type!=SEQ_IMAGE) return; seqact= last_seq; /* last_seq changes in alloc_sequence */ - + /* search sfile */ sfile= scrarea_find_space_of_type(curarea, SPACE_FILE); if(sfile==0) return; @@ -800,10 +800,10 @@ static void reload_image_strip(char *name) free_strip(seqact->strip); seqact->strip= seq->strip; - + seqact->len= seq->len; calc_sequence(seqact); - + seq->strip= 0; free_sequence(seq); BLI_remlink(ed->seqbasep, seq); @@ -823,9 +823,9 @@ static void reload_image_strip(char *name) waitcursor(0); allqueue(REDRAWSEQ, 0); -} +} -static int event_to_efftype(int event) +static int event_to_efftype(int event) { if(event==2) return SEQ_CROSS; if(event==3) return SEQ_GAMCROSS; @@ -836,6 +836,7 @@ static int event_to_efftype(int event) if(event==8) return SEQ_ALPHAUNDER; if(event==9) return SEQ_OVERDROP; if(event==10) return SEQ_PLUGIN; + if(event==13) return SEQ_SWEEP; return 0; } @@ -846,7 +847,7 @@ static int add_seq_effect(int type) Strip *strip; float x, y; int cfra, machine; - short mval[2]; + short mval[2]; if(G.scene->ed==0) return 0; ed= G.scene->ed; @@ -857,7 +858,7 @@ static int add_seq_effect(int type) seq= ed->seqbasep->first; while(seq) { if(seq->flag & SELECT) { - if (seq->type == SEQ_SOUND) { error("Can't apply effects to audio sequence strips"); return 0; } + if (seq->type == SEQ_SOUND) { error("Can't apply effects to audio sequence strips"); return 0; } if(seq != seq2) { if(seq1==0) seq1= seq; else if(seq3==0) seq3= seq; @@ -869,8 +870,8 @@ static int add_seq_effect(int type) } seq= seq->next; } - - if(type==10) { /* plugin: minimal 1 select */ + + if(type==10 || type==13) { /* plugin: minimal 1 select */ if(seq2==0) { error("Need at least one selected sequence strip"); return 0; @@ -885,7 +886,7 @@ static int add_seq_effect(int type) } if(seq3==0) seq3= seq2; } - + deselect_all_seq(); /* where will it be (cfra is not realy needed) */ @@ -895,9 +896,14 @@ static int add_seq_effect(int type) machine= (int)(y+0.5); seq= alloc_sequence(cfra, machine); - + seq->type= event_to_efftype(type); - + + /* Allocate variable structs for effects with settings */ + if(seq->type==SEQ_SWEEP){ + seq->varstr = MEM_callocN(sizeof(struct SweepVars), "sweepvars"); + } + if(seq->type==SEQ_ALPHAUNDER || seq->type==SEQ_ALPHAOVER) { seq->seq2= seq1; seq->seq1= seq2; @@ -908,25 +914,25 @@ static int add_seq_effect(int type) } seq->seq3= seq3; calc_sequence(seq); - + seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); strip->len= seq->len; strip->us= 1; if(seq->len>0) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - + return 1; } static void load_plugin_seq(char *str) /* called from fileselect */ { Editing *ed; - + add_seq_effect(10); /* this sets last_seq */ - + free_plugin_seq(last_seq->plugin); - + last_seq->plugin= (PluginSeq *)add_plugin_seq(str, last_seq->name+2); - + if(last_seq->plugin==0) { ed= G.scene->ed; BLI_remlink(ed->seqbasep, last_seq); @@ -936,7 +942,7 @@ static void load_plugin_seq(char *str) /* called from fileselect */ else { last_seq->machine= MAX3(last_seq->seq1->machine, last_seq->seq2->machine, last_seq->seq3->machine); if( test_overlap_seq(last_seq) ) shuffle_seq(last_seq); - + transform_seq('g'); } } @@ -949,7 +955,7 @@ void add_sequence(int type) Scene *sce; float x, y; int cfra, machine; - short nr, event, mval[2]; + short nr, event, mval[2]; char *str; if (type >= 0){ @@ -994,36 +1000,39 @@ void add_sequence(int type) case SEQ_OVERDROP: event = 9; break; + case SEQ_SWEEP: + event = 13; + break; default: event = 0; break; } } else { - event= pupmenu("Add Sequence Strip%t|Images%x1|Movie%x102|Audio%x103|Scene%x101|Plugin%x10|Cross%x2|Gamma Cross%x3|Add%x4|Sub%x5|Mul%x6|Alpha Over%x7|Alpha Under%x8|Alpha Over Drop%x9"); + event= pupmenu("Add Sequence Strip%t|Images%x1|Movie%x102|Audio%x103|Scene%x101|Plugin%x10|Cross%x2|Gamma Cross%x3|Add%x4|Sub%x5|Mul%x6|Alpha Over%x7|Alpha Under%x8|Alpha Over Drop%x9|Sweep%x13"); } if(event<1) return; - + if(G.scene->ed==0) { ed= G.scene->ed= MEM_callocN( sizeof(Editing), "addseq"); ed->seqbasep= &ed->seqbase; } else ed= G.scene->ed; - + switch(event) { case 1: - + activate_fileselect(FILE_SPECIAL, "Select Images", last_imagename, add_image_strips); break; case 102: - + activate_fileselect(FILE_SPECIAL, "Select Movie", last_imagename, add_movie_strip); break; case 101: /* new menu: */ IDnames_to_pupstring(&str, NULL, NULL, &G.main->scene, (ID *)G.scene, NULL); - + event= pupmenu_col(str, 20); if(event> -1) { @@ -1035,31 +1044,31 @@ void add_sequence(int type) sce= sce->id.next; } if(sce) { - + deselect_all_seq(); - + /* where ? */ getmouseco_areawin(mval); areamouseco_to_ipoco(G.v2d, mval, &x, &y); cfra= (int)(x+0.5); machine= (int)(y+0.5); - + seq= alloc_sequence(cfra, machine); seq->type= SEQ_SCENE; seq->scene= sce; seq->sfra= sce->r.sfra; seq->len= sce->r.efra - sce->r.sfra + 1; - + seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); strip->len= seq->len; strip->us= 1; if(seq->len>0) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - + transform_seq('g'); } } MEM_freeN(str); - + break; case 2: case 3: @@ -1070,7 +1079,8 @@ void add_sequence(int type) case 8: case 9: case 10: - + case 13: + if(last_seq==0) error("Need at least one active sequence strip"); else if(event==10) { activate_fileselect(FILE_SPECIAL, "Select Plugin", U.plugseqdir, load_plugin_seq); @@ -1078,20 +1088,20 @@ void add_sequence(int type) else { if( add_seq_effect(event) ) transform_seq('g'); } - + break; case 103: if (!last_sounddir[0]) strcpy(last_sounddir, U.sounddir); activate_fileselect(FILE_SPECIAL, "Select Wav", last_sounddir, add_sound_strip); break; - } + } } void change_sequence(void) { Scene *sce; short event; - + if(last_seq==0) return; if(last_seq->type & SEQ_EFFECT) { @@ -1104,7 +1114,7 @@ void change_sequence(void) SWAP(Sequence *, last_seq->seq2, last_seq->seq3); } else if(event==11) { - activate_fileselect(FILE_SPECIAL, "Select Plugin", U.plugseqdir, change_plugin_seq); + activate_fileselect(FILE_SPECIAL, "Select Plugin", U.plugseqdir, change_plugin_seq); } else if(event==12); /* recalculate: only new_stripdata */ else { @@ -1127,15 +1137,15 @@ void change_sequence(void) } else if(last_seq->type == SEQ_SCENE) { event= pupmenu("Change Scene%t|Update Start and End"); - + if(event==1) { sce= last_seq->scene; - + last_seq->len= sce->r.efra - sce->r.sfra + 1; last_seq->sfra= sce->r.sfra; new_stripdata(last_seq); calc_sequence(last_seq); - + allqueue(REDRAWSEQ, 0); } } @@ -1146,16 +1156,16 @@ static int is_a_sequence(Sequence *test) { Sequence *seq; Editing *ed; - + ed= G.scene->ed; if(ed==0 || test==0) return 0; - + seq= ed->seqbasep->first; while(seq) { if(seq==test) return 1; seq= seq->next; } - + return 0; } @@ -1167,7 +1177,7 @@ static void recurs_del_seq(ListBase *lb) while(seq) { seqn= seq->next; if(seq->flag & SELECT) { - if(seq->type==SEQ_SOUND && seq->sound) seq->sound->id.us--; + if(seq->type==SEQ_SOUND && seq->sound) seq->sound->id.us--; BLI_remlink(lb, seq); if(seq==last_seq) last_seq= 0; if(seq->type==SEQ_META) recurs_del_seq(&seq->seqbase); @@ -1184,14 +1194,14 @@ void del_seq(void) MetaStack *ms; Editing *ed; int doit; - + if(okee("Erase selected")==0) return; ed= G.scene->ed; if(ed==0) return; - + recurs_del_seq(ed->seqbasep); - + /* test effects */ doit= 1; while(doit) { @@ -1210,14 +1220,14 @@ void del_seq(void) seq= seqn; } } - + /* updates lengths etc */ seq= ed->seqbasep->first; while(seq) { calc_sequence(seq); seq= seq->next; } - + /* free parent metas */ ms= ed->metastack.last; while(ms) { @@ -1225,7 +1235,7 @@ void del_seq(void) calc_sequence(ms->parseq); ms= ms->prev; } - + allqueue(REDRAWSEQ, 0); } @@ -1236,38 +1246,38 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new) Sequence *seq, *seqn; StripElem *se; int a; - + seq= old->first; - + while(seq) { seq->newseq= 0; if(seq->flag & SELECT) { - + if(seq->type==SEQ_META) { seqn= MEM_dupallocN(seq); seq->newseq= seqn; BLI_addtail(new, seqn); - + seqn->strip= MEM_dupallocN(seq->strip); - + if(seq->len>0) seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - + seq->flag &= SEQ_DESEL; seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); seqn->seqbase.first= seqn->seqbase.last= 0; recurs_dupli_seq(&seq->seqbase, &seqn->seqbase); - + } else if(seq->type == SEQ_SCENE) { seqn= MEM_dupallocN(seq); seq->newseq= seqn; BLI_addtail(new, seqn); - + seqn->strip= MEM_dupallocN(seq->strip); - + if(seq->len>0) seqn->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - + seq->flag &= SEQ_DESEL; seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); } @@ -1275,10 +1285,10 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new) seqn= MEM_dupallocN(seq); seq->newseq= seqn; BLI_addtail(new, seqn); - + seqn->strip= MEM_dupallocN(seq->strip); seqn->anim= 0; - + if(seqn->len>0) { seqn->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); /* copy first elem */ @@ -1290,7 +1300,7 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new) se++; } } - + seq->flag &= SEQ_DESEL; seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); } @@ -1298,11 +1308,11 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new) seqn= MEM_dupallocN(seq); seq->newseq= seqn; BLI_addtail(new, seqn); - + seqn->strip= MEM_dupallocN(seq->strip); seqn->anim= 0; seqn->sound->id.us++; - + if(seqn->len>0) { seqn->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); /* copy first elem */ @@ -1314,43 +1324,43 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new) se++; } } - + seq->flag &= SEQ_DESEL; seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); - } + } else if(seq->type < SEQ_EFFECT) { seqn= MEM_dupallocN(seq); seq->newseq= seqn; BLI_addtail(new, seqn); - + seqn->strip->us++; seq->flag &= SEQ_DESEL; - + seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); } else { if(seq->seq1->newseq) { - + seqn= MEM_dupallocN(seq); seq->newseq= seqn; BLI_addtail(new, seqn); - + seqn->seq1= seq->seq1->newseq; if(seq->seq2 && seq->seq2->newseq) seqn->seq2= seq->seq2->newseq; if(seq->seq3 && seq->seq3->newseq) seqn->seq3= seq->seq3->newseq; - + if(seqn->ipo) seqn->ipo->id.us++; - + if(seq->plugin) { seqn->plugin= MEM_dupallocN(seq->plugin); open_plugin_seq(seqn->plugin, seqn->name+2); } seqn->strip= MEM_dupallocN(seq->strip); - + if(seq->len>0) seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - + seq->flag &= SEQ_DESEL; - + seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); } } @@ -1364,15 +1374,15 @@ void add_duplicate_seq(void) { Editing *ed; ListBase new; - + ed= G.scene->ed; if(ed==0) return; - + new.first= new.last= 0; - + recurs_dupli_seq(ed->seqbasep, &new); addlisttolist(ed->seqbasep, &new); - + transform_seq('g'); } @@ -1381,11 +1391,11 @@ int insert_gap(int gap, int cfra) Sequence *seq; Editing *ed; int done=0; - + /* all strips >= cfra are shifted */ ed= G.scene->ed; if(ed==0) return 0; - + WHILE_SEQ(ed->seqbasep) { if(seq->startdisp >= cfra) { seq->start+= gap; @@ -1394,7 +1404,7 @@ int insert_gap(int gap, int cfra) } } END_SEQ - + return done; } @@ -1403,15 +1413,15 @@ void touch_seq_files(void) Sequence *seq; Editing *ed; char str[256]; - + /* touch all strips with movies */ ed= G.scene->ed; if(ed==0) return; - + if(okee("Touch and print selected movies")==0) return; - + waitcursor(1); - + WHILE_SEQ(ed->seqbasep) { if(seq->flag & SELECT) { if(seq->type==SEQ_MOVIE) { @@ -1420,11 +1430,11 @@ void touch_seq_files(void) BLI_touch(seq->name); } } - + } } END_SEQ - + waitcursor(0); } @@ -1432,18 +1442,18 @@ void set_filter_seq(void) { Sequence *seq; Editing *ed; - + ed= G.scene->ed; if(ed==0) return; - + if(okee("Set FilterY")==0) return; - + WHILE_SEQ(ed->seqbasep) { if(seq->flag & SELECT) { if(seq->type==SEQ_MOVIE) { seq->flag |= SEQ_FILTERY; } - + } } END_SEQ @@ -1456,10 +1466,10 @@ void no_gaps(void) { Editing *ed; int cfra, first= 0, done; - + ed= G.scene->ed; if(ed==0) return; - + for(cfra= CFRA; cfra<=EFRA; cfra++) { if(first==0) { if( evaluate_seq_frame(cfra) ) first= 1; @@ -1484,7 +1494,7 @@ void make_meta(void) Sequence *seq, *seqm, *next; Editing *ed; int tot; - + ed= G.scene->ed; if(ed==0) return; @@ -1499,9 +1509,9 @@ void make_meta(void) seq= seq->next; } if(tot < 2) return; - + if(okee("Make Meta Strip")==0) return; - + /* test relationships */ seq= ed->seqbasep->first; while(seq) { @@ -1530,7 +1540,7 @@ void make_meta(void) seqm= alloc_sequence(1, 1); seqm->type= SEQ_META; seqm->flag= SELECT; - + seq= ed->seqbasep->first; while(seq) { next= seq->next; @@ -1541,14 +1551,14 @@ void make_meta(void) seq= next; } calc_sequence(seqm); - + seqm->strip= MEM_callocN(sizeof(Strip), "metastrip"); seqm->strip->len= seqm->len; seqm->strip->us= 1; if(seqm->len) seqm->strip->stripdata= MEM_callocN(seqm->len*sizeof(StripElem), "metastripdata"); - + set_meta_stripdata(seqm); - + allqueue(REDRAWSEQ, 0); } @@ -1557,19 +1567,19 @@ void un_meta(void) Editing *ed; Sequence *seq, *seqn; int doit; - + ed= G.scene->ed; if(ed==0) return; - + if(last_seq==0 || last_seq->type!=SEQ_META) return; - + if(okee("Un Meta")==0) return; addlisttolist(ed->seqbasep, &last_seq->seqbase); - + last_seq->seqbase.first= 0; last_seq->seqbase.last= 0; - + BLI_remlink(ed->seqbasep, last_seq); free_sequence(last_seq); @@ -1603,9 +1613,9 @@ void un_meta(void) } } END_SEQ; - + allqueue(REDRAWSEQ, 0); - + } void exit_meta(void) @@ -1613,13 +1623,13 @@ void exit_meta(void) Sequence *seq; MetaStack *ms; Editing *ed; - + ed= G.scene->ed; if(ed==0) return; - + if(ed->metastack.first==0) return; - - ms= ed->metastack.last; + + ms= ed->metastack.last; BLI_remlink(&ed->metastack, ms); ed->seqbasep= ms->oldbasep; @@ -1635,10 +1645,10 @@ void exit_meta(void) } last_seq= ms->parseq; - + last_seq->flag= SELECT; recurs_sel_seq(last_seq); - + MEM_freeN(ms); allqueue(REDRAWSEQ, 0); } @@ -1648,22 +1658,22 @@ void enter_meta(void) { MetaStack *ms; Editing *ed; - + ed= G.scene->ed; if(ed==0) return; - + if(last_seq==0 || last_seq->type!=SEQ_META || last_seq->flag==0) { exit_meta(); return; } - + ms= MEM_mallocN(sizeof(MetaStack), "metastack"); BLI_addtail(&ed->metastack, ms); ms->parseq= last_seq; ms->oldbasep= ed->seqbasep; - + ed->seqbasep= &last_seq->seqbase; - + last_seq= 0; allqueue(REDRAWSEQ, 0); } @@ -1688,13 +1698,13 @@ void transform_seq(int mode) unsigned short event = 0; short mval[2], val, xo, yo, xn, yn; char str[32]; - + if(mode!='g') return; /* from gesture */ - + /* which seqs are involved */ ed= G.scene->ed; if(ed==0) return; - + WHILE_SEQ(ed->seqbasep) { if(seq->flag & SELECT) tot++; } @@ -1705,41 +1715,41 @@ void transform_seq(int mode) G.moving= 1; ts=transmain= MEM_callocN(tot*sizeof(TransSeq), "transseq"); - + WHILE_SEQ(ed->seqbasep) { - + if(seq->flag & SELECT) { - + ts->start= seq->start; ts->machine= seq->machine; ts->startstill= seq->startstill; ts->endstill= seq->endstill; ts->startofs= seq->startofs; ts->endofs= seq->endofs; - + ts++; } } END_SEQ - + getmouseco_areawin(mval); xo=xn= mval[0]; yo=yn= mval[1]; dvec[0]= dvec[1]= 0.0; - + while(afbreek==0) { getmouseco_areawin(mval); if(mval[0]!=xo || mval[1]!=yo || firsttime) { firsttime= 0; - + if(mode=='g') { - + dx= mval[0]- xo; dy= mval[1]- yo; - + div= G.v2d->mask.xmax-G.v2d->mask.xmin; dx= (G.v2d->cur.xmax-G.v2d->cur.xmin)*(dx)/div; - + div= G.v2d->mask.ymax-G.v2d->mask.ymin; dy= (G.v2d->cur.ymax-G.v2d->cur.ymin)*(dy)/div; @@ -1749,14 +1759,14 @@ void transform_seq(int mode) dvec[0]+= dx; dvec[1]+= dy; - + if(midtog) dvec[proj]= 0.0; ix= floor(dvec[0]+0.5); iy= floor(dvec[1]+0.5); - - + + ts= transmain; - + WHILE_SEQ(ed->seqbasep) { if(seq->flag & SELECT) { if(seq->flag & SEQ_LEFTSEL) { @@ -1807,29 +1817,29 @@ void transform_seq(int mode) } if( (seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0 ) { if(seq->type<SEQ_EFFECT) seq->start= ts->start+ ix; - + if(seq->depth==0) seq->machine= ts->machine+ iy; - + if(seq->machine<1) seq->machine= 1; else if(seq->machine>= MAXSEQ) seq->machine= MAXSEQ; } - + calc_sequence(seq); - + ts++; } } END_SEQ - + sprintf(str, "X: %d Y: %d ", ix, iy); headerprint(str); } - + xo= mval[0]; yo= mval[1]; - + /* test for effect and overlap */ - + WHILE_SEQ(ed->seqbasep) { if(seq->flag & SELECT) { seq->flag &= ~SEQ_OVERLAP; @@ -1844,11 +1854,11 @@ void transform_seq(int mode) } } END_SEQ; - + force_draw(); } else BIF_wait_for_statechange(); - + while(qtest()) { event= extern_qread(&val); if(val) { @@ -1873,9 +1883,9 @@ void transform_seq(int mode) if(afbreek) break; } } - + if(event==ESCKEY) { - + ts= transmain; WHILE_SEQ(ed->seqbasep) { if(seq->flag & SELECT) { @@ -1888,7 +1898,7 @@ void transform_seq(int mode) calc_sequence(seq); seq->flag &= ~SEQ_OVERLAP; - + ts++; } else if(seq->type & SEQ_EFFECT) { if(seq->seq1->flag & SELECT) calc_sequence(seq); @@ -1906,7 +1916,7 @@ void transform_seq(int mode) if(seq->type == SEQ_META) { calc_sequence(seq); seq->flag &= ~SEQ_OVERLAP; - if( test_overlap_seq(seq) ) shuffle_seq(seq); + if( test_overlap_seq(seq) ) shuffle_seq(seq); } else if(seq->flag & SELECT) { calc_sequence(seq); @@ -1916,14 +1926,14 @@ void transform_seq(int mode) else if(seq->type & SEQ_EFFECT) calc_sequence(seq); } END_SEQ - + /* as last: */ sort_seq(); } - + G.moving= 0; MEM_freeN(transmain); - + allqueue(REDRAWSEQ, 0); } @@ -1934,18 +1944,18 @@ void clever_numbuts_seq(void) StripElem *se; VarStruct *varstr; int a; - + if(last_seq==0) return; if(last_seq->type==SEQ_PLUGIN) { pis= last_seq->plugin; if(pis->vars==0) return; - + varstr= pis->varstr; if(varstr) { for(a=0; a<pis->vars; a++, varstr++) { add_numbut(a, varstr->type, varstr->name, varstr->min, varstr->max, &(pis->data[a]), varstr->tip); } - + if( do_clever_numbuts(pis->pname, pis->vars, REDRAW) ) { new_stripdata(last_seq); free_imbuf_effect_spec(CFRA); @@ -1983,7 +1993,7 @@ void clever_numbuts_seq(void) se= last_seq->curelem; allqueue(REDRAWSEQ, 0); } - } + } else if(last_seq->type==SEQ_META) { add_numbut(0, TEX, "Name:", 0.0, 21.0, last_seq->name+2, 0); @@ -1997,7 +2007,7 @@ void clever_numbuts_seq(void) void seq_snap_menu(void) { short event; - + event= pupmenu("Snap %t|To Current Frame%x1"); if(event < 1) return; @@ -2008,7 +2018,7 @@ void seq_snap(short event) { Editing *ed; Sequence *seq; - + ed= G.scene->ed; if(ed==0) return; @@ -2022,8 +2032,8 @@ void seq_snap(short event) } } END_SEQ - - + + /* test for effects and overlap */ WHILE_SEQ(ed->seqbasep) { if(seq->flag & SELECT) { @@ -2042,7 +2052,7 @@ void seq_snap(short event) /* as last: */ sort_seq(); - + allqueue(REDRAWSEQ, 0); } @@ -2057,7 +2067,7 @@ void borderselect_seq(void) ed= G.scene->ed; if(ed==0) return; - + val= get_border(&rect, 3); if(val) { @@ -2070,14 +2080,14 @@ void borderselect_seq(void) seq= ed->seqbasep->first; while(seq) { - + if(seq->startstill) rq.xmin= seq->start; else rq.xmin= seq->startdisp; rq.ymin= seq->machine+0.2; if(seq->endstill) rq.xmax= seq->start+seq->len; else rq.xmax= seq->enddisp; rq.ymax= seq->machine+0.8; - + if(BLI_isect_rctf(&rq, &rectf, 0)) { if(val==LEFTMOUSE) { seq->flag |= SELECT; @@ -2086,7 +2096,7 @@ void borderselect_seq(void) seq->flag &= ~SELECT; } } - + seq= seq->next; } |