85 header +=
IFACE_(
"Current: ");
87 const bool is_ctrl = (
event->modifier &
KM_CTRL) != 0;
88 const bool is_shift = (
event->modifier &
KM_SHIFT) != 0;
93 if (is_ctrl && !is_shift) {
96 if (is_shift && !is_ctrl) {
99 if (is_ctrl && is_shift) {
105 header +=
IFACE_(
"Stroke");
118 header +=
IFACE_(
", Ctrl: Stroke, Shift: Fill, Shift+Ctrl: Both");
130 const char *display_device;
131 display_device = scene->display_settings.display_device;
147 MEM_delete<EyedropperGreasePencil>(eye);
164 for (
short i = 0; i < *totcol; i++) {
171 if (gp_style !=
nullptr) {
221 gp_style_new->
flag &= ~GP_MATERIAL_FILL_SHOW;
228 gp_style_new->
flag &= ~GP_MATERIAL_STROKE_SHOW;
255 if (paint->
palette ==
nullptr) {
261 if (vertexpaint->
palette ==
nullptr) {
291 if (brush ==
nullptr) {
304 const bool is_ctrl = (
event->modifier &
KM_CTRL) != 0;
305 const bool is_shift = (
event->modifier &
KM_SHIFT) != 0;
308 if (is_ctrl && !is_shift) {
311 if (is_shift && !is_ctrl) {
314 if (is_ctrl && is_shift) {
370 switch (event->
type) {
372 switch (event->
val) {
463 {
int(EyeMode::Material),
"MATERIAL", 0,
"Material",
""},
464 {
int(EyeMode::Palette),
"PALETTE", 0,
"Palette",
""},
465 {
int(EyeMode::Brush),
"BRUSH", 0,
"Brush",
""},
466 {0,
nullptr, 0,
nullptr,
nullptr},
470 {
int(MaterialMode::Stroke),
"STROKE", 0,
"Stroke",
""},
471 {
int(MaterialMode::Fill),
"FILL", 0,
"Fill",
""},
472 {
int(MaterialMode::Both),
"BOTH", 0,
"Both",
""},
473 {0,
nullptr, 0,
nullptr,
nullptr},
477 ot->
name =
"Grease Pencil Eyedropper";
478 ot->
idname =
"UI_OT_eyedropper_grease_pencil_color";
479 ot->
description =
"Sample a color from the Blender Window and create Grease Pencil material";
482 ot->
invoke = eyedropper_grease_pencil_invoke;
483 ot->
modal = eyedropper_grease_pencil_modal;
484 ot->
cancel = eyedropper_grease_pencil_cancel;
485 ot->
exec = eyedropper_grease_pencil_exec;
486 ot->
poll = eyedropper_grease_pencil_poll;
496 int(MaterialMode::Stroke),
void BKE_brush_tag_unsaved_changes(Brush *brush)
wmWindow * CTX_wm_window(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
Low-level operations for grease pencil.
Material * BKE_grease_pencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index)
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
short * BKE_object_material_len_p(struct Object *ob)
PaletteColor * BKE_palette_color_add(Palette *palette)
Palette * BKE_palette_add(Main *bmain, const char *name)
Brush * BKE_paint_brush(Paint *paint)
void BKE_paint_palette_set(Paint *paint, Palette *palette)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v4(float r[4])
MINLINE bool compare_v3v3(const float v1[3], const float v2[3], float limit) ATTR_WARN_UNUSED_RESULT
void DEG_relations_tag_update(Main *bmain)
@ GP_MATERIAL_STROKE_SHOW
void ED_workspace_status_text(bContext *C, const char *str)
void ED_undo_push(bContext *C, const char *str)
ColorManagedDisplay * IMB_colormanagement_display_get_named(const char *name)
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], ColorManagedDisplay *display)
Read Guarded memory(de)allocation.
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void eyedropper_color_sample_fl(bContext *C, Eyedropper *eye, const int event_xy[2], float r_col[3])
void UI_OT_eyedropper_grease_pencil_color(wmOperatorType *ot)
@ EYE_MODAL_SAMPLE_CONFIRM
static int eyedropper_grease_pencil_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int eyedropper_grease_pencil_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool eyedropper_grease_pencil_poll(bContext *C)
static void eyedropper_add_palette_color(bContext *C, const float3 col_conv)
static void eyedropper_set_brush_color(bContext *C, const float3 &col_conv)
static void eyedropper_grease_pencil_color_sample(bContext *C, EyedropperGreasePencil *eye, const int m_xy[2])
static void eyedropper_grease_pencil_exit(bContext *C, wmOperator *op)
static bool eyedropper_grease_pencil_init(bContext *C, wmOperator *op)
static void eyedropper_grease_pencil_status_indicators(bContext *C, wmOperator *op, const wmEvent *event)
static void eyedropper_grease_pencil_cancel(bContext *C, wmOperator *op)
static void eyedropper_add_material(bContext *C, const float3 col_conv, const MaterialMode mat_mode)
static void eyedropper_grease_pencil_color_set(bContext *C, const wmEvent *event, EyedropperGreasePencil *eye)
static int eyedropper_grease_pencil_exec(bContext *C, wmOperator *op)
VecBase< float, 3 > float3
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
struct MaterialGPencilStyle * gp_style
ColorManagedDisplay * display
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(* cancel)(bContext *C, wmOperator *op)
void WM_main_add_notifier(uint type, void *reference)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)