|
Blender V5.0
|
#include <cstdarg>#include <cstdlib>#include <cstring>#include "MEM_guardedalloc.h"#include "DNA_userdef_types.h"#include "BLI_listbase.h"#include "BLI_string_utf8.h"#include "BLI_utildefines.h"#include "BKE_context.hh"#include "UI_interface_c.hh"#include "WM_api.hh"#include "WM_types.hh"#include "RNA_access.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 } |
| enum | ePickerSpace { PICKER_SPACE_LINEAR = 0 , PICKER_SPACE_PERCEPTUAL = 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) |
| static void | ui_scene_linear_to_perceptual_space (const bool is_gamma, float rgb[3]) |
| static void | ui_perceptual_to_scene_linear_space (const bool is_gamma, float rgb[3]) |
| void | ui_scene_linear_to_perceptual_space (uiBut *but, float rgb[3]) |
| void | ui_perceptual_to_scene_linear_space (uiBut *but, float rgb[3]) |
Variables | |
| static char | g_color_picker_type = PICKER_TYPE_HSV |
| static char | g_color_picker_space = PICKER_SPACE_PERCEPTUAL |
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_from_rgb_linear (ColorPicker *cpicker, const bool is_gamma, const bool is_editing_sliders, const float rgb_scene_linear[3]) |
| void | ui_but_hsv_set (uiBut *but) |
| static void | ui_update_color_picker_buts_rgba (uiBlock *block, ColorPicker *cpicker, const bool is_editing_sliders, const float rgba_scene_linear[4]) |
| static void | ui_colorpicker_rgba_update_cb (bContext *, void *picker_bt1, void *prop_bt1) |
| static void | ui_colorpicker_hsv_perceptual_slider_update_cb (bContext *, void *bt1, void *bt2) |
| static void | ui_colorpicker_hsv_linear_slider_update_cb (bContext *, void *bt1, void *bt2) |
| static void | ui_colorpicker_rgb_perceptual_slider_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) |
| static void | ui_colorpicker_update_type_space_cb (bContext *, void *picker_bt1, void *prop_bt1) |
| 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 (const bContext *, 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 509 of file interface_region_color_picker.cc.
Referenced by ui_colorpicker_circle(), and ui_colorpicker_square().
| #define PICKER_H PICKER_W |
Definition at line 512 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 510 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 508 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 511 of file interface_region_color_picker.cc.
Referenced by ui_colorpicker_circle().
| enum ePickerSpace |
| Enumerator | |
|---|---|
| PICKER_SPACE_LINEAR | |
| PICKER_SPACE_PERCEPTUAL | |
Definition at line 42 of file interface_region_color_picker.cc.
| enum ePickerType |
| Enumerator | |
|---|---|
| PICKER_TYPE_RGB | |
| PICKER_TYPE_HSV | |
Definition at line 37 of file interface_region_color_picker.cc.
|
static |
Definition at line 630 of file interface_region_color_picker.cc.
References BLT_I18NCONTEXT_COLOR, But, COLOR_ROLE_COLOR_PICKING, COLOR_ROLE_SCENE_LINEAR, copy_v4_v4(), CTX_TIP_, uiBut::custom_data, FLT_MAX, g_color_picker_space, g_color_picker_type, uiBut::hardmax, ColorPicker::has_alpha, ColorPicker::hexcol, ColorPicker::hsv_linear_slider, ColorPicker::hsv_perceptual_slider, IFACE_, IMB_colormanagement_role_colorspace_name_get(), IMB_colormanagement_scene_linear_to_srgb_v3(), blender::wm::InvokeDefault, uiBlock::is_color_gamma_picker, Label, NumSlider, PICKER_TOTAL_W, PICKER_TYPE_HSV, PICKER_TYPE_RGB, ptr, ColorPicker::rgb_perceptual_slider, rgba_float_to_uchar(), RNA_property_float_get_array_at_most(), RNA_property_float_range(), RNA_property_float_ui_range(), uiBut::rnapoin, uiBut::rnaprop, Row, SNPRINTF_UTF8, uiBut::softmax, uiBut::softmin, step, str, Text, TIP_, U, UI_block_align_begin(), UI_block_align_end(), ui_block_colorpicker_create(), 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_from_rgb_linear(), ui_colorpicker_circle(), ui_colorpicker_hex_rna_cb(), ui_colorpicker_hide_reveal(), ui_colorpicker_hsv_linear_slider_update_cb(), ui_colorpicker_hsv_perceptual_slider_update_cb(), ui_colorpicker_rgb_perceptual_slider_update_cb(), ui_colorpicker_rgba_update_cb(), ui_colorpicker_square(), ui_colorpicker_update_type_space_cb(), UI_GRAD_HS, UI_GRAD_HV, UI_GRAD_SV, ui_popup_close_cb(), UI_TIP_LC_ACTIVE, 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 y.
Referenced by ui_block_func_COLOR().
| ColorPicker * ui_block_colorpicker_create | ( | uiBlock * | block | ) |
Definition at line 1136 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 1111 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 118 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 227 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 107 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_but_is_color_gamma(), ui_colorpicker_hex_rna_cb(), ui_draw_but_HSVCIRCLE(), ui_draw_but_HSVCUBE(), ui_perceptual_to_scene_linear_space(), ui_scene_linear_to_perceptual_space(), ui_tooltip_data_from_button_or_extra_icon(), and widget_swatch().
Definition at line 95 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_linear_slider_update_cb(), ui_colorpicker_hsv_perceptual_slider_update_cb(), ui_colorpicker_wheel_cb(), ui_do_but_HSVCIRCLE(), ui_draw_but_HSVCIRCLE(), and ui_numedit_but_HSVCIRCLE().
|
static |
Definition at line 54 of file interface_region_color_picker.cc.
Referenced by ui_block_colorpicker(), ui_color_picker_update_from_rgb_linear(), ui_colorpicker_hex_rna_cb(), ui_perceptual_to_scene_linear_space(), ui_scene_linear_to_perceptual_space(), and ui_update_color_picker_buts_rgba().
Definition at line 83 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_from_rgb_linear(), and ui_colorpicker_rgb_perceptual_slider_update_cb().
Definition at line 69 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_from_rgb_linear(), ui_colorpicker_wheel_cb(), ui_do_but_HSVCIRCLE(), ui_draw_but_HSVCIRCLE(), and ui_numedit_but_HSVCIRCLE().
|
static |
Definition at line 168 of file interface_region_color_picker.cc.
References copy_v3_v3(), g_color_picker_space, g_color_picker_type, ColorPicker::hsv_linear_slider, ColorPicker::hsv_perceptual, ColorPicker::hsv_perceptual_init, ColorPicker::hsv_perceptual_slider, ColorPicker::is_init, PICKER_SPACE_LINEAR, PICKER_SPACE_PERCEPTUAL, PICKER_TYPE_HSV, PICKER_TYPE_RGB, ColorPicker::rgb_perceptual_slider, ui_color_picker_rgb_round(), 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 514 of file interface_region_color_picker.cc.
References BLT_I18NCONTEXT_COLOR, CTX_TIP_, uiBut::custom_data, uiButHSVCube::gradient_type, HsvCircle, HsvCube, PICKER_BAR, PICKER_H, PICKER_SPACE, PICKER_W, ptr, TIP_, U, 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 401 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, ptr, 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 453 of file interface_region_color_picker.cc.
References uiBlock::buttons, g_color_picker_space, g_color_picker_type, uiBlock::is_color_gamma_picker, NumSlider, PICKER_SPACE_LINEAR, PICKER_SPACE_PERCEPTUAL, PICKER_TYPE_HSV, PICKER_TYPE_RGB, SET_FLAG_FROM_TEST, ui_colorpicker_hsv_linear_slider_update_cb(), ui_colorpicker_hsv_perceptual_slider_update_cb(), ui_colorpicker_rgb_perceptual_slider_update_cb(), ui_colorpicker_rgba_update_cb(), and UI_HIDDEN.
Referenced by ui_block_colorpicker(), and ui_colorpicker_update_type_space_cb().
|
static |
Definition at line 343 of file interface_region_color_picker.cc.
References ARRAY_SIZE, uiBut::block, uiBut::custom_data, uiBlock::handle, ColorPicker::hsv_linear_slider, uiPopupBlockHandle::menuretval, ptr, 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 313 of file interface_region_color_picker.cc.
References ARRAY_SIZE, uiBut::block, copy_v3_v3(), uiBut::custom_data, uiBlock::handle, ColorPicker::hsv_perceptual_slider, uiBlock::is_color_gamma_picker, uiPopupBlockHandle::menuretval, ptr, ColorPicker::rgb_perceptual_slider, RNA_property_float_get_array_at_most(), uiBut::rnapoin, uiBut::rnaprop, ui_color_picker_hsv_to_rgb(), ui_perceptual_to_scene_linear_space(), 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 371 of file interface_region_color_picker.cc.
References ARRAY_SIZE, uiBut::block, copy_v3_v3(), uiBut::custom_data, uiBlock::handle, ColorPicker::hsv_perceptual_slider, uiBlock::is_color_gamma_picker, uiPopupBlockHandle::menuretval, ptr, ColorPicker::rgb_perceptual_slider, RNA_property_float_get_array_at_most(), uiBut::rnapoin, uiBut::rnaprop, ui_color_picker_rgb_to_hsv(), ui_perceptual_to_scene_linear_space(), 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 288 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 580 of file interface_region_color_picker.cc.
References BLI_assert, BLT_I18NCONTEXT_COLOR, CTX_TIP_, uiBut::custom_data, uiButHSVCube::gradient_type, HsvCube, PICKER_BAR, PICKER_H, PICKER_SPACE, PICKER_TOTAL_W, ptr, TIP_, UI_but_func_set(), ui_colorpicker_rgba_update_cb(), UI_GRAD_HS, and uiDefButR_prop().
Referenced by ui_block_colorpicker().
|
static |
Definition at line 488 of file interface_region_color_picker.cc.
References ARRAY_SIZE, uiBut::block, uiBut::custom_data, ptr, RNA_property_float_get_array_at_most(), uiBut::rnapoin, uiBut::rnaprop, ui_colorpicker_hide_reveal(), ui_update_color_picker_buts_rgba(), and zero_v4().
Referenced by ui_block_colorpicker().
Definition at line 1044 of file interface_region_color_picker.cc.
References add(), BLI_rcti_isect_pt(), uiBlock::buttons, clamp_f(), uiBlock::handle, ColorPicker::hsv_perceptual, HsvCube, uiBlock::is_color_gamma_picker, ISMOUSE_WHEEL, uiPopupBlockHandle::menuretval, MOUSEPAN, uiPopupBlockHandle::region, wmEvent::type, 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_OK, UI_RETURN_UPDATE, UI_SCALE_FAC, ui_scene_linear_to_perceptual_space(), ui_update_color_picker_buts_rgba(), WHEELDOWNMOUSE, WHEELUPMOUSE, ARegion::winrct, WM_event_absolute_delta_y(), and wmEvent::xy.
Referenced by ui_block_func_COLOR().
|
static |
Definition at line 144 of file interface_region_color_picker.cc.
References IMB_colormanagement_color_picking_to_scene_linear_v3(), and ui_color_picker_rgb_round().
Referenced by ui_colorpicker_hsv_perceptual_slider_update_cb(), ui_colorpicker_rgb_perceptual_slider_update_cb(), ui_colorpicker_wheel_cb(), and ui_perceptual_to_scene_linear_space().
Definition at line 157 of file interface_region_color_picker.cc.
References ui_but_is_color_gamma(), and ui_perceptual_to_scene_linear_space().
Referenced by ui_draw_but_HSVCIRCLE(), ui_numedit_but_HSVCIRCLE(), and ui_numedit_but_HSVCUBE().
|
static |
Definition at line 439 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().
|
static |
Definition at line 133 of file interface_region_color_picker.cc.
References IMB_colormanagement_scene_linear_to_color_picking_v3(), and ui_color_picker_rgb_round().
Referenced by ui_color_picker_update_from_rgb_linear(), ui_colorpicker_wheel_cb(), and ui_scene_linear_to_perceptual_space().
Definition at line 152 of file interface_region_color_picker.cc.
References ui_but_is_color_gamma(), and ui_scene_linear_to_perceptual_space().
Referenced by 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 239 of file interface_region_color_picker.cc.
References uiBlock::buttons, col, copy_v4_v4(), ColorPicker::has_alpha, IMB_colormanagement_scene_linear_to_srgb_v3(), uiBlock::is_color_gamma_picker, rgba_float_to_uchar(), SNPRINTF_UTF8_RLEN, Text, UI_but_flag_disable(), UI_BUT_UNDO, ui_but_update(), ui_but_v4_set(), ui_color_picker_rgb_round(), ui_color_picker_update_from_rgb_linear(), UNPACK3_EX, and UNPACK4_EX.
Referenced by ui_colorpicker_hex_rna_cb(), ui_colorpicker_hsv_linear_slider_update_cb(), ui_colorpicker_hsv_perceptual_slider_update_cb(), ui_colorpicker_rgb_perceptual_slider_update_cb(), ui_colorpicker_rgba_update_cb(), ui_colorpicker_update_type_space_cb(), and ui_colorpicker_wheel_cb().
|
static |
Definition at line 48 of file interface_region_color_picker.cc.
Referenced by ui_block_colorpicker(), ui_color_picker_update_from_rgb_linear(), and ui_colorpicker_hide_reveal().
|
static |
Definition at line 47 of file interface_region_color_picker.cc.
Referenced by ui_block_colorpicker(), ui_color_picker_update_from_rgb_linear(), and ui_colorpicker_hide_reveal().