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>2019-08-15 15:50:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-08-15 15:57:41 +0300
commit78b56fa7d973dab8d11786115a87af57681a7dda (patch)
treec7c71ae420989af3fde66a76689a41b1b5b4249c
parentfdef1a6712bc3ccf7fa41b0d7b11c725b5503288 (diff)
Fix T65461: IntProperty does not respect its 'step' field
Originally D5020 by @deadpin, refactored to make the change simpler.
-rw-r--r--source/blender/editors/interface/interface_handlers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 9c2eb4204e8..8fd39b5d120 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4807,7 +4807,8 @@ static int ui_do_but_NUM(
/* Integer Value. */
if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
- const int value_step = 1;
+ const int value_step = (int)but->a1;
+ BLI_assert(value_step > 0);
const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
(double)max_ii((int)softmin, (int)data->value - value_step) :
(double)min_ii((int)softmax, (int)data->value + value_step);
@@ -4825,6 +4826,7 @@ static int ui_do_but_NUM(
if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
const double value_step = (double)but->a1 * UI_PRECISION_FLOAT_SCALE;
+ BLI_assert(value_step > 0.0f);
const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
(double)max_ff(softmin, (float)(data->value - value_step)) :
(double)min_ff(softmax, (float)(data->value + value_step));