diff options
author | Richard Antalik <richardantalik@gmail.com> | 2019-01-14 08:28:07 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2019-01-14 08:57:09 +0300 |
commit | b3dbe17658fe8ca5115abab642cc0f1680d1f0d5 (patch) | |
tree | 9ee5fa8e6f8e4e8a009a9f6ed4bb2af0f91693f8 /source/blender/makesrna/intern/rna_sequencer.c | |
parent | c450461e68cdd723825c7bf4a4ebde079ba7b57b (diff) |
Add font selection to VSE text strips
Allows users to select a font for text strips in the video sequence editor.
Related: 3610f1fc43d0 Sequencer: refactor clipboard copy to no longer increase user count.
Reviewed by: Brecht
Differential Revision: https://developer.blender.org/D3621
Diffstat (limited to 'source/blender/makesrna/intern/rna_sequencer.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 433ca729c65..e39a5e57933 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -32,6 +32,7 @@ #include "DNA_scene_types.h" #include "DNA_sequence_types.h" #include "DNA_movieclip_types.h" +#include "DNA_vfont_types.h" #include "BLI_math.h" @@ -461,6 +462,19 @@ static void rna_SequenceCrop_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P BKE_sequence_invalidate_cache(scene, seq); } +static void rna_Sequence_text_font_set(PointerRNA *ptr, PointerRNA ptr_value) +{ + Sequence *seq = ptr->data; + TextVars *data = seq->effectdata; + VFont *value = ptr_value.data; + + BKE_sequencer_text_font_unload(data, true); + + id_us_plus(&value->id); + data->text_blf_id = SEQ_FONT_NOT_LOADED; + data->text_font = value; +} + /* name functions that ignore the first two characters */ static void rna_Sequence_name_get(PointerRNA *ptr, char *value) { @@ -2407,6 +2421,14 @@ static void rna_def_text(StructRNA *srna) RNA_def_struct_sdna_from(srna, "TextVars", "effectdata"); + prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "text_font"); + RNA_def_property_ui_icon(prop, ICON_FILE_FONT, false); + RNA_def_property_ui_text(prop, "Font", "Font of the text. Falls back to the UI font by default"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Sequence_text_font_set", NULL, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); + prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "text_size"); RNA_def_property_ui_text(prop, "Size", "Size of the text"); |