[Bf-blender-cvs] [98139f4e9a6] temp-T78835: Sequencer: Add session UUID to Sequence

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


Commit: 98139f4e9a687d91ad1f1a1624e1cbe826508a70
Author: Sergey Sharybin
Date:   Thu Jul 30 11:58:18 2020 +0200
Branches: temp-T78835
https://developer.blender.org/rB98139f4e9a687d91ad1f1a1624e1cbe826508a70

Sequencer: Add session UUID 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..8110c350108 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,13 @@ static Sequence *seq_dupli(const Scene *scene_src,
 {
   Sequence *seqn = MEM_dupallocN(seq);
 
+  if (flag & LIB_ID_COPY_ON_WRITE) {
+    /* Keep existing UUID, so that the dependency graph can match copy with the original. */
+  }
+  else {
+    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..f127a2ba9d8 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6514,6 +6514,8 @@ static void direct_link_scene(BlendDataReader *reader, Scene *sce)
           BKE_sequencer_proxy_set(seq, true);
         }
 
+        BKE_sequence_session_uuid_generate(seq);
+
         /* need to load color balance to it could be converted to modifier */
         BLO_read_data_address(reader, &seq->strip->color_balance);
       }



More information about the Bf-blender-cvs mailing list