WM: Use tool-system for setting brushes

This sets the tool instead of the brush, with cycling support.
This commit is contained in:
Campbell Barton 2018-05-31 09:04:15 +02:00
parent 81bf9a41e1
commit e910765ad0
1 changed files with 18 additions and 3 deletions

View File

@ -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)