diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-18 16:56:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-18 16:56:19 +0300 |
commit | 533ec46efbc533383f80052f8c5057db5ec1348b (patch) | |
tree | b8bd76142fa5a1e2f2a8bb7ca0fea93c437fb32f /source/blender/editors/interface/interface.c | |
parent | ad80bfdab9c82695df240c8b5a5d19a2b5b84254 (diff) | |
parent | d0344d7b7d619e62bc852c4d00df52cfbfdda544 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r-- | source/blender/editors/interface/interface.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 1ce5b08c522..10668c9ea22 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1936,13 +1936,14 @@ void ui_but_value_set(uiBut *but, double value) else { /* first do rounding */ if (but->pointype == UI_BUT_POIN_CHAR) { - value = (char)floor(value + 0.5); + value = round_db_to_uchar_clamp(value); } else if (but->pointype == UI_BUT_POIN_SHORT) { - value = (short)floor(value + 0.5); + value = round_db_to_short_clamp(value); + } + else if (but->pointype == UI_BUT_POIN_INT) { + value = round_db_to_int_clamp(value); } - else if (but->pointype == UI_BUT_POIN_INT) - value = (int)floor(value + 0.5); else if (but->pointype == UI_BUT_POIN_FLOAT) { float fval = (float)value; if (fval >= -0.00001f && fval <= 0.00001f) fval = 0.0f; /* prevent negative zero */ |