Merge branch 'master' into blender2.8

This commit is contained in:
2017-08-01 10:38:36 +10:00
42 changed files with 172 additions and 82 deletions

View File

@@ -2224,9 +2224,9 @@ void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, const int
ui_get_but_string_unit(but, str, maxlen, value, false, float_precision);
}
else {
const int prec = (float_precision == -1) ? ui_but_calc_float_precision(but, value) : float_precision;
int prec = (float_precision == -1) ? ui_but_calc_float_precision(but, value) : float_precision;
if (use_exp_float) {
const int l10 = (int)log10(fabs(value));
const int l10 = (value == 0.0f) ? 0 : (int)log10(fabs(value));
if (l10 < -6 || l10 > 12) {
BLI_snprintf(str, maxlen, "%.*g", prec, value);
if (r_use_exp_float) {
@@ -2234,7 +2234,9 @@ void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, const int
}
}
else {
BLI_snprintf(str, maxlen, "%.*f", prec - l10 + (int)(l10 < 0), value);
prec -= l10 + (int)(l10 < 0);
CLAMP(prec, 0, UI_PRECISION_FLOAT_MAX);
BLI_snprintf(str, maxlen, "%.*f", prec, value);
}
}
else {