[Bf-blender-cvs] [99e6c413738] blender2.8: Tool System: support non paint tools in paint mode

Campbell Barton noreply at git.blender.org
Thu Aug 23 04:52:35 CEST 2018


Commit: 99e6c413738ca001d501397ecf81081b4d23b347
Author: Campbell Barton
Date:   Thu Aug 23 12:47:32 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB99e6c413738ca001d501397ecf81081b4d23b347

Tool System: support non paint tools in paint mode

This is needed so non-paint-brush tools can be used in paint modes.

===================================================================

M	source/blender/editors/sculpt_paint/paint_stroke.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index fc008213ae0..b5d68786664 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -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;
 }



More information about the Bf-blender-cvs mailing list