[Bf-blender-cvs] [a8e8c0f3495] temp-T78835: Sequencer: Ensure UUIDs are updated when needed

Sergey Sharybin noreply at git.blender.org
Thu Jul 30 15:44:36 CEST 2020


Commit: a8e8c0f34958bf091c6c977940e8facf878909cd
Author: Sergey Sharybin
Date:   Thu Jul 30 14:53:42 2020 +0200
Branches: temp-T78835
https://developer.blender.org/rBa8e8c0f34958bf091c6c977940e8facf878909cd

Sequencer: Ensure UUIDs are updated when needed

Document cases where it seems that they need to be updated, but where
the proper behavior is to not update the UUID.

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

M	source/blender/editors/space_sequencer/sequencer_edit.c

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

diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index ce4fc0ff538..cb5742aef79 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2541,7 +2541,8 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
 
   if (nseqbase.first) {
     Sequence *seq = nseqbase.first;
-    /* Rely on the nseqbase list being added at the end. */
+    /* Rely on the nseqbase list being added at the end.
+     * Their UUIDs has been re-generated by the BKE_sequence_base_dupli_recursive(), */
     BLI_movelisttolist(ed->seqbasep, &nseqbase);
 
     for (; seq; seq = seq->next) {
@@ -2954,6 +2955,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
     if (seq != seqm && (seq->flag & SELECT)) {
       BKE_sequence_invalidate_cache_composite(scene, seq);
       channel_max = max_ii(seq->machine, channel_max);
+      /* Sequence is moved within the same edit, no need to re-generate the UUID. */
       BLI_remlink(ed->seqbasep, seq);
       BLI_addtail(&seqm->seqbase, seq);
     }
@@ -3030,6 +3032,9 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
     BKE_sequence_invalidate_cache_composite(scene, seq);
   }
 
+  /* This moves strips from meta to parent, sating within same edit and no new strips are
+   * allocated. If the UUID was unique already (as it should) it will stay unique. Nn need to
+   * re-generate the UUIDs.*/
   BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase);
 
   BLI_listbase_clear(&last_seq->seqbase);
@@ -3369,8 +3374,16 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
 
+  /* NOTE: The UUID is re-generated on paste, so we can keep UUID in the clipboard since
+   * nobody can reach them anyway.
+   * This reduces chance or running out of UUIDs if a cat falls asleep on Ctrl-C. */
   BKE_sequence_base_dupli_recursive(
-      scene, scene, &seqbase_clipboard, ed->seqbasep, 0, LIB_ID_CREATE_NO_USER_REFCOUNT);
+      scene,
+      scene,
+      &seqbase_clipboard,
+      ed->seqbasep,
+      0,
+      (LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_COPY_KEEP_SESSION_UUID));
 
   seqbase_clipboard_frame = scene->r.cfra;
 
@@ -3428,6 +3441,8 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
 
   iseq_first = nseqbase.first;
 
+  /* NOTE: BKE_sequence_base_dupli_recursive() takes care of generating new UUIDs for sequences
+   * in the new list. */
   BLI_movelisttolist(ed->seqbasep, &nseqbase);
 
   for (iseq = iseq_first; iseq; iseq = iseq->next) {



More information about the Bf-blender-cvs mailing list