diff --git a/scripts/presets/keyconfig/keymap_data/blender_default.py b/scripts/presets/keyconfig/keymap_data/blender_default.py index 201e99f3f45..fbfb64d0eb0 100644 --- a/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -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 diff --git a/scripts/startup/bl_ui/space_view3d.py b/scripts/startup/bl_ui/space_view3d.py index dd7b4942218..31b18250be4 100644 --- a/scripts/startup/bl_ui/space_view3d.py +++ b/scripts/startup/bl_ui/space_view3d.py @@ -2180,6 +2180,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" diff --git a/source/blender/editors/sculpt_paint/paint_image.cc b/source/blender/editors/sculpt_paint/paint_image.cc index 8e776d23a33..cf6073d725b 100644 --- a/source/blender/editors/sculpt_paint/paint_image.cc +++ b/source/blender/editors/sculpt_paint/paint_image.cc @@ -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" @@ -761,7 +762,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)