[Bf-blender-cvs] [69522283869] master: UI: fix a precision issue with float field step size.
Alexander Gavrilov
noreply at git.blender.org
Tue Jan 18 14:25:44 CET 2022
Commit: 695222838699921865a1f5685c420c9155f27ca7
Author: Alexander Gavrilov
Date: Tue Jan 18 12:00:09 2022 +0300
Branches: master
https://developer.blender.org/rB695222838699921865a1f5685c420c9155f27ca7
UI: fix a precision issue with float field step size.
Fix a precision issue when stepping down from 1 to 0 via the left
decrement button and step 100 results in a small nonzero value.
The reason is that 0.01 can't be precisely represented in binary
and converting to double before multiplication reveals this.
Ref D13753
===================================================================
M source/blender/editors/interface/interface_handlers.c
===================================================================
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 6ecaead67ce..905fd452b6c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -5484,7 +5484,7 @@ static int ui_do_but_NUM(
log10f(number_but->step_size));
}
else {
- value_step = (double)number_but->step_size * UI_PRECISION_FLOAT_SCALE;
+ value_step = (double)(number_but->step_size * UI_PRECISION_FLOAT_SCALE);
}
BLI_assert(value_step > 0.0f);
const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
More information about the Bf-blender-cvs
mailing list