[Bf-blender-cvs] [a273e432ccb] blender2.8: GP: Add pressure button for eraser brushes

Antonioya noreply at git.blender.org
Thu Sep 13 16:52:38 CEST 2018


Commit: a273e432ccbb510c5dea26f16df61cfc9c747008
Author: Antonioya
Date:   Thu Sep 13 16:52:27 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBa273e432ccbb510c5dea26f16df61cfc9c747008

GP: Add pressure button for eraser brushes

===================================================================

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/editors/gpencil/gpencil_paint.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 9bb2193ea1a..e1f9abfdae7 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1419,9 +1419,11 @@ class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
 
             # Brush details
             if gp_settings.gpencil_brush_type == 'ERASE':
-                col = layout.column(align=True)
-                col.prop(brush, "size", text="Radius")
+                row = layout.row(align=True)
+                row.prop(brush, "size", text="Radius")
+                row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
 
+                col = layout.column(align=True)
                 col.separator()
                 row = col.row()
                 row.prop(gp_settings, "eraser_mode", expand=True)
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index f65ae8806b4..16c085f1fdb 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1299,6 +1299,7 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p, const bGPDspoint *pt, cons
 /* apply a falloff effect to brush strength, based on distance */
 static float gp_stroke_eraser_calc_influence(tGPsdata *p, const int mval[2], const int radius, const int co[2])
 {
+	Brush *brush = p->brush;
 	/* Linear Falloff... */
 	float distance = (float)len_v2v2_int(mval, co);
 	float fac;
@@ -1307,7 +1308,9 @@ static float gp_stroke_eraser_calc_influence(tGPsdata *p, const int mval[2], con
 	fac = 1.0f - (distance / (float)radius);
 
 	/* Control this further using pen pressure */
-	fac *= p->pressure;
+	if (brush->gpencil_settings->flag & GP_BRUSH_USE_PRESSURE) {
+		fac *= p->pressure;
+	}
 
 	/* Return influence factor computed here */
 	return fac;



More information about the Bf-blender-cvs mailing list