From 22ddd573638582ad5213bb4a7ff23ccae50dd285 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 9 Jan 2019 10:39:31 +0100 Subject: Fix T60338: Allow user to input units of another system --- source/blender/editors/util/numinput.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/util') diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index e3c0f6ca685..817b12fbc4d 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -258,13 +258,7 @@ bool user_string_to_number(bContext *C, const char *str, const UnitSettings *uni { #ifdef WITH_PYTHON double unit_scale = BKE_scene_unit_scale(unit, type, 1.0); - if (!bUnit_ContainsUnit(str, unit->system, type)) { - int success = BPY_execute_string_as_number(C, NULL, str, true, r_value); - *r_value *= bUnit_PreferredInputUnitScalar(unit, type); - *r_value /= unit_scale; - return success; - } - else { + if (bUnit_ContainsUnit(str, type)) { char str_unit_convert[256]; BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert)); bUnit_ReplaceString( @@ -273,6 +267,12 @@ bool user_string_to_number(bContext *C, const char *str, const UnitSettings *uni return BPY_execute_string_as_number(C, NULL, str_unit_convert, true, r_value); } + else { + int success = BPY_execute_string_as_number(C, NULL, str, true, r_value); + *r_value *= bUnit_PreferredInputUnitScalar(unit, type); + *r_value /= unit_scale; + return success; + } #else *r_value = atof(str); return true; -- cgit v1.2.3