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:
authorCampbell Barton <ideasman42@gmail.com>2009-08-12 21:02:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-08-12 21:02:03 +0400
commitb8fcda9ea57d65b1b956695bb1ff17c4e41f0ab4 (patch)
tree5432de8c52a64de915b403708ddeb0ec5b273215 /source/blender/blenkernel/intern/unit.c
parenta86aa8c34b6fd7a5f41d33cf84a860525b7448e0 (diff)
unit grid snap while transforming, display units in the header.
Diffstat (limited to 'source/blender/blenkernel/intern/unit.c')
-rw-r--r--source/blender/blenkernel/intern/unit.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index fef15f83ccd..8c63a8756a4 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -68,11 +68,16 @@ static struct bUnitDef buMetricLenDef[] = {
{"centimeter", "Centimeters", "cm", NULL, 0.01, 0.0, B_UNIT_DEF_NONE},
{"millimeter", "Millimeters", "mm", NULL, 0.001, 0.0, B_UNIT_DEF_NONE},
{"micrometer", "Micrometers", "um", "µm", 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 */
+ /*
{"nanometer", "Nanometers", "nm", NULL, 0.000000001, 0.0, B_UNIT_DEF_NONE},
{"picometer", "Picometers", "pm", NULL, 0.000000000001, 0.0,B_UNIT_DEF_NONE},
+ */
{NULL, NULL, NULL, NULL, 0.0, 0.0}
};
-static struct bUnitCollection buMetricLenCollecton = {buMetricLenDef, 1, 0, sizeof(buMetricLenDef)/sizeof(bUnitDef)};
+static struct bUnitCollection buMetricLenCollecton = {buMetricLenDef, 3, 0, sizeof(buMetricLenDef)/sizeof(bUnitDef)};
static struct bUnitDef buImperialLenDef[] = {
{"mile", "Miles", "mi", "m", 1609.344, 0.0, B_UNIT_DEF_NONE},
@@ -83,7 +88,7 @@ static struct bUnitDef buImperialLenDef[] = {
{"thou", "Thous", "mil", NULL,0.0000254, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, 0.0, 0.0}
};
-static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 2, 0, sizeof(buImperialLenDef)/sizeof(bUnitDef)};
+static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 3, 0, sizeof(buImperialLenDef)/sizeof(bUnitDef)};
/* Time */
@@ -390,6 +395,12 @@ double bUnit_ClosestScalar(double value, int system, int type)
return unit->scalar;
}
+double bUnit_BaseScalar(int system, int type)
+{
+ bUnitCollection *usys = unit_get_system(system, type);
+ return unit_default(usys)->scalar;
+}
+
/* external access */
void bUnit_GetSystem(void **usys_pt, int *len, int system, int type)
{