From 9ea6228b07efe4fcefdfb5de83a66308a73ce923 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 30 Jul 2020 14:53:42 +0200 Subject: 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. --- .../blender/editors/space_sequencer/sequencer_edit.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 3fbc31d5240..fe851aa16c8 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2543,7 +2543,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) { @@ -2956,6 +2957,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); } @@ -3032,6 +3034,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); @@ -3371,8 +3376,15 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BKE_sequence_base_dupli_recursive( - scene, scene, &seqbase_clipboard, ed->seqbasep, 0, LIB_ID_CREATE_NO_USER_REFCOUNT); + /* 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 | LIB_ID_FREE_NO_MAIN)); seqbase_clipboard_frame = scene->r.cfra; @@ -3430,6 +3442,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) { -- cgit v1.2.3