diff options
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b8a84e1638a..f7b22098835 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3162,13 +3162,15 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, if (but->rnaprop) { if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) - color_profile = BLI_PR_NONE; + color_profile = FALSE; } ui_get_but_vectorf(but, rgb); - rgb_to_hsv_compat_v(rgb, hsv); + if (color_profile && (int)but->a1) + ui_block_to_display_space_v3(but->block, rgb); + rgb_to_hsv_compat_v(rgb, hsv); /* relative position within box */ x = ((float)mx_fl - but->rect.xmin) / BLI_RCT_SIZE_X(&but->rect); @@ -3204,17 +3206,16 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, /* exception only for value strip - use the range set in but->min/max */ hsv[2] = y * (but->softmax - but->softmin) + but->softmin; - if (color_profile) - hsv[2] = srgb_to_linearrgb(hsv[2]); - - if (hsv[2] > but->softmax) - hsv[2] = but->softmax; break; default: assert(!"invalid hsv type"); } hsv_to_rgb_v(hsv, rgb); + + if (color_profile && (int)but->a1) + ui_block_to_scene_linear_v3(but->block, rgb); + copy_v3_v3(data->vec, rgb); data->draglastx = mx; @@ -3233,10 +3234,14 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF if (but->rnaprop) { if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) - color_profile = BLI_PR_NONE; + color_profile = FALSE; } ui_get_but_vectorf(but, rgb); + + if (color_profile && (int)but->a1) + ui_block_to_display_space_v3(but->block, rgb); + rgb_to_hsv_compat_v(rgb, hsv); switch ((int)but->a1) { @@ -3267,15 +3272,16 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF /* exception only for value strip - use the range set in but->min/max */ hsv[2] += ndof->rx * sensitivity; - if (color_profile) - hsv[2] = srgb_to_linearrgb(hsv[2]); - CLAMP(hsv[2], but->softmin, but->softmax); default: assert(!"invalid hsv type"); } - + hsv_to_rgb_v(hsv, rgb); + + if (color_profile && (int)but->a1) + ui_block_to_scene_linear_v3(but->block, rgb); + copy_v3_v3(data->vec, rgb); ui_set_but_vectorf(but, data->vec); } |