[Bf-blender-cvs] [2c609f6175d] greasepencil-object: Fix: Don't allow Annotation tool to paint on GP Objects and vice versa

Joshua Leung noreply at git.blender.org
Tue Jul 10 07:22:11 CEST 2018


Commit: 2c609f6175db6df3b95aa6b1d958f3bd43d193bd
Author: Joshua Leung
Date:   Tue Jul 10 15:44:30 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB2c609f6175db6df3b95aa6b1d958f3bd43d193bd

Fix: Don't allow Annotation tool to paint on GP Objects and vice versa

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

M	source/blender/editors/gpencil/annotate_paint.c
M	source/blender/editors/gpencil/gpencil_paint.c

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

diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 393f33c2fcb..6958e0fe476 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1152,17 +1152,17 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
 		{
 			p->status = GP_STATUS_ERROR;
 			if (G.debug & G_DEBUG)
-				printf("Error: Active view not appropriate for Grease Pencil drawing\n");
+				printf("Error: Annotations are not supported in this editor\n");
 			return 0;
 		}
 	}
 
 	/* get gp-data */
 	gpd_ptr = ED_gpencil_data_get_pointers(C, &p->ownerPtr);
-	if (gpd_ptr == NULL) {
+	if ((gpd_ptr == NULL) || !ED_gpencil_data_owner_is_annotation(&p->ownerPtr)) {
 		p->status = GP_STATUS_ERROR;
 		if (G.debug & G_DEBUG)
-			printf("Error: Current context doesn't allow for any Grease Pencil data\n");
+			printf("Error: Current context doesn't allow for any Annotation data\n");
 		return 0;
 	}
 	else {
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index b9f048856d2..d12b3f5a732 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1695,7 +1695,7 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
 
 	/* get gp-data */
 	gpd_ptr = ED_gpencil_data_get_pointers(C, &p->ownerPtr);
-	if (gpd_ptr == NULL) {
+	if ((gpd_ptr == NULL) || ED_gpencil_data_owner_is_annotation(&p->ownerPtr)) {
 		p->status = GP_STATUS_ERROR;
 		if (G.debug & G_DEBUG)
 			printf("Error: Current context doesn't allow for any Grease Pencil data\n");



More information about the Bf-blender-cvs mailing list