Blender Git Commit Log

Git Commits -> Revision 7d8f0fc

Revision 7d8f0fc by Campbell Barton (master)
September 15, 2010, 17:37 (GMT)
patch [#23758] Better handling of UTF chars in UNITS fields (lengths, angles, etc.)
from Lorenzo Tozzi (oni_niubbo) with minor edits.

--- from the tracker
The present situation is this: due to bug#22274, during editing, UTF chars are stripped from buttons with a unit associated
(length, angles, etc.).
Example: if the button displays '90°' and you click on it with LMB, the editing string will become '90'.

The problem arises if you use microns: '34µm' becomes '34' that blender interprets as 34 meters. So clicking on a button
and hitting enter won't confirm the previous value, but will change it (very badly also).

Of course nobody is using microns in blender, but the problem will arise when we will implement areas and option 'Separate
Units' will be enabled. The value '2m² 3cm²' will become '2m' during editing.

This patch solves the problem rewriting the string in a smarter way than just stripping the UTF chars: the unit is translated
from unit->name_short ('µm') to unit->name_alt ('um'). So clicking on '34µm' the editing string will become
'34um'.
--- end

note: rather then allowing empty strings in name_alt field I made it so if the unit system was the default one a NULL name_alt will just strip the string, since its the default its not needed.

Commit Details:

Full Hash: 7d8f0fce7a551ff39a86cb5a113df8ae9b0b57cf
SVN Revision: 31953
Parent Commit: fb454bf
Lines Changed: +69, -3

5 Modified Paths:

/source/blender/blenkernel/BKE_unit.h (+3, -0) (Diff)
/source/blender/blenkernel/intern/unit.c (+46, -2) (Diff)
/source/blender/editors/interface/interface.c (+17, -0) (Diff)
/source/blender/editors/interface/interface_handlers.c (+2, -1) (Diff)
/source/blender/editors/interface/interface_intern.h (+1, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021