diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h index 07aeceda474..598817298b8 100644 --- a/source/blender/blenkernel/BKE_unit.h +++ b/source/blender/blenkernel/BKE_unit.h @@ -61,17 +61,19 @@ const char *bUnit_GetNameDisplay(void *usys_pt, int index); double bUnit_GetScaler(void *usys_pt, int index); /* aligned with PropertyUnit */ -#define B_UNIT_NONE 0 -#define B_UNIT_LENGTH 1 -#define B_UNIT_AREA 2 -#define B_UNIT_VOLUME 3 -#define B_UNIT_MASS 4 -#define B_UNIT_ROTATION 5 -#define B_UNIT_TIME 6 -#define B_UNIT_VELOCITY 7 -#define B_UNIT_ACCELERATION 8 -#define B_UNIT_CAMERA 9 -#define B_UNIT_TYPE_TOT 10 +enum { + B_UNIT_NONE = 0, + B_UNIT_LENGTH = 1, + B_UNIT_AREA = 2, + B_UNIT_VOLUME = 3, + B_UNIT_MASS = 4, + B_UNIT_ROTATION = 5, + B_UNIT_TIME = 6, + B_UNIT_VELOCITY = 7, + B_UNIT_ACCELERATION = 8, + B_UNIT_CAMERA = 9, + B_UNIT_TYPE_TOT = 10, +}; #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index de6424f3145..8aca9f78702 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -536,7 +536,7 @@ static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pr len_name = strlen(replace_str); len_move = (len - (found_ofs + len_name)) + 1; /* 1+ to copy the string terminator */ - len_num = BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%g"SEP_STR, unit->scalar / scale_pref); /* # removed later */ + len_num = BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%.9g"SEP_STR, unit->scalar / scale_pref); /* # removed later */ if (len_num > len_max) len_num = len_max; @@ -598,7 +598,7 @@ static int unit_find(const char *str, bUnitDef *unit) * ...will be resolved by python. * * values will be split by a comma's - * 5'2" -> 5'0.0254, 2*0.3048 + * 5'2" -> 5*0.3048, 2*0.0254 * * str_prev is optional, when valid it is used to get a base unit when none is set. *