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:
-rw-r--r--source/blender/include/BIF_editseq.h6
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h18
-rw-r--r--source/blender/src/editseq.c236
-rw-r--r--source/blender/src/header_seq.c4
-rw-r--r--source/blender/src/space.c15
5 files changed, 224 insertions, 55 deletions
diff --git a/source/blender/include/BIF_editseq.h b/source/blender/include/BIF_editseq.h
index 0cadfcd78b1..81353c48a9a 100644
--- a/source/blender/include/BIF_editseq.h
+++ b/source/blender/include/BIF_editseq.h
@@ -48,11 +48,14 @@ void clear_last_seq();
void del_seq(void);
void enter_meta(void);
void exit_meta(void);
-struct Sequence* find_neighboring_sequence(struct Sequence *test, int lr);
+struct Sequence* find_neighboring_sequence(struct Sequence *test, int lr, int sel);
+struct Sequence* find_next_prev_sequence(struct Sequence *test, int lr, int sel);
struct Sequence* find_nearest_seq(int *hand);
int insert_gap(int gap, int cfra);
void make_meta(void);
void select_channel_direction(struct Sequence *test,int lr);
+void select_more_seq(void);
+void select_less_seq(void);
void mouse_select_seq(void);
void no_gaps(void);
void seq_snap(short event);
@@ -70,6 +73,7 @@ void select_surrounding_handles(struct Sequence *test);
void select_surround_from_last();
void select_dir_from_last(int lr);
void select_neighbor_from_last(int lr);
+void select_linked_seq(int mode);
struct Sequence* alloc_sequence(ListBase *lb, int cfra, int machine); /*used from python*/
int check_single_image_seq(struct Sequence *seq);
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index f1abc2dc0c8..969f838750b 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -88,21 +88,22 @@ typedef struct PluginSeq {
typedef struct Sequence {
- struct Sequence *next, *prev, *newseq;
- void *lib;
- char name[24];
+ struct Sequence *next, *prev;
+ void *tmp; /* tmp var for copying, and tagging for linked selection */
+ char name[24]; /* name, not set by default and dosnt need to be unique as with ID's */
short flag, type; /*flags bitmap (see below) and the type of sequence*/
- int len;
+ int len; /* the length of the contense of this strip - before handles are applied */
int start, startofs, endofs;
int startstill, endstill;
- int machine, depth;
+ int machine, depth; /*machine - the strip channel, depth - the depth in the sequence when dealing with metastrips */
int startdisp, enddisp; /*starting and ending points in the sequence*/
float mul, handsize;
- int sfra; /* starting frame according to the timeline of the scene */
+ /* is sfra needed anymore? - it looks like its only used in one place */
+ int sfra; /* starting frame according to the timeline of the scene. */
Strip *strip;
- StripElem *curelem;
+ StripElem *curelem; /* reference the current frame - value from give_stripelem */
struct Ipo *ipo;
struct Scene *scene;
@@ -114,8 +115,7 @@ typedef struct Sequence {
/* pointers for effects: */
struct Sequence *seq1, *seq2, *seq3;
- /* meta */
- ListBase seqbase;
+ ListBase seqbase; /* list of strips for metastrips */
struct bSound *sound; /* the linked "bSound" object */
struct hdaudio *hdaudio; /* external hdaudio object */
diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c
index 5123508b352..eb1ccd966a8 100644
--- a/source/blender/src/editseq.c
+++ b/source/blender/src/editseq.c
@@ -304,46 +304,92 @@ int sequence_is_free_transformable(Sequence * seq)
|| (get_sequence_effect_num_inputs(seq->type) == 0);
}
-Sequence *find_neighboring_sequence(Sequence *test, int lr) {
-/* looks to the left on lr==1, to the right on lr==2 */
- Sequence *seq,*foundneighbor = 0;
- int found=0;
+Sequence *find_neighboring_sequence(Sequence *test, int lr, int sel) {
+/* looks to the left on lr==1, to the right on lr==2
+ sel - 0==unselected, 1==selected, -1==done care*/
+ Sequence *seq;
Editing *ed;
ed= G.scene->ed;
if(ed==0) return 0;
+ if (sel>0) sel = SELECT;
+
seq= ed->seqbasep->first;
while(seq) {
- if(seq!=test) {
- if (test->machine==seq->machine) {
- if(test->depth==seq->depth) {
- switch (lr) {
- case 1:
- if (test->startdisp == (seq->enddisp)) {
- foundneighbor=seq;
- found=1;
- }
- break;
- case 2:
- if (test->enddisp == (seq->startdisp)) {
- foundneighbor=seq;
- found=1;
- }
- break;
- }
+ if( (seq!=test) &&
+ (test->machine==seq->machine) &&
+ (test->depth==seq->depth) &&
+ ((sel == -1) || (sel && (seq->flag & SELECT)) || (sel==0 && (seq->flag & SELECT)==0) ))
+ {
+ switch (lr) {
+ case 1:
+ if (test->startdisp == (seq->enddisp)) {
+ return seq;
+ }
+ break;
+ case 2:
+ if (test->enddisp == (seq->startdisp)) {
+ return seq;
}
+ break;
}
}
seq= seq->next;
}
- if (found==1) {
- return foundneighbor;
- } else {
- return 0;
+ return NULL;
+}
+
+Sequence *find_next_prev_sequence(Sequence *test, int lr, int sel) {
+/* looks to the left on lr==1, to the right on lr==2
+ sel - 0==unselected, 1==selected, -1==done care*/
+ Sequence *seq,*best_seq = NULL;
+ Editing *ed;
+
+ int dist, best_dist;
+ best_dist = MAXFRAME*2;
+
+ ed= G.scene->ed;
+ if(ed==0) return 0;
+
+ if (sel) sel = SELECT;
+
+ seq= ed->seqbasep->first;
+ while(seq) {
+ if( (seq!=test) &&
+ (test->machine==seq->machine) &&
+ (test->depth==seq->depth) &&
+ ((sel == -1) || (sel==(seq->flag & SELECT))))
+ {
+ dist = MAXFRAME*2;
+
+ switch (lr) {
+ case 1:
+ if (seq->enddisp <= test->startdisp) {
+ dist = test->enddisp - seq->startdisp;
+ }
+ break;
+ case 2:
+ if (seq->startdisp >= test->enddisp) {
+ dist = seq->startdisp - test->enddisp;
+ }
+ break;
+ }
+
+ if (dist==0) {
+ best_seq = seq;
+ break;
+ } else if (dist < best_dist) {
+ best_dist = dist;
+ best_seq = seq;
+ }
+ }
+ seq= seq->next;
}
+ return best_seq; /* can be null */
}
+
Sequence *find_nearest_seq(int *hand)
{
Sequence *seq;
@@ -627,13 +673,13 @@ void select_surrounding_handles(Sequence *test)
{
Sequence *neighbor;
- neighbor=find_neighboring_sequence(test, 1);
+ neighbor=find_neighboring_sequence(test, 1, -1);
if (neighbor) {
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_RIGHTSEL;
}
- neighbor=find_neighboring_sequence(test, 2);
+ neighbor=find_neighboring_sequence(test, 2, -1);
if (neighbor) {
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
@@ -660,7 +706,7 @@ void select_neighbor_from_last(int lr)
Sequence *neighbor;
int change = 0;
if (seq) {
- neighbor=find_neighboring_sequence(seq, lr);
+ neighbor=find_neighboring_sequence(seq, lr, -1);
if (neighbor) {
switch (lr) {
case 1:
@@ -768,7 +814,7 @@ void mouse_select_seq(void)
if (G.qual & LR_CTRLKEY) seldir=1;
else seldir=2;
- neighbor=find_neighboring_sequence(seq, seldir);
+ neighbor=find_neighboring_sequence(seq, seldir, -1);
if (neighbor) {
switch (seldir) {
case 1:
@@ -2081,12 +2127,12 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
seq= old->first;
while(seq) {
- seq->newseq= 0;
+ seq->tmp= NULL;
if(seq->flag & SELECT) {
if(seq->type==SEQ_META) {
seqn= MEM_dupallocN(seq);
- seq->newseq= seqn;
+ seq->tmp= seqn;
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
@@ -2102,7 +2148,7 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
}
else if(seq->type == SEQ_SCENE) {
seqn= MEM_dupallocN(seq);
- seq->newseq= seqn;
+ seq->tmp= seqn;
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
@@ -2114,7 +2160,7 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
}
else if(seq->type == SEQ_MOVIE) {
seqn= MEM_dupallocN(seq);
- seq->newseq= seqn;
+ seq->tmp= seqn;
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
@@ -2137,7 +2183,7 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
}
else if(seq->type == SEQ_RAM_SOUND) {
seqn= MEM_dupallocN(seq);
- seq->newseq= seqn;
+ seq->tmp= seqn;
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
@@ -2162,7 +2208,7 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
}
else if(seq->type == SEQ_HD_SOUND) {
seqn= MEM_dupallocN(seq);
- seq->newseq= seqn;
+ seq->tmp= seqn;
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
@@ -2187,7 +2233,7 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
}
else if(seq->type < SEQ_EFFECT) {
seqn= MEM_dupallocN(seq);
- seq->newseq= seqn;
+ seq->tmp= seqn;
BLI_addtail(new, seqn);
seqn->strip->us++;
@@ -2197,12 +2243,12 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
}
else {
seqn= MEM_dupallocN(seq);
- seq->newseq= seqn;
+ seq->tmp= seqn;
BLI_addtail(new, seqn);
- if(seq->seq1 && seq->seq1->newseq) 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(seq->seq1 && seq->seq1->tmp) seqn->seq1= seq->seq1->tmp;
+ if(seq->seq2 && seq->seq2->tmp) seqn->seq2= seq->seq2->tmp;
+ if(seq->seq3 && seq->seq3->tmp) seqn->seq3= seq->seq3->tmp;
if(seqn->ipo) seqn->ipo->id.us++;
@@ -2883,20 +2929,20 @@ void transform_seq(int mode, int context)
}
/* check seq's next to the active also - nice for quick snapping */
- if (snap_dist) {
- seq = find_neighboring_sequence(last_seq, 1); /* left */
+ if (snap_dist && seq_tx_check_left(last_seq)) {
+ seq = find_next_prev_sequence(last_seq, 1, 0); /* left */
if(seq && !seq_tx_check_right(seq))
TESTSNAP(seq_tx_get_final_right(seq));
}
- if (snap_dist) {
- seq = find_neighboring_sequence(last_seq, 2); /* right */
+ if (snap_dist && seq_tx_check_right(last_seq)) {
+ seq = find_next_prev_sequence(last_seq, 2, 0); /* right */
if(seq && !seq_tx_check_left(seq))
TESTSNAP(seq_tx_get_final_left(seq));
}
#undef TESTSNAP
-
+
if (abs(ix_old-ix) >= snapdist_max) {
/* mouse has moved out of snap range */
snapskip = 0;
@@ -3399,6 +3445,106 @@ void seq_separate_images(void)
allqueue(REDRAWSEQ, 0);
}
+/* run recursivly to select linked */
+static int select_more_less_seq__internal(int sel, int linked) {
+ Editing *ed;
+ Sequence *seq, *neighbor;
+ int change=0;
+ int isel;
+
+ ed= G.scene->ed;
+ if(ed==0) return 0;
+
+ if (sel) {
+ sel = SELECT;
+ isel = 0;
+ } else {
+ sel = 0;
+ isel = SELECT;
+ }
+
+ if (!linked) {
+ /* if not linked we only want to touch each seq once, newseq */
+ for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ seq->tmp = NULL;
+ }
+ }
+
+ for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if((int)(seq->flag & SELECT) == sel) {
+ if ((linked==0 && seq->tmp)==0) {
+ /* only get unselected nabours */
+ neighbor = find_neighboring_sequence(seq, 1, isel);
+ if (neighbor) {
+ if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);}
+ else neighbor->flag &= ~SELECT;
+ if (linked==0) neighbor->tmp = (Sequence *)1;
+ change = 1;
+ }
+ neighbor = find_neighboring_sequence(seq, 2, isel);
+ if (neighbor) {
+ if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);}
+ else neighbor->flag &= ~SELECT;
+ if (linked==0) neighbor->tmp = (void *)1;
+ change = 1;
+ }
+ }
+ }
+ }
+
+ return change;
+}
+
+void select_less_seq(void)
+{
+ if (select_more_less_seq__internal(0, 0)) {
+ BIF_undo_push("Select Less, Sequencer");
+ allqueue(REDRAWSEQ, 0);
+ }
+}
+
+void select_more_seq(void)
+{
+ if (select_more_less_seq__internal(1, 0)) {
+ BIF_undo_push("Select More, Sequencer");
+ allqueue(REDRAWSEQ, 0);
+ }
+}
+
+/* TODO not all modes supported - if you feel like being picky, add them! ;) */
+void select_linked_seq(int mode) {
+ Editing *ed;
+ Sequence *seq, *mouse_seq;
+ int selected, hand;
+
+ ed= G.scene->ed;
+ if(ed==0) return;
+
+ /* replace current selection */
+ if (mode==0 || mode==2) {
+ /* this works like UV, not mesh */
+ if (mode==0) {
+ mouse_seq= find_nearest_seq(&hand);
+ if (!mouse_seq)
+ return; /* user error as with mesh?? */
+
+ for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ seq->flag &= ~SELECT;
+ }
+ mouse_seq->flag |= SELECT;
+ recurs_sel_seq(mouse_seq);
+ }
+
+ selected = 1;
+ while (selected) {
+ selected = select_more_less_seq__internal(1, 1);
+ }
+ BIF_undo_push("Select Linked, Sequencer");
+ allqueue(REDRAWSEQ, 0);
+ }
+ /* TODO - more modes... */
+}
+
void seq_snap_menu(void)
{
short event;
diff --git a/source/blender/src/header_seq.c b/source/blender/src/header_seq.c
index 0c7c59999cf..a0edbdc316f 100644
--- a/source/blender/src/header_seq.c
+++ b/source/blender/src/header_seq.c
@@ -194,6 +194,9 @@ static void do_seq_selectmenu(void *arg, int event)
case 6:
select_neighbor_from_last(2);
break;
+ case 7:
+ select_linked_seq(2);
+ break;
}
}
@@ -214,6 +217,7 @@ static uiBlock *seq_selectmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ 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|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
if(curarea->headertype==HEADERTOP) {
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index b24fa7eaa9b..4d81d6bd232 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -4445,6 +4445,10 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
mouse_select_seq();
break;
case PADPLUSKEY:
+ if (G.qual==LR_CTRLKEY) {
+ select_more_seq();
+ break;
+ }
case WHEELUPMOUSE:
if(sseq->mainb) {
sseq->zoom++;
@@ -4473,6 +4477,10 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
doredraw= 1;
break;
case PADMINUS:
+ if (G.qual==LR_CTRLKEY) {
+ select_less_seq();
+ break;
+ }
case WHEELDOWNMOUSE:
if(sseq->mainb) {
sseq->zoom--;
@@ -4577,6 +4585,13 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
if(okee("Cut strips")) seq_cut(CFRA);
}
break;
+ case LKEY:
+ if((G.qual==0)) { /* Cut at current frame */
+ select_linked_seq( 0 );
+ } else if((G.qual==LR_CTRLKEY)) { /* Cut at current frame */
+ select_linked_seq( 2 );
+ }
+ break;
case YKEY:
if((G.qual==0)) { /* Cut at current frame */
seq_separate_images();