[Bf-blender-cvs] [2dff0c99c08] blender2.8: Fix T56686: Crash when copy and paste Annotations

Antonioya noreply at git.blender.org
Tue Sep 4 17:16:47 CEST 2018


Commit: 2dff0c99c08cae80baa14f7f4b1e5d443765e273
Author: Antonioya
Date:   Tue Sep 4 17:16:14 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB2dff0c99c08cae80baa14f7f4b1e5d443765e273

Fix T56686: Crash when copy and paste Annotations

Annotations are not designed to edit, copy or paste, so the operators must be disabled.

By design annotations can only be added or deleted, but not edited.

Still pending clean the pie menus, but this will be done during UI cleanup.

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

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 b9832cd6b04..48fd5736a13 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -96,11 +96,17 @@
   /* Stroke Edit Mode Management */
 static bool gpencil_editmode_toggle_poll(bContext *C)
 {
-	/* if using gpencil object, use this gpd */
+	/* edit only supported with grease pencil objects */
 	Object *ob = CTX_data_active_object(C);
-	if ((ob) && (ob->type == OB_GPENCIL)) {
+	if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+		return false;
+	}
+
+	/* if using gpencil object, use this gpd */
+	if (ob->type == OB_GPENCIL) {
 		return ob->data != NULL;
 	}
+
 	return ED_gpencil_data_get_active(C) != NULL;
 }
 
@@ -434,6 +440,12 @@ void GPENCIL_OT_weightmode_toggle(wmOperatorType *ot)
 /* poll callback for all stroke editing operators */
 static bool gp_stroke_edit_poll(bContext *C)
 {
+	/* edit only supported with grease pencil objects */
+	Object *ob = CTX_data_active_object(C);
+	if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+		return false;
+	}
+
 	/* NOTE: this is a bit slower, but is the most accurate... */
 	return CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0;
 }
@@ -441,6 +453,13 @@ static bool gp_stroke_edit_poll(bContext *C)
 /* poll callback to verify edit mode in 3D view only */
 static bool gp_strokes_edit3d_poll(bContext *C)
 {
+	/* edit only supported with grease pencil objects */
+	Object *ob = CTX_data_active_object(C);
+	if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+		return false;
+	}
+
+
 	/* 2 Requirements:
 	 * - 1) Editable GP data
 	 * - 2) 3D View only



More information about the Bf-blender-cvs mailing list