Move some sequencer functions about, no functional changes.
- Remove SEQ_DESEL, better not have a flag which includes ~, use ~SEQ_ALLSEL instead. - Rename recurs_dupli_seq -> seqbase_dupli_recursive - Rename deep_dupli_seq -> seq_dupli_recursive
This commit is contained in:
@@ -191,12 +191,15 @@ int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene
|
||||
int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene);
|
||||
int seqbase_isolated_sel_check(struct ListBase *seqbase);
|
||||
void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage);
|
||||
struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Sequence * seq);
|
||||
int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b);
|
||||
|
||||
void seq_update_sound(struct Scene* scene, struct Sequence *seq);
|
||||
void seq_update_muting(struct Scene* scene, struct Editing *ed);
|
||||
void seqbase_sound_reload(Scene *scene, ListBase *seqbase);
|
||||
void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq);
|
||||
void seqbase_dupli_recursive(struct Scene *scene, ListBase *nseqbase, ListBase *seqbase, int do_context);
|
||||
|
||||
void clear_scene_in_allseqs(struct Scene *sce);
|
||||
|
||||
struct Sequence *get_seq_by_name(struct ListBase *seqbase, const char *name, int recursive);
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include "DNA_group_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_sequence_types.h"
|
||||
|
||||
#include "BKE_anim.h"
|
||||
#include "BKE_animsys.h"
|
||||
|
@@ -4086,3 +4086,130 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
|
||||
|
||||
return seq;
|
||||
}
|
||||
|
||||
|
||||
static Sequence *dupli_seq(struct Scene *scene, Sequence *seq)
|
||||
{
|
||||
Sequence *seqn = MEM_dupallocN(seq);
|
||||
|
||||
seq->tmp = seqn;
|
||||
seqn->strip= MEM_dupallocN(seq->strip);
|
||||
|
||||
// XXX: add F-Curve duplication stuff?
|
||||
|
||||
seqn->strip->tstripdata = 0;
|
||||
seqn->strip->tstripdata_startstill = 0;
|
||||
seqn->strip->tstripdata_endstill = 0;
|
||||
seqn->strip->ibuf_startstill = 0;
|
||||
seqn->strip->ibuf_endstill = 0;
|
||||
|
||||
if (seq->strip->crop) {
|
||||
seqn->strip->crop = MEM_dupallocN(seq->strip->crop);
|
||||
}
|
||||
|
||||
if (seq->strip->transform) {
|
||||
seqn->strip->transform = MEM_dupallocN(seq->strip->transform);
|
||||
}
|
||||
|
||||
if (seq->strip->proxy) {
|
||||
seqn->strip->proxy = MEM_dupallocN(seq->strip->proxy);
|
||||
}
|
||||
|
||||
if (seq->strip->color_balance) {
|
||||
seqn->strip->color_balance
|
||||
= MEM_dupallocN(seq->strip->color_balance);
|
||||
}
|
||||
|
||||
if(seq->type==SEQ_META) {
|
||||
seqn->strip->stripdata = 0;
|
||||
|
||||
seqn->seqbase.first= seqn->seqbase.last= 0;
|
||||
/* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */
|
||||
/* - seq_dupli_recursive(&seq->seqbase,&seqn->seqbase);*/
|
||||
} else if(seq->type == SEQ_SCENE) {
|
||||
seqn->strip->stripdata = 0;
|
||||
if(seq->scene_sound)
|
||||
seqn->scene_sound = sound_scene_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
|
||||
} else if(seq->type == SEQ_MOVIE) {
|
||||
seqn->strip->stripdata =
|
||||
MEM_dupallocN(seq->strip->stripdata);
|
||||
seqn->anim= 0;
|
||||
} else if(seq->type == SEQ_SOUND) {
|
||||
seqn->strip->stripdata =
|
||||
MEM_dupallocN(seq->strip->stripdata);
|
||||
if(seq->scene_sound)
|
||||
seqn->scene_sound = sound_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
|
||||
|
||||
seqn->sound->id.us++;
|
||||
} else if(seq->type == SEQ_IMAGE) {
|
||||
seqn->strip->stripdata =
|
||||
MEM_dupallocN(seq->strip->stripdata);
|
||||
} else if(seq->type >= SEQ_EFFECT) {
|
||||
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 (seq->type & SEQ_EFFECT) {
|
||||
struct SeqEffectHandle sh;
|
||||
sh = get_sequence_effect(seq);
|
||||
if(sh.copy)
|
||||
sh.copy(seq, seqn);
|
||||
}
|
||||
|
||||
seqn->strip->stripdata = 0;
|
||||
|
||||
} else {
|
||||
fprintf(stderr, "Aiiiiekkk! sequence type not "
|
||||
"handled in duplicate!\nExpect a crash"
|
||||
" now...\n");
|
||||
}
|
||||
|
||||
seqbase_unique_name_recursive(&scene->ed->seqbase, seqn);
|
||||
|
||||
return seqn;
|
||||
}
|
||||
|
||||
Sequence * seq_dupli_recursive(struct Scene *scene, Sequence * seq)
|
||||
{
|
||||
Sequence * seqn = dupli_seq(scene, seq);
|
||||
if (seq->type == SEQ_META) {
|
||||
Sequence * s;
|
||||
for(s= seq->seqbase.first; s; s = s->next) {
|
||||
Sequence *n = seq_dupli_recursive(scene, s);
|
||||
if (n) {
|
||||
BLI_addtail(&seqn->seqbase, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
return seqn;
|
||||
}
|
||||
|
||||
void seqbase_dupli_recursive(Scene *scene, ListBase *nseqbase, ListBase *seqbase, int do_context)
|
||||
{
|
||||
Sequence *seq;
|
||||
Sequence *seqn = 0;
|
||||
Sequence *last_seq = seq_active_get(scene);
|
||||
|
||||
for(seq= seqbase->first; seq; seq= seq->next) {
|
||||
seq->tmp= NULL;
|
||||
if(seq->flag & SELECT) {
|
||||
seqn = dupli_seq(scene, seq);
|
||||
if (seqn) { /*should never fail */
|
||||
if(do_context) {
|
||||
seq->flag &= ~SEQ_ALLSEL;
|
||||
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL+SEQ_LOCK);
|
||||
}
|
||||
|
||||
BLI_addtail(nseqbase, seqn);
|
||||
if(seq->type==SEQ_META)
|
||||
seqbase_dupli_recursive(scene, &seqn->seqbase, &seq->seqbase, do_context);
|
||||
|
||||
if(do_context) {
|
||||
if (seq == last_seq) {
|
||||
seq_active_set(scene, seqn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -389,7 +389,7 @@ void deselect_all_seq(Scene *scene)
|
||||
if(ed==NULL) return;
|
||||
|
||||
SEQP_BEGIN(ed, seq) {
|
||||
seq->flag &= SEQ_DESEL;
|
||||
seq->flag &= ~SEQ_ALLSEL;
|
||||
}
|
||||
SEQ_END
|
||||
|
||||
@@ -402,9 +402,9 @@ void recurs_sel_seq(Sequence *seqm)
|
||||
seq= seqm->seqbase.first;
|
||||
while(seq) {
|
||||
|
||||
if(seqm->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL)) seq->flag &= SEQ_DESEL;
|
||||
if(seqm->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL;
|
||||
else if(seqm->flag & SELECT) seq->flag |= SELECT;
|
||||
else seq->flag &= SEQ_DESEL;
|
||||
else seq->flag &= ~SEQ_ALLSEL;
|
||||
|
||||
if(seq->seqbase.first) recurs_sel_seq(seq);
|
||||
|
||||
@@ -768,132 +768,6 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
|
||||
}
|
||||
}
|
||||
|
||||
static Sequence *dupli_seq(struct Scene *scene, Sequence *seq)
|
||||
{
|
||||
Sequence *seqn = MEM_dupallocN(seq);
|
||||
|
||||
seq->tmp = seqn;
|
||||
seqn->strip= MEM_dupallocN(seq->strip);
|
||||
|
||||
// XXX: add F-Curve duplication stuff?
|
||||
|
||||
seqn->strip->tstripdata = 0;
|
||||
seqn->strip->tstripdata_startstill = 0;
|
||||
seqn->strip->tstripdata_endstill = 0;
|
||||
seqn->strip->ibuf_startstill = 0;
|
||||
seqn->strip->ibuf_endstill = 0;
|
||||
|
||||
if (seq->strip->crop) {
|
||||
seqn->strip->crop = MEM_dupallocN(seq->strip->crop);
|
||||
}
|
||||
|
||||
if (seq->strip->transform) {
|
||||
seqn->strip->transform = MEM_dupallocN(seq->strip->transform);
|
||||
}
|
||||
|
||||
if (seq->strip->proxy) {
|
||||
seqn->strip->proxy = MEM_dupallocN(seq->strip->proxy);
|
||||
}
|
||||
|
||||
if (seq->strip->color_balance) {
|
||||
seqn->strip->color_balance
|
||||
= MEM_dupallocN(seq->strip->color_balance);
|
||||
}
|
||||
|
||||
if(seq->type==SEQ_META) {
|
||||
seqn->strip->stripdata = 0;
|
||||
|
||||
seqn->seqbase.first= seqn->seqbase.last= 0;
|
||||
/* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */
|
||||
/* - recurs_dupli_seq(&seq->seqbase,&seqn->seqbase);*/
|
||||
} else if(seq->type == SEQ_SCENE) {
|
||||
seqn->strip->stripdata = 0;
|
||||
if(seq->scene_sound)
|
||||
seqn->scene_sound = sound_scene_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
|
||||
} else if(seq->type == SEQ_MOVIE) {
|
||||
seqn->strip->stripdata =
|
||||
MEM_dupallocN(seq->strip->stripdata);
|
||||
seqn->anim= 0;
|
||||
} else if(seq->type == SEQ_SOUND) {
|
||||
seqn->strip->stripdata =
|
||||
MEM_dupallocN(seq->strip->stripdata);
|
||||
if(seq->scene_sound)
|
||||
seqn->scene_sound = sound_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
|
||||
|
||||
seqn->sound->id.us++;
|
||||
} else if(seq->type == SEQ_IMAGE) {
|
||||
seqn->strip->stripdata =
|
||||
MEM_dupallocN(seq->strip->stripdata);
|
||||
} else if(seq->type >= SEQ_EFFECT) {
|
||||
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 (seq->type & SEQ_EFFECT) {
|
||||
struct SeqEffectHandle sh;
|
||||
sh = get_sequence_effect(seq);
|
||||
if(sh.copy)
|
||||
sh.copy(seq, seqn);
|
||||
}
|
||||
|
||||
seqn->strip->stripdata = 0;
|
||||
|
||||
} else {
|
||||
fprintf(stderr, "Aiiiiekkk! sequence type not "
|
||||
"handled in duplicate!\nExpect a crash"
|
||||
" now...\n");
|
||||
}
|
||||
|
||||
seqbase_unique_name_recursive(&scene->ed->seqbase, seqn);
|
||||
|
||||
return seqn;
|
||||
}
|
||||
|
||||
static Sequence * deep_dupli_seq(struct Scene *scene, Sequence * seq)
|
||||
{
|
||||
Sequence * seqn = dupli_seq(scene, seq);
|
||||
if (seq->type == SEQ_META) {
|
||||
Sequence * s;
|
||||
for(s= seq->seqbase.first; s; s = s->next) {
|
||||
Sequence * n = deep_dupli_seq(scene, s);
|
||||
if (n) {
|
||||
BLI_addtail(&seqn->seqbase, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
return seqn;
|
||||
}
|
||||
|
||||
|
||||
static void recurs_dupli_seq(Scene *scene, ListBase *old, ListBase *new, int do_context)
|
||||
{
|
||||
Sequence *seq;
|
||||
Sequence *seqn = 0;
|
||||
Sequence *last_seq = seq_active_get(scene);
|
||||
|
||||
for(seq= old->first; seq; seq= seq->next) {
|
||||
seq->tmp= NULL;
|
||||
if(seq->flag & SELECT) {
|
||||
seqn = dupli_seq(scene, seq);
|
||||
if (seqn) { /*should never fail */
|
||||
if(do_context) {
|
||||
seq->flag &= SEQ_DESEL;
|
||||
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL+SEQ_LOCK);
|
||||
}
|
||||
|
||||
BLI_addtail(new, seqn);
|
||||
if(seq->type==SEQ_META)
|
||||
recurs_dupli_seq(scene, &seq->seqbase,&seqn->seqbase, do_context);
|
||||
|
||||
if(do_context) {
|
||||
if (seq == last_seq) {
|
||||
seq_active_set(scene, seqn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
|
||||
{
|
||||
@@ -947,7 +821,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
|
||||
|
||||
if (!skip_dup) {
|
||||
/* Duplicate AFTER the first change */
|
||||
seqn = deep_dupli_seq(scene, seq);
|
||||
seqn = seq_dupli_recursive(scene, seq);
|
||||
}
|
||||
|
||||
if (seqn) {
|
||||
@@ -1036,7 +910,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
|
||||
|
||||
if (!skip_dup) {
|
||||
/* Duplicate AFTER the first change */
|
||||
seqn = deep_dupli_seq(scene, seq);
|
||||
seqn = seq_dupli_recursive(scene, seq);
|
||||
}
|
||||
|
||||
if (seqn) {
|
||||
@@ -1621,11 +1495,11 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
|
||||
SEQP_BEGIN(ed, seq) {
|
||||
if (cut_side==SEQ_SIDE_LEFT) {
|
||||
if ( seq->startdisp >= cut_frame ) {
|
||||
seq->flag &= SEQ_DESEL;
|
||||
seq->flag &= ~SEQ_ALLSEL;
|
||||
}
|
||||
} else {
|
||||
if ( seq->enddisp <= cut_frame ) {
|
||||
seq->flag &= SEQ_DESEL;
|
||||
seq->flag &= ~SEQ_ALLSEL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1687,17 +1561,17 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op)
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
|
||||
ListBase new= {NULL, NULL};
|
||||
ListBase nseqbase= {NULL, NULL};
|
||||
|
||||
if(ed==NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
recurs_dupli_seq(scene, ed->seqbasep, &new, TRUE);
|
||||
seqbase_dupli_recursive(scene, &nseqbase, ed->seqbasep, TRUE);
|
||||
|
||||
if(new.first) {
|
||||
Sequence * seq= new.first;
|
||||
/* rely on the new list being added at the end */
|
||||
addlisttolist(ed->seqbasep, &new);
|
||||
if(nseqbase.first) {
|
||||
Sequence * seq= nseqbase.first;
|
||||
/* rely on the nseqbase list being added at the end */
|
||||
addlisttolist(ed->seqbasep, &nseqbase);
|
||||
|
||||
for( ; seq; seq= seq->next)
|
||||
seqbase_unique_name_recursive(&ed->seqbase, seq);
|
||||
@@ -2666,7 +2540,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
recurs_dupli_seq(scene, ed->seqbasep, &seqbase_clipboard, FALSE);
|
||||
seqbase_dupli_recursive(scene, &seqbase_clipboard, ed->seqbasep, FALSE);
|
||||
seqbase_clipboard_frame= scene->r.cfra;
|
||||
|
||||
/* Need to remove anything that references the current scene */
|
||||
@@ -2713,23 +2587,23 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */
|
||||
ListBase new = {NULL, NULL};
|
||||
ListBase nseqbase = {NULL, NULL};
|
||||
int ofs;
|
||||
Sequence *iseq;
|
||||
|
||||
deselect_all_seq(scene);
|
||||
ofs = scene->r.cfra - seqbase_clipboard_frame;
|
||||
|
||||
recurs_dupli_seq(scene, &seqbase_clipboard, &new, FALSE);
|
||||
seqbase_dupli_recursive(scene, &nseqbase, &seqbase_clipboard, FALSE);
|
||||
|
||||
/* transform pasted strips before adding */
|
||||
if(ofs) {
|
||||
for(iseq= new.first; iseq; iseq= iseq->next) {
|
||||
for(iseq= nseqbase.first; iseq; iseq= iseq->next) {
|
||||
seq_offset(scene, iseq, ofs);
|
||||
}
|
||||
}
|
||||
|
||||
addlisttolist(ed->seqbasep, &new);
|
||||
addlisttolist(ed->seqbasep, &nseqbase);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
|
||||
|
||||
|
@@ -146,8 +146,6 @@ enum {
|
||||
};
|
||||
|
||||
/* defines used internally */
|
||||
#define SEQ_ALLSEL (SELECT+SEQ_LEFTSEL+SEQ_RIGHTSEL)
|
||||
#define SEQ_DESEL ~SEQ_ALLSEL
|
||||
#define SCE_MARKERS 0 // XXX - dummy
|
||||
|
||||
/* sequencer_ops.c */
|
||||
|
@@ -231,7 +231,7 @@ static int sequencer_deselect_exec(bContext *C, wmOperator *op)
|
||||
|
||||
for(seq= ed->seqbasep->first; seq; seq=seq->next) {
|
||||
if (desel) {
|
||||
seq->flag &= SEQ_DESEL;
|
||||
seq->flag &= ~SEQ_ALLSEL;
|
||||
}
|
||||
else {
|
||||
seq->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
|
||||
@@ -269,7 +269,7 @@ static int sequencer_select_inverse_exec(bContext *C, wmOperator *op)
|
||||
|
||||
for(seq= ed->seqbasep->first; seq; seq=seq->next) {
|
||||
if (seq->flag & SELECT) {
|
||||
seq->flag &= SEQ_DESEL;
|
||||
seq->flag &= ~SEQ_ALLSEL;
|
||||
}
|
||||
else {
|
||||
seq->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
|
||||
@@ -409,7 +409,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
switch(hand) {
|
||||
case SEQ_SIDE_NONE:
|
||||
if (linked_handle==0)
|
||||
seq->flag &= SEQ_DESEL;
|
||||
seq->flag &= ~SEQ_ALLSEL;
|
||||
break;
|
||||
case SEQ_SIDE_LEFT:
|
||||
seq->flag ^= SEQ_LEFTSEL;
|
||||
@@ -860,7 +860,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if(BLI_isect_rctf(&rq, &rectf, 0)) {
|
||||
if(selecting) seq->flag |= SELECT;
|
||||
else seq->flag &= SEQ_DESEL;
|
||||
else seq->flag &= ~SEQ_ALLSEL;
|
||||
recurs_sel_seq(seq);
|
||||
}
|
||||
}
|
||||
|
@@ -276,6 +276,9 @@ typedef struct SpeedControlVars {
|
||||
#define SEQ_USE_PROXY_CUSTOM_FILE 2097152
|
||||
#define SEQ_USE_EFFECT_DEFAULT_FADE 4194304
|
||||
|
||||
/* convenience define for all selection flags */
|
||||
#define SEQ_ALLSEL (SELECT+SEQ_LEFTSEL+SEQ_RIGHTSEL)
|
||||
|
||||
/* deprecated, dont use a flag anymore*/
|
||||
/*#define SEQ_ACTIVE 1048576*/
|
||||
|
||||
|
Reference in New Issue
Block a user