Fix #29670: color picker draw issues with RGB values out of soft range.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 21 Dec 2011 13:49:22 +0000 (13:49 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 21 Dec 2011 13:49:22 +0000 (13:49 +0000)
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_widgets.c

index 1bad61be3242fec36ea6615ad59343b042b61102..63e410824498fc3e8a1cd3e625503ef9536f2919 100644 (file)
@@ -1901,7 +1901,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
                        if(softmin < (double)but->hardmin)
                                softmin= (double)but->hardmin;
                }
                        if(softmin < (double)but->hardmin)
                                softmin= (double)but->hardmin;
                }
-               else if(value_max-1e-10 > softmax) {
+               if(value_max-1e-10 > softmax) {
                        if(value_max < 0.0)
                                softmax= -soft_range_round_down(-value_max, -softmax);
                        else
                        if(value_max < 0.0)
                                softmax= -soft_range_round_down(-value_max, -softmax);
                        else
index 6ebfddff5c154d66535b07c387cf6929b8c8deb3..900cbbd5cbfaf7ae723cc5ef6282b19bd63a5b98 100644 (file)
@@ -5247,7 +5247,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
                   highlight when not in a popup menu, we remove because data used in
                   button below popup might have been removed by action of popup. Needs
                   a more reliable solution... */
                   highlight when not in a popup menu, we remove because data used in
                   button below popup might have been removed by action of popup. Needs
                   a more reliable solution... */
-               if(state != BUTTON_STATE_HIGHLIGHT || but->block->handle)
+               if(state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
                        ui_check_but(but);
        }
 
                        ui_check_but(but);
        }
 
index 0da4d3895e00aecbf949eac5140b805f79e86a5e..d8a34262e81cd26193bf210303e48ca17708bf3b 100644 (file)
@@ -1795,7 +1795,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 {
        /* gouraud triangle fan */
        float radstep, ang= 0.0f;
 {
        /* gouraud triangle fan */
        float radstep, ang= 0.0f;
-       float centx, centy, radius;
+       float centx, centy, radius, cursor_radius;
        float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
        int a, tot= 32;
        int color_profile = but->block->color_profile;
        float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
        int a, tot= 32;
        int color_profile = but->block->color_profile;
@@ -1864,12 +1864,12 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
        ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
 
        if(but->flag & UI_BUT_COLOR_CUBIC)
        ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
 
        if(but->flag & UI_BUT_COLOR_CUBIC)
-               radius= (1.0f - powf(1.0f - hsvo[1], 3.0f)) *radius;
+               cursor_radius = (1.0f - powf(1.0f - hsvo[1], 3.0f));
        else
        else
-               radius= hsvo[1] * radius;
+               cursor_radius = hsvo[1];
 
 
+       radius= CLAMPIS(cursor_radius, 0.0f, 1.0f) * radius;
        ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius);
        ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius);
-       
 }
 
 /* ************ custom buttons, old stuff ************** */
 }
 
 /* ************ custom buttons, old stuff ************** */