[Bf-blender-cvs] [e910765ad04] blender2.8: WM: Use tool-system for setting brushes

Campbell Barton noreply at git.blender.org
Thu May 31 09:07:24 CEST 2018


Commit: e910765ad044084ba65a5b8f158a6b1c307fbb6f
Author: Campbell Barton
Date:   Thu May 31 09:04:15 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe910765ad044084ba65a5b8f158a6b1c307fbb6f

WM: Use tool-system for setting brushes

This sets the tool instead of the brush, with cycling support.

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

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

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

diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 42bcf3b63ea..f56ef32ba72 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -47,6 +47,7 @@
 
 #include "WM_api.h"
 #include "WM_types.h"
+#include "WM_toolsystem.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -452,9 +453,23 @@ static int brush_select_exec(bContext *C, wmOperator *op)
 			return OPERATOR_CANCELLED;
 	}
 
-	return brush_generic_tool_set(bmain, paint, tool, tool_offset,
-	                              paint_mode, tool_name, create_missing,
-	                              toggle);
+	/* TODO(campbell): Use the toolsystem for now, ideally the toolsystem will display brushes directly
+	 * so we don't need to sync between tools and brushes. */
+	if (false) {
+		return brush_generic_tool_set(
+		            bmain, paint, tool, tool_offset,
+		            paint_mode, tool_name, create_missing,
+		            toggle);
+	}
+	else {
+		WorkSpace *workspace = CTX_wm_workspace(C);
+		if (WM_toolsystem_ref_set_by_name(C, workspace, NULL, tool_name, true)) {
+			return OPERATOR_FINISHED;
+		}
+		else {
+			return OPERATOR_CANCELLED;
+		}
+	}
 }
 
 static void PAINT_OT_brush_select(wmOperatorType *ot)



More information about the Bf-blender-cvs mailing list