|
Blender V4.5
|
#include <cstdarg>#include <cstdlib>#include <cstring>#include "MEM_guardedalloc.h"#include "DNA_userdef_types.h"#include "BLI_listbase.h"#include "BLI_string.h"#include "BLI_utildefines.h"#include "WM_api.hh"#include "WM_types.hh"#include "RNA_access.hh"#include "UI_interface.hh"#include "BLT_translation.hh"#include "IMB_colormanagement.hh"#include "interface_intern.hh"Go to the source code of this file.
Enumerations | |
| enum | ePickerType { PICKER_TYPE_RGB = 0 , PICKER_TYPE_HSV = 1 } |
Functions | |
Color Conversion | |
| static void | ui_color_picker_rgb_round (float rgb[3]) |
| void | ui_color_picker_rgb_to_hsv_compat (const float rgb[3], float r_cp[3]) |
| void | ui_color_picker_rgb_to_hsv (const float rgb[3], float r_cp[3]) |
| void | ui_color_picker_hsv_to_rgb (const float r_cp[3], float rgb[3]) |
| bool | ui_but_is_color_gamma (uiBut *but) |
| bool | ui_but_color_has_alpha (uiBut *but) |
| void | ui_scene_linear_to_perceptual_space (uiBut *but, float rgb[3]) |
| void | ui_perceptual_to_scene_linear_space (uiBut *but, float rgb[3]) |
Color Picker | |
| #define | PICKER_TOTAL_W (180.0f * UI_SCALE_FAC) |
| #define | PICKER_BAR ((8.0f * UI_SCALE_FAC) + (6 * U.pixelsize)) |
| #define | PICKER_SPACE (8.0f * UI_SCALE_FAC) |
| #define | PICKER_W (PICKER_TOTAL_W - PICKER_BAR - PICKER_SPACE) |
| #define | PICKER_H PICKER_W |
| static void | ui_color_picker_update_hsv (ColorPicker *cpicker, uiBut *from_but, const float rgb_scene_linear[3]) |
| void | ui_but_hsv_set (uiBut *but) |
| static void | ui_update_color_picker_buts_rgba (uiBut *from_but, uiBlock *block, ColorPicker *cpicker, const float rgba_scene_linear[4]) |
| static void | ui_colorpicker_rgba_update_cb (bContext *, void *bt1, void *) |
| static void | ui_colorpicker_hsv_update_cb (bContext *, void *bt1, void *bt2) |
| static void | ui_colorpicker_hex_rna_cb (bContext *, void *bt1, void *bt2) |
| static void | ui_popup_close_cb (bContext *, void *bt1, void *) |
| static void | ui_colorpicker_hide_reveal (uiBlock *block, ePickerType colormode) |
| static void | ui_colorpicker_create_mode_cb (bContext *, void *bt1, void *) |
| static void | ui_colorpicker_circle (uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, ColorPicker *cpicker) |
| static void | ui_colorpicker_square (uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, eButGradientType type, ColorPicker *cpicker) |
| static void | ui_block_colorpicker (uiBlock *block, uiBut *from_but, float rgba_scene_linear[4], bool show_picker) |
| static int | ui_colorpicker_wheel_cb (const bContext *, uiBlock *block, const wmEvent *event) |
| uiBlock * | ui_block_func_COLOR (bContext *C, uiPopupBlockHandle *handle, void *arg_but) |
| ColorPicker * | ui_block_colorpicker_create (uiBlock *block) |
Color Picker Region & Color Utils
Definition in file interface_region_color_picker.cc.
| #define PICKER_BAR ((8.0f * UI_SCALE_FAC) + (6 * U.pixelsize)) |
Definition at line 364 of file interface_region_color_picker.cc.
Referenced by ui_colorpicker_circle(), and ui_colorpicker_square().
| #define PICKER_H PICKER_W |
Definition at line 367 of file interface_region_color_picker.cc.
Referenced by ui_colorpicker_circle(), and ui_colorpicker_square().
| #define PICKER_SPACE (8.0f * UI_SCALE_FAC) |
Definition at line 365 of file interface_region_color_picker.cc.
Referenced by ui_colorpicker_circle(), and ui_colorpicker_square().
| #define PICKER_TOTAL_W (180.0f * UI_SCALE_FAC) |
Definition at line 363 of file interface_region_color_picker.cc.
Referenced by ui_block_colorpicker(), and ui_colorpicker_square().
| #define PICKER_W (PICKER_TOTAL_W - PICKER_BAR - PICKER_SPACE) |
Definition at line 366 of file interface_region_color_picker.cc.
Referenced by ui_colorpicker_circle().
| enum ePickerType |
| Enumerator | |
|---|---|
| PICKER_TYPE_RGB | |
| PICKER_TYPE_HSV | |
Definition at line 36 of file interface_region_color_picker.cc.
|
static |
Definition at line 485 of file interface_region_color_picker.cc.
References BLT_I18NCONTEXT_COLOR, copy_v4_v4(), CTX_IFACE_, CTX_TIP_, uiBut::custom_data, FLT_MAX, uiBut::hardmax, ColorPicker::has_alpha, ColorPicker::hsv_scene_linear, IFACE_, IMB_colormanagement_scene_linear_to_srgb_v3(), PICKER_TOTAL_W, PICKER_TYPE_HSV, PICKER_TYPE_RGB, ptr, rgba_float_to_uchar(), RNA_property_float_get_array_at_most(), RNA_property_float_range(), RNA_property_float_ui_range(), uiBut::rnapoin, uiBut::rnaprop, SNPRINTF, step, TIP_, U, UI_block_align_begin(), UI_block_align_end(), ui_block_colorpicker_create(), UI_BTYPE_BUT, UI_BTYPE_LABEL, UI_BTYPE_NUM_SLIDER, UI_BTYPE_ROW, UI_BTYPE_TEXT, ui_but_color_has_alpha(), UI_but_drawflag_disable(), UI_but_flag_disable(), UI_but_func_set(), UI_but_func_tooltip_custom_set(), UI_BUT_ICON_LEFT, ui_but_is_color_gamma(), UI_but_number_slider_precision_set(), UI_but_number_slider_step_size_set(), UI_BUT_TEXT_LEFT, UI_BUT_UNDO, ui_color_picker_rgb_round(), ui_color_picker_update_hsv(), ui_colorpicker_circle(), ui_colorpicker_create_mode_cb(), ui_colorpicker_hex_rna_cb(), ui_colorpicker_hide_reveal(), ui_colorpicker_hsv_update_cb(), ui_colorpicker_rgba_update_cb(), ui_colorpicker_square(), UI_GRAD_HS, UI_GRAD_HV, UI_GRAD_SV, ui_popup_close_cb(), UI_TIP_LC_NORMAL, UI_TIP_STYLE_HEADER, UI_TIP_STYLE_NORMAL, UI_tooltip_text_field_add(), UI_UNIT_X, UI_UNIT_Y, uiDefBut(), uiDefButC(), uiDefButF(), uiDefButR_prop(), uiDefIconButO(), UNPACK3_EX, UNPACK4_EX, USER_CP_CIRCLE_HSL, USER_CP_CIRCLE_HSV, USER_CP_SQUARE_HS, USER_CP_SQUARE_HV, USER_CP_SQUARE_SV, and WM_OP_INVOKE_DEFAULT.
Referenced by ui_block_func_COLOR().
| ColorPicker * ui_block_colorpicker_create | ( | uiBlock * | block | ) |
Definition at line 918 of file interface_region_color_picker.cc.
References BLI_addhead(), uiBlock::color_pickers, ColorPickerData::list, and MEM_callocN().
Referenced by ui_block_colorpicker(), and uiTemplateColorPicker().
| uiBlock * ui_block_func_COLOR | ( | bContext * | C, |
| uiPopupBlockHandle * | handle, | ||
| void * | arg_but ) |
Definition at line 893 of file interface_region_color_picker.cc.
References uiBlock::block_event_func, C, copy_v3_v3(), uiBlock::direction, uiBut::editvec, blender::ui::Emboss, uiBlock::flag, uiBlock::is_color_gamma_picker, uiPopupBlockHandle::region, uiPopupBlockHandle::retvec, UI_block_begin(), UI_block_bounds_set_normal(), ui_block_colorpicker(), UI_BLOCK_KEEP_OPEN, UI_BLOCK_LOOP, UI_BLOCK_MOVEMOUSE_QUIT, UI_BLOCK_OUT_1, UI_BLOCK_THEME_STYLE_POPUP, UI_block_theme_style_set(), ui_but_is_color_gamma(), ui_colorpicker_wheel_cb(), UI_DIR_UP, and UI_UNIT_X.
Referenced by ui_block_open_begin().
| bool ui_but_color_has_alpha | ( | uiBut * | but | ) |
Returns true if the button represents a color with an Alpha component.
Definition at line 109 of file interface_region_color_picker.cc.
References ELEM, PROP_COLOR, PROP_COLOR_GAMMA, RNA_property_array_length(), RNA_property_subtype(), uiBut::rnapoin, and uiBut::rnaprop.
Referenced by ui_block_colorpicker(), and ui_but_drag_init().
| void ui_but_hsv_set | ( | uiBut * | but | ) |
For picker, while editing HSV.
Definition at line 179 of file interface_region_color_picker.cc.
References uiBut::custom_data, ColorPicker::hsv_perceptual, ui_but_v3_set(), and ui_color_picker_hsv_to_rgb().
Referenced by ui_do_but_HSVCIRCLE().
| bool ui_but_is_color_gamma | ( | uiBut * | but | ) |
Returns true if the button is for a color with gamma baked in, or if it's a color picker for such a button.
Definition at line 98 of file interface_region_color_picker.cc.
References uiBut::block, uiBlock::is_color_gamma_picker, PROP_COLOR_GAMMA, RNA_property_subtype(), and uiBut::rnaprop.
Referenced by ui_block_colorpicker(), ui_block_func_COLOR(), ui_colorpicker_hex_rna_cb(), ui_draw_but_HSVCIRCLE(), ui_perceptual_to_scene_linear_space(), ui_scene_linear_to_perceptual_space(), ui_tooltip_data_from_button_or_extra_icon(), ui_update_color_picker_buts_rgba(), and widget_swatch().
| void ui_color_picker_hsv_to_rgb | ( | const float | r_cp[3], |
| float | rgb[3] ) |
Definition at line 86 of file interface_region_color_picker.cc.
References hsl_to_rgb_v(), hsv_to_rgb_v(), U, and USER_CP_CIRCLE_HSL.
Referenced by ui_but_hsv_set(), ui_colorpicker_hsv_update_cb(), ui_colorpicker_wheel_cb(), ui_do_but_HSVCIRCLE(), ui_draw_but_HSVCIRCLE(), and ui_numedit_but_HSVCIRCLE().
|
static |
Definition at line 45 of file interface_region_color_picker.cc.
Referenced by ui_block_colorpicker(), ui_colorpicker_hex_rna_cb(), ui_perceptual_to_scene_linear_space(), ui_scene_linear_to_perceptual_space(), and ui_update_color_picker_buts_rgba().
| void ui_color_picker_rgb_to_hsv | ( | const float | rgb[3], |
| float | r_cp[3] ) |
Definition at line 74 of file interface_region_color_picker.cc.
References rgb_to_hsl_v(), rgb_to_hsv_v(), U, and USER_CP_CIRCLE_HSL.
Referenced by ui_color_picker_update_hsv().
| void ui_color_picker_rgb_to_hsv_compat | ( | const float | rgb[3], |
| float | r_cp[3] ) |
Definition at line 60 of file interface_region_color_picker.cc.
References rgb_to_hsl_compat_v(), rgb_to_hsv_compat_v(), U, and USER_CP_CIRCLE_HSL.
Referenced by ui_color_picker_update_hsv(), ui_colorpicker_wheel_cb(), ui_do_but_HSVCIRCLE(), ui_draw_but_HSVCIRCLE(), and ui_numedit_but_HSVCIRCLE().
|
static |
Definition at line 149 of file interface_region_color_picker.cc.
References copy_v3_v3(), ColorPicker::hsv_perceptual, ColorPicker::hsv_perceptual_init, ColorPicker::hsv_scene_linear, ColorPicker::is_init, ui_color_picker_rgb_to_hsv(), ui_color_picker_rgb_to_hsv_compat(), and ui_scene_linear_to_perceptual_space().
Referenced by ui_block_colorpicker(), and ui_update_color_picker_buts_rgba().
|
static |
Definition at line 369 of file interface_region_color_picker.cc.
References BLT_I18NCONTEXT_COLOR, CTX_TIP_, uiBut::custom_data, uiButHSVCube::gradient_type, PICKER_BAR, PICKER_H, PICKER_SPACE, PICKER_W, ptr, TIP_, U, UI_BTYPE_HSVCIRCLE, UI_BTYPE_HSVCUBE, UI_but_func_set(), ui_colorpicker_rgba_update_cb(), UI_GRAD_L_ALT, UI_GRAD_V_ALT, uiDefButR_prop(), and USER_CP_CIRCLE_HSL.
Referenced by ui_block_colorpicker().
|
static |
Definition at line 356 of file interface_region_color_picker.cc.
References uiBut::block, ui_but_value_get(), and ui_colorpicker_hide_reveal().
Referenced by ui_block_colorpicker().
|
static |
Definition at line 287 of file interface_region_color_picker.cc.
References ARRAY_SIZE, uiBut::block, uiBut::custom_data, uiBlock::handle, hex_to_rgba(), IMB_colormanagement_srgb_to_scene_linear_v3(), uiPopupBlockHandle::menuretval, RNA_property_float_get_array_at_most(), uiBut::rnapoin, uiBut::rnaprop, ui_but_is_color_gamma(), ui_but_string_get(), ui_color_picker_rgb_round(), UI_RETURN_UPDATE, ui_update_color_picker_buts_rgba(), and zero_v4().
Referenced by ui_block_colorpicker().
|
static |
Definition at line 339 of file interface_region_color_picker.cc.
References uiBlock::buttons, PICKER_TYPE_HSV, PICKER_TYPE_RGB, SET_FLAG_FROM_TEST, UI_BTYPE_NUM_SLIDER, ui_colorpicker_hsv_update_cb(), ui_colorpicker_rgba_update_cb(), and UI_HIDDEN.
Referenced by ui_block_colorpicker(), and ui_colorpicker_create_mode_cb().
|
static |
Definition at line 259 of file interface_region_color_picker.cc.
References ARRAY_SIZE, uiBut::block, uiBut::custom_data, uiBlock::handle, ColorPicker::hsv_scene_linear, uiPopupBlockHandle::menuretval, RNA_property_float_get_array_at_most(), uiBut::rnapoin, uiBut::rnaprop, ui_color_picker_hsv_to_rgb(), UI_RETURN_UPDATE, ui_update_color_picker_buts_rgba(), and zero_v4().
Referenced by ui_block_colorpicker(), and ui_colorpicker_hide_reveal().
|
static |
Definition at line 238 of file interface_region_color_picker.cc.
References ARRAY_SIZE, uiBut::block, uiBut::custom_data, uiBlock::handle, uiPopupBlockHandle::menuretval, ptr, RNA_property_float_get_array_at_most(), uiBut::rnapoin, uiBut::rnaprop, UI_RETURN_UPDATE, ui_update_color_picker_buts_rgba(), and zero_v4().
Referenced by ui_block_colorpicker(), ui_colorpicker_circle(), ui_colorpicker_hide_reveal(), and ui_colorpicker_square().
|
static |
Definition at line 435 of file interface_region_color_picker.cc.
References BLI_assert, BLT_I18NCONTEXT_COLOR, CTX_TIP_, uiBut::custom_data, uiButHSVCube::gradient_type, PICKER_BAR, PICKER_H, PICKER_SPACE, PICKER_TOTAL_W, ptr, TIP_, UI_BTYPE_HSVCUBE, UI_but_func_set(), ui_colorpicker_rgba_update_cb(), UI_GRAD_HS, and uiDefButR_prop().
Referenced by ui_block_colorpicker().
Definition at line 836 of file interface_region_color_picker.cc.
References add(), uiBlock::buttons, clamp_f(), uiBlock::handle, ColorPicker::hsv_perceptual, uiPopupBlockHandle::menuretval, MOUSEPAN, wmEvent::type, UI_BTYPE_HSVCUBE, ui_but_v4_get(), ui_but_v4_set(), ui_color_picker_hsv_to_rgb(), ui_color_picker_rgb_to_hsv_compat(), ui_perceptual_to_scene_linear_space(), UI_RETURN_UPDATE, UI_SCALE_FAC, ui_scene_linear_to_perceptual_space(), ui_update_color_picker_buts_rgba(), WHEELDOWNMOUSE, WHEELUPMOUSE, and WM_event_absolute_delta_y().
Referenced by ui_block_func_COLOR().
| void ui_perceptual_to_scene_linear_space | ( | uiBut * | but, |
| float | rgb[3] ) |
Definition at line 135 of file interface_region_color_picker.cc.
References IMB_colormanagement_color_picking_to_scene_linear_v3(), ui_but_is_color_gamma(), and ui_color_picker_rgb_round().
Referenced by ui_colorpicker_wheel_cb(), ui_draw_but_HSVCIRCLE(), ui_numedit_but_HSVCIRCLE(), and ui_numedit_but_HSVCUBE().
|
static |
Definition at line 325 of file interface_region_color_picker.cc.
References BLI_assert, uiBut::block, uiBut::custom_data, equals_v3v3(), uiBlock::handle, ColorPicker::hsv_perceptual, ColorPicker::hsv_perceptual_init, ColorPicker::is_init, uiPopupBlockHandle::menuretval, UI_RETURN_CANCEL, and UI_RETURN_OK.
Referenced by ui_block_colorpicker().
| void ui_scene_linear_to_perceptual_space | ( | uiBut * | but, |
| float | rgb[3] ) |
Definition at line 124 of file interface_region_color_picker.cc.
References IMB_colormanagement_scene_linear_to_color_picking_v3(), ui_but_is_color_gamma(), and ui_color_picker_rgb_round().
Referenced by ui_color_picker_update_hsv(), ui_colorpicker_wheel_cb(), ui_draw_but_HSV_v(), ui_draw_but_HSVCIRCLE(), ui_draw_but_HSVCUBE(), ui_numedit_but_HSVCIRCLE(), and ui_numedit_but_HSVCUBE().
|
static |
Definition at line 191 of file interface_region_color_picker.cc.
References uiBlock::buttons, col, copy_v4_v4(), ColorPicker::has_alpha, IMB_colormanagement_scene_linear_to_srgb_v3(), rgba_float_to_uchar(), SNPRINTF_RLEN, UI_BTYPE_TEXT, UI_but_flag_disable(), ui_but_is_color_gamma(), UI_BUT_UNDO, ui_but_update(), ui_but_v4_set(), ui_color_picker_rgb_round(), ui_color_picker_update_hsv(), UNPACK3_EX, and UNPACK4_EX.
Referenced by ui_colorpicker_hex_rna_cb(), ui_colorpicker_hsv_update_cb(), ui_colorpicker_rgba_update_cb(), and ui_colorpicker_wheel_cb().