diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-06-21 21:37:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-06-21 21:37:50 +0400 |
commit | 72d21c35adcea937bbf2e2423472c9ca5ed315c6 (patch) | |
tree | db996aab43585032910c0e1a96885926e342111f /source/blender/blenkernel/intern | |
parent | 3f4121cea5d10b76fac30f4fc60390f0d5e8ad20 (diff) |
sequencer swap data operator.
needed for durian so we can swap out preview AVI's for EXR sequences.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index d1ab63ca65e..51428f56dc9 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -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) { |