[Bf-blender-cvs] [3305a94fa1d] blender-v2.90-release: Sequencer: Add session UUID management to Sequence

Sergey Sharybin noreply at git.blender.org
Fri Jul 31 11:50:41 CEST 2020


Commit: 3305a94fa1d80259651c776e088ec9c6a6f64e44
Author: Sergey Sharybin
Date:   Thu Jul 30 11:58:18 2020 +0200
Branches: blender-v2.90-release
https://developer.blender.org/rB3305a94fa1d80259651c776e088ec9c6a6f64e44

Sequencer: Add session UUID management to Sequence

This is the first step for having sequences covered with session UUID
with the goal to remove code which uses original sequence pointer to
match sequences.

Currently this UUID is maintained on file load, allocation and leaf
duplication function.There are more cases to cover and ensure UUID
is re-generated or re-used when needed. It will be done as follow-up
development.

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

M	source/blender/blenkernel/BKE_sequencer.h
M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/blenloader/intern/readfile.c

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

diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index c32abbb41c6..6997ea94786 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -527,6 +527,9 @@ typedef struct Sequence *(*SeqLoadFn)(struct bContext *, ListBase *, struct SeqL
 
 struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type);
 
+/* Generate new UUID for the given sequence. */
+void BKE_sequence_session_uuid_generate(struct Sequence *sequence);
+
 void BKE_sequence_alpha_mode_from_extension(struct Sequence *seq);
 void BKE_sequence_init_colorspace(struct Sequence *seq);
 
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 42276b7f5c0..57295805e97 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -46,6 +46,7 @@
 #include "BLI_listbase.h"
 #include "BLI_math.h"
 #include "BLI_path_util.h"
+#include "BLI_session_uuid.h"
 #include "BLI_string.h"
 #include "BLI_string_utf8.h"
 #include "BLI_threads.h"
@@ -5352,9 +5353,16 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type)
   seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Sequence Stereo Format");
   seq->cache_flag = SEQ_CACHE_STORE_RAW | SEQ_CACHE_STORE_PREPROCESSED | SEQ_CACHE_STORE_COMPOSITE;
 
+  BKE_sequence_session_uuid_generate(seq);
+
   return seq;
 }
 
+void BKE_sequence_session_uuid_generate(struct Sequence *sequence)
+{
+  sequence->runtime.session_uuid = BLI_session_uuid_generate();
+}
+
 void BKE_sequence_alpha_mode_from_extension(Sequence *seq)
 {
   if (seq->strip && seq->strip->stripdata) {
@@ -5664,6 +5672,10 @@ static Sequence *seq_dupli(const Scene *scene_src,
 {
   Sequence *seqn = MEM_dupallocN(seq);
 
+  if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) {
+    BKE_sequence_session_uuid_generate(seq);
+  }
+
   seq->tmp = seqn;
   seqn->strip = MEM_dupallocN(seq->strip);
 
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 9320187f2a0..3c6bf481abe 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6461,6 +6461,9 @@ static void direct_link_scene(BlendDataReader *reader, Scene *sce)
     link_recurs_seq(reader, &ed->seqbase);
 
     SEQ_BEGIN (ed, seq) {
+      /* Do as early as possible, so that other parts of reading can rely on valid session UUID. */
+      BKE_sequence_session_uuid_generate(seq);
+
       BLO_read_data_address(reader, &seq->seq1);
       BLO_read_data_address(reader, &seq->seq2);
       BLO_read_data_address(reader, &seq->seq3);



More information about the Bf-blender-cvs mailing list