Follow up to previous commit:

Make HSL wheel useful in compositing.

In HSL, 0.5 lightness corresponds to most vibrant colors so make that
default for locked wheels (previous value of 1.0 just made it white).
Also, unlock the wheel for both very bright and very dark colors.
This commit is contained in:
Antonis Ryakiotakis 2014-03-18 01:33:28 +02:00
parent 06de5be90e
commit 4d44f70d5f
2 changed files with 22 additions and 6 deletions

View File

@ -4638,8 +4638,14 @@ static bool ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data,
/* exception, when using color wheel in 'locked' value state:
* allow choosing a hue for black values, by giving a tiny increment */
if (but->flag & UI_BUT_COLOR_LOCK) { // lock
if (hsv[2] == 0.f) hsv[2] = 0.0001f;
if (but->flag & UI_BUT_COLOR_LOCK) {
if (U.color_picker_type == USER_CP_CIRCLE_HSV) { // lock
if (hsv[2] == 0.f) hsv[2] = 0.0001f;
}
else {
if (hsv[2] == 0.f) hsv[2] = 0.0001f;
if (hsv[2] == 1.f) hsv[2] = 0.9999f;
}
}
/* only apply the delta motion, not absolute */
@ -4727,8 +4733,14 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data,
/* exception, when using color wheel in 'locked' value state:
* allow choosing a hue for black values, by giving a tiny increment */
if (but->flag & UI_BUT_COLOR_LOCK) { // lock
if (hsv[2] == 0.0f) hsv[2] = 0.0001f;
if (but->flag & UI_BUT_COLOR_LOCK) {
if (U.color_picker_type == USER_CP_CIRCLE_HSV) { // lock
if (hsv[2] == 0.f) hsv[2] = 0.0001f;
}
else {
if (hsv[2] == 0.f) hsv[2] = 0.0001f;
if (hsv[2] == 1.f) hsv[2] = 0.9999f;
}
}
if (snap != SNAP_OFF) {

View File

@ -2071,8 +2071,12 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
/* exception: if 'lock' is set
* lock the value of the color wheel to 1.
* Useful for color correction tools where you're only interested in hue. */
if (but->flag & UI_BUT_COLOR_LOCK)
hsv[2] = 1.f;
if (but->flag & UI_BUT_COLOR_LOCK) {
if(U.color_picker_type == USER_CP_CIRCLE_HSV)
hsv[2] = 1.f;
else
hsv[2] = 0.5f;
}
ui_color_picker_to_rgb(0.f, 0.f, hsv[2], colcent, colcent + 1, colcent + 2);