Tool System: support non paint tools in paint mode

This is needed so non-paint-brush tools can be used in paint modes.
This commit is contained in:
Campbell Barton
2018-08-23 12:47:32 +10:00
parent 5203ebbaad
commit 99e6c41373

View File

@@ -1390,7 +1390,15 @@ bool paint_poll(bContext *C)
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
return p && ob && BKE_paint_brush(p) &&
(sa && ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) &&
(ar && ar->regiontype == RGN_TYPE_WINDOW);
if (p && ob && BKE_paint_brush(p) &&
(sa && ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) &&
(ar && ar->regiontype == RGN_TYPE_WINDOW))
{
/* Check the current tool is a brush. */
bToolRef *tref = sa->runtime.tool;
if (tref && tref->runtime && tref->runtime->data_block[0]) {
return true;
}
}
return false;
}