From 86aeb7df961b994e87be57d85410de530b392f3e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 5 Oct 2015 11:55:52 +0200 Subject: Fix T46379: Bad behavior of bUnit_ToUnitAltName() with default units. It would simply remove default units (in most case), cannot see any good reason for such behavior? Might work in case default unit is the only one present, but breaks consistency (and it may not be always obvious for user which unit it is). Comes from original patch from five years ago, rB7d8f0fce. This will break keyboard-setting of values, e.g. '2m 33.4cm' would become '2 33.4cm', totally useless and invalid entry! --- source/blender/blenkernel/intern/unit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 64d561491e2..ab8fbabd329 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -730,11 +730,10 @@ void bUnit_ToUnitAltName(char *str, int len_max, const char *orig_str, int syste bUnitCollection *usys = unit_get_system(system, type); bUnitDef *unit; - bUnitDef *unit_def = unit_default(usys); /* find and substitute all units */ for (unit = usys->units; unit->name; unit++) { - if (len_max > 0 && (unit->name_alt || unit == unit_def)) { + if (len_max > 0 && unit->name_alt) { const char *found = unit_find_str(orig_str, unit->name_short); if (found) { int offset = (int)(found - orig_str); -- cgit v1.2.3