[Bf-blender-cvs] [b83cf9d340c] blender2.8: GP: Enable Smooth Sculpt brush when press Shift key

Antonioya noreply at git.blender.org
Tue Dec 4 22:35:47 CET 2018


Commit: b83cf9d340c54ec3cd5e2cde98d6dfb0e739c4bf
Author: Antonioya
Date:   Tue Dec 4 22:34:50 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBb83cf9d340c54ec3cd5e2cde98d6dfb0e739c4bf

GP: Enable Smooth Sculpt brush when press Shift key

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

M	source/blender/editors/gpencil/gpencil_brush.c

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

diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index d73b39811ce..e6ceac0ef8d 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -109,8 +109,10 @@ typedef struct tGP_BrushEditData {
 	/* Brush Settings */
 	GP_Sculpt_Settings *settings;
 	GP_Sculpt_Data *gp_brush;
+	GP_Sculpt_Data *gp_brush_old;
 
 	eGP_Sculpt_Types brush_type;
+	eGP_Sculpt_Types brush_type_old;
 	eGP_Sculpt_Flag  flag;
 
 	/* Space Conversion Data */
@@ -119,6 +121,7 @@ typedef struct tGP_BrushEditData {
 
 	/* Is the brush currently painting? */
 	bool is_painting;
+	bool is_weight_mode;
 
 	/* Start of new sculpt stroke */
 	bool first;
@@ -1203,6 +1206,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
 	/* store state */
 	gso->settings = gpsculpt_get_settings(scene);
 	gso->gp_brush = gpsculpt_get_brush(scene, is_weight_mode);
+	gso->is_weight_mode = is_weight_mode;
 
 	if (is_weight_mode) {
 		gso->brush_type = gso->settings->weighttype;
@@ -1769,6 +1773,8 @@ static void gpsculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *itempt
 static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	tGP_BrushEditData *gso = op->customdata;
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	GP_Sculpt_Settings *gset = &ts->gp_sculpt;
 	PointerRNA itemptr;
 	float mouse[2];
 	int tablet = 0;
@@ -1802,6 +1808,22 @@ static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEven
 		RNA_float_set(&itemptr, "pressure", 1.0f);
 	}
 
+	if (!gso->is_weight_mode) {
+		if (event->shift) {
+			gso->gp_brush_old = gso->gp_brush;
+			gso->brush_type_old = gso->brush_type;
+
+			gso->gp_brush = &gset->brush[GP_SCULPT_TYPE_SMOOTH];
+			gso->brush_type = GP_SCULPT_TYPE_SMOOTH;
+		}
+		else {
+			if (gso->gp_brush_old != NULL) {
+				gso->gp_brush = gso->gp_brush_old;
+				gso->brush_type = gso->brush_type_old;
+			}
+		}
+	}
+
 	/* apply */
 	gpsculpt_brush_apply(C, op, &itemptr);
 }



More information about the Bf-blender-cvs mailing list