[Bf-blender-cvs] [eaee2b41193] blender-v2.83-release: Fix T36263: Pasted strip doesnt have F-Curve keyframes from the original

Richard Antalik noreply at git.blender.org
Sun May 10 08:28:26 CEST 2020


Commit: eaee2b4119359493b87422100e913a5e1dc9a001
Author: Richard Antalik
Date:   Sun May 10 08:26:24 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBeaee2b4119359493b87422100e913a5e1dc9a001

Fix T36263: Pasted strip doesnt have F-Curve keyframes from the original

Original code for copying strips tried to change strip name 2 times before
copying and once again after pasting.

Store structs in clipboard in unchanged state, so we can reference data after
pasting easily.

Better method would probably be storing animation data in clipboard as well,
so we can copy animated strips even between scenes.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7638

===================================================================

M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/editors/space_sequencer/sequencer_edit.c

===================================================================

diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 46edcea26c0..6791424694a 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -131,6 +131,7 @@ static ThreadMutex seq_render_mutex = BLI_MUTEX_INITIALIZER;
 #define SELECT 1
 ListBase seqbase_clipboard;
 int seqbase_clipboard_frame;
+
 SequencerDrawView sequencer_view3d_fn = NULL; /* NULL in background mode */
 
 #if 0 /* unused function */
@@ -4618,6 +4619,10 @@ bool BKE_sequence_test_overlap(ListBase *seqbasep, Sequence *test)
 
 void BKE_sequence_translate(Scene *evil_scene, Sequence *seq, int delta)
 {
+  if (delta == 0) {
+    return;
+  }
+
   BKE_sequencer_offset_animdata(evil_scene, seq, delta);
   seq->start += delta;
 
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index e615e7be92f..a86d679992b 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -3456,8 +3456,6 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
   Scene *scene = CTX_data_scene(C);
   Editing *ed = BKE_sequencer_editing_get(scene, false);
 
-  ListBase nseqbase = {NULL, NULL};
-
   BKE_sequencer_free_clipboard();
 
   if (BKE_sequence_base_isolated_sel_check(ed->seqbasep) == false) {
@@ -3466,27 +3464,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
   }
 
   BKE_sequence_base_dupli_recursive(
-      scene, scene, &nseqbase, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME, LIB_ID_CREATE_NO_USER_REFCOUNT);
-
-  /* Make sure that copied strips have unique names.
-   * Add them temporarily to the end of the original seqbase (bug 25932). */
-  if (nseqbase.first) {
-    Sequence *seq, *first_seq = nseqbase.first;
-    BLI_movelisttolist(ed->seqbasep, &nseqbase);
-
-    for (seq = first_seq; seq; seq = seq->next) {
-      BKE_sequencer_recursive_apply(seq, apply_unique_name_fn, scene);
-    }
-
-    seqbase_clipboard.first = first_seq;
-    seqbase_clipboard.last = ed->seqbasep->last;
-
-    if (first_seq->prev) {
-      first_seq->prev->next = NULL;
-      ed->seqbasep->last = first_seq->prev;
-      first_seq->prev = NULL;
-    }
-  }
+      scene, scene, &seqbase_clipboard, ed->seqbasep, 0, LIB_ID_CREATE_NO_USER_REFCOUNT);
 
   seqbase_clipboard_frame = scene->r.cfra;
 
@@ -3517,7 +3495,7 @@ void SEQUENCER_OT_copy(wmOperatorType *ot)
   ot->flag = OPTYPE_REGISTER;
 }
 
-static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
+static int sequencer_paste_exec(bContext *C, wmOperator *op)
 {
   Main *bmain = CTX_data_main(C);
   Scene *scene = CTX_data_scene(C);
@@ -3533,28 +3511,18 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
    * must happen on the clipboard itself, so that copying does user counting
    * on the actual data-blocks. */
   BKE_sequencer_base_clipboard_pointers_restore(&seqbase_clipboard, bmain);
-  BKE_sequence_base_dupli_recursive(
-      scene, scene, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME, 0);
-  BKE_sequencer_base_clipboard_pointers_store(bmain, &seqbase_clipboard);
-
-  /* Transform pasted strips before adding. */
-  if (ofs) {
-    for (iseq = nseqbase.first; iseq; iseq = iseq->next) {
-      BKE_sequence_translate(scene, iseq, ofs);
-    }
-  }
+  BKE_sequence_base_dupli_recursive(scene, scene, &nseqbase, &seqbase_clipboard, 0, 0);
 
   iseq_first = nseqbase.first;
 
   BLI_movelisttolist(ed->seqbasep, &nseqbase);
 
-  /* Make sure, that pasted strips have unique names. */
   for (iseq = iseq_first; iseq; iseq = iseq->next) {
+    /* Make sure, that pasted strips have unique names. */
     BKE_sequencer_recursive_apply(iseq, apply_unique_name_fn, scene);
-  }
-
-  /* Ensure, that pasted strips don't overlap. */
-  for (iseq = iseq_first; iseq; iseq = iseq->next) {
+    /* Translate after name has been changed, otherwise this will affect animdata of original strip. */
+    BKE_sequence_translate(scene, iseq, ofs);
+    /* Ensure, that pasted strips don't overlap. */
     if (BKE_sequence_test_overlap(ed->seqbasep, iseq)) {
       BKE_sequence_base_shuffle(ed->seqbasep, iseq, scene);
     }



More information about the Bf-blender-cvs mailing list