diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-02 01:10:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-02 11:40:39 +0300 |
commit | ac8d7873278c47e8e282b7f83888108e2720a451 (patch) | |
tree | 902a404882e4ab22b8d7a153fbfc2e306747b083 /source/blender/editors/gpencil | |
parent | 5bd3f3e64b7eba34e6c1676b82eec5b3c7d49d97 (diff) |
Tool System: brushes are now categorized by tool
The toolbar now shows brush types, the brush selector now
only shows brushes matching the current tool type.
Details:
- Add's Paint.tool_slots (used by the toolbar).
- Removed custom grease pencil brush tool code.
- Bumped subversion.
See T57526 for details.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_ops.c | 6 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 14 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_utils.c | 6 |
3 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index ed3eab7b642..d9a233b78d8 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -134,7 +134,7 @@ static bool gp_stroke_paintmode_draw_poll(bContext *C) Brush *brush = BKE_brush_getactive_gpencil(ts); return ((gpd) && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush && brush->gpencil_settings) && - (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_DRAW)); + (brush->gpencil_tool == GPAINT_TOOL_DRAW)); } /* Poll callback for stroke painting (erase brush) */ @@ -146,7 +146,7 @@ static bool gp_stroke_paintmode_erase_poll(bContext *C) Brush *brush = BKE_brush_getactive_gpencil(ts); return ((gpd) && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush && brush->gpencil_settings) && - (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)); + (brush->gpencil_tool == GPAINT_TOOL_ERASE)); } /* Poll callback for stroke painting (fill) */ @@ -158,7 +158,7 @@ static bool gp_stroke_paintmode_fill_poll(bContext *C) Brush *brush = BKE_brush_getactive_gpencil(ts); return ((gpd) && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush && brush->gpencil_settings) && - (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_FILL)); + (brush->gpencil_tool == GPAINT_TOOL_FILL)); } /* Poll callback for stroke sculpting mode */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index e734542eb43..afd91d50e1f 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1546,10 +1546,10 @@ static void gp_stroke_doeraser(tGPsdata *p) float press = 1.0f; /* detect if use pressure in eraser */ - if (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE) { + if (brush->gpencil_tool == GPAINT_TOOL_ERASE) { use_pressure = (bool)(brush->gpencil_settings->flag & GP_BRUSH_USE_PRESSURE); } - else if ((eraser != NULL) & (eraser->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)) { + else if ((eraser != NULL) & (eraser->gpencil_tool == GPAINT_TOOL_ERASE)) { use_pressure = (bool)(eraser->gpencil_settings->flag & GP_BRUSH_USE_PRESSURE); } if (use_pressure) { @@ -1645,7 +1645,7 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts) Brush *brush_old = paint->brush; for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) { if ((brush->ob_mode == OB_MODE_GPENCIL_PAINT) && - (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)) + (brush->gpencil_tool == GPAINT_TOOL_ERASE)) { /* save first eraser to use later if no default */ if (brush_dft == NULL) { @@ -1668,7 +1668,7 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts) brush_dft->size = 30.0f; brush_dft->gpencil_settings->flag |= (GP_BRUSH_ENABLE_CURSOR | GP_BRUSH_DEFAULT_ERASER); brush_dft->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_SOFT; - brush_dft->gpencil_settings->brush_type = GP_BRUSH_TYPE_ERASE; + brush_dft->gpencil_tool = GPAINT_TOOL_ERASE; brush_dft->gpencil_settings->eraser_mode = GP_BRUSH_ERASER_SOFT; /* reset current brush */ @@ -1704,7 +1704,7 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p) /* assign to temp tGPsdata */ p->brush = brush; - if (brush->gpencil_settings->brush_type != GP_BRUSH_TYPE_ERASE) { + if (brush->gpencil_tool != GPAINT_TOOL_ERASE) { p->eraser = gp_get_default_eraser(p->bmain, ts); } else { @@ -2317,7 +2317,7 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event) /* if mode is draw and the brush is eraser, cancel */ if (paintmode != GP_PAINTMODE_ERASER) { - if ((brush) && (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)) { + if ((brush) && (brush->gpencil_tool == GPAINT_TOOL_ERASE)) { return 0; } } @@ -2358,7 +2358,7 @@ static void gpencil_draw_cursor_set(tGPsdata *p) { Brush *brush = p->brush; if ((p->paintmode == GP_PAINTMODE_ERASER) || - (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)) + (brush->gpencil_tool == GPAINT_TOOL_ERASE)) { WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */ } diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index fd7ce2d4139..5b8c11ac38c 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -1554,7 +1554,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata) } /* eraser has special shape and use a different shader program */ - if (paintbrush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE) { + if (paintbrush->gpencil_tool == GPAINT_TOOL_ERASE) { ED_gpencil_brush_draw_eraser(paintbrush, x, y); return; } @@ -1576,7 +1576,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata) if ((gp_style) && (GPENCIL_PAINT_MODE(gpd)) && ((paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) && ((paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) && - (paintbrush->gpencil_settings->brush_type == GP_BRUSH_TYPE_DRAW)) + (paintbrush->gpencil_tool == GPAINT_TOOL_DRAW)) { radius = 2.0f; copy_v3_v3(color, gp_style->stroke_rgba); @@ -1621,7 +1621,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata) if ((gp_style) && (GPENCIL_PAINT_MODE(gpd)) && ((paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) && ((paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) && - (paintbrush->gpencil_settings->brush_type == GP_BRUSH_TYPE_DRAW)) + (paintbrush->gpencil_tool == GPAINT_TOOL_DRAW)) { imm_draw_circle_fill_2d(pos, x, y, radius, 40); } |