[Bf-blender-cvs] [10ac2c1017a] temp-lanpr-staging: Fix T65461: IntProperty does not respect its 'step' field

Campbell Barton noreply at git.blender.org
Fri Aug 16 03:05:14 CEST 2019


Commit: 10ac2c1017a9866087912e9b2d23e800a462e7e4
Author: Campbell Barton
Date:   Thu Aug 15 22:50:30 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB10ac2c1017a9866087912e9b2d23e800a462e7e4

Fix T65461: IntProperty does not respect its 'step' field

Originally D5020 by @deadpin, refactored to make the change simpler.

===================================================================

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 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));



More information about the Bf-blender-cvs mailing list