diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-17 19:28:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-17 19:28:45 +0300 |
commit | 4271a40ee7a53029f04389234278b7f64d834a11 (patch) | |
tree | b2923b1da5fe4fcc28897db10acfae15030d1ce5 /source/blender/editors/space_sequencer | |
parent | 8d63126b64b4adec9c9c19d230f64a6010b26b2f (diff) |
- sequencer clipboard now stored globally (not in the scene, makes pasting into other scenes nicer)
- multiple pastes after copying
- clear the sound handle when copying (was crashing)
- allow seq freeing without a scene (assumes seq strip isnt active and sound handle isnt set)
- free clipboard sequences on exit
- paste sequence strips using the relative playhead location from when they were copied.
TODO
- check scene pointers on paste
- detect overlaps after paste
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 82 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_ops.c | 3 |
2 files changed, 70 insertions, 15 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 8c228e9ca74..dda5860900b 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -954,7 +954,7 @@ static Sequence * deep_dupli_seq(struct Scene *scene, Sequence * seq) } -static void recurs_dupli_seq(Scene *scene, ListBase *old, ListBase *new) +static void recurs_dupli_seq(Scene *scene, ListBase *old, ListBase *new, int do_context) { Sequence *seq; Sequence *seqn = 0; @@ -965,15 +965,19 @@ static void recurs_dupli_seq(Scene *scene, ListBase *old, ListBase *new) if(seq->flag & SELECT) { seqn = dupli_seq(scene, seq); if (seqn) { /*should never fail */ - seq->flag &= SEQ_DESEL; - seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL+SEQ_LOCK); + 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); + recurs_dupli_seq(scene, &seq->seqbase,&seqn->seqbase, do_context); - if (seq == last_seq) { - active_seq_set(scene, seqn); + if(do_context) { + if (seq == last_seq) { + active_seq_set(scene, seqn); + } } } } @@ -1801,7 +1805,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) if(ed==NULL) return OPERATOR_CANCELLED; - recurs_dupli_seq(scene, ed->seqbasep, &new); + recurs_dupli_seq(scene, ed->seqbasep, &new, TRUE); addlisttolist(ed->seqbasep, &new); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); @@ -2746,19 +2750,39 @@ void SEQUENCER_OT_rendersize(wmOperatorType *ot) /* properties */ } -static void *_copy_scene= NULL; // XXX - FIXME +static void seq_del_sound(Scene *scene, Sequence *seq) +{ + if(seq->type == SEQ_META) { + Sequence *iseq; + for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) { + seq_del_sound(scene, iseq); + } + } + else if(seq->sound_handle) + sound_delete_handle(scene, seq->sound_handle); + +} + +/* TODO, validate scenes */ static int sequencer_copy_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); + Sequence *seq, *seq_act; if(ed==NULL) return OPERATOR_CANCELLED; - seq_free_clipboard(scene); - recurs_dupli_seq(scene, ed->seqbasep, &ed->seqbase_clipboard); + seq_free_clipboard(); + + recurs_dupli_seq(scene, ed->seqbasep, &seqbase_clipboard, FALSE); + seqbase_clipboard_frame= scene->r.cfra; + + /* Need to remove anything that references the current scene */ + for(seq= seqbase_clipboard.first; seq; seq= seq->next) { + seq_del_sound(scene, seq); + } - _copy_scene = scene; return OPERATOR_FINISHED; } @@ -2779,16 +2803,44 @@ void SEQUENCER_OT_copy(wmOperatorType *ot) /* properties */ } +static void seq_offset(Sequence *seq, int ofs) +{ + if(seq->type == SEQ_META) { + Sequence *iseq; + for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) { + seq_offset(iseq, ofs); + } + } + else { + seq->start += ofs; + } + + calc_sequence_disp(seq); +} + static int sequencer_paste_exec(bContext *C, wmOperator *op) { - int retval = OPERATOR_CANCELLED; Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */ - Editing *ed_from= seq_give_editing((Scene *)_copy_scene, TRUE); /* create if needed */ + ListBase new = {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); - addlisttolist(ed->seqbasep, &ed_from->seqbase_clipboard); - ed_from->seqbase_clipboard.first= ed_from->seqbase_clipboard.last= NULL; // XXX - could duplicate these to use the clip + /* transform pasted strips before adding */ + if(ofs) { + for(iseq= new.first; iseq; iseq= iseq->next) { + seq_offset(iseq, ofs); + } + } + + addlisttolist(ed->seqbasep, &new); + + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 76c7b37f59e..7e7b45e623f 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -146,6 +146,9 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", DELKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_images_separate", YKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_meta_toggle", TABKEY, KM_PRESS, 0, 0); |