diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-31 10:04:15 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-31 10:04:15 +0300 |
commit | e910765ad044084ba65a5b8f158a6b1c307fbb6f (patch) | |
tree | 578d29892a6af94c5557962ebe08ee88aa516eb7 /source/blender | |
parent | 81bf9a41e1d769a52b58836f20f2252f214b927d (diff) |
WM: Use tool-system for setting brushes
This sets the tool instead of the brush, with cycling support.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 21 |
1 files changed, 18 insertions, 3 deletions
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) |