From c58bf31aeddddc2cfa8ce84e00bf48e7a2f7c7b9 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Thu, 6 May 2021 16:46:36 +0200 Subject: GPencil: Add Bracket keymaps to increase/decrease brush size This add the missing keymaps. Requested by Jukien Kaspar. Differential Revision: https://developer.blender.org/D11183 --- source/blender/editors/sculpt_paint/paint_ops.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to '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 e1dc8fa30b9..fed89e02e8f 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -139,13 +139,14 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Paint *paint = BKE_paint_get_active_from_context(C); Brush *brush = BKE_paint_brush(paint); + const bool is_gpencil = (brush && brush->gpencil_settings != NULL); // Object *ob = CTX_data_active_object(C); float scalar = RNA_float_get(op->ptr, "scalar"); if (brush) { /* pixel radius */ { - const int old_size = BKE_brush_size_get(scene, brush); + const int old_size = (!is_gpencil) ? BKE_brush_size_get(scene, brush) : brush->size; int size = (int)(scalar * old_size); if (abs(old_size - size) < U.pixelsize) { @@ -156,6 +157,12 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op) size -= U.pixelsize; } } + /* Grease Pencil does not use unified size. */ + if (is_gpencil) { + brush->size = max_ii(size, 1); + WM_main_add_notifier(NC_BRUSH | NA_EDITED, brush); + return OPERATOR_FINISHED; + } BKE_brush_size_set(scene, brush, size); } -- cgit v1.2.3