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
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-03-18 03:08:24 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-03-18 03:08:36 +0400
commit06de5be90e8b009c53b6fe3225085fcd4375f21f (patch)
treec7eaf7391cebf1cb7d9e959c4913048025f9304d /source/blender/editors/interface/interface_widgets.c
parent7da21752716a0e9e6e6ad8ccbda20fb1c5e8e123 (diff)
Fix T39228 Gamma/lift/gain are burned out in the circular color pickers
and value/lightness slider stops midway. Issue here is manyfold: Color wheel does not support properties with different soft min/max values than 1.0 (which after experimenting a little I left as is), and also color management is completely destroying the mapping between the value slider and the RNA property value range. To solve this I have disabled color management by setting the property to gamma corrected (only in RNA, Sequence editor coders please check!), otherwise it will just become a big mess of tracking where color comes from and what kind of color transforms it needs in different color pickers (if property has non normalized range etc). HSL is not really meant to represent colors outside a normalized space so I have disabled setting lightness above 1.0 in this model. This will work, however it is hacking a color picker to do something other than what it is supposed to do: pick a color from the screen accurately. Which means normalized values always. The non normalized colors picked for lift/gain/gamma through the pickers do not correspond to any accurate colors; they are rather a user friendly way to 'sort of' choose a color and a gamma with an indication of maximum value. I think that lift/gamma/gain nodes need a dedicated widget for this (besides it is quite clear that some options are written for that use case) -or- a separate gamma multiplier for the picked color (which should itself be in a normalized space)
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 179ec578b1d..2eff3a359ba 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2027,7 +2027,7 @@ void ui_hsvcircle_pos_from_vals(uiBut *but, const rcti *rect, float *hsv, float
ang = 2.0f * (float)M_PI * hsv[0] + 0.5f * (float)M_PI;
- if (but->flag & UI_BUT_COLOR_CUBIC)
+ if ((but->flag & UI_BUT_COLOR_CUBIC) && (U.color_picker_type == USER_CP_CIRCLE_HSV))
radius_t = (1.0f - powf(1.0f - hsv[1], 3.0f));
else
radius_t = hsv[1];
@@ -2063,10 +2063,11 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
if (color_profile)
ui_block_to_display_space_v3(but->block, rgb);
- ui_rgb_to_color_picker_compat_v(rgb, hsvo);
-
ui_rgb_to_color_picker_compat_v(rgb, hsv);
-
+ copy_v3_v3(hsvo, hsv);
+
+ CLAMP(hsv[2], 0.0f, 1.0f); /* for display only */
+
/* 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. */
@@ -2086,7 +2087,6 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
float co = cos(ang);
ui_hsvcircle_vals_from_pos(hsv, hsv + 1, rect, centx + co * radius, centy + si * radius);
- CLAMP(hsv[2], 0.0f, 1.0f); /* for display only */
ui_color_picker_to_rgb_v(hsv, col);
@@ -2287,10 +2287,14 @@ void ui_hsvcube_pos_from_vals(uiBut *but, const rcti *rect, float *hsv, float *x
x = hsv[1]; y = 0.5; break;
case UI_GRAD_V:
x = hsv[2]; y = 0.5; break;
- case UI_GRAD_V_ALT:
case UI_GRAD_L_ALT:
x = 0.5f;
/* exception only for value strip - use the range set in but->min/max */
+ y = hsv[2];
+ break;
+ case UI_GRAD_V_ALT:
+ x = 0.5f;
+ /* exception only for value strip - use the range set in but->min/max */
y = (hsv[2] - but->softmin ) / (but->softmax - but->softmin);
break;
}
@@ -2337,7 +2341,7 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect)
uiWidgetBase wtb;
const float rad = 0.5f * BLI_rcti_size_x(rect);
float x, y;
- float rgb[3], hsv[3], v, range;
+ float rgb[3], hsv[3], v;
bool color_profile = but->block->color_profile;
if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
@@ -2355,9 +2359,11 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect)
v = hsv[2];
/* map v from property range to [0,1] */
- range = but->softmax - but->softmin;
- v = (v - but->softmin) / range;
-
+ if (but->a1 == UI_GRAD_V_ALT) {
+ float range = but->softmax - but->softmin;
+ v = (v - but->softmin) / range;
+ }
+
widget_init(&wtb);
/* fully rounded */