Merge branch 'blender-v2.90-release'
This commit is contained in:
@@ -3092,8 +3092,38 @@ static double soft_range_round_down(double value, double max)
|
||||
return newmax;
|
||||
}
|
||||
|
||||
void ui_but_range_set_hard(uiBut *but)
|
||||
{
|
||||
if (but->rnaprop) {
|
||||
const PropertyType type = RNA_property_type(but->rnaprop);
|
||||
double hardmin, hardmax;
|
||||
|
||||
/* 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);
|
||||
hardmin = (imin == INT_MIN) ? -1e4 : imin;
|
||||
hardmax = (imin == INT_MAX) ? 1e4 : imax;
|
||||
}
|
||||
else if (type == PROP_FLOAT) {
|
||||
float fmin, fmax;
|
||||
|
||||
RNA_property_float_range(&but->rnapoin, but->rnaprop, &fmin, &fmax);
|
||||
hardmin = (fmin == -FLT_MAX) ? (float)-1e4 : fmin;
|
||||
hardmax = (fmax == FLT_MAX) ? (float)1e4 : fmax;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
but->hardmin = hardmin;
|
||||
but->hardmax = hardmax;
|
||||
}
|
||||
}
|
||||
|
||||
/* note: this could be split up into functions which handle arrays and not */
|
||||
static void ui_set_but_soft_range(uiBut *but)
|
||||
void ui_but_range_set_soft(uiBut *but)
|
||||
{
|
||||
/* ideally we would not limit this but practically, its more than
|
||||
* enough worst case is very long vectors wont use a smart soft-range
|
||||
@@ -3497,7 +3527,7 @@ static void ui_but_update_ex(uiBut *but, const bool validate)
|
||||
/* only update soft range while not editing */
|
||||
if (!ui_but_is_editing(but)) {
|
||||
if ((but->rnaprop != NULL) || (but->poin && (but->pointype & UI_BUT_POIN_TYPES))) {
|
||||
ui_set_but_soft_range(but);
|
||||
ui_but_range_set_soft(but);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user