Blender Git Commit Log

Git Commits -> Revision 8535b9b

Revision 8535b9b by Bastien Montagne (master)
August 20, 2014, 10:12 (GMT)
Fix T38722: Adding units in Imperial setting results in inconsistent values

Now always check for a default unit, and evaluate the whole expression in this "unit space".
Not an ideal solution, but should handle most cases nicely
(we can't address all possible corner cases anyway).

Note default unit is searched in current string first (bigger unit of current system wins),
then in previous string.

Note this also replaces ',' by '+' in default separation between units,
helps solving issues with parenthesis (e.g. (1'1")*2.5 would fail in existing code)!
This would break if someone uses py ops with lower precedence than '+' (like bitwise
operations, and comparison), but these are not expected usecase here anyway.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D340

Commit Details:

Full Hash: 8535b9bd15434dc76e599a95a041422b17153116
Parent Commit: 21da42b
Lines Changed: +69, -49

2 Modified Paths:

/source/blender/blenkernel/intern/unit.c (+65, -48) (Diff)
/tests/python/bl_pyapi_units.py (+4, -1) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021