diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-01-27 17:00:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-01-28 15:16:49 +0300 |
commit | a51ff5208b47254122eefb4ed9cc832fb4885012 (patch) | |
tree | 3e54b8a98d5f8b1c68230e4e22f9c33ea03d8707 /source/blender | |
parent | 3726aa68c35d91aa6065d197aecdc3ee36a1b38f (diff) |
Fix alpha transparency slider range being influenced by RGB values
For buttons that edit array properties, the soft min/max and slider ranges are
based on the range of all values in the array. However for alpha this does not
make much sense, the only reasonable range is 0..1 even when there are RGB
values larger than 1. So treat alpha as an individual property.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7340a373573..319ae385ffc 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3201,6 +3201,7 @@ void ui_but_range_set_soft(uiBut *but) if (but->rnaprop) { const PropertyType type = RNA_property_type(but->rnaprop); + const PropertySubType subtype = RNA_property_subtype(but->rnaprop); double softmin, softmax /*, step, precision*/; double value_min; double value_max; @@ -3224,7 +3225,7 @@ void ui_but_range_set_soft(uiBut *but) value_max = (double)value_range[1]; } else { - value_min = value_max = (double)RNA_property_int_get(&but->rnapoin, but->rnaprop); + value_min = value_max = ui_but_value_get(but); } } else if (type == PROP_FLOAT) { @@ -3237,14 +3238,15 @@ void ui_but_range_set_soft(uiBut *but) /*step = fstep;*/ /*UNUSED*/ /*precision = fprecision;*/ /*UNUSED*/ - if (is_array) { + /* Use shared min/max for array values, except for color alpha. */ + if (is_array && !(subtype == PROP_COLOR && but->rnaindex == 3)) { float value_range[2]; RNA_property_float_get_array_range(&but->rnapoin, but->rnaprop, value_range); value_min = (double)value_range[0]; value_max = (double)value_range[1]; } else { - value_min = value_max = (double)RNA_property_float_get(&but->rnapoin, but->rnaprop); + value_min = value_max = ui_but_value_get(but); } } else { |