[Bf-blender-cvs] [c4dbe9448cb] greasepencil-object: New Eraser with Lasso select

Antonio Vazquez noreply at git.blender.org
Fri Dec 15 12:35:17 CET 2017


Commit: c4dbe9448cbe2f45494e120fb674a85a5f637151
Author: Antonio Vazquez
Date:   Fri Dec 15 12:31:13 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc4dbe9448cbe2f45494e120fb674a85a5f637151

New Eraser with Lasso select

When you are in paint mode, if press Ctrl+Alt and select with lasso tool, the points are removed.

This is a request of the Hero team after been working in cleanup process. The Lasso delete allows to remove very fast areas of the drawing.

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

M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/gpencil/gpencil_intern.h
M	source/blender/editors/gpencil/gpencil_select.c

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

diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 02cfbddb040..34fab119640 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1812,7 +1812,6 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
 	BLI_freelinkN(&gpf->strokes, gps);
 }
 
-
 /* Split selected strokes into segments, splitting on selected points */
 static int gp_delete_selected_points(bContext *C)
 {
@@ -1871,6 +1870,12 @@ static int gp_delete_selected_points(bContext *C)
 	}
 }
 
+/* simple wrapper to external call */
+int gp_delete_selected_point_wrap(bContext *C)
+{
+	return gp_delete_selected_points(C);
+}
+
 /* ----------------------------------- */
 
 static int gp_delete_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index e5b3ea2117b..5a84b97b88c 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -113,7 +113,7 @@ struct GHash *gp_copybuf_validate_colormap(struct bContext *C);
 /* Stroke Editing ------------------------------------ */
 
 void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke, int tag_flags);
-
+int gp_delete_selected_point_wrap(bContext *C);
 
 bool gp_smooth_stroke(bGPDstroke *gps, int i, float inf, bool affect_pressure);
 bool gp_smooth_stroke_strength(bGPDstroke *gps, int i, float inf);
diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c
index 1b757ec2401..fcfb485e586 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -1061,15 +1061,10 @@ void GPENCIL_OT_select_border(wmOperatorType *ot)
 static int gpencil_lasso_select_exec(bContext *C, wmOperator *op)
 {
 	bGPdata *gpd = ED_gpencil_data_get_active(C);
-	/* if not edit/sculpt mode, the event is catched but not processed */
-	if (GPENCIL_NONE_EDIT_MODE(gpd)) {
-		return OPERATOR_CANCELLED;
-	}
-
 	GP_SpaceConversion gsc = {NULL};
 	rcti rect = {0};
 	
-	const bool extend = RNA_boolean_get(op->ptr, "extend");
+	const bool extend = RNA_boolean_get(op->ptr, "extend") && ((gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0);
 	const bool select = !RNA_boolean_get(op->ptr, "deselect");
 		
 	int mcords_tot;
@@ -1139,6 +1134,13 @@ static int gpencil_lasso_select_exec(bContext *C, wmOperator *op)
 	/* cleanup */
 	MEM_freeN((void *)mcords);
 	
+	/* if paint mode,delete selected points */
+	if (gpd->flag & GP_DATA_STROKE_PAINTMODE) {
+		gp_delete_selected_point_wrap(C);
+		changed = true;
+		BKE_gpencil_batch_cache_dirty(gpd);
+	}
+
 	/* updates */
 	if (changed) {
 		WM_event_add_notifier(C, NC_GPENCIL | NA_SELECTED, NULL);



More information about the Bf-blender-cvs mailing list