Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-05-01 12:42:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-01 12:42:25 +0300
commit70d352d994d0f8187ad2c871ee22712b1bf4b855 (patch)
tree85b0e430b9eeae5fb6c6ded78f54da236108652d /source/blender/editors/sculpt_paint/paint_image.c
parent2c9670b92d32e79d0f071475731bcaf79aae42f5 (diff)
Tool System: add paint poll which ignores the tool
Needed for tools which ensure paint context but aren't brushes (color sample & gradient).
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 06df1632593..3207b4f6a0a 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -264,7 +264,7 @@ static Brush *image_paint_brush(bContext *C)
return BKE_paint_brush(&settings->imapaint.paint);
}
-static int image_paint_poll(bContext *C)
+static int image_paint_poll_ex(bContext *C, bool check_tool)
{
Object *obact;
@@ -273,7 +273,7 @@ static int image_paint_poll(bContext *C)
obact = CTX_data_active_object(C);
if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) {
- if (WM_toolsystem_active_tool_is_brush(C)) {
+ if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) {
return 1;
}
}
@@ -292,6 +292,16 @@ static int image_paint_poll(bContext *C)
return 0;
}
+static int image_paint_poll(bContext *C)
+{
+ return image_paint_poll_ex(C, true);
+}
+
+static int image_paint_poll_ignore_tool(bContext *C)
+{
+ return image_paint_poll_ex(C, false);
+}
+
static int image_paint_2d_clone_poll(bContext *C)
{
Brush *brush = image_paint_brush(C);
@@ -1001,7 +1011,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int sample_color_poll(bContext *C)
{
- return (image_paint_poll(C) || vertex_paint_poll(C));
+ return (image_paint_poll_ignore_tool(C) || image_paint_poll_ignore_tool(C));
}
void PAINT_OT_sample_color(wmOperatorType *ot)