Commit: e0c05a1e6ab82b365146b5149cec1dfd89b1cd2f
Author: Campbell Barton
Date:   Mon Oct 12 12:34:17 2015 +1100
Branches: master
https://developer.blender.org/rBe0c05a1e6ab82b365146b5149cec1dfd89b1cd2f

Support applying scale for font objects

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

M       source/blender/editors/object/object_transform.c

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

diff --git a/source/blender/editors/object/object_transform.c 
b/source/blender/editors/object/object_transform.c
index 340b662..ac1f13e 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -382,7 +382,7 @@ static int apply_objects_internal(bContext *C, ReportList 
*reports, bool apply_l
        /* first check if we can execute */
        CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
        {
-               if (ELEM(ob->type, OB_MESH, OB_ARMATURE, OB_LATTICE, OB_MBALL, 
OB_CURVE, OB_SURF)) {
+               if (ELEM(ob->type, OB_MESH, OB_ARMATURE, OB_LATTICE, OB_MBALL, 
OB_CURVE, OB_SURF, OB_FONT)) {
                        ID *obdata = ob->data;
                        if (ID_REAL_USERS(obdata) > 1) {
                                BKE_reportf(reports, RPT_ERROR,
@@ -418,6 +418,15 @@ static int apply_objects_internal(bContext *C, ReportList 
*reports, bool apply_l
                                changed = false;
                        }
                }
+
+               if (ob->type == OB_FONT) {
+                       if (apply_rot || apply_loc) {
+                               BKE_reportf(reports, RPT_ERROR,
+                                           "Font's can only have scale 
applied: \"%s\"",
+                                           ob->id.name + 2);
+                               changed = false;
+                       }
+               }
        }
        CTX_DATA_END;
        
@@ -496,6 +505,22 @@ static int apply_objects_internal(bContext *C, ReportList 
*reports, bool apply_l
                        scale = mat3_to_scale(rsmat);
                        BKE_curve_transform_ex(cu, mat, true, scale);
                }
+               else if (ob->type == OB_FONT) {
+                       Curve *cu = ob->data;
+                       int i;
+
+                       scale = mat3_to_scale(rsmat);
+
+                       for (i = 0; i < cu->totbox; i++) {
+                               TextBox *tb = &cu->tb[i];
+                               tb->x *= scale;
+                               tb->y *= scale;
+                               tb->w *= scale;
+                               tb->h *= scale;
+                       }
+
+                       cu->fsize *= scale;
+               }
                else if (ob->type == OB_CAMERA) {
                        MovieClip *clip = BKE_object_movieclip_get(scene, ob, 
false);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to