Commit: 7a0ee16f25196e446b5960b3b61df9f68dfa3fc6 Author: Antonio Vazquez Date: Fri Mar 2 20:15:51 2018 +0100 Branches: greasepencil-object https://developer.blender.org/rB7a0ee16f25196e446b5960b3b61df9f68dfa3fc6
Change Eraser brush to use brush radius not global value The old configuration uses a global user prefs value, but now must be the brush size. Still need to fix the problem when resize size of the brush. =================================================================== M release/scripts/startup/bl_ui/space_view3d_toolbar.py M source/blender/blenkernel/intern/gpencil.c M source/blender/editors/gpencil/gpencil_paint.c M source/blender/editors/gpencil/gpencil_utils.c =================================================================== diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 840f82ad3be..775d2a7ccb1 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -2123,7 +2123,8 @@ class VIEW3D_PT_tools_grease_pencil_brush(Panel): if brush.type == 'ERASE': col = layout.column(align=True) - col.prop(context.user_preferences.edit, "grease_pencil_eraser_radius", text="Radius") + col.prop(brush, "line_width", text="Radius") + # col.prop(context.user_preferences.edit, "grease_pencil_eraser_radius", text="Radius") # TODO: Hard/Soft mode, sensitivity factors, etc. if brush.type != 'ERASE': diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index b0f546debff..754f9d559bf 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -780,25 +780,11 @@ void BKE_gpencil_brush_init_presets(ToolSettings *ts) /* Eraser brush */ brush = BKE_gpencil_brush_addnew(ts, "Erase", false); - brush->thickness = 1.0f; + brush->thickness = 30.0f; brush->flag |= GP_BRUSH_ENABLE_CURSOR; - brush->draw_sensitivity = 1.0f; - brush->fill_leak = 3; - brush->fill_threshold = 0.1f; - brush->fill_simplylvl = 1; brush->icon = GPBRUSH_ERASE; brush->type = GP_BRUSH_TYPE_ERASE; - brush->draw_smoothfac = 0.5f; - brush->draw_smoothlvl = 1; - brush->thick_smoothfac = 1.0f; - brush->thick_smoothlvl = 3; - brush->sublevel = 1; - - brush->lazy_radius = LAZY_RADIUS; - brush->lazy_factor = LAZY_FACTOR; - - brush->draw_strength = 1.0f; copy_v3_v3(brush->curcolor, curcolor); } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 87c07e77adc..3ae1c7bdf94 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1420,6 +1420,8 @@ static void gp_init_drawing_brush(ToolSettings *ts, tGPsdata *p) /* asign to temp tGPsdata */ p->brush = brush; + /* use radius as eraser */ + p->radius = (short)brush->thickness; } @@ -1695,11 +1697,13 @@ static tGPsdata *gp_session_initpaint(bContext *C, wmOperator *op) gp_session_initdata(C, op, p); +#if 0 /* radius for eraser circle is defined in userprefs now */ /* NOTE: we do this here, so that if we exit immediately, * erase size won't get lost */ p->radius = U.gp_eraser; +#endif /* return context data for running paint operator */ return p; diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index e400f229779..06002615564 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -1290,10 +1290,9 @@ static bool gp_check_cursor_region(bContext *C, int mval[2]) } /* draw eraser cursor */ -static void gp_brush_draw_eraser(bContext *C, int x, int y) +static void gp_brush_draw_eraser(bContext *C, bGPDbrush *brush, int x, int y) { - /* TODO: Change to brush thickness, no global value */ - short radius = U.gp_eraser; + short radius = (short)brush->thickness; Gwn_VertFormat *format = immVertexFormat(); const uint shdr_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); @@ -1389,7 +1388,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->type == GP_BRUSH_TYPE_ERASE) { - gp_brush_draw_eraser(C, x, y); + gp_brush_draw_eraser(C, paintbrush, x, y); return; } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs