diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-08 22:55:08 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-08 22:55:08 +0400 |
commit | 2b2099cd519d2723dd79af2e1d9035c7cbb12022 (patch) | |
tree | a12fa477bb34c227d9ea69811347f796927b48c7 /source/blender/editors/interface/interface.c | |
parent | d2b55d1171af787f603c6c14129224dc1c038e85 (diff) |
Fix #34875: 0 digits of precision was not supported for FloatProperty, now
you can specify precision=0 for this, and use -1 for the default 2.
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r-- | source/blender/editors/interface/interface.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 095155a9814..8fbb293d586 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -442,7 +442,7 @@ static int ui_but_float_precision(uiBut *but, double value) int prec; /* first check if prec is 0 and fallback to a simple default */ - if ((prec = (int)but->a2) == 0) { + if ((prec = (int)but->a2) == -1) { prec = (but->hardmax < 10.001f) ? 3 : 2; } @@ -483,7 +483,7 @@ static int ui_but_float_precision(uiBut *but, double value) } } - CLAMP(prec, 1, PRECISION_FLOAT_MAX); + CLAMP(prec, 0, PRECISION_FLOAT_MAX); return prec; } @@ -1676,7 +1676,7 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va /* Sanity checks */ precision = (int)but->a2; if (precision > PRECISION_FLOAT_MAX) precision = PRECISION_FLOAT_MAX; - else if (precision == 0) precision = 2; + else if (precision == -1) precision = 2; } else { precision = float_precision; |