[Bf-blender-cvs] [c383397d072] master: Fix versioning for sequencer color balance modifier.

Josef Raschen noreply at git.blender.org
Fri Oct 15 23:21:02 CEST 2021


Commit: c383397d072f3fdc10857bd4b0e484c0de469e2f
Author: Josef Raschen
Date:   Fri Oct 15 23:13:31 2021 +0200
Branches: master
https://developer.blender.org/rBc383397d072f3fdc10857bd4b0e484c0de469e2f

Fix versioning for sequencer color balance modifier.

Commit 213554f24a17 added slope/offset/power controls to the sequencer
color balance modifier, but colors in this mode were not initialized
with old files.

Initialize colors to default values.

Reviewed By: ISS

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

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

M	source/blender/blenloader/intern/versioning_300.c

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

diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index af61447e5ad..93c299a48aa 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -456,6 +456,22 @@ static bool do_versions_sequencer_color_tags(Sequence *seq, void *UNUSED(user_da
   return true;
 }
 
+static bool do_versions_sequencer_color_balance_sop(Sequence *seq, void *UNUSED(user_data))
+{
+  LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) {
+    if (smd->type == seqModifierType_ColorBalance) {
+      StripColorBalance *cb = &((ColorBalanceModifierData *)smd)->color_balance;
+      cb->method = SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN;
+      for (int i = 0; i < 3; i++) {
+        copy_v3_fl(cb->slope, 1.0f);
+        copy_v3_fl(cb->offset, 1.0f);
+        copy_v3_fl(cb->power, 1.0f);
+      }
+    }
+  }
+  return true;
+}
+
 static bNodeLink *find_connected_link(bNodeTree *ntree, bNodeSocket *in_socket)
 {
   LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
@@ -1709,6 +1725,13 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
         }
       }
     }
+
+    /* Set defaults for new color balance modifier parameters. */
+    LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+      if (scene->ed != NULL) {
+        SEQ_for_each_callback(&scene->ed->seqbase, do_versions_sequencer_color_balance_sop, NULL);
+      }
+    }
   }
 
   if (!MAIN_VERSION_ATLEAST(bmain, 300, 33)) {



More information about the Bf-blender-cvs mailing list