diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-08-11 22:53:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-08-11 22:53:01 +0400 |
commit | b2a77852ff99f1a8da8225239de68edc2aead6e2 (patch) | |
tree | a9fdacedc04ae75251152b1300173ef64ca841d7 /release | |
parent | 3ba949b0505d725a464735e56df05a97eefffdfa (diff) |
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
Diffstat (limited to 'release')
-rw-r--r-- | release/ui/bpy_ops.py | 45 | ||||
-rw-r--r-- | release/ui/space_info.py | 11 |
2 files changed, 11 insertions, 45 deletions
diff --git a/release/ui/bpy_ops.py b/release/ui/bpy_ops.py index 1d79f1a331f..aa9bfb460f0 100644 --- a/release/ui/bpy_ops.py +++ b/release/ui/bpy_ops.py @@ -111,48 +111,3 @@ class bpy_ops_submodule_op(object): import bpy bpy.ops = bpy_ops() - - - - -# A bit out of place but add button conversion code here -module_type = type(__builtins__) -import types -mod = types.ModuleType('button_convert') - -import sys -sys.modules['button_convert'] = mod - -def convert(expr): - - def replace(string, unit, scaler): - # in need of regex - change = True - while change: - change = False - i = string.find(unit) - if i != -1: - if i>0 and not string[i-1].isalpha(): - i_end = i+len(unit) - if i_end+1 >= len(string) or (not string[i_end+1].isalpha()): - string = string.replace(unit, scaler) - change = True - # print(string) - return string - - #imperial - expr = replace(expr, 'mi', '*1609.344') - expr = replace(expr, 'yd', '*0.9144') - expr = replace(expr, 'ft', '*0.3048') - expr = replace(expr, 'in', '*0.0254') - - # metric - expr = replace(expr, 'km', '*1000') - expr = replace(expr, 'm', '') - expr = replace(expr, 'cm', '*0.01') - expr = replace(expr, 'mm', '*0.001') - - return expr - -mod.convert = convert - diff --git a/release/ui/space_info.py b/release/ui/space_info.py index 366d5f5740c..9ebbc68c219 100644 --- a/release/ui/space_info.py +++ b/release/ui/space_info.py @@ -320,7 +320,18 @@ class INFO_PT_edit(bpy.types.Panel): sub1.itemS() sub1.itemL(text="Transform:") sub1.itemR(edit, "drag_immediately") + sub1.itemS() + sub1.itemS() + sub1.itemS() + sub1.itemL(text="Units:") + sub1.itemR(edit, "unit_type") + + sub2 = sub1.column() + sub2.active = (edit.unit_type != 'NONE') + sub2.itemR(edit, "unit_scale_length") + sub2.itemR(edit, "use_unit_split") + col = split.column() sub = col.split(percentage=0.85) |