Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_region_color_picker.c
| Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | case USER_CP_CIRCLE_HSL: | ||||
| hsl_to_rgb_v(r_cp, rgb); | hsl_to_rgb_v(r_cp, rgb); | ||||
| break; | break; | ||||
| default: | default: | ||||
| hsv_to_rgb_v(r_cp, rgb); | hsv_to_rgb_v(r_cp, rgb); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| /* Returns true if the button is for a color with gamma baked in, | |||||
| * or if it's a color picker for such a button. */ | |||||
| bool ui_but_is_color_gamma(uiBut *but) | bool ui_but_is_color_gamma(uiBut *but) | ||||
| { | { | ||||
| if (but->rnaprop) { | if (but->rnaprop) { | ||||
| if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { | if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | static void ui_color_picker_update_hsv(ColorPicker *cpicker, | ||||
| } | } | ||||
| else { | else { | ||||
| ui_color_picker_rgb_to_hsv_compat(rgb_perceptual, cpicker->hsv_perceptual); | ui_color_picker_rgb_to_hsv_compat(rgb_perceptual, cpicker->hsv_perceptual); | ||||
| } | } | ||||
| cpicker->is_init = true; | cpicker->is_init = true; | ||||
| } | } | ||||
| /* for picker, while editing hsv */ | |||||
| void ui_but_hsv_set(uiBut *but) | void ui_but_hsv_set(uiBut *but) | ||||
| { | { | ||||
| float rgb_perceptual[3]; | float rgb_perceptual[3]; | ||||
| ColorPicker *cpicker = but->custom_data; | ColorPicker *cpicker = but->custom_data; | ||||
| float *hsv_perceptual = cpicker->hsv_perceptual; | float *hsv_perceptual = cpicker->hsv_perceptual; | ||||
| ui_color_picker_hsv_to_rgb(hsv_perceptual, rgb_perceptual); | ui_color_picker_hsv_to_rgb(hsv_perceptual, rgb_perceptual); | ||||
| ▲ Show 20 Lines • Show All 735 Lines • Show Last 20 Lines | |||||