Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/util/numinput.c
| Show First 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | if (bUnit_ContainsUnit(str, type)) { | ||||
| BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert)); | BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert)); | ||||
| bUnit_ReplaceString( | bUnit_ReplaceString( | ||||
| str_unit_convert, sizeof(str_unit_convert), str, unit_scale, unit->system, type); | str_unit_convert, sizeof(str_unit_convert), str, unit_scale, unit->system, type); | ||||
| return BPY_run_string_as_number(C, NULL, str_unit_convert, error_prefix, r_value); | return BPY_run_string_as_number(C, NULL, str_unit_convert, error_prefix, r_value); | ||||
| } | } | ||||
| int success = BPY_run_string_as_number(C, NULL, str, error_prefix, r_value); | int success = BPY_run_string_as_number(C, NULL, str, error_prefix, r_value); | ||||
| *r_value *= bUnit_PreferredInputUnitScalar(unit, type); | *r_value = bUnit_ApplyPreferredUnit(unit, type, *r_value); | ||||
| *r_value /= unit_scale; | *r_value /= unit_scale; | ||||
| return success; | return success; | ||||
| #else | #else | ||||
| UNUSED_VARS(C, unit, type); | UNUSED_VARS(C, unit, type); | ||||
| *r_value = atof(str); | *r_value = atof(str); | ||||
| return true; | return true; | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 311 Lines • Show Last 20 Lines | |||||