Commit: 78b56fa7d973dab8d11786115a87af57681a7dda
Author: Campbell Barton
Date:   Thu Aug 15 22:50:30 2019 +1000
Branches: master
https://developer.blender.org/rB78b56fa7d973dab8d11786115a87af57681a7dda

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

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to