From 0912bffb848dbb3fd13e736f1f60128e4a36a7f7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 27 Apr 2016 15:49:13 +1000 Subject: Sequencer text strip color options D1930 by @NiKoZLaB --- release/scripts/startup/bl_ui/space_sequencer.py | 10 +++++++++- source/blender/blenkernel/intern/seqeffects.c | 8 ++++++-- source/blender/blenloader/intern/versioning_270.c | 16 ++++++++++++++++ source/blender/makesdna/DNA_sequence_types.h | 1 + source/blender/makesrna/intern/rna_sequencer.c | 10 ++++++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 233145819e7..65fd0a43619 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 dfce931cbf4..ef447412f2b 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 18740d43a26..54b2582c56c 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 3a64890a84b..1f4e4df4660 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 e8a45e6a77d..68d4f7f7e51 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"); -- cgit v1.2.3