GPv3: Sample color #116235

Merged
Falk David merged 1 commits from casey-bianco-davis/blender:GPv3-sample-color into main 2024-01-12 11:12:06 +01:00
3 changed files with 9 additions and 1 deletions

View File

@ -4586,6 +4586,8 @@ def km_grease_pencil_paint(_params):
# Show/hide
*_template_items_hide_reveal_actions("grease_pencil.layer_hide", "grease_pencil.layer_reveal"),
("paint.sample_color", {"type": 'X', "value": 'PRESS', "shift": True}, None),
])
return keymap

View File

@ -2179,6 +2179,10 @@ class VIEW3D_MT_paint_grease_pencil(Menu):
layout.menu("VIEW3D_MT_edit_greasepencil_showhide")
layout.separator()
layout.operator("paint.sample_color")
class VIEW3D_MT_paint_gpencil(Menu):
bl_label = "Paint"

View File

@ -52,6 +52,7 @@
#include "UI_interface.hh"
#include "UI_view2d.hh"
#include "ED_grease_pencil.hh"
#include "ED_image.hh"
#include "ED_object.hh"
#include "ED_paint.hh"
@ -760,7 +761,8 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
static bool sample_color_poll(bContext *C)
{
return (image_paint_poll_ignore_tool(C) || vertex_paint_poll_ignore_tool(C));
return (image_paint_poll_ignore_tool(C) || vertex_paint_poll_ignore_tool(C) ||
blender::ed::greasepencil::grease_pencil_painting_poll(C));
}
void PAINT_OT_sample_color(wmOperatorType *ot)