Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-06-07 09:26:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-07 09:26:10 +0400
commit82a0461361eb2556542f6e951388b3187b0397d2 (patch)
treeb519ed7148e5cdf5609a1c19445fe9bbf17ce80b /source/blender/editors/interface
parent06c3756db85b56da79afee9300f652a4b1e96c26 (diff)
fix for glitch in previous commit with 0.00002 displaying as 0.000020, this uses 2 calls to double_round which I'd rather avoid but at least it now works right for users.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 5f7cb36cbba..a21122698d9 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -467,9 +467,15 @@ static int ui_but_float_precision(uiBut *but, double value)
double prec_d_floor = floor(prec_d + FLT_EPSILON);
int test_prec= (int)prec_d_floor;
- /* this check is so 0.00016 from isnt rounded to 0.0001 _but_ it is not working ideally because 0.0002 becomes 0.00020 */
- if(prec_d - prec_d_floor > FLT_EPSILON) {
- test_prec += 2;
+ /* this check is so 0.00016 from isnt rounded to 0.0001 */
+ if(prec_d - prec_d_floor > FLT_EPSILON) { /* not ending with a .0~001 */
+ /* check if a second decimal place is needed 0.00015 for eg. */
+ if(double_round(value, test_prec + 1) - double_round(value, test_prec + 2) != 0.0) {
+ test_prec += 2;
+ }
+ else {
+ test_prec += 1;
+ }
}
if(test_prec > prec && test_prec <= 7) {