GPv3: Sample color

This adds the ability to use the `sample color` operator in GPv3

Pull Request: https://projects.blender.org/blender/blender/pulls/116235
This commit is contained in:
Casey Bianco-Davis
2024-01-12 11:11:55 +01:00
committed by Falk David
parent 13ed151e3d
commit 33b4964c0c
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

@@ -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"

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"
@@ -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)