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>2010-09-15 21:37:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-15 21:37:00 +0400
commit7d8f0fce7a551ff39a86cb5a113df8ae9b0b57cf (patch)
treea802ed68893c3010d4927612d8c202c720996185 /source/blender/blenkernel/BKE_unit.h
parentfb454bfe08e72ec5c546d91627a90a8989432e76 (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/BKE_unit.h')
-rw-r--r--source/blender/blenkernel/BKE_unit.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h
index 36ccc1f1497..65bdea8095a 100644
--- a/source/blender/blenkernel/BKE_unit.h
+++ b/source/blender/blenkernel/BKE_unit.h
@@ -36,6 +36,9 @@ void bUnit_AsString(char *str, int len_max, double value, int prec, int system,
/* replace units with values, used before python button evaluation */
int bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pref, int system, int type);
+/* make string keyboard-friendly: 10µm --> 10um */
+void bUnit_ToUnitAltName(char *str, int len_max, char *orig_str, int system, int type);
+
/* the size of the unit used for this value (used for calculating the ckickstep) */
double bUnit_ClosestScalar(double value, int system, int type);