Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-01-25 17:53:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-01-25 17:53:41 +0300
commit31fc0ff995497b6727457f514f499accfb94a491 (patch)
treec7fa033bd0f2c01420f654b5f2014e6a29dca681 /source/blender/editors/space_sequencer
parent2ae25bdba95c5547dadea900ac71f433b2ea81a9 (diff)
* added operators SEQUENCER_OT_lock, unlock, reload, refresh_all, view_all, view_selected.
* sequencer transform now does overlap checks. * removed old transform functions from sequencer_edit.c * shuffle_seq moved to kernel, now moves strips to the end of the last sequence of itschannel (if all channels are used). 2.4x would remove the strip. * most of the 'Strip' menu items now call their operators in the header menu, some for view and select too.
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c858
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c47
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c1049
-rw-r--r--source/blender/editors/space_sequencer/sequencer_header.c146
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h10
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c15
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c11
7 files changed, 432 insertions, 1704 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index b776b1acc97..7e7076d56d8 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -92,862 +92,6 @@
/* own include */
#include "sequencer_intern.h"
-static void BIF_undo_push() {}
-static void error() {}
-static void waitcursor() {}
-static void activate_fileselect() {}
-
-
-static int pupmenu() {return 0;}
-static int pupmenu_col() {return 0;}
-
-
-
-
-static void transform_seq_nomarker() {}
-
-
-
-
-
-
-static Sequence *sfile_to_sequence(Scene *scene, SpaceFile *sfile, int cfra, int machine, int last)
-{
-#if 0
- /* XXX sfile recoded... */
- Sequence *seq;
- Strip *strip;
- StripElem *se;
- int totsel, a;
- char name[160];
- Editing *ed= scene->ed;
-
- /* are there selected files? */
- totsel= 0;
- for(a=0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if( (sfile->filelist[a].type & S_IFDIR)==0 ) {
- totsel++;
- }
- }
- }
-
- if(last) {
- /* 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(((Editing *)scene->ed)->seqbasep, cfra, machine);
- seq->len= totsel;
-
- if(totsel==1) {
- seq->startstill= 25;
- seq->endstill= 24;
- }
-
- calc_sequence(seq);
-
- if(sfile->flag & FILE_STRINGCODE) {
- strcpy(name, sfile->dir);
- BLI_makestringcode(G.sce, name);
- } else {
- strcpy(name, sfile->dir);
- }
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totsel;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(totsel*sizeof(StripElem), "stripelem");
-
- for(a=0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if( (sfile->filelist[a].type & S_IFDIR)==0 ) {
- strncpy(se->name, sfile->filelist[a].relname, FILE_MAXFILE-1);
- se++;
- }
- }
- }
- /* no selected file: */
- if(totsel==1 && se==strip->stripdata) {
- strncpy(se->name, sfile->file, FILE_MAXFILE-1);
- }
-
- /* last active name */
- strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1);
-
- return seq;
-#endif
- return NULL;
-}
-
-
-#if 0
-static int sfile_to_mv_sequence_load(Scene *scene, SpaceFile *sfile, int cfra,
- int machine, int index )
-{
- /* XXX sfile recoded... */
- Sequence *seq;
- struct anim *anim;
- Strip *strip;
- StripElem *se;
- int totframe;
- char name[160];
- char str[FILE_MAXDIR+FILE_MAXFILE];
- Editing *ed= scene->ed;
-
- totframe= 0;
-
- strncpy(str, sfile->dir, FILE_MAXDIR-1);
- if(index<0)
- strncat(str, sfile->file, FILE_MAXDIR-1);
- else
- strncat(str, sfile->filelist[index].relname, FILE_MAXDIR-1);
-
- /* is it a movie? */
- anim = openanim(str, IB_rect);
- if(anim==0) {
- error("The selected file is not a movie or "
- "FFMPEG-support not compiled in!");
- return(cfra);
- }
-
- totframe= IMB_anim_get_duration(anim);
-
- /* make seq */
- seq= alloc_sequence(((Editing *)scene->ed)->seqbasep, cfra, machine);
- seq->len= totframe;
- seq->type= SEQ_MOVIE;
- seq->anim= anim;
- seq->anim_preseek = IMB_anim_get_preseek(anim);
-
- calc_sequence(seq);
-
- if(sfile->flag & FILE_STRINGCODE) {
- strcpy(name, sfile->dir);
- BLI_makestringcode(G.sce, name);
- } else {
- strcpy(name, sfile->dir);
- }
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totframe;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
-
- /* name movie in first strip */
- if(index<0)
- strncpy(se->name, sfile->file, FILE_MAXFILE-1);
- else
- strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1);
-
- /* last active name */
- strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1);
- return(cfra+totframe);
-}
-#endif
-
-static void sfile_to_mv_sequence(SpaceFile *sfile, int cfra, int machine)
-{
-#if 0
- /* XXX sfile recoded... */
- int a, totsel;
-
- totsel= 0;
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if ((sfile->filelist[a].type & S_IFDIR)==0) {
- totsel++;
- }
- }
- }
-
- if((totsel==0) && (sfile->file[0])) {
- cfra= sfile_to_mv_sequence_load(sfile, cfra, machine, -1);
- return;
- }
-
- if(totsel==0) return;
-
- /* ok. check all the select file, and load it. */
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if ((sfile->filelist[a].type & S_IFDIR)==0) {
- /* load and update current frame. */
- cfra= sfile_to_mv_sequence_load(sfile, cfra, machine, a);
- }
- }
- }
-#endif
-}
-
-static Sequence *sfile_to_ramsnd_sequence(Scene *scene, SpaceFile *sfile, int cfra, int machine)
-{
-#if 0
- /* XXX sfile recoded... */
- Sequence *seq;
- bSound *sound;
- Strip *strip;
- StripElem *se;
- double totframe;
- char name[160];
- char str[256];
-
- totframe= 0.0;
-
- strncpy(str, sfile->dir, FILE_MAXDIR-1);
- strncat(str, sfile->file, FILE_MAXFILE-1);
-
- sound= sound_new_sound(str);
- if (!sound || sound->sample->type == SAMPLE_INVALID) {
- error("Unsupported audio format");
- return 0;
- }
- if (sound->sample->bits != 16) {
- error("Only 16 bit audio is supported");
- return 0;
- }
- sound->id.us=1;
- sound->flags |= SOUND_FLAGS_SEQUENCE;
- audio_makestream(sound);
-
- totframe= (int) ( ((float)(sound->streamlen-1)/
- ( (float)scene->r.audio.mixrate*4.0 ))* FPS);
-
- /* make seq */
- seq= alloc_sequence(((Editing *)scene->ed)->seqbasep, cfra, machine);
- seq->len= totframe;
- seq->type= SEQ_RAM_SOUND;
- seq->sound = sound;
-
- calc_sequence(seq);
-
- if(sfile->flag & FILE_STRINGCODE) {
- strcpy(name, sfile->dir);
- BLI_makestringcode(G.sce, name);
- } else {
- strcpy(name, sfile->dir);
- }
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totframe;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
-
- /* name sound in first strip */
- strncpy(se->name, sfile->file, FILE_MAXFILE-1);
-
- /* last active name */
- strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1);
-
- return seq;
-#endif
- return NULL;
-}
-
-#if 0
-static int sfile_to_hdsnd_sequence_load(SpaceFile *sfile, int cfra,
- int machine, int index)
-{
- /* XXX sfile recoded... */
- Sequence *seq;
- struct hdaudio *hdaudio;
- Strip *strip;
- StripElem *se;
- int totframe;
- char name[160];
- char str[FILE_MAXDIR+FILE_MAXFILE];
-
- totframe= 0;
-
- strncpy(str, sfile->dir, FILE_MAXDIR-1);
- if(index<0)
- strncat(str, sfile->file, FILE_MAXDIR-1);
- else
- strncat(str, sfile->filelist[index].relname, FILE_MAXDIR-1);
-
- /* is it a sound file? */
- hdaudio = sound_open_hdaudio(str);
- if(hdaudio==0) {
- error("The selected file is not a sound file or "
- "FFMPEG-support not compiled in!");
- return(cfra);
- }
-
- totframe= sound_hdaudio_get_duration(hdaudio, FPS);
-
- /* make seq */
- seq= alloc_sequence(((Editing *)scene->ed)->seqbasep, cfra, machine);
- seq->len= totframe;
- seq->type= SEQ_HD_SOUND;
- seq->hdaudio= hdaudio;
-
- calc_sequence(seq);
-
- if(sfile->flag & FILE_STRINGCODE) {
- strcpy(name, sfile->dir);
- BLI_makestringcode(G.sce, name);
- } else {
- strcpy(name, sfile->dir);
- }
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totframe;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
-
- /* name movie in first strip */
- if(index<0)
- strncpy(se->name, sfile->file, FILE_MAXFILE-1);
- else
- strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1);
-
- /* last active name */
- strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1);
- return(cfra+totframe);
-}
-#endif
-
-static void sfile_to_hdsnd_sequence(SpaceFile *sfile, int cfra, int machine)
-{
-#if 0
- /* XXX sfile recoded... */
- int totsel, a;
-
- totsel= 0;
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if((sfile->filelist[a].type & S_IFDIR)==0) {
- totsel++;
- }
- }
- }
-
- if((totsel==0) && (sfile->file[0])) {
- cfra= sfile_to_hdsnd_sequence_load(sfile, cfra, machine, -1);
- return;
- }
-
- if(totsel==0) return;
-
- /* ok, check all the select file, and load it. */
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if((sfile->filelist[a].type & S_IFDIR)==0) {
- /* load and update current frame. */
- cfra= sfile_to_hdsnd_sequence_load(sfile, cfra, machine, a);
- }
- }
- }
-#endif
-}
-
-
-static void add_image_strips(Scene *scene, char *name)
-{
-#if 0
- /* XXX sfile recoded... */
-
- SpaceFile *sfile;
- struct direntry *files;
- float x, y;
- int a, totfile, cfra, machine;
- short mval[2];
-
- deselect_all_seq(scene);
-
- /* restore windowmatrices */
-// XXX drawseqspace(curarea, curarea->spacedata.first);
-
- /* search sfile */
-// sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if(sfile==0) return;
-
- /* where will it be */
-// getmouseco_areawin(mval);
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- /* also read contents of directories */
- files= sfile->filelist;
- totfile= sfile->totfile;
- sfile->filelist= 0;
- sfile->totfile= 0;
-
- for(a=0; a<totfile; a++) {
- if(files[a].flags & ACTIVE) {
- if( (files[a].type & S_IFDIR) ) {
- strncat(sfile->dir, files[a].relname, FILE_MAXFILE-1);
- strcat(sfile->dir,"/");
- read_dir(sfile);
-
- /* select all */
- swapselect_file(sfile);
-
- if ( sfile_to_sequence(scene, sfile, cfra, machine, 0) ) machine++;
-
- parent(sfile);
- }
- }
- }
-
- sfile->filelist= files;
- sfile->totfile= totfile;
-
- /* read directory itself */
- sfile_to_sequence(scene, sfile, cfra, machine, 1);
-
- waitcursor(0);
-
- BIF_undo_push("Add Image Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-#endif
-}
-
-static void add_movie_strip(Scene *scene, View2D *v2d, char *name)
-{
-
- /* XXX sfile recoded... */
- SpaceFile *sfile;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- deselect_all_seq(scene);
-
- /* restore windowmatrices */
-// drawseqspace(curarea, curarea->spacedata.first);
-
- /* search sfile */
-// sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if(sfile==0) return;
-
- /* where will it be */
-// getmouseco_areawin(mval);
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- /* read directory itself */
- sfile_to_mv_sequence(sfile, cfra, machine);
-
- waitcursor(0);
-
- BIF_undo_push("Add Movie Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-
-}
-
-static void add_movie_and_hdaudio_strip(Scene *scene, View2D *v2d, char *name)
-{
- SpaceFile *sfile;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- deselect_all_seq(scene);
-
- /* restore windowmatrices */
-// areawinset(curarea->win);
-// drawseqspace(curarea, curarea->spacedata.first);
-
- /* search sfile */
-// sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if(sfile==0) return;
-
- /* where will it be */
-// getmouseco_areawin(mval);
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- /* read directory itself */
- sfile_to_hdsnd_sequence(sfile, cfra, machine);
- sfile_to_mv_sequence(sfile, cfra, machine);
-
- waitcursor(0);
-
- BIF_undo_push("Add Movie and HD-Audio Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-
-}
-
-static void add_sound_strip_ram(Scene *scene, View2D *v2d, char *name)
-{
- SpaceFile *sfile;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- deselect_all_seq(scene);
-
-// sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if (sfile==0) return;
-
- /* where will it be */
-// getmouseco_areawin(mval);
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- sfile_to_ramsnd_sequence(scene, sfile, cfra, machine);
-
- waitcursor(0);
-
- BIF_undo_push("Add Sound (RAM) Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-}
-
-static void add_sound_strip_hd(Scene *scene, View2D *v2d, char *name)
-{
- SpaceFile *sfile;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- deselect_all_seq(scene);
-
-// sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if (sfile==0) return;
-
- /* where will it be */
-// getmouseco_areawin(mval);
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- sfile_to_hdsnd_sequence(sfile, cfra, machine);
-
- waitcursor(0);
-
- BIF_undo_push("Add Sound (HD) Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-}
-
-static void add_scene_strip(Scene *scene, View2D *v2d, short event)
-{
- Sequence *seq;
- Strip *strip;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- if(event> -1) {
- int nr= 1;
- Scene * sce= G.main->scene.first;
- while(sce) {
- if( event==nr) break;
- nr++;
- sce= sce->id.next;
- }
- if(sce) {
-
- deselect_all_seq(scene);
-
- /* where ? */
-// getmouseco_areawin(mval);
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- seq= alloc_sequence(((Editing *)scene->ed)->seqbasep, 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");
- strncpy(seq->name + 2, sce->id.name + 2,
- sizeof(seq->name) - 2);
- strip->len= seq->len;
- strip->us= 1;
-
- BIF_undo_push("Add Scene Strip, Sequencer");
- transform_seq_nomarker('g', 0);
- }
- }
-}
-
-
-
-static int add_seq_effect(Scene *scene, View2D *v2d, int type, char *str)
-{
- Editing *ed;
- Sequence *newseq, *seq1, *seq2, *seq3;
- Strip *strip;
- float x, y;
- int cfra, machine;
- short mval[2];
- struct SeqEffectHandle sh;
-
- if(scene->ed==NULL) return 0;
- ed= scene->ed;
-
- if(!seq_effect_find_selected(scene, NULL, event_to_efftype(type), &seq1, &seq2, &seq3))
- return 0;
-
- deselect_all_seq(scene);
-
- /* where will it be (cfra is not realy needed) */
-// getmouseco_areawin(mval);
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- /* allocate and initialize */
- newseq= alloc_sequence(((Editing *)scene->ed)->seqbasep, cfra, machine);
- newseq->type= event_to_efftype(type);
-
- sh = get_sequence_effect(newseq);
-
- newseq->seq1= seq1;
- newseq->seq2= seq2;
- newseq->seq3= seq3;
-
- sh.init(newseq);
-
- if (!seq1) {
- newseq->len= 1;
- newseq->startstill= 25;
- newseq->endstill= 24;
- }
-
- calc_sequence(newseq);
-
- newseq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= newseq->len;
- strip->us= 1;
- if(newseq->len>0)
- strip->stripdata= MEM_callocN(newseq->len*sizeof(StripElem), "stripelem");
-
- /* initialize plugin */
- if(newseq->type == SEQ_PLUGIN) {
- sh.init_plugin(newseq, str);
-
- if(newseq->plugin==0) {
- BLI_remlink(ed->seqbasep, newseq);
- seq_free_sequence(ed, newseq);
- set_last_seq(scene, NULL);
- return 0;
- }
- }
-
- /* set find a free spot to but the strip */
- if (newseq->seq1) {
- newseq->machine= MAX3(newseq->seq1->machine,
- newseq->seq2->machine,
- newseq->seq3->machine);
- }
- if(test_overlap_seq(scene, newseq)) shuffle_seq(scene, newseq);
-
- update_changed_seq_and_deps(scene, newseq, 1, 1);
-
- /* push undo and go into grab mode */
- if(newseq->type == SEQ_PLUGIN) {
- BIF_undo_push("Add Plugin Strip, Sequencer");
- } else {
- BIF_undo_push("Add Effect Strip, Sequencer");
- }
-
- transform_seq_nomarker('g', 0);
-
- return 1;
-}
-
-static void load_plugin_seq(Scene *scene, View2D *v2d, char *str) /* called from fileselect */
-{
- add_seq_effect(scene, v2d, 10, str);
-}
-
-void add_sequence(Scene *scene, View2D *v2d, int type)
-{
- Editing *ed= scene->ed;
- short event;
- char *str;
-
- if (type >= 0){
- /* bypass pupmenu for calls from menus (aphex) */
- switch(type){
- case SEQ_SCENE:
- event = 101;
- break;
- case SEQ_IMAGE:
- event = 1;
- break;
- case SEQ_MOVIE:
- event = 102;
- break;
- case SEQ_RAM_SOUND:
- event = 103;
- break;
- case SEQ_HD_SOUND:
- event = 104;
- break;
- case SEQ_MOVIE_AND_HD_SOUND:
- event = 105;
- break;
- case SEQ_PLUGIN:
- event = 10;
- break;
- case SEQ_CROSS:
- event = 2;
- break;
- case SEQ_ADD:
- event = 4;
- break;
- case SEQ_SUB:
- event = 5;
- break;
- case SEQ_ALPHAOVER:
- event = 7;
- break;
- case SEQ_ALPHAUNDER:
- event = 8;
- break;
- case SEQ_GAMCROSS:
- event = 3;
- break;
- case SEQ_MUL:
- event = 6;
- break;
- case SEQ_OVERDROP:
- event = 9;
- break;
- case SEQ_WIPE:
- event = 13;
- break;
- case SEQ_GLOW:
- event = 14;
- break;
- case SEQ_TRANSFORM:
- event = 15;
- break;
- case SEQ_COLOR:
- event = 16;
- break;
- case SEQ_SPEED:
- event = 17;
- break;
- default:
- event = 0;
- break;
- }
- }
- else {
- event= pupmenu("Add Sequence Strip%t"
- "|Image Sequence%x1"
- "|Movie%x102"
-#ifdef WITH_FFMPEG
- "|Movie + Audio (HD)%x105"
- "|Audio (RAM)%x103"
- "|Audio (HD)%x104"
-#else
- "|Audio (Wav)%x103"
-#endif
- "|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"
- "|Wipe%x13"
- "|Glow%x14"
- "|Transforms%x15"
- "|Color Generator%x16"
- "|Speed Control%x17");
- }
-
- if(event<1) return;
-
- if(scene->ed==NULL) {
- ed= scene->ed= MEM_callocN( sizeof(Editing), "addseq");
- ed->seqbasep= &ed->seqbase;
- }
-
- switch(event) {
- case 1:
- /* Image Dosnt work at the moment - TODO */
- //if(G.qual & LR_CTRLKEY)
- // activate_imageselect(FILE_SPECIAL, "Select Images", ed->act_imagedir, add_image_strips);
- //else
- activate_fileselect(FILE_SPECIAL, "Select Images", ed->act_imagedir, add_image_strips);
- break;
- case 105:
- activate_fileselect(FILE_SPECIAL, "Select Movie+Audio", ed->act_imagedir, add_movie_and_hdaudio_strip);
- break;
- case 102:
-
- activate_fileselect(FILE_SPECIAL, "Select Movie", ed->act_imagedir, add_movie_strip);
- break;
- case 101:
- /* new menu: */
- IDnames_to_pupstring(&str, NULL, NULL, &G.main->scene, (ID *)scene, NULL);
-
- add_scene_strip(scene, v2d, pupmenu_col(str, 20));
-
- MEM_freeN(str);
-
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- if(get_last_seq(scene)==0 &&
- get_sequence_effect_num_inputs( event_to_efftype(event))> 0)
- error("Need at least one active sequence strip");
- else if(event==10)
- activate_fileselect(FILE_SPECIAL, "Select Plugin", U.plugseqdir, load_plugin_seq);
- else
- add_seq_effect(scene, v2d, event, NULL);
-
- break;
- case 103:
- if (ed->act_sounddir[0]=='\0') strncpy(ed->act_sounddir, U.sounddir, FILE_MAXDIR-1);
- activate_fileselect(FILE_SPECIAL, "Select Audio (RAM)", ed->act_sounddir, add_sound_strip_ram);
- break;
- case 104:
- if (ed->act_sounddir[0]=='\0') strncpy(ed->act_sounddir, U.sounddir, FILE_MAXDIR-1);
- activate_fileselect(FILE_SPECIAL, "Select Audio (HD)", ed->act_sounddir, add_sound_strip_hd);
- break;
- }
-}
-
-
/* Generic functions, reused by add strip operators */
static void sequencer_generic_props__internal(wmOperatorType *ot, int do_filename, int do_endframe)
{
@@ -1101,7 +245,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "scene", sce_name);
- sce_seq= find_id("SC", sce_name);
+ sce_seq= (Scene *)find_id("SC", sce_name);
if (sce_seq==NULL) {
BKE_reportf(op->reports, RPT_ERROR, "Scene \"%s\" not found", sce_name);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index e719d0ace2c..ee03aee3fab 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -73,9 +73,6 @@
#define SEQ_LEFTHANDLE 1
#define SEQ_RIGHTHANDLE 2
-#define SEQ_STRIP_OFSBOTTOM 0.2
-#define SEQ_STRIP_OFSTOP 0.8
-
/* Note, Dont use WHILE_SEQ while drawing! - it messes up transform, - Campbell */
int no_rightbox=0, no_leftbox= 0;
@@ -807,7 +804,7 @@ static void draw_image_seq(Scene *scene, ARegion *ar, SpaceSeq *sseq)
if(ibuf->rect==NULL && ibuf->rect_float == NULL)
return;
- switch(sseq->mainb) {
+ switch(sseq->mainb != SEQ_DRAW_SEQUENCE) {
case SEQ_DRAW_IMG_IMBUF:
if (sseq->zebra != 0) {
ibuf = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
@@ -905,44 +902,6 @@ void seq_reset_imageofs(SpaceSeq *sseq)
sseq->xof = sseq->yof = sseq->zoom = 0;
}
-void seq_home(Scene *scene, ARegion *ar, SpaceSeq *sseq)
-{
- View2D *v2d= &ar->v2d;
-
- if (!sseq->mainb) {
- v2d->cur= v2d->tot;
-// test_view2d(v2d, ar->winx, ar->winy);
-// view2d_do_locks(ar, V2D_LOCK_COPY);
- } else {
- float zoomX, zoomY;
- int width, height, imgwidth, imgheight;
-
- width = ar->winx;
- height = ar->winy;
-
- seq_reset_imageofs(sseq);
-
- imgwidth= (scene->r.size*scene->r.xsch)/100;
- imgheight= (scene->r.size*scene->r.ysch)/100;
-
- /* Apply aspect, dosnt need to be that accurate */
- imgwidth= (int)(imgwidth * ((float)scene->r.xasp / (float)scene->r.yasp));
-
- if (((imgwidth >= width) || (imgheight >= height)) &&
- ((width > 0) && (height > 0))) {
-
- /* Find the zoom value that will fit the image in the image space */
- zoomX = ((float)width) / ((float)imgwidth);
- zoomY = ((float)height) / ((float)imgheight);
- sseq->zoom= (zoomX < zoomY) ? zoomX : zoomY;
-
- sseq->zoom = 1.0f / power_of_2(1/ MIN2(zoomX, zoomY) );
- }
- else {
- sseq->zoom= 1.0f;
- }
- }
-}
#if 0
/* XXX - these should really be made to use View2D instead of so wacko private system - Aligorith */
@@ -1016,7 +975,7 @@ void drawprefetchseqspace(Scene *scene, ARegion *ar, SpaceSeq *sseq)
rectx= (scene->r.size*scene->r.xsch)/100;
recty= (scene->r.size*scene->r.ysch)/100;
- if(sseq->mainb) {
+ if(sseq->mainb != SEQ_DRAW_SEQUENCE) {
give_ibuf_prefetch_request(
rectx, recty, (scene->r.cfra), sseq->chanshown);
}
@@ -1036,7 +995,7 @@ void drawseqspace(const bContext *C, ARegion *ar)
ed= scene->ed;
- if(sseq->mainb) {
+ if(sseq->mainb != SEQ_DRAW_SEQUENCE) {
draw_image_seq(scene, ar, sseq);
return;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 57d3a9722f4..a66c7b8bd39 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -66,8 +66,6 @@
#include "BKE_utildefines.h"
#include "BKE_report.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "BIF_transform.h"
#include "WM_api.h"
@@ -155,114 +153,19 @@ Sequence *get_forground_frame_seq(Scene *scene, int frame)
return best_seq;
}
-/* check if one side can be transformed */
-int seq_tx_check_left(Sequence *seq)
-{
- if (seq->flag & SELECT) {
- if (seq->flag & SEQ_LEFTSEL)
- return 1;
- else if (seq->flag & SEQ_RIGHTSEL)
- return 0;
-
- return 1; /* selected and neither left or right handles are, so let us move both */
- }
- return 0;
-}
-
-int seq_tx_check_right(Sequence *seq)
-{
- if (seq->flag & SELECT) {
- if (seq->flag & SEQ_RIGHTSEL)
- return 1;
- else if (seq->flag & SEQ_LEFTSEL)
- return 0;
-
- return 1; /* selected and neither left or right handles are, so let us move both */
- }
- return 0;
-}
-
void seq_rectf(Sequence *seq, rctf *rectf)
{
if(seq->startstill) rectf->xmin= seq->start;
else rectf->xmin= seq->startdisp;
- rectf->ymin= seq->machine+0.2;
+ rectf->ymin= seq->machine+SEQ_STRIP_OFSBOTTOM;
if(seq->endstill) rectf->xmax= seq->start+seq->len;
else rectf->xmax= seq->enddisp;
- rectf->ymax= seq->machine+0.8;
-}
-
-int test_overlap_seq(Scene *scene, Sequence *test)
-{
- Sequence *seq;
- Editing *ed;
-
- ed= scene->ed;
- if(ed==NULL) return 0;
-
- seq= ed->seqbasep->first;
- while(seq) {
- if(seq!=test) {
- if(test->machine==seq->machine) {
- if(test->depth==seq->depth) {
- if( (test->enddisp <= seq->startdisp) || (test->startdisp >= seq->enddisp) );
- else return 1;
- }
- }
- }
- seq= seq->next;
- }
- return 0;
-}
-
-void shuffle_seq(Scene *scene, Sequence *test)
-{
- Editing *ed;
- Sequence *seq;
- int a, start;
-
- ed= scene->ed;
- if(ed==NULL) return;
-
- /* is there more than 1 select: only shuffle y */
- a=0;
- seq= ed->seqbasep->first;
- while(seq) {
- 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);
- if( test_overlap_seq(scene, test)==0) return;
- test->start= start-a;
- calc_sequence(test);
- if( test_overlap_seq(scene, test)==0) return;
- }
- test->start= start;
- }
-
- test->machine++;
- calc_sequence(test);
- while( test_overlap_seq(scene, test) ) {
- if(test->machine >= MAXSEQ) {
- error("There is no more space to add a sequence strip");
-
- BLI_remlink(ed->seqbasep, test);
- seq_free_sequence(ed, test);
- return;
- }
- test->machine++;
- calc_sequence(test);
- }
+ rectf->ymax= seq->machine+SEQ_STRIP_OFSTOP;
}
static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect */
{
+ Editing *ed= scene->ed;
struct SeqEffectHandle sh;
Sequence *last_seq= get_last_seq(scene);
@@ -276,7 +179,7 @@ static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect
last_seq->seq2->machine,
last_seq->seq3->machine);
- if( test_overlap_seq(scene, last_seq) ) shuffle_seq(scene, last_seq);
+ if( seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq);
BIF_undo_push("Load/Change Plugin, Sequencer");
}
@@ -313,18 +216,6 @@ void boundbox_seq(Scene *scene, rctf *rect)
}
-/* XXX - use mouse_frame_side instead */
-char mouse_cfra_side(View2D *v2d, int frame )
-{
- short mval[2];
- float xmouse, ymouse;
-// getmouseco_areawin(mval);
-
- /* choose the side based on which side of the playhead the mouse is on */
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &xmouse, &ymouse);
- return (xmouse > frame) ? 'R' : 'L';
-}
-
int mouse_frame_side(View2D *v2d, short mouse_x, int frame )
{
short mval[2];
@@ -870,19 +761,6 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
return 1;
}
-void reload_sequence(Scene *scene)
-{
- Editing *ed= scene->ed;
- Sequence *seq;
-
- SEQP_BEGIN(ed, seq) {
- if(seq->flag & SELECT) {
- update_changed_seq_and_deps(scene, seq, 0, 1);
- }
- }
- SEQ_END
-}
-
void reassign_inputs_seq_effect(Scene *scene)
{
Editing *ed= scene->ed;
@@ -1447,7 +1325,7 @@ void no_gaps(Scene *scene)
BIF_undo_push("No Gaps, Sequencer");
}
-
+#if 0
static int seq_get_snaplimit(View2D *v2d)
{
/* fake mouse coords to get the snap value
@@ -1461,621 +1339,7 @@ static int seq_get_snaplimit(View2D *v2d)
UI_view2d_region_to_view(v2d, mval[0], mval[1], &xmouse, &ymouse);
return (int)(x - xmouse);
}
-
-static int can_transform_seq_test_func(Sequence * seq)
-{
- if((seq->flag & SELECT) && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
- return BUILD_SEQAR_COUNT_CURRENT | BUILD_SEQAR_COUNT_CHILDREN;
- }
- if ((seq->depth==0 && seq->flag & SEQ_LOCK) && !(seq->type & SEQ_EFFECT)) {
- if (seq->type != SEQ_META) {
- return BUILD_SEQAR_COUNT_NOTHING;
- } else {
- return BUILD_SEQAR_COUNT_CURRENT;
- }
- }
- return BUILD_SEQAR_COUNT_CURRENT | BUILD_SEQAR_COUNT_CHILDREN;
-}
-
-void transform_seq(Scene *scene, SpaceSeq *sseq, View2D *v2d, int mode, int context)
-{
- Sequence *seq, *last_seq;
- Editing *ed;
- float dx, dy, dvec[2], div;
- TransSeq *transmain, *ts;
- int totstrip=0, firsttime=1, afbreek=0, midtog= 0, proj= 0;
- int ix, iy; /* these values are used for storing the mouses offset from its original location */
- int ix_old = 0;
- unsigned short event = 0;
- short mval[2], xo, yo, xn, yn;
- char str[32];
- char side= 'L'; /* for extend mode only - use to know which side to extend on */
- char marker_moved=0; /* if we mvoed a marker, redraw all marker views */
- /* used for extend in a number of places */
- int cfra = CFRA;
-
- /* for snapping */
- char snapskip = 0, snap, snap_old= 0;
- int snapdist_max = seq_get_snaplimit(v2d);
- /* at the moment there are only 4 possible snap points,
- - last_seq (start,end)
- - selected bounds (start/end)
- - last_seq (next/prev)
- - current frame */
- int snap_points[4], snap_point_num = 0;
- int j; /* loop on snap_points */
-
- /* for markers */
- int *oldframe = NULL, totmark=0, a;
- TimeMarker *marker;
-
- /* looping on sequences, WHILE_SEQ macro allocates memory each time */
- int totseq_index, seq_index;
- Sequence **seqar = 0;
-
- if(mode!='g' && mode!='e') return; /* from gesture */
-
- /* which seqs are involved */
- ed= scene->ed;
- if(ed==NULL) return;
-
- /* Build the sequence array once, be sure to free it */
- build_seqar_cb( ed->seqbasep, &seqar, &totseq_index,
- can_transform_seq_test_func );
-
- if (seqar) {
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if((seq->flag & SELECT) && !(seq->depth==0 && seq->flag & SEQ_LOCK))
- totstrip++;
- /* only needed for extend but can set here anyway since were alredy looping */
- seq->tmp= NULL;
- }
- }
-
- /* for extending we need the metastrip clipped left/right values, set the metastrips as parents in seq->tmp */
- if (mode=='e') {
- Sequence *meta_seq;
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if (seq->type == SEQ_META) {
- for (meta_seq = seq->seqbase.first; meta_seq; meta_seq= meta_seq->next){
- meta_seq->tmp= (void *)seq;
- }
- }
- }
- }
-
-
- if (sseq->flag & SEQ_MARKER_TRANS) {
- for(marker= scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) totmark++;
- }
- }
-
- if(totstrip==0 && totmark==0) {
- if(seqar) MEM_freeN(seqar);
- return;
- }
-
- G.moving= 1;
-
- last_seq = get_last_seq(scene);
-
- ts=transmain= MEM_callocN(totstrip*sizeof(TransSeq), "transseq");
-
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if((seq->flag & SELECT) && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
- ts->start= seq->start;
- ts->machine= seq->machine;
- ts->startstill= seq->startstill;
- ts->endstill= seq->endstill;
- ts->startofs= seq->startofs;
- ts->endofs= seq->endofs;
-
- /* for extend only */
- if (mode=='e') {
- ts->final_left = seq_tx_get_final_left(seq, 1);
- ts->final_right = seq_tx_get_final_right(seq, 1);
- }
- ts++;
- }
- }
-
-// getmouseco_areawin(mval);
-
- /* choose the side based on which side of the playhead the mouse is on */
- if (mode=='e')
- side = mouse_cfra_side(v2d, cfra);
-
- /* Markers */
- if (sseq->flag & SEQ_MARKER_TRANS && totmark) {
- oldframe= MEM_mallocN(totmark*sizeof(int), "marker array");
- for(a=0, marker= scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- if (mode=='e') {
-
- /* when extending, invalidate markers on the other side by using an invalid frame value */
- if ((side == 'L' && marker->frame > cfra) || (side == 'R' && marker->frame < cfra)) {
- oldframe[a] = MAXFRAME+1;
- } else {
- oldframe[a]= marker->frame;
- }
- } else {
- oldframe[a]= marker->frame;
- }
- a++;
- }
- }
- }
-
- xo=xn= mval[0];
- yo=yn= mval[1];
- dvec[0]= dvec[1]= 0.0;
-
- while(afbreek==0) {
-// getmouseco_areawin(mval);
- // XXX G.qual = get_qual();
- // snap = (G.qual & LR_CTRLKEY) ? 1 : 0;
-
- if(mval[0]!=xo || mval[1]!=yo || firsttime || snap != snap_old) {
- if (firsttime) {
- snap_old = snap;
- firsttime= 0;
- }
-
- /* run for either grab or extend */
- dx= mval[0]- xo;
- dy= mval[1]- yo;
-
- div= v2d->mask.xmax-v2d->mask.xmin;
- dx= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/div;
-
- div= v2d->mask.ymax-v2d->mask.ymin;
- dy= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/div;
-
- if(0) { // XXX G.qual & LR_SHIFTKEY) {
- if(dx>1.0) dx= 1.0; else if(dx<-1.0) dx= -1.0;
- }
-
- 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;
-
- /* SNAP! use the active Seq */
- // XXX snap = G.qual & LR_CTRLKEY ? 1 : 0;
-
- if (!snap) {
- snapskip = 0;
- } else {
- int dist;
- int snap_ofs= 0;
- int snap_dist= snapdist_max;
-
- /* Get sequence points to snap to the markers */
-
- snap_point_num=0;
- if (last_seq && (last_seq->flag & SELECT)) { /* active seq bounds */
- if(seq_tx_check_left(last_seq))
- snap_points[snap_point_num++] = seq_tx_get_final_left(last_seq, 0);
- if(seq_tx_check_right(last_seq))
- snap_points[snap_point_num++] = seq_tx_get_final_right(last_seq, 0);
-
- }
- if (totstrip > 1) { /* selection bounds */
- int bounds_left = MAXFRAME*2;
- int bounds_right = -(MAXFRAME*2);
-
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT) {
- if(seq_tx_check_left(seq))
- bounds_left = MIN2(bounds_left, seq_tx_get_final_left(seq, 0));
- if(seq_tx_check_right(seq))
- bounds_right = MAX2(bounds_right,seq_tx_get_final_right(seq, 0));
- }
- }
-
- /* its possible there were no points to set on either side */
- if (bounds_left != MAXFRAME*2)
- snap_points[snap_point_num++] = bounds_left;
- if (bounds_right != -(MAXFRAME*2))
- snap_points[snap_point_num++] = bounds_right;
- }
-
-
- /* Define so we can snap to other points without hassle */
-
-#define TESTSNAP(test_frame)\
- for(j=0; j<snap_point_num; j++) {\
- /* see if this beats the current best snap point */\
- dist = abs(snap_points[j] - test_frame);\
- if (dist < snap_dist) {\
- snap_ofs = test_frame - snap_points[j];\
- snap_dist = dist;\
- }\
- }
-
-
- /* Detect the best marker to snap to! */
- for(a=0, marker= scene->markers.first; marker; a++, marker= marker->next) {
-
- /* dont snap to a marker on the wrong extend side */
- if (mode=='e' && ((side == 'L' && marker->frame > cfra) || (side == 'R' && marker->frame < cfra)))
- continue;
-
- /* when we are moving markers, dont snap to selected markers, durr */
- if ((sseq->flag & SEQ_MARKER_TRANS)==0 || (marker->flag & SELECT)==0) {
-
- /* loop over the sticky points - max 4 */
- TESTSNAP(marker->frame);
- if (snap_dist == 0) break; /* alredy snapped? - stop looking */
- }
- }
-
- if (snap_dist) {
- TESTSNAP(cfra);
- }
-
- /* check seq's next to the active also - nice for quick snapping */
- if (snap_dist && last_seq && seq_tx_check_left(last_seq)) {
- seq = find_next_prev_sequence(scene, last_seq, 1, 0); /* left */
- if(seq && !seq_tx_check_right(seq))
- TESTSNAP(seq_tx_get_final_right(seq, 0));
- }
-
- if (snap_dist && last_seq && seq_tx_check_right(last_seq)) {
- seq = find_next_prev_sequence(scene, last_seq, 2, 0); /* right */
- if(seq && !seq_tx_check_left(seq))
- TESTSNAP(seq_tx_get_final_left(seq, 0));
- }
-
-#undef TESTSNAP
-
- if (abs(ix_old-ix) >= snapdist_max) {
- /* mouse has moved out of snap range */
- snapskip = 0;
- } else if (snap_dist==0) {
- /* nowhere to move, dont do anything */
- snapskip = 1;
- } else if (snap_dist < snapdist_max) {
- /* do the snapping by adjusting the mouse offset value */
- ix = ix_old + snap_ofs;
- }
- }
-
- if (mode=='g' && !snapskip) {
- /* Grab */
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
- int myofs;
- /* flag, ignores lefsel/rightsel for nested strips */
- int sel_flag = (seq->depth==0) ? seq->flag : seq->flag & ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
-
- // SEQ_DEBUG_INFO(seq);
-
- /* X Transformation */
- if((seq->depth==0) && (sel_flag & SEQ_LEFTSEL)) {
- myofs = (ts->startofs - ts->startstill);
- seq_tx_set_final_left(seq, ts->start + (myofs + ix));
- }
- if((seq->depth==0) && (sel_flag & SEQ_RIGHTSEL)) {
- myofs = (ts->endstill - ts->endofs);
- seq_tx_set_final_right(seq, ts->start + seq->len + (myofs + ix));
- }
- seq_tx_handle_xlimits(seq, sel_flag & SEQ_LEFTSEL, sel_flag & SEQ_RIGHTSEL);
-
- if( (sel_flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0 ) {
- if(seq_tx_test(seq)) seq->start= ts->start+ ix;
-
- /* Y Transformation */
- 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++;
- }
- }
-
- /* Markers */
- if (sseq->flag & SEQ_MARKER_TRANS) {
- for(a=0, marker= scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- marker->frame= oldframe[a] + ix;
- marker_moved=1;
- a++;
- }
- }
- }
-
- /* Extend, grabs one side of the current frame */
- } else if (mode=='e' && !snapskip) {
- int myofs; /* offset from start of the seq clip */
- int xnew, final_left, final_right; /* just to store results from seq_tx_get_final_left/right */
-
- /* we dont use seq side selection flags for this,
- instead we need to calculate which sides to move
- based on its initial position from the cursor */
- int move_left, move_right;
-
- /* Extend, Similar to grab but operate on one side of the cursor */
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
- /* only move the contents of the metastrip otherwise the transformation is applied twice */
- if (seq_tx_test(seq) && seq->type != SEQ_META) {
-
- move_left = move_right = 0;
-
- //SEQ_DEBUG_INFO(seq);
-
- final_left = seq_tx_get_final_left(seq, 1);
- final_right = seq_tx_get_final_right(seq, 1);
-
- /* Only X Axis moving */
-
- /* work out which sides to move first */
- if (side=='L') {
- if (final_left <= cfra || ts->final_left <= cfra) move_left = 1;
- if (final_right <= cfra || ts->final_right <= cfra) move_right = 1;
- } else {
- if (final_left >= cfra || ts->final_left >= cfra) move_left = 1;
- if (final_right >= cfra || ts->final_right >= cfra) move_right = 1;
- }
-
- if (move_left && move_right) {
- /* simple move - dont need to do anything complicated */
- seq->start= ts->start+ ix;
- } else {
- if (side=='L') {
- if (move_left) {
-
- /* Similar to other funcs */
- myofs = (ts->startofs - ts->startstill);
- xnew = ts->start + (ix + myofs);
-
- /* make sure the we dont resize down to 0 or less in size
- also include the startstill so the contense dosnt go outside the bounds,
- if the seq->startofs is 0 then its ignored */
-
- /* TODO remove, add check to seq_tx_handle_xlimits, works ok for now */
- if (xnew + seq->startstill > final_right-1) {
- xnew = (final_right-1) - seq->startstill;
- }
- /* Note, this is the only case where the start needs to be adjusted
- since its not needed when modifying the end or when moving the entire sequence */
- //seq->start = ts->start+ix; // This works when xnew is not clamped, line below takes clamping into account
- seq->start= xnew - myofs; /* TODO see above */
- /* done with unique stuff */
-
- seq_tx_set_final_left(seq, xnew);
- seq_tx_handle_xlimits(seq, 1, 0);
-
- /* Special case again - setting the end back to what it was */
- seq_tx_set_final_right(seq, final_right);
- }
- if (move_right) {
- myofs = (ts->endstill - ts->endofs);
- xnew = ts->start + seq->len + (myofs + ix);
- seq_tx_set_final_right(seq, xnew);
- seq_tx_handle_xlimits(seq, 0, 1);
- }
- } else { /* R */
- if (move_left) {
- myofs = (ts->startofs - ts->startstill);
- xnew = ts->start + (myofs + ix);
- seq_tx_set_final_left(seq, xnew);
- seq_tx_handle_xlimits(seq, 1, 0);
- }
- if (move_right) {
- myofs = (ts->endstill - ts->endofs);
- xnew = ts->start + seq->len + (myofs + ix);
- seq_tx_set_final_right(seq, xnew);
- seq_tx_handle_xlimits(seq, 0, 1);
- }
- }
- }
- }
- calc_sequence(seq);
- ts++;
- }
- }
-
- /* markers */
- if (sseq->flag & SEQ_MARKER_TRANS) {
- for(a=0, marker= scene->markers.first; marker; marker= marker->next) {\
- if (marker->flag & SELECT) {
- if(oldframe[a] != MAXFRAME+1) {
- marker->frame= oldframe[a] + ix;
- marker_moved=1;
- }
- a++;
- }
- }
- }
- }
-
- sprintf(str, "X: %d Y: %d ", ix, iy);
-// headerprint(str);
-
- /* remember the last value for snapping,
- only set if we are not currently snapped,
- prevents locking on a keyframe */
- if (!snapskip)
- ix_old = ix;
-
- /* just to tell if ctrl was pressed, this means we get a recalc when pressing ctrl */
- snap_old = snap;
-
- /* rememver last mouse values so we can skip transform when nothing happens */
- xo= mval[0];
- yo= mval[1];
-
- /* test for effect and overlap */
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if((seq->depth==0) && (seq->flag & SELECT) && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
- seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(scene, seq) ) {
- seq->flag |= SEQ_OVERLAP;
- }
- }
- else if(seq->type & SEQ_EFFECT) {
- if(seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(seq);
- else if(seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(seq);
- else if(seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(seq);
- }
- }
- /* warning, drawing should NEVER use WHILE_SEQ,
- if it does the seq->depth value will be messed up and
- overlap checks with metastrips will give incorrect results */
-// XXX force_draw_plus(SPACE_BUTS, 0);
-
- }
-
-#if 0
- while(qtest()) {
- event= extern_qread(&val);
- if(val) {
- switch(event) {
- case ESCKEY:
- case LEFTMOUSE:
- case RIGHTMOUSE:
- case SPACEKEY:
- case RETKEY:
- afbreek= 1;
- break;
- case XKEY:
- if(!(midtog && (proj == 0))) {
- midtog= ~midtog;
- }
- if(midtog) {
- proj= 1;
- firsttime= 1;
- }
- break;
- case YKEY:
- if(!(midtog && (proj == 1))) {
- midtog= ~midtog;
- }
- if(midtog) {
- proj= 0;
- firsttime= 1;
- }
- break;
- case MIDDLEMOUSE:
- midtog= ~midtog;
- if(midtog) {
- if( abs(mval[0]-xn) > abs(mval[1]-yn)) proj= 1;
- else proj= 0;
- firsttime= 1;
- }
- break;
- default:
- arrows_move_cursor(event);
- }
- }
- if(afbreek) break;
- }
#endif
- }
-
- if((event==ESCKEY) || (event==RIGHTMOUSE)) {
-
- ts= transmain;
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
- seq->start= ts->start;
- seq->machine= ts->machine;
- seq->startstill= ts->startstill;
- seq->endstill= ts->endstill;
- seq->startofs= ts->startofs;
- seq->endofs= ts->endofs;
-
- calc_sequence(seq);
- seq->flag &= ~SEQ_OVERLAP;
-
- ts++;
- } else if(seq->type & SEQ_EFFECT) {
- if(seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(seq);
- else if(seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(seq);
- else if(seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(seq);
- }
- }
-
- /* Markers */
- if (sseq->flag & SEQ_MARKER_TRANS) {
- for(a=0, marker= scene->markers.first; marker; marker= marker->next) {
- if (marker->flag & SELECT) {
- if(oldframe[a] != MAXFRAME+1) {
- marker->frame= oldframe[a];
- }
- a++;
- }
- }
- marker_moved = 0;
- }
- } else {
-
- /* images, effects and overlap */
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
-
- /* fixes single image strips - makes sure their start is not out of bounds
- ideally this would be done during transform since data is rendered at that time
- however it ends up being a lot messier! - Campbell */
- fix_single_seq(seq);
-
- if(seq->type == SEQ_META) {
- calc_sequence(seq);
- seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(scene, seq) ) shuffle_seq(scene, seq);
- }
- else if(seq->flag & SELECT) {
- calc_sequence(seq);
- seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(scene, seq) ) shuffle_seq(scene, seq);
- }
- else if(seq->type & SEQ_EFFECT) calc_sequence(seq);
- }
-
- /* as last: */
- sort_seq(scene);
- }
-
- /* free sequence array */
- if(seqar) MEM_freeN(seqar);
-
- G.moving= 0;
- MEM_freeN(transmain);
-
- if (sseq->flag & SEQ_MARKER_TRANS && totmark)
- MEM_freeN(oldframe);
-
- if (mode=='g')
- BIF_undo_push("Transform Grab, Sequencer");
- else if (mode=='e')
- BIF_undo_push("Transform Extend, Sequencer");
-
-}
-
-/* since grab can move markers, we must turn this off before adding a new sequence
- I am not so happy with this, but the baddness in contained here - Campbell */
-
-/* XXX temp disabled, will work differently anyway */
-void _transform_seq_nomarker_(Scene *scene, SpaceSeq *sseq, View2D *v2d, int mode, int context)
-{
- int flag_back;
- if (!sseq) return; /* should never happen */
-
- flag_back = sseq->flag;
- sseq->flag &= ~SEQ_MARKER_TRANS;
-
- transform_seq(scene, sseq, v2d, mode, context);
-
- sseq->flag = flag_back;
-}
void seq_snap(Scene *scene, short event)
{
@@ -2110,8 +1374,8 @@ void seq_snap(Scene *scene, short event)
SEQP_BEGIN(ed, seq) {
if(seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(scene, seq) ) {
- shuffle_seq(scene, seq);
+ if( seq_test_overlap(ed->seqbasep, seq) ) {
+ shuffle_seq(ed->seqbasep, seq);
}
}
else if(seq->type & SEQ_EFFECT) {
@@ -2141,24 +1405,6 @@ void seq_snap_menu(Scene *scene)
seq_snap(scene, event);
}
-void seq_lock_sel(Scene *scene, int lock)
-{
- Editing *ed;
- Sequence *seq;
-
- ed= scene->ed;
- if(!ed) return;
-
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- if ((seq->flag & SELECT)) {
- if (lock) seq->flag |= SEQ_LOCK;
- else seq->flag &= ~SEQ_LOCK;
- }
- }
- BIF_undo_push(lock?"Lock Strips, Sequencer":"Unlock Strips, Sequencer");
-}
-
-
/* Operator functions */
@@ -2172,10 +1418,9 @@ static EnumPropertyItem prop_set_mute_types[] = {
static int sequencer_mute_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed;
+ Editing *ed= scene->ed;
Sequence *seq;
int selected;
- ed= scene->ed;
selected= RNA_enum_is_equal(op->ptr, "type", "SELECTED");
@@ -2222,10 +1467,9 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot)
static int sequencer_unmute_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed;
+ Editing *ed= scene->ed;
Sequence *seq;
int selected;
- ed= scene->ed;
selected= RNA_enum_is_equal(op->ptr, "type", "SELECTED");
@@ -2268,6 +1512,133 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
}
+/* lock operator */
+static int sequencer_lock_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= scene->ed;
+ Sequence *seq;
+
+ for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if (seq->flag & SELECT) {
+ seq->flag |= SEQ_LOCK;
+ }
+ }
+
+ ED_undo_push(C, "Lock Strips, Sequencer");
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_lock(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Lock Strips";
+ ot->idname= "SEQUENCER_OT_lock";
+
+ /* api callbacks */
+ ot->exec= sequencer_lock_exec;
+
+ ot->poll= ED_operator_sequencer_active;
+ ot->flag= OPTYPE_REGISTER;
+}
+
+/* unlock operator */
+static int sequencer_unlock_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= scene->ed;
+ Sequence *seq;
+
+ for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if (seq->flag & SELECT) {
+ seq->flag &= ~SEQ_LOCK;
+ }
+ }
+
+ ED_undo_push(C, "UnLock Strips, Sequencer");
+ ED_area_tag_redraw(CTX_wm_area(C));
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_unlock(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "UnLock Strips";
+ ot->idname= "SEQUENCER_OT_unlock";
+
+ /* api callbacks */
+ ot->exec= sequencer_unlock_exec;
+
+ ot->poll= ED_operator_sequencer_active;
+ ot->flag= OPTYPE_REGISTER;
+}
+
+/* reload operator */
+static int sequencer_reload_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= scene->ed;
+ Sequence *seq;
+
+ for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if(seq->flag & SELECT) {
+ update_changed_seq_and_deps(scene, seq, 0, 1);
+ }
+ }
+
+ ED_undo_push(C, "UnLock Strips, Sequencer");
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_reload(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Reload Strips";
+ ot->idname= "SEQUENCER_OT_reload";
+
+ /* api callbacks */
+ ot->exec= sequencer_reload_exec;
+
+ ot->poll= ED_operator_sequencer_active;
+ ot->flag= OPTYPE_REGISTER;
+}
+
+/* reload operator */
+static int sequencer_refresh_all_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= scene->ed;
+
+
+ free_imbuf_seq(&ed->seqbase);
+
+ ED_undo_push(C, "Refresh, Sequencer");
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Refresh Sequencer";
+ ot->idname= "SEQUENCER_OT_refresh_all";
+
+ /* api callbacks */
+ ot->exec= sequencer_refresh_all_exec;
+
+ ot->poll= ED_operator_sequencer_active;
+ ot->flag= OPTYPE_REGISTER;
+}
+
/* cut operator */
static EnumPropertyItem prop_cut_side_types[] = {
{SEQ_LEFT, "LEFT", "Left", ""},
@@ -2525,7 +1896,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* new seq */
se = give_stripelem(seq, cfra);
- seq_new= alloc_sequence(((Editing *)scene->ed)->seqbasep, start_ofs, seq->machine);
+ seq_new= alloc_sequence(ed->seqbasep, start_ofs, seq->machine);
seq_new->type= SEQ_IMAGE;
seq_new->len = 1;
seq_new->endstill = step-1;
@@ -2541,8 +1912,8 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
strncpy(se_new->name, se->name, FILE_MAXFILE-1);
calc_sequence(seq_new);
seq_new->flag &= ~SEQ_OVERLAP;
- if (test_overlap_seq(scene, seq_new)) {
- shuffle_seq(scene, seq_new);
+ if (seq_test_overlap(ed->seqbasep, seq_new)) {
+ shuffle_seq(ed->seqbasep, seq_new);
}
cfra++;
@@ -2728,7 +2099,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
set_last_seq(scene, seqm);
- if( test_overlap_seq(scene, seqm) ) shuffle_seq(scene, seqm);
+ if( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm);
ED_undo_push(C, "Make Meta Strip, Sequencer");
@@ -2789,8 +2160,8 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *op)
SEQP_BEGIN(ed, seq) {
if(seq->flag & SELECT) {
seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(scene, seq) ) {
- shuffle_seq(scene, seq);
+ if( seq_test_overlap(ed->seqbasep, seq) ) {
+ shuffle_seq(ed->seqbasep, seq);
}
}
}
@@ -2817,5 +2188,141 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
ot->poll= ED_operator_sequencer_active;
}
+/* view_all operator */
+static int sequencer_view_all_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ bScreen *sc= CTX_wm_screen(C);
+ ScrArea *area= CTX_wm_area(C);
+ ARegion *ar= CTX_wm_region(C);
+ SpaceSeq *sseq= area->spacedata.first;
+ View2D *v2d= UI_view2d_fromcontext(C);
+
+ if (sseq->mainb==SEQ_DRAW_SEQUENCE) {
+ v2d->cur= v2d->tot;
+ UI_view2d_curRect_validate(v2d);
+ UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
+ } else {
+ /* Like zooming on an image view */
+ float zoomX, zoomY;
+ int width, height, imgwidth, imgheight;
+
+ width = ar->winx;
+ height = ar->winy;
+
+ seq_reset_imageofs(sseq);
+
+ imgwidth= (scene->r.size*scene->r.xsch)/100;
+ imgheight= (scene->r.size*scene->r.ysch)/100;
+
+ /* Apply aspect, dosnt need to be that accurate */
+ imgwidth= (int)(imgwidth * ((float)scene->r.xasp / (float)scene->r.yasp));
+
+ if (((imgwidth >= width) || (imgheight >= height)) &&
+ ((width > 0) && (height > 0))) {
+
+ /* Find the zoom value that will fit the image in the image space */
+ zoomX = ((float)width) / ((float)imgwidth);
+ zoomY = ((float)height) / ((float)imgheight);
+ sseq->zoom= (zoomX < zoomY) ? zoomX : zoomY;
+
+ sseq->zoom = 1.0f / power_of_2(1/ MIN2(zoomX, zoomY) );
+ }
+ else {
+ sseq->zoom= 1.0f;
+ }
+ }
+
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_view_all(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "View All";
+ ot->idname= "SEQUENCER_OT_view_all";
+
+ /* api callbacks */
+ ot->exec= sequencer_view_all_exec;
+
+ ot->poll= ED_operator_sequencer_active;
+}
+
+
+/* view_all operator */
+static int sequencer_view_selected_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ View2D *v2d= UI_view2d_fromcontext(C);
+ ScrArea *area= CTX_wm_area(C);
+ bScreen *sc= CTX_wm_screen(C);
+ Editing *ed= scene->ed;
+ Sequence *seq;
+
+ int xmin= MAXFRAME*2;
+ int xmax= -MAXFRAME*2;
+ int ymin= MAXSEQ+1;
+ int ymax= 0;
+ int orig_height;
+ int ymid;
+ int ymargin= 1;
+ int xmargin= FPS;
+
+
+ for(seq=ed->seqbasep->first; seq; seq=seq->next) {
+ if(seq->flag & SELECT) {
+ xmin= MIN2(xmin, seq->startdisp);
+ xmax= MAX2(xmax, seq->enddisp);
+
+ ymin= MIN2(ymin, seq->machine);
+ ymax= MAX2(ymax, seq->machine);
+ }
+ }
+
+ if (ymax != 0) {
+
+ xmax += xmargin;
+ xmin -= xmargin;
+ ymax += ymargin;
+ ymin -= ymargin;
+
+ orig_height= v2d->cur.ymax - v2d->cur.ymin;
+
+ v2d->cur.xmin= xmin;
+ v2d->cur.xmax= xmax;
+
+ v2d->cur.ymin= ymin;
+ v2d->cur.ymax= ymax;
+
+ /* only zoom out vertically */
+ if (orig_height > v2d->cur.ymax - v2d->cur.ymin) {
+ ymid= (v2d->cur.ymax + v2d->cur.ymin) / 2;
+
+ v2d->cur.ymin= ymid - (orig_height/2);
+ v2d->cur.ymax= ymid + (orig_height/2);
+ }
+
+ UI_view2d_curRect_validate(v2d);
+ UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_view_selected(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "View Selected";
+ ot->idname= "SEQUENCER_OT_view_selected";
+
+ /* api callbacks */
+ ot->exec= sequencer_view_selected_exec;
+
+ ot->poll= ED_operator_sequencer_active;
+}
diff --git a/source/blender/editors/space_sequencer/sequencer_header.c b/source/blender/editors/space_sequencer/sequencer_header.c
index c2678819e41..a36828813ef 100644
--- a/source/blender/editors/space_sequencer/sequencer_header.c
+++ b/source/blender/editors/space_sequencer/sequencer_header.c
@@ -50,8 +50,11 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "RNA_access.h"
+
#include "BIF_gl.h"
#include "BIF_glutil.h"
+#include "BIF_transform.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -70,7 +73,14 @@
static void do_viewmenu(bContext *C, void *arg, int event)
{
-
+ switch (event) { // XXX more to go
+ case 3:
+ WM_operator_name_call(C, "SEQUENCER_OT_view_all", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 4:
+ WM_operator_name_call(C, "SEQUENCER_OT_view_selected", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ }
}
static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
@@ -85,22 +95,19 @@ static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
block= uiBeginBlock(C, handle->region, "seq_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
-
-
- if (sseq->mainb) {
+ if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
+ "Play Back Animation "
+ "in all Sequence Areas|Alt A", 0, yco-=20,
+ menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+ }
+ else {
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL,
"Grease Pencil...", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- }
- if (sseq->mainb == 0) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Play Back Animation "
- "in all Sequence Areas|Alt A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- } else {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Play Back Animation "
"in this window|Alt A", 0, yco-=20,
@@ -155,22 +162,42 @@ static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
static void do_selectmenu(bContext *C, void *arg, int event)
{
-
+ switch (event) {
+ case 0:
+ WM_operator_name_call(C, "SEQUENCER_OT_borderselect", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 1:
+ WM_operator_name_call(C, "SEQUENCER_OT_select_linked", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 2: /* strips to left */
+ break;
+ case 3: /* strips to right */
+ break;
+ case 5: /* strips to left */
+ break;
+ case 6: /* strips to right */
+ break;
+ case 7:
+ WM_operator_name_call(C, "SEQUENCER_OT_select_linked", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 8: /* sel all markers */
+ break;
+ case 9:
+ WM_operator_name_call(C, "SEQUENCER_OT_select_invert", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ }
}
static uiBlock *seq_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
-
-
uiBlock *block;
short yco= 0, menuwidth=120;
block= uiBeginBlock(C, handle->region, "seq_selectmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_selectmenu, NULL);
-
-
+
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strips to the Left", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strips to the Right", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
@@ -184,7 +211,7 @@ static uiBlock *seq_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Strips|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Markers|Ctrl A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
-
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Invert Selection|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
if(sa->headertype==HEADERTOP) {
@@ -436,7 +463,87 @@ static uiBlock *seq_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_un
static void do_editmenu(bContext *C, void *arg, int event)
{
+ PointerRNA ptr;
+
+ switch (event) {
+ case 7:
+ WM_operator_properties_create(&ptr, "TFM_OT_transform");
+ RNA_int_set(&ptr, "mode", TFM_TIME_EXTEND);
+ WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, &ptr);
+ WM_operator_properties_free(&ptr);
+ break;
+ case 11:
+ WM_operator_properties_create(&ptr, "TFM_OT_transform");
+ RNA_int_set(&ptr, "mode", TFM_TRANSLATION);
+ WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, &ptr);
+ WM_operator_properties_free(&ptr);
+ break;
+ case 12:
+ /* snap to current frame */
+ break;
+ case 13:
+ WM_operator_properties_create(&ptr, "SEQUENCER_OT_cut");
+ RNA_enum_set(&ptr, "type", 1); // CONSTANT
+ WM_operator_name_call(C, "SEQUENCER_OT_cut", WM_OP_INVOKE_REGION_WIN, &ptr);
+ WM_operator_properties_free(&ptr);
+ break;
+ case 23:
+ WM_operator_properties_create(&ptr, "SEQUENCER_OT_cut");
+ RNA_enum_set(&ptr, "type", 0); // CONSTANT
+ WM_operator_name_call(C, "SEQUENCER_OT_cut", WM_OP_INVOKE_REGION_WIN, &ptr);
+ WM_operator_properties_free(&ptr);
+ break;
+ case 16:
+ WM_operator_name_call(C, "SEQUENCER_OT_separate_images", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 5:
+ WM_operator_name_call(C, "SEQUENCER_OT_add_duplicate", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 6:
+ WM_operator_name_call(C, "SEQUENCER_OT_delete", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 1: /* change efect image scene TODO */
+ break;
+ case 14: /* reassign inputs */
+ break;
+ case 15: /* remap paths */
+ break;
+ case 2:
+ WM_operator_name_call(C, "SEQUENCER_OT_meta_make", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 3:
+ WM_operator_name_call(C, "SEQUENCER_OT_meta_separate", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 9:
+ case 10:
+ WM_operator_name_call(C, "SEQUENCER_OT_meta_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 17:
+ WM_operator_name_call(C, "SEQUENCER_OT_reload", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 18:
+ WM_operator_name_call(C, "SEQUENCER_OT_lock", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 19:
+ WM_operator_name_call(C, "SEQUENCER_OT_unlock", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 20:
+ WM_operator_name_call(C, "SEQUENCER_OT_mute", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 21:
+ WM_operator_name_call(C, "SEQUENCER_OT_unmute", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
+ case 22:
+
+#define SEQ_UNSELECTED 1 // XXX
+
+ WM_operator_properties_create(&ptr, "SEQUENCER_OT_mute");
+ RNA_enum_set(&ptr, "type", SEQ_UNSELECTED); // CONSTANT
+ WM_operator_name_call(C, "SEQUENCER_OT_mute", WM_OP_INVOKE_REGION_WIN, &ptr);
+ WM_operator_properties_free(&ptr);
+ break;
+ }
}
static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
@@ -535,6 +642,9 @@ static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
static void do_sequencer_buttons(bContext *C, void *arg, int event)
{
switch(event) {
+ case B_SEQCLEAR:
+ WM_operator_name_call(C, "SEQUENCER_OT_refresh_all", WM_OP_INVOKE_REGION_WIN, NULL);
+ break;
}
}
@@ -597,7 +707,7 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
xco+= 8 + XIC+10;
- if(sseq->mainb) {
+ if(sseq->mainb != SEQ_DRAW_SEQUENCE) {
int minchan = 0;
/* CHANNEL shown in image preview */
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 643e0c57b79..f83acdd0eba 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -42,6 +42,7 @@ void sequencer_header_buttons(const struct bContext *C, struct ARegion *ar);
/* sequencer_draw.c */
void drawseqspace(const struct bContext *C, struct ARegion *ar);
+void seq_reset_imageofs(struct SpaceSeq *sseq);
/* sequencer_edit.c */
struct View2D;
@@ -60,15 +61,16 @@ void set_last_seq(struct Scene *scene, struct Sequence *seq);
int seq_effect_find_selected(struct Scene *scene, struct Sequence *activeseq, int type, struct Sequence **selseq1, struct Sequence **selseq2, struct Sequence **selseq3);
struct Sequence *alloc_sequence(struct ListBase *lb, int cfra, int machine);
-int test_overlap_seq(struct Scene *scene, struct Sequence *test);
-void shuffle_seq(struct Scene *scene, struct Sequence *test);
-
/* operators */
struct wmOperatorType;
struct wmWindowManager;
void SEQUENCER_OT_cut(struct wmOperatorType *ot);
void SEQUENCER_OT_mute(struct wmOperatorType *ot);
void SEQUENCER_OT_unmute(struct wmOperatorType *ot);
+void SEQUENCER_OT_lock(struct wmOperatorType *ot);
+void SEQUENCER_OT_unlock(struct wmOperatorType *ot);
+void SEQUENCER_OT_reload(struct wmOperatorType *ot);
+void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot);
void SEQUENCER_OT_add_duplicate(struct wmOperatorType *ot);
void SEQUENCER_OT_delete(struct wmOperatorType *ot);
void SEQUENCER_OT_separate_images(struct wmOperatorType *ot);
@@ -76,6 +78,8 @@ void SEQUENCER_OT_meta_toggle(struct wmOperatorType *ot);
void SEQUENCER_OT_meta_make(struct wmOperatorType *ot);
void SEQUENCER_OT_meta_separate(struct wmOperatorType *ot);
+void SEQUENCER_OT_view_all(struct wmOperatorType *ot);
+void SEQUENCER_OT_view_selected(struct wmOperatorType *ot);
/* sequencer_select.c */
void SEQUENCER_OT_deselect_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 170ed785134..79d2853f988 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -67,12 +67,19 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_cut);
WM_operatortype_append(SEQUENCER_OT_mute);
WM_operatortype_append(SEQUENCER_OT_unmute);
+ WM_operatortype_append(SEQUENCER_OT_lock);
+ WM_operatortype_append(SEQUENCER_OT_unlock);
+ WM_operatortype_append(SEQUENCER_OT_reload);
+ WM_operatortype_append(SEQUENCER_OT_refresh_all);
WM_operatortype_append(SEQUENCER_OT_add_duplicate);
WM_operatortype_append(SEQUENCER_OT_delete);
WM_operatortype_append(SEQUENCER_OT_separate_images);
WM_operatortype_append(SEQUENCER_OT_meta_toggle);
WM_operatortype_append(SEQUENCER_OT_meta_make);
WM_operatortype_append(SEQUENCER_OT_meta_separate);
+
+ WM_operatortype_append(SEQUENCER_OT_view_all);
+ WM_operatortype_append(SEQUENCER_OT_view_selected);
/* sequencer_select.c */
WM_operatortype_append(SEQUENCER_OT_deselect_all);
@@ -109,6 +116,11 @@ void sequencer_keymap(wmWindowManager *wm)
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", SEQ_SELECTED);
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "type", SEQ_UNSELECTED);
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_lock", LKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", HKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
+
WM_keymap_add_item(keymap, "SEQUENCER_OT_add_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", XKEY, KM_PRESS, 0, 0);
@@ -120,6 +132,9 @@ void sequencer_keymap(wmWindowManager *wm)
WM_keymap_add_item(keymap, "SEQUENCER_OT_meta_make", MKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_meta_separate", MKEY, KM_PRESS, KM_ALT, 0);
+
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1);
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 2343bda4696..acabe762b3c 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -39,12 +39,7 @@
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
-#include "BLI_storage_types.h"
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "DNA_ipo_types.h"
#include "DNA_curve_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
@@ -52,21 +47,15 @@
#include "DNA_sequence_types.h"
#include "DNA_view2d_types.h"
#include "DNA_userdef_types.h"
-#include "DNA_sound_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
-#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_main.h"
-#include "BKE_plugin_types.h"
#include "BKE_sequence.h"
#include "BKE_scene.h"
#include "BKE_utildefines.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
#include "WM_api.h"
#include "WM_types.h"