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_vertex.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_vertex.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index fc43fe97648..68e0f34a685 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -206,7 +206,7 @@ int vertex_paint_mode_poll(bContext *C)
return ob && ob->mode == OB_MODE_VERTEX_PAINT && ((Mesh *)ob->data)->totpoly;
}
-int vertex_paint_poll(bContext *C)
+static int vertex_paint_poll_ex(bContext *C, bool check_tool)
{
if (vertex_paint_mode_poll(C) &&
BKE_paint_brush(&CTX_data_tool_settings(C)->vpaint->paint))
@@ -215,7 +215,7 @@ int vertex_paint_poll(bContext *C)
if (sa && sa->spacetype == SPACE_VIEW3D) {
ARegion *ar = CTX_wm_region(C);
if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (WM_toolsystem_active_tool_is_brush(C)) {
+ if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) {
return 1;
}
}
@@ -224,6 +224,16 @@ int vertex_paint_poll(bContext *C)
return 0;
}
+int vertex_paint_poll(bContext *C)
+{
+ return vertex_paint_poll_ex(C, true);
+}
+
+int vertex_paint_poll_ignore_tool(bContext *C)
+{
+ return vertex_paint_poll_ex(C, true);
+}
+
int weight_paint_mode_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
@@ -231,7 +241,7 @@ int weight_paint_mode_poll(bContext *C)
return ob && ob->mode == OB_MODE_WEIGHT_PAINT && ((Mesh *)ob->data)->totpoly;
}
-int weight_paint_poll(bContext *C)
+static int weight_paint_poll_ex(bContext *C, bool check_tool)
{
Object *ob = CTX_data_active_object(C);
ScrArea *sa;
@@ -244,7 +254,7 @@ int weight_paint_poll(bContext *C)
{
ARegion *ar = CTX_wm_region(C);
if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (WM_toolsystem_active_tool_is_brush(C)) {
+ if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) {
return 1;
}
}
@@ -252,6 +262,16 @@ int weight_paint_poll(bContext *C)
return 0;
}
+int weight_paint_poll(bContext *C)
+{
+ return weight_paint_poll_ex(C, true);
+}
+
+int weight_paint_poll_ignore_tool(bContext *C)
+{
+ return weight_paint_poll_ex(C, false);
+}
+
static VPaint *new_vpaint(void)
{
VPaint *vp = MEM_callocN(sizeof(VPaint), "VPaint");