Fix T65461: IntProperty does not respect its 'step' field
Originally D5020 by @deadpin, refactored to make the change simpler.
This commit is contained in:
parent
fdef1a6712
commit
78b56fa7d9
Notes:
blender-bot
2023-02-14 10:29:32 +01:00
Referenced by commit2746fbc935
, Fix T70397: Dilate/Erode 'distance' increment/decrement arrows not Referenced by commit44ace647a8
, Fix interger number buttons increment/decrement arrows not working in Referenced by issue #69305, Some Integer button increment/decrement arrows are broken (e.g Color Ramp switch arrows don't work) Referenced by issue #65461, IntProperty does not respect its 'step' field
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue