Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-07-09 08:00:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-09 08:00:56 +0400
commit750b30c7dda4b46eb41f0ad611bae0a739b34610 (patch)
treef9eb93c611f4ac8ca9e127609e60e5ba5fe73aba /source
parentbd5cb6fb3bad20795c942f23da0263ad9e9afc13 (diff)
fix [#36008] Can't set values higher than 1.0 in HSV colour picker (But can in RGB) - also some strange behavior
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface.c22
-rw-r--r--source/blender/editors/interface/interface_regions.c8
2 files changed, 21 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 9ac499fc94b..c3bc87ac647 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2167,6 +2167,15 @@ static void ui_set_but_soft_range(uiBut *but)
but->softmin = softmin;
but->softmax = softmax;
}
+ else if (but->poin && (but->pointype & UI_BUT_POIN_TYPES)) {
+ float value = ui_get_but_val(but);
+ CLAMP(value, but->hardmin, but->hardmax);
+ but->softmin = min_ff(but->softmin, value);
+ but->softmax = max_ff(but->softmax, value);
+ }
+ else {
+ BLI_assert(0);
+ }
}
/* ******************* Free ********************/
@@ -2368,8 +2377,12 @@ void ui_check_but(uiBut *but)
ui_check_but_select(but, &value);
/* only update soft range while not editing */
- if (but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
- ui_set_but_soft_range(but);
+ if (!(but->editval || but->editstr || but->editvec)) {
+ if ((but->rnaprop != NULL) ||
+ (but->poin && (but->pointype & UI_BUT_POIN_TYPES)))
+ {
+ ui_set_but_soft_range(but);
+ }
}
/* test for min and max, icon sliders, etc */
@@ -2757,13 +2770,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
uiBut *but;
int slen;
- BLI_assert(width >= 0);
- BLI_assert(height >= 0);
+ BLI_assert(width >= 0 && height >= 0);
/* we could do some more error checks here */
if ((type & BUTTYPE) == LABEL) {
- if ((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f)))
- printf("blah\n");
BLI_assert((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f)) == FALSE);
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 9558baf0334..2e915d6357d 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2116,7 +2116,7 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
static char tip[50];
static char hexcol[128];
float rgb_gamma[3];
- float min, max, step, precision;
+ float softmin, softmax, hardmin, hardmax, step, precision;
float *hsv = ui_block_hsv_get(block);
int yco;
@@ -2142,7 +2142,8 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
/* sneaky way to check for alpha */
rgba[3] = FLT_MAX;
- RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision);
+ RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
+ RNA_property_float_range(ptr, prop, &hardmin, &hardmax);
RNA_property_float_get_array(ptr, prop, rgba);
switch (U.color_picker_type) {
@@ -2196,7 +2197,8 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
bt = uiDefButF(block, NUMSLI, 0, IFACE_("S "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation"));
uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
- bt = uiDefButF(block, NUMSLI, 0, IFACE_("V "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 2, 0.0, max, 10, 3, TIP_("Value"));
+ bt = uiDefButF(block, NUMSLI, 0, IFACE_("V "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 2, 0.0, softmax, 10, 3, TIP_("Value"));
+ bt->hardmax = hardmax; /* not common but rgb may be over 1.0 */
uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
uiBlockEndAlign(block);