From 92f8a6ac21acee5ee1d5151ddf11570afcaa64a8 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 3 Jun 2021 13:12:51 +0200 Subject: Fix T88762: UI using tab to enter next button could clamp the hard min/ max unneccessarily Since rB298d5eb66916 [which was needed to update buttons with custom property range functions correctly], using tab would always clamp (hardmin/hardmax) properties which were using FLT_MAX / INT_MAX as range in their property definitions. The clamping of rB298d5eb66916 was copied over from rB9b7f44ceb56c [where it was used for the softmin/softmax], and while the re-evaluation of hardmin/hardmax is needed for custom property range functions, the clamping should actually not take place. There are many properties using FLT_MAX / INT_MAX etc. and while it probably would be good to update these with ranges that make more sense -- not using FLT_MAX / INT_MAX would not have done the clamping here -- there should not be an arbitrary limit to these and they should stay as they are. Maniphest Tasks: T88762 Differential Revision: https://developer.blender.org/D11473 --- source/blender/editors/interface/interface.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a31efefd99c..f6b2a6a1bc6 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3207,19 +3207,17 @@ void ui_but_range_set_hard(uiBut *but) const PropertyType type = RNA_property_type(but->rnaprop); - /* clamp button range to something reasonable in case - * we get -inf/inf from RNA properties */ if (type == PROP_INT) { int imin, imax; RNA_property_int_range(&but->rnapoin, but->rnaprop, &imin, &imax); - but->hardmin = (imin == INT_MIN) ? -1e4 : imin; - but->hardmax = (imin == INT_MAX) ? 1e4 : imax; + but->hardmin = imin; + but->hardmax = imax; } else if (type == PROP_FLOAT) { float fmin, fmax; RNA_property_float_range(&but->rnapoin, but->rnaprop, &fmin, &fmax); - but->hardmin = (fmin == -FLT_MAX) ? (float)-1e4 : fmin; - but->hardmax = (fmax == FLT_MAX) ? (float)1e4 : fmax; + but->hardmin = fmin; + but->hardmax = fmax; } } -- cgit v1.2.3