[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50385] trunk/blender: Sequencer: remove strip's color balance in favor of modifiers

Sergey Sharybin sergey.vfx at gmail.com
Tue Sep 4 15:37:53 CEST 2012


Revision: 50385
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50385
Author:   nazgul
Date:     2012-09-04 13:37:53 +0000 (Tue, 04 Sep 2012)
Log Message:
-----------
Sequencer: remove strip's color balance in favor of modifiers

Having two ways to control color balance now seems a bit overkill
and not clear.

Removed old Color Balance settings from the interface and logic,
added versioning code to convert this settings to modifier.

Unfortunately, since color balance was a pointer, it's not actually
possible to preserve compatibility of old files saved in new
blender and opened back in old blender.

Hopefully there's no regressions :)

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
    trunk/blender/source/blender/blenkernel/BKE_blender.h
    trunk/blender/source/blender/blenkernel/intern/sequencer.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/blenloader/intern/writefile.c
    trunk/blender/source/blender/makesdna/DNA_sequence_types.h
    trunk/blender/source/blender/makesrna/intern/rna_sequencer.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2012-09-04 13:29:07 UTC (rev 50384)
+++ trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2012-09-04 13:37:53 UTC (rev 50385)
@@ -793,11 +793,7 @@
         col.prop(strip, "use_premultiply")
         col.prop(strip, "use_float")
 
-        layout.prop(strip, "use_color_balance")
-        if strip.use_color_balance and strip.color_balance:  # TODO - need to add this somehow
-            draw_color_balance(layout, strip.color_balance)
 
-
 class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
     bl_label = "Proxy / Timecode"
 

Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h	2012-09-04 13:29:07 UTC (rev 50384)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h	2012-09-04 13:37:53 UTC (rev 50385)
@@ -42,7 +42,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         263
-#define BLENDER_SUBVERSION      17
+#define BLENDER_SUBVERSION      18
 
 /* 262 was the last editmesh release but its has compatibility code for bmesh data,
  * so set the minversion to 2.61 */

Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c	2012-09-04 13:29:07 UTC (rev 50384)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c	2012-09-04 13:37:53 UTC (rev 50385)
@@ -165,9 +165,6 @@
 	if (strip->transform) {
 		MEM_freeN(strip->transform);
 	}
-	if (strip->color_balance) {
-		MEM_freeN(strip->color_balance);
-	}
 
 	MEM_freeN(strip);
 }
@@ -1670,26 +1667,6 @@
 		imb_freerectImBuf(ibuf);
 }
 
-static void sequence_color_balance(SeqRenderData context, Sequence *seq, ImBuf *ibuf, float mul, int cfra)
-{
-	StripColorBalance *cb = seq->strip->color_balance;
-	ImBuf *mask_input = NULL;
-	short make_float = seq->flag & SEQ_MAKE_FLOAT;
-
-	if (seq->mask_sequence) {
-		if (seq->mask_sequence != seq && !BKE_sequence_check_depend(seq, seq->mask_sequence)) {
-			int make_float = ibuf->rect_float != NULL;
-
-			mask_input = BKE_sequencer_render_mask_input(context, SEQUENCE_MASK_INPUT_STRIP, seq->mask_sequence, NULL, cfra, make_float);
-		}
-	}
-
-	BKE_sequencer_color_balance_apply(cb, ibuf, mul, make_float, mask_input);
-
-	if (mask_input)
-		IMB_freeImBuf(mask_input);
-}
-
 /*
  *  input preprocessing for SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP and SEQ_TYPE_SCENE
  *
@@ -1712,9 +1689,7 @@
 {
 	float mul;
 
-	if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX |
-	                 SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL))
-	{
+	if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX | SEQ_FLIPY | SEQ_MAKE_PREMUL)) {
 		return TRUE;
 	}
 
@@ -1833,11 +1808,6 @@
 		mul *= seq->blend_opacity / 100.0f;
 	}
 
-	if (seq->flag & SEQ_USE_COLOR_BALANCE && seq->strip->color_balance) {
-		sequence_color_balance(context, seq, ibuf, mul, cfra);
-		mul = 1.0;
-	}
-
 	if (seq->flag & SEQ_MAKE_FLOAT) {
 		if (!ibuf->rect_float)
 			IMB_float_from_rect_simple(ibuf);
@@ -4037,10 +4007,6 @@
 		seqn->strip->proxy->anim = NULL;
 	}
 
-	if (seq->strip->color_balance) {
-		seqn->strip->color_balance = MEM_dupallocN(seq->strip->color_balance);
-	}
-
 	if (seqn->modifiers.first) {
 		seqn->modifiers.first = seqn->modifiers.last = NULL;
 

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2012-09-04 13:29:07 UTC (rev 50384)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2012-09-04 13:37:53 UTC (rev 50385)
@@ -5005,16 +5005,9 @@
 				else {
 					seq->strip->proxy = NULL;
 				}
-				if (seq->flag & SEQ_USE_COLOR_BALANCE) {
-					seq->strip->color_balance = newdataadr(
-						fd, seq->strip->color_balance);
-				}
-				else {
-					seq->strip->color_balance = NULL;
-				}
-				if (seq->strip->color_balance) {
-					// seq->strip->color_balance->gui = 0; // XXX - peter, is this relevant in 2.5?
-				}
+
+				/* need to load color balance to it could be converted to modifier */
+				seq->strip->color_balance = newdataadr(fd, seq->strip->color_balance);
 			}
 
 			direct_link_sequence_modifiers(fd, &seq->modifiers);
@@ -7888,6 +7881,42 @@
 			ntreetype->foreach_nodetree(main, NULL, do_version_ntree_mask_264);
 	}
 
+	if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 18)) {
+		Scene *scene;
+
+		for (scene = main->scene.first; scene; scene = scene->id.next) {
+			if (scene->ed) {
+				Sequence *seq;
+
+				SEQ_BEGIN (scene->ed, seq)
+				{
+					Strip *strip = seq->strip;
+
+					if (strip && strip->color_balance) {
+						SequenceModifierData *smd;
+						ColorBalanceModifierData *cbmd;
+
+						smd = BKE_sequence_modifier_new(seq, NULL, seqModifierType_ColorBalance);
+						cbmd = (ColorBalanceModifierData *) smd;
+
+						cbmd->color_balance = *strip->color_balance;
+
+						/* multiplication with color balance used is handled differently,
+						 * so we need to move multiplication to modifier so files would be
+						 * compatible
+						 */
+						cbmd->color_multiply = seq->mul;
+						seq->mul = 1.0f;
+
+						MEM_freeN(strip->color_balance);
+						strip->color_balance = NULL;
+					}
+				}
+				SEQ_END
+			}
+		}
+	}
+
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
 	/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
 

Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c	2012-09-04 13:29:07 UTC (rev 50384)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c	2012-09-04 13:37:53 UTC (rev 50385)
@@ -2214,9 +2214,6 @@
 					if (seq->flag & SEQ_USE_PROXY && strip->proxy) {
 						writestruct(wd, DATA, "StripProxy", 1, strip->proxy);
 					}
-					if (seq->flag & SEQ_USE_COLOR_BALANCE && strip->color_balance) {
-						writestruct(wd, DATA, "StripColorBalance", 1, strip->color_balance);
-					}
 					if (seq->type==SEQ_TYPE_IMAGE)
 						writestruct(wd, DATA, "StripElem", MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), strip->stripdata);
 					else if (seq->type==SEQ_TYPE_MOVIE || seq->type==SEQ_TYPE_SOUND_RAM || seq->type == SEQ_TYPE_SOUND_HD)

Modified: trunk/blender/source/blender/makesdna/DNA_sequence_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_sequence_types.h	2012-09-04 13:29:07 UTC (rev 50384)
+++ trunk/blender/source/blender/makesdna/DNA_sequence_types.h	2012-09-04 13:37:53 UTC (rev 50385)
@@ -99,7 +99,7 @@
 	StripProxy *proxy;
 	StripCrop *crop;
 	StripTransform *transform;
-	StripColorBalance *color_balance;
+	StripColorBalance *color_balance DNA_DEPRECATED;
 } Strip;
 
 /**
@@ -315,7 +315,7 @@
 #define SEQ_USE_PROXY               (1 << 15)
 #define SEQ_USE_TRANSFORM           (1 << 16)
 #define SEQ_USE_CROP                (1 << 17)
-#define SEQ_USE_COLOR_BALANCE       (1 << 18)
+/* #define SEQ_USE_COLOR_BALANCE       (1 << 18) */ /* DEPRECATED */
 #define SEQ_USE_PROXY_CUSTOM_DIR    (1 << 19)
 
 #define SEQ_USE_PROXY_CUSTOM_FILE   (1 << 21)

Modified: trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sequencer.c	2012-09-04 13:29:07 UTC (rev 50384)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequencer.c	2012-09-04 13:37:53 UTC (rev 50385)
@@ -244,28 +244,6 @@
 	BKE_sequencer_sort(scene);
 }
 
-/* properties that need to allocate structs */
-static void rna_Sequence_use_color_balance_set(PointerRNA *ptr, int value)
-{
-	Sequence *seq = (Sequence *)ptr->data;
-	int c;
-	
-	if (value) {
-		seq->flag |= SEQ_USE_COLOR_BALANCE;
-		if (seq->strip->color_balance == NULL) {
-			seq->strip->color_balance = MEM_callocN(sizeof(struct StripColorBalance), "StripColorBalance");
-			for (c = 0; c < 3; c++) {
-				seq->strip->color_balance->lift[c] = 1.0f;
-				seq->strip->color_balance->gamma[c] = 1.0f;
-				seq->strip->color_balance->gain[c] = 1.0f;
-			}
-		}
-	}
-	else {
-		seq->flag ^= SEQ_USE_COLOR_BALANCE;
-	}
-}
-
 static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value)
 {
 	Sequence *seq = (Sequence *)ptr->data;
@@ -1631,16 +1609,6 @@
 	RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame");
 	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
 
-	prop = RNA_def_property(srna, "use_color_balance", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_COLOR_BALANCE);
-	RNA_def_property_ui_text(prop, "Use Color Balance", "(3-Way color correction) on input");
-	RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_color_balance_set");
-	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
-	prop = RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
-	RNA_def_property_pointer_sdna(prop, NULL, "strip->color_balance");
-	RNA_def_property_ui_text(prop, "Color Balance", "");
-
 	prop = RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM);
 	RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing");




More information about the Bf-blender-cvs mailing list