sequencer swap data operator.
needed for durian so we can swap out preview AVI's for EXR sequences.
This commit is contained in:
@@ -3790,6 +3790,33 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int seq_swap(Sequence *seq_a, Sequence *seq_b)
|
||||
{
|
||||
if(seq_a->len != seq_b->len)
|
||||
return 0;
|
||||
|
||||
/* type checking, could be more advanced but disalow sound vs non-sound copy */
|
||||
if(seq_a->type != seq_b->type) {
|
||||
if(seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
SWAP(Sequence, *seq_a, *seq_b);
|
||||
SWAP(void *, seq_a->prev, seq_b->prev);
|
||||
SWAP(void *, seq_a->next, seq_b->next);
|
||||
|
||||
SWAP(int, seq_a->start, seq_b->start);
|
||||
SWAP(int, seq_a->startofs, seq_b->startofs);
|
||||
SWAP(int, seq_a->endofs, seq_b->endofs);
|
||||
SWAP(int, seq_a->startstill, seq_b->startstill);
|
||||
SWAP(int, seq_a->endstill, seq_b->endstill);
|
||||
SWAP(int, seq_a->machine, seq_b->machine);
|
||||
SWAP(int, seq_a->startdisp, seq_b->enddisp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* XXX - hackish function needed for transforming strips! TODO - have some better solution */
|
||||
void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
|
||||
{
|
||||
@@ -3832,14 +3859,14 @@ Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
|
||||
}
|
||||
|
||||
|
||||
Sequence *active_seq_get(Scene *scene)
|
||||
Sequence *seq_active_get(Scene *scene)
|
||||
{
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
if(ed==NULL) return NULL;
|
||||
return ed->act_seq;
|
||||
}
|
||||
|
||||
void active_seq_set(Scene *scene, Sequence *seq)
|
||||
void seq_active_set(Scene *scene, Sequence *seq)
|
||||
{
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
if(ed==NULL) return;
|
||||
@@ -3847,6 +3874,35 @@ void active_seq_set(Scene *scene, Sequence *seq)
|
||||
ed->act_seq= seq;
|
||||
}
|
||||
|
||||
int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
|
||||
{
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
|
||||
*seq_act= seq_active_get(scene);
|
||||
|
||||
if(*seq_act == NULL) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
Sequence *seq;
|
||||
|
||||
*seq_other= NULL;
|
||||
|
||||
for(seq= ed->seqbasep->first; seq; seq= seq->next) {
|
||||
if(seq->flag & SELECT && (seq != (*seq_act))) {
|
||||
if(*seq_other) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
*seq_other= seq;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (*seq_other != NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* api like funcs for adding */
|
||||
|
||||
void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
|
||||
@@ -3861,7 +3917,7 @@ void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
|
||||
|
||||
if(seq_load->flag & SEQ_LOAD_REPLACE_SEL) {
|
||||
seq_load->flag |= SELECT;
|
||||
active_seq_set(scene, seq);
|
||||
seq_active_set(scene, seq);
|
||||
}
|
||||
|
||||
if(seq_load->flag & SEQ_LOAD_SOUND_CACHE) {
|
||||
|
||||
Reference in New Issue
Block a user