Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2016-06-21 05:21:24 +0300
committerDalai Felinto <dfelinto@gmail.com>2016-06-21 05:21:24 +0300
commitcb5a77253a719c08986aa69a3d3f7fc8725648c7 (patch)
tree436b7fa179d163801d3f95ea3472a1c1ec0edd78 /source/blender/makesrna/intern/rna_curve.c
parent1c199401983bd53577cb180efe83ee5314f04296 (diff)
Text Object: Vertical Alignment
A new option for Font/Text objects vertical alignment: * Top Base-Line (current mode) * Top * Center * Bottom The Top is the equivalent as the Top-Baseline with an empty line at the begin of the text. It's nice to have this option too though, since if we are driving the alignment via Python we don't want to add extra lines to the text only to accomodate to the desired vertical alignment. The Center and Bottom are as intuitive as their name suggest. When working with text boxes, the vertical alignment only work for paragraphs that are not vertically full. Many thanks to Campbell Barton (ideasman42 / @campbellbarton) for the code review, code comments, and overall suggestions and changes :) Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D2061
Diffstat (limited to 'source/blender/makesrna/intern/rna_curve.c')
-rw-r--r--source/blender/makesrna/intern/rna_curve.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index cb7a40a9238..b18fbf962bb 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -952,7 +952,7 @@ static void rna_def_nurbs(BlenderRNA *UNUSED(brna), StructRNA *srna)
static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna)
{
PropertyRNA *prop;
-
+
static EnumPropertyItem prop_align_items[] = {
{CU_LEFT, "LEFT", 0, "Left", "Align text to the left"},
{CU_MIDDLE, "CENTER", 0, "Center", "Center text"},
@@ -961,14 +961,28 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna)
{CU_FLUSH, "FLUSH", 0, "Flush", "Align to the left and the right, with equal character spacing"},
{0, NULL, 0, NULL, NULL}
};
-
+
+ static EnumPropertyItem prop_align_y_items[] = {
+ {CU_ALIGN_Y_TOP_BASELINE, "TOP_BASELINE", 0, "Top Base-Line", "Align to top but use the base-line of the text"},
+ {CU_ALIGN_Y_TOP, "TOP", 0, "Top", "Align text to the top"},
+ {CU_ALIGN_Y_CENTER, "CENTER", 0, "Center", "Align text to the middle"},
+ {CU_ALIGN_Y_BOTTOM, "BOTTOM", 0, "Bottom", "Align text to the bottom"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
/* Enums */
- prop = RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE);
+ prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spacemode");
RNA_def_property_enum_items(prop, prop_align_items);
- RNA_def_property_ui_text(prop, "Text Align", "Text align from the object center");
+ RNA_def_property_ui_text(prop, "Text Horizontal Align", "Text horizontal align from the object center");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
+
+ prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "align_y");
+ RNA_def_property_enum_items(prop, prop_align_y_items);
+ RNA_def_property_ui_text(prop, "Text Vertical Align", "Text vertical align from the object center");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
/* number values */
prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fsize");