Fix [#33997] Units Scale in Metric mode displays wrong face area.
authorBastien Montagne <montagne29@wanadoo.fr>
Fri, 25 Jan 2013 21:21:38 +0000 (21:21 +0000)
committerBastien Montagne <montagne29@wanadoo.fr>
Fri, 25 Jan 2013 21:21:38 +0000 (21:21 +0000)
Also now display nice "area" units (maybe using "length" units was a perf matter, but anyway, you can't have more than a few tens of values displayed at a time, after that they become unreadable). Easy to undo anyway if we really want to keep ugly "10m" as area display!

source/blender/editors/space_view3d/drawobject.c
source/blender/python/intern/bpy_app_translations.c

index 4eb42f7cefdc192903d5604debc8de39b5f6aac6..6dd3ecca244fd0846716cddf7504c7c3f4f12e56 100644 (file)
@@ -2653,16 +2653,21 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
                BMFace *f;
                int n;
 
                BMFace *f;
                int n;
 
-#define DRAW_EM_MEASURE_STATS_FACEAREA()                                      \
-       if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {                               \
-               mul_v3_fl(vmid, 1.0f / (float)n);                                     \
-               if (unit->system)                                                     \
-                       bUnit_AsString(numstr, sizeof(numstr),                            \
-                                      (double)(area * unit->scale_length),               \
-                                      3, unit->system, B_UNIT_LENGTH, do_split, FALSE);  \
-               else                                                                  \
-                       BLI_snprintf(numstr, sizeof(numstr), conv_float, area);           \
-               view3d_cached_text_draw_add(vmid, numstr, 0, txt_flag, col);          \
+#define DRAW_EM_MEASURE_STATS_FACEAREA()                                                 \
+       if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {                                          \
+               mul_v3_fl(vmid, 1.0f / (float)n);                                                \
+               if (unit->system) {                                                              \
+                       bUnit_AsString(numstr, sizeof(numstr),                                       \
+                                      (double)(area * unit->scale_length * unit->scale_length),     \
+                                      3, unit->system, B_UNIT_AREA, do_split, FALSE);               \
+                       view3d_cached_text_draw_add(vmid, numstr, 0,                                 \
+                                                   /* Metric system uses unicode "squared" sign! */ \
+                                                   txt_flag ^ V3D_CACHE_TEXT_ASCII, col);           \
+               }                                                                                \
+               else {                                                                           \
+                       BLI_snprintf(numstr, sizeof(numstr), conv_float, area);                      \
+                       view3d_cached_text_draw_add(vmid, numstr, 0, txt_flag, col);                 \
+               }                                                                                \
        } (void)0
 
                UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
        } (void)0
 
                UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
index db99d6bcf922091b38502f52f0b2df526f3a9d20..b6d2f6242292af65475ab632de37a156d76f3b12 100644 (file)
@@ -708,7 +708,7 @@ static PyTypeObject BlenderAppTranslationsType = {
                                    /* newfunc tp_new; */
        (newfunc)app_translations_new,
        /*  Low-level free-memory routine */
                                    /* newfunc tp_new; */
        (newfunc)app_translations_new,
        /*  Low-level free-memory routine */
-       app_translations_free,                       /* freefunc tp_free;  */
+       app_translations_free,      /* freefunc tp_free;  */
        /* For PyObject_IS_GC */
        NULL,                       /* inquiry tp_is_gc;  */
        NULL,                       /* PyObject *tp_bases; */
        /* For PyObject_IS_GC */
        NULL,                       /* inquiry tp_is_gc;  */
        NULL,                       /* PyObject *tp_bases; */