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
This commit is contained in:
parent
7b8d812277
commit
92f8a6ac21
Notes:
blender-bot
2023-02-13 18:31:51 +01:00
Referenced by issue #88762, Entering Clip End above 10000 resets back to 10000
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue