[Bf-blender-cvs] [645b1463957] greasepencil-object: Avoid some operators in multiframe edit mode

Antonio Vazquez noreply at git.blender.org
Wed Nov 29 12:22:37 CET 2017


Commit: 645b146395746b961348e424cf4f4fa91bfb2ae7
Author: Antonio Vazquez
Date:   Wed Nov 29 12:22:28 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB645b146395746b961348e424cf4f4fa91bfb2ae7

Avoid some operators in multiframe edit mode

As initial idea is better to keep limited to single edit mode, but maybe in the future we can enable it.

The reason to limit them is because in some situations the artist can get confused with the edition he did if multiframe is activated and could consider the operation as a bug when really was working as expected.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 01117101221..3c47d89b1a7 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -645,11 +645,16 @@ static void gp_duplicate_points(const bGPDstroke *gps, ListBase *new_strokes, co
 static int gp_duplicate_exec(bContext *C, wmOperator *op)
 {
 	bGPdata *gpd = ED_gpencil_data_get_active(C);
-	
+
 	if (gpd == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
 		return OPERATOR_CANCELLED;
 	}
+
+	if (GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)) {
+		BKE_report(op->reports, RPT_ERROR, "Operator not supported in multiframe edition");
+		return OPERATOR_CANCELLED;
+	}
 	
 	/* for each visible (and editable) layer's selected strokes,
 	 * copy the strokes into a temporary buffer, then append
@@ -832,7 +837,12 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op)
 		BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
 		return OPERATOR_CANCELLED;
 	}
-	
+
+	if (GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)) {
+		BKE_report(op->reports, RPT_ERROR, "Operator not supported in multiframe edition");
+		return OPERATOR_CANCELLED;
+	}
+
 	/* clear the buffer first */
 	ED_gpencil_strokes_copybuf_free();
 	
@@ -954,6 +964,10 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
 		BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
 		return OPERATOR_CANCELLED;
 	}
+	else if (GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)) {
+		BKE_report(op->reports, RPT_ERROR, "Operator not supported in multiframe edition");
+		return OPERATOR_CANCELLED;
+	}
 	else if (BLI_listbase_is_empty(&gp_strokes_copypastebuf)) {
 		BKE_report(op->reports, RPT_ERROR, "No strokes to paste, select and copy some points before trying again");
 		return OPERATOR_CANCELLED;
@@ -1109,7 +1123,12 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
 	bGPDlayer *target_layer = NULL;
 	ListBase strokes = {NULL, NULL};
 	int layer_num = RNA_enum_get(op->ptr, "layer");
-	
+
+	if (GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)) {
+		BKE_report(op->reports, RPT_ERROR, "Operator not supported in multiframe edition");
+		return OPERATOR_CANCELLED;
+	}
+
 	/* Get layer or create new one */
 	if (layer_num == -1) {
 		/* Create layer */



More information about the Bf-blender-cvs mailing list