diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-24 10:51:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-24 10:51:04 +0400 |
commit | 576161b18673ef5cd5833330d4bfbf1266c3f624 (patch) | |
tree | 4448532c0b4b8aac30cac9d0de0d29e821df4dce /source/blender/editors/space_sequencer | |
parent | d0f225393cc4c65c1e2e9c2003f3a07eb18db28f (diff) |
fix [#36262] Paste strip with video or sound content from another file crashes Blender
existing code was very stupid.
- all ID pointers for clipboard strips are handled uniformly.
- clipboard stores a duplicate ID pointer which are restored on paste.
- restoring pointers...
-- use ID's that are still in the database (copy&paste within the same file).
-- fallback to name lookup.
-- fallback to loading them from the original filepath (movie-clip and sound only).
also fix bug pasting where initialing the sound wasn't done if there was no frame-offset.
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 8981a28834e..955a9c78c56 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2721,7 +2721,6 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq) } } -/* TODO, validate scenes */ static int sequencer_copy_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -2766,6 +2765,11 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) for (seq = seqbase_clipboard.first; seq; seq = seq->next) { seq_copy_del_sound(scene, seq); } + + /* duplicate pointers */ + for (seq = seqbase_clipboard.first; seq; seq = seq->next) { + BKE_sequence_clipboard_pointers_store(seq); + } } return OPERATOR_FINISHED; @@ -2790,6 +2794,7 @@ void SEQUENCER_OT_copy(wmOperatorType *ot) static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, TRUE); /* create if needed */ ListBase nseqbase = {NULL, NULL}; @@ -2805,10 +2810,17 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) if (ofs) { for (iseq = nseqbase.first; iseq; iseq = iseq->next) { BKE_sequence_translate(scene, iseq, ofs); - BKE_sequence_sound_init(scene, iseq); } } + for (iseq = nseqbase.first; iseq; iseq = iseq->next) { + BKE_sequence_clipboard_pointers_restore(iseq, bmain); + } + + for (iseq = nseqbase.first; iseq; iseq = iseq->next) { + BKE_sequence_sound_init(scene, iseq); + } + iseq_first = nseqbase.first; BLI_movelisttolist(ed->seqbasep, &nseqbase); |