[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61198] trunk/blender/source/blender: [ #37327] Inconsistent numeric input conversion.

Bastien Montagne montagne29 at wanadoo.fr
Fri Nov 8 12:25:51 CET 2013


Revision: 61198
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61198
Author:   mont29
Date:     2013-11-08 11:25:50 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
[#37327] Inconsistent numeric input conversion.

Issue was actually that micrometer was not drawing correctly (from r58165), reverted that fix and instead use utf8 drawing for editmode metrics when using a unit system (we already had a similar hack for surfaces and volumes, anyway).

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58165

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/unit.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c

Modified: trunk/blender/source/blender/blenkernel/intern/unit.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/unit.c	2013-11-08 08:46:43 UTC (rev 61197)
+++ trunk/blender/source/blender/blenkernel/intern/unit.c	2013-11-08 11:25:50 UTC (rev 61198)
@@ -95,11 +95,6 @@
 #define B_UNIT_DEF_SUPPRESS 1 /* Use for units that are not used enough to be translated into for common use */
 #define B_UNIT_DEF_TENTH 2 /* Display a unit even if its value is 0.1, eg 0.1mm instead of 100um */
 
-/* workaround encoding issue with "µm", bug [#36090] */
-#define B_UNIT_CHAR_MICRO "\xb5"
-#define UM B_UNIT_CHAR_MICRO"m"
-#define US B_UNIT_CHAR_MICRO"s"
-
 /* define a single unit */
 typedef struct bUnitCollection {
 	struct bUnitDef *units;
@@ -114,14 +109,14 @@
 
 /* Lengths */
 static struct bUnitDef buMetricLenDef[] = {
-	{"kilometer", "kilometers",     "km",  NULL, "Kilometers", UN_SC_KM, 0.0,     B_UNIT_DEF_NONE},
-	{"hectometer", "hectometers",   "hm",  NULL, "100 Meters", UN_SC_HM, 0.0,     B_UNIT_DEF_SUPPRESS},
-	{"dekameter", "dekameters",     "dam", NULL, "10 Meters",  UN_SC_DAM, 0.0,    B_UNIT_DEF_SUPPRESS},
-	{"meter", "meters",             "m",   NULL, "Meters",     UN_SC_M, 0.0,      B_UNIT_DEF_NONE},     /* base unit */
-	{"decimeter", "decimeters",     "dm",  NULL, "10 Centimeters", UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
-	{"centimeter", "centimeters",   "cm",  NULL, "Centimeters", UN_SC_CM, 0.0,    B_UNIT_DEF_NONE},
-	{"millimeter", "millimeters",   "mm",  NULL, "Millimeters", UN_SC_MM, 0.0,    B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
-	{"micrometer", "micrometers",   UM,    "um", "Micrometers", UN_SC_UM, 0.0,    B_UNIT_DEF_NONE},     // micron too?
+	{"kilometer", "kilometers",     "km",  NULL, "Kilometers",     UN_SC_KM,  0.0, B_UNIT_DEF_NONE},
+	{"hectometer", "hectometers",   "hm",  NULL, "100 Meters",     UN_SC_HM,  0.0, B_UNIT_DEF_SUPPRESS},
+	{"dekameter", "dekameters",     "dam", NULL, "10 Meters",      UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
+	{"meter", "meters",             "m",   NULL, "Meters",         UN_SC_M,   0.0, B_UNIT_DEF_NONE},     /* base unit */
+	{"decimeter", "decimeters",     "dm",  NULL, "10 Centimeters", UN_SC_DM,  0.0, B_UNIT_DEF_SUPPRESS},
+	{"centimeter", "centimeters",   "cm",  NULL, "Centimeters",    UN_SC_CM,  0.0, B_UNIT_DEF_NONE},
+	{"millimeter", "millimeters",   "mm",  NULL, "Millimeters",    UN_SC_MM,  0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
+	{"micrometer", "micrometers",   "µm",  "um", "Micrometers",    UN_SC_UM,  0.0, B_UNIT_DEF_NONE},
 
 	/* These get displayed because of float precision problems in the transform header,
 	 * could work around, but for now probably people wont use these */
@@ -134,87 +129,87 @@
 static struct bUnitCollection buMetricLenCollection = {buMetricLenDef, 3, 0, sizeof(buMetricLenDef) / sizeof(bUnitDef)};
 
 static struct bUnitDef buImperialLenDef[] = {
-	{"mile", "miles",       "mi", "m", "Miles",      UN_SC_MI, 0.0,  B_UNIT_DEF_NONE},
-	{"furlong", "furlongs", "fur", NULL, "Furlongs", UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS},
-	{"chain", "chains",     "ch", NULL, "Chains",    UN_SC_CH, 0.0,  B_UNIT_DEF_SUPPRESS},
-	{"yard", "yards",       "yd", NULL, "Yards",     UN_SC_YD, 0.0,  B_UNIT_DEF_SUPPRESS},
-	{"foot", "feet",        "'", "ft", "Feet",       UN_SC_FT, 0.0,  B_UNIT_DEF_NONE}, /* base unit */
-	{"inch", "inches",      "\"", "in", "Inches",    UN_SC_IN, 0.0,  B_UNIT_DEF_NONE},
-	{"thou", "thou",        "thou", "mil", "Thou",   UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, /* plural for thou has no 's' */
+	{"mile", "miles",       "mi",   "m",   "Miles",    UN_SC_MI,  0.0, B_UNIT_DEF_NONE},
+	{"furlong", "furlongs", "fur",  NULL,  "Furlongs", UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS},
+	{"chain", "chains",     "ch",   NULL,  "Chains",   UN_SC_CH,  0.0, B_UNIT_DEF_SUPPRESS},
+	{"yard", "yards",       "yd",   NULL,  "Yards",    UN_SC_YD,  0.0, B_UNIT_DEF_SUPPRESS},
+	{"foot", "feet",        "'",    "ft",  "Feet",     UN_SC_FT,  0.0, B_UNIT_DEF_NONE}, /* base unit */
+	{"inch", "inches",      "\"",   "in",  "Inches",   UN_SC_IN,  0.0, B_UNIT_DEF_NONE},
+	{"thou", "thou",        "thou", "mil", "Thou",     UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, /* plural for thou has no 's' */
 	{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
 };
 static struct bUnitCollection buImperialLenCollection = {buImperialLenDef, 4, 0, sizeof(buImperialLenDef) / sizeof(bUnitDef)};
 
 /* Areas */
 static struct bUnitDef buMetricAreaDef[] = {
-	{"square kilometer",  "square kilometers",  "km²", "km2",   "Square Kilometers", UN_SC_KM * UN_SC_KM, 0.0,    B_UNIT_DEF_NONE},
-	{"square hectometer", "square hectometers", "hm²", "hm2",   "Square Hectometers", UN_SC_HM * UN_SC_HM, 0.0,   B_UNIT_DEF_SUPPRESS},   /* hectare */
-	{"square dekameter",  "square dekameters",  "dam²", "dam2",  "Square Dekameters", UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},  /* are */
-	{"square meter",      "square meters",      "m²",  "m2",    "Square Meters", UN_SC_M * UN_SC_M, 0.0,          B_UNIT_DEF_NONE},   /* base unit */
-	{"square decimeter",  "square decimetees",  "dm²", "dm2",   "Square Decimeters", UN_SC_DM * UN_SC_DM, 0.0,    B_UNIT_DEF_SUPPRESS},
-	{"square centimeter", "square centimeters", "cm²", "cm2",   "Square Centimeters", UN_SC_CM * UN_SC_CM, 0.0,   B_UNIT_DEF_NONE},
-	{"square millimeter", "square millimeters", "mm²", "mm2",   "Square Millimeters", UN_SC_MM * UN_SC_MM, 0.0,   B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
-	{"square micrometer", "square micrometers", UM"²", "um2",   "Square Micrometers", UN_SC_UM * UN_SC_UM, 0.0,   B_UNIT_DEF_NONE},
+	{"square kilometer",  "square kilometers",  "km²",  "km2",   "Square Kilometers",  UN_SC_KM * UN_SC_KM,   0.0, B_UNIT_DEF_NONE},
+	{"square hectometer", "square hectometers", "hm²",  "hm2",   "Square Hectometers", UN_SC_HM * UN_SC_HM,   0.0, B_UNIT_DEF_SUPPRESS},   /* hectare */
+	{"square dekameter",  "square dekameters",  "dam²", "dam2",  "Square Dekameters",  UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},  /* are */
+	{"square meter",      "square meters",      "m²",   "m2",    "Square Meters",      UN_SC_M * UN_SC_M,     0.0, B_UNIT_DEF_NONE},   /* base unit */
+	{"square decimeter",  "square decimetees",  "dm²",  "dm2",   "Square Decimeters",  UN_SC_DM * UN_SC_DM,   0.0, B_UNIT_DEF_SUPPRESS},
+	{"square centimeter", "square centimeters", "cm²",  "cm2",   "Square Centimeters", UN_SC_CM * UN_SC_CM,   0.0, B_UNIT_DEF_NONE},
+	{"square millimeter", "square millimeters", "mm²",  "mm2",   "Square Millimeters", UN_SC_MM * UN_SC_MM,   0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
+	{"square micrometer", "square micrometers", "µm²",  "um2",   "Square Micrometers", UN_SC_UM * UN_SC_UM,   0.0, B_UNIT_DEF_NONE},
 	{NULL, NULL, NULL,  NULL, NULL, 0.0, 0.0}
 };
 static struct bUnitCollection buMetricAreaCollection = {buMetricAreaDef, 3, 0, sizeof(buMetricAreaDef) / sizeof(bUnitDef)};
 
 static struct bUnitDef buImperialAreaDef[] = {
-	{"square mile", "square miles",       "sq mi", "sq m", "Square Miles", UN_SC_MI * UN_SC_MI, 0.0,      B_UNIT_DEF_NONE},
+	{"square mile", "square miles",       "sq mi", "sq m", "Square Miles",    UN_SC_MI * UN_SC_MI,   0.0, B_UNIT_DEF_NONE},
 	{"square furlong", "square furlongs", "sq fur", NULL,  "Square Furlongs", UN_SC_FUR * UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS},
-	{"square chain", "square chains",     "sq ch",  NULL,  "Square Chains", UN_SC_CH * UN_SC_CH, 0.0,     B_UNIT_DEF_SUPPRESS},
-	{"square yard", "square yards",       "sq yd",  NULL,  "Square Yards", UN_SC_YD * UN_SC_YD, 0.0,      B_UNIT_DEF_NONE},
-	{"square foot", "square feet",        "sq ft",  NULL,  "Square Feet", UN_SC_FT * UN_SC_FT, 0.0,       B_UNIT_DEF_NONE}, /* base unit */
-	{"square inch", "square inches",      "sq in",  NULL,  "Square Inches", UN_SC_IN * UN_SC_IN, 0.0,     B_UNIT_DEF_NONE},
-	{"square thou", "square thous",       "sq mil", NULL,  "Square Thous", UN_SC_MIL * UN_SC_MIL, 0.0,    B_UNIT_DEF_NONE},
+	{"square chain", "square chains",     "sq ch",  NULL,  "Square Chains",   UN_SC_CH * UN_SC_CH,   0.0, B_UNIT_DEF_SUPPRESS},
+	{"square yard", "square yards",       "sq yd",  NULL,  "Square Yards",    UN_SC_YD * UN_SC_YD,   0.0, B_UNIT_DEF_NONE},
+	{"square foot", "square feet",        "sq ft",  NULL,  "Square Feet",     UN_SC_FT * UN_SC_FT,   0.0, B_UNIT_DEF_NONE}, /* base unit */
+	{"square inch", "square inches",      "sq in",  NULL,  "Square Inches",   UN_SC_IN * UN_SC_IN,   0.0, B_UNIT_DEF_NONE},
+	{"square thou", "square thous",       "sq mil", NULL,  "Square Thous",    UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
 	{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
 };
 static struct bUnitCollection buImperialAreaCollection = {buImperialAreaDef, 4, 0, sizeof(buImperialAreaDef) / sizeof(bUnitDef)};
 
 /* Volumes */
 static struct bUnitDef buMetricVolDef[] = {
-	{"cubic kilometer",  "cubic kilometers",  "km³",  "km3",  "Cubic Kilometers", UN_SC_KM * UN_SC_KM * UN_SC_KM, 0.0,    B_UNIT_DEF_NONE},
-	{"cubic hectometer", "cubic hectometers", "hm³",  "hm3",  "Cubic Hectometers", UN_SC_HM * UN_SC_HM * UN_SC_HM, 0.0,   B_UNIT_DEF_SUPPRESS},
-	{"cubic dekameter",  "cubic dekameters",  "dam³", "dam3", "Cubic Dekameters", UN_SC_DAM * UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
-	{"cubic meter",      "cubic meters",      "m³",   "m3",   "Cubic Meters", UN_SC_M * UN_SC_M * UN_SC_M, 0.0,           B_UNIT_DEF_NONE}, /* base unit */
-	{"cubic decimeter",  "cubic decimeters",  "dm³",  "dm3",  "Cubic Decimeters", UN_SC_DM * UN_SC_DM * UN_SC_DM, 0.0,    B_UNIT_DEF_SUPPRESS},
-	{"cubic centimeter", "cubic centimeters", "cm³",  "cm3",  "Cubic Centimeters", UN_SC_CM * UN_SC_CM * UN_SC_CM, 0.0,   B_UNIT_DEF_NONE},
-	{"cubic millimeter", "cubic millimeters", "mm³",  "mm3",  "Cubic Millimeters", UN_SC_MM * UN_SC_MM * UN_SC_MM, 0.0,   B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
-	{"cubic micrometer", "cubic micrometers", UM"³",  "um3",  "Cubic Micrometers", UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0,   B_UNIT_DEF_NONE},
+	{"cubic kilometer",  "cubic kilometers",  "km³",  "km3",  "Cubic Kilometers",  UN_SC_KM * UN_SC_KM * UN_SC_KM,    0.0, B_UNIT_DEF_NONE},
+	{"cubic hectometer", "cubic hectometers", "hm³",  "hm3",  "Cubic Hectometers", UN_SC_HM * UN_SC_HM * UN_SC_HM,    0.0, B_UNIT_DEF_SUPPRESS},

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list