Fix [#21895] Incorrect calculations for measurement system
authorMatt Ebb <matt@mke3.net>
Mon, 5 Apr 2010 05:32:16 +0000 (05:32 +0000)
committerMatt Ebb <matt@mke3.net>
Mon, 5 Apr 2010 05:32:16 +0000 (05:32 +0000)
3d view grid scale text description wasn't using unit scale correctly

source/blender/blenkernel/intern/unit.c
source/blender/editors/space_view3d/view3d_draw.c

index 87424dda04d14c3d6e09275ca6c8b38c8fb1038c..133f858e9eab6c648b6fdd292033a5981e769bbe 100644 (file)
@@ -81,7 +81,7 @@ static struct bUnitDef buMetricLenDef[] = {
        {"decimetre", "decimetres",             "dm", NULL,     "10 Centimeters", 0.1, 0.0,                     B_UNIT_DEF_SUPPRESS},
        {"centimeter", "centimeters",   "cm", NULL,     "Centimeters", 0.01, 0.0,                       B_UNIT_DEF_NONE},
        {"millimeter", "millimeters",   "mm", NULL,     "Millimeters", 0.001, 0.0,                      B_UNIT_DEF_NONE},
-       {"micrometer", "micrometers",   "um", "µm",    "Micrometers", 0.000001, 0.0,           B_UNIT_DEF_NONE}, // micron too?
+       {"micrometer", "micrometers",   "µm", "um",    "Micrometers", 0.000001, 0.0,           B_UNIT_DEF_NONE}, // micron too?
 
        /* These get displayed because of float precision problems in the transform header,
         * could work around, but for now probably people wont use these */
index c75e068648fe5c342b14ec7de68401adb6f5098b..64c3da55318eb715b96297ade489732991593642 100644 (file)
@@ -292,7 +292,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_u
                        while(i--) {
                                scalar= bUnit_GetScaler(usys, i);
 
-                               dx_scalar = dx * scalar * unit->scale_length;
+                               dx_scalar = dx * scalar / unit->scale_length;
                                if (dx_scalar < (GRID_MIN_PX*2))
                                        continue;
 
@@ -2366,7 +2366,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
        }
        if (grid_unit) { /* draw below the viewport name */
                UI_ThemeColor(TH_TEXT_HI);
-               BLF_draw_default(10,  ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, grid_unit);
+               BLF_draw_default(22,  ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, grid_unit);
        }
 
        ob= OBACT;