[Bf-blender-cvs] [0912bff] master: Sequencer text strip color options

Campbell Barton noreply at git.blender.org
Wed Apr 27 07:46:41 CEST 2016


Commit: 0912bffb848dbb3fd13e736f1f60128e4a36a7f7
Author: Campbell Barton
Date:   Wed Apr 27 15:49:13 2016 +1000
Branches: master
https://developer.blender.org/rB0912bffb848dbb3fd13e736f1f60128e4a36a7f7

Sequencer text strip color options

D1930 by @NiKoZLaB

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

M	release/scripts/startup/bl_ui/space_sequencer.py
M	source/blender/blenkernel/intern/seqeffects.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/makesdna/DNA_sequence_types.h
M	source/blender/makesrna/intern/rna_sequencer.c

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

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 2331458..65fd0a4 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -668,7 +668,15 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
             col = layout.column()
             col.prop(strip, "text")
             col.prop(strip, "font_size")
-            col.prop(strip, "use_shadow")
+
+            row = col.row()
+            row.prop(strip, "color")
+            row = col.row()
+            row.prop(strip, "use_shadow")
+            rowsub = row.row()
+            rowsub.active = strip.use_shadow
+            rowsub.prop(strip, "shadow_color", text="")
+
             col.prop(strip, "align_x")
             col.prop(strip, "align_y")
             col.prop(strip, "location")
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index dfce931..ef44741 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -3084,6 +3084,10 @@ static void init_text_effect(Sequence *seq)
 
 	data = seq->effectdata = MEM_callocN(sizeof(TextVars), "textvars");
 	data->text_size = 30;
+
+	copy_v4_fl(data->color, 1.0f);
+	data->shadow_color[3] = 1.0f;
+
 	BLI_strncpy(data->text, "Text", sizeof(data->text));
 
 	data->loc[0] = 0.5f;
@@ -3188,11 +3192,11 @@ static ImBuf *do_text_effect(const SeqRenderData *context, Sequence *seq, float
 		fontx = BLF_width_max(mono);
 		fonty = line_height;
 		BLF_position(mono, x + max_ii(fontx / 25, 1), y + max_ii(fonty / 25, 1), 0.0f);
-		BLF_buffer_col(mono, (const float[4]){0.0f, 0.0f, 0.0f, 1.0f});
+		BLF_buffer_col(mono, data->shadow_color);
 		BLF_draw_buffer(mono, data->text, BLF_DRAW_STR_DUMMY_MAX);
 	}
 	BLF_position(mono, x, y, 0.0f);
-	BLF_buffer_col(mono, (const float[4]){1.0f, 1.0f, 1.0f, 1.0f});
+	BLF_buffer_col(mono, data->color);
 	BLF_draw_buffer(mono, data->text, BLF_DRAW_STR_DUMMY_MAX);
 
 	BLF_buffer(mono, NULL, NULL, 0, 0, 0, NULL);
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 18740d4..54b2582 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1084,5 +1084,21 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 			}
 		}
 
+		for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+			Sequence *seq;
+
+			SEQ_BEGIN (scene->ed, seq)
+			{
+				if (seq->type == SEQ_TYPE_TEXT) {
+					TextVars *data = seq->effectdata;
+					if (data->color[3] == 0.0f) {
+						copy_v4_fl(data->color, 1.0f);
+						data->shadow_color[3] = 1.0f;
+					}
+				}
+			}
+			SEQ_END
+		}
+
 	}
 }
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 3a64890..1f4e4df 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -274,6 +274,7 @@ typedef struct GaussianBlurVars {
 typedef struct TextVars {
 	char text[512];
 	int text_size;
+	float color[4], shadow_color[4];
 	float loc[2];
 	float wrap_width;
 	char flag;
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index e8a45e6..68d4f7f 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -2330,6 +2330,16 @@ static void rna_def_text(StructRNA *srna)
 	RNA_def_property_ui_range(prop, 0.0f, 1000, 1, -1);
 	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
 
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "color");
+	RNA_def_property_ui_text(prop, "Color", "");
+	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+	prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "shadow_color");
+	RNA_def_property_ui_text(prop, "Shadow Color", "");
+	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
 	prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "loc");
 	RNA_def_property_ui_text(prop, "Location", "Location of the text");




More information about the Bf-blender-cvs mailing list