[Bf-blender-cvs] [ead5d92] GPencil_Editing_Stage3: GP Editing: Expose the copy-paste buffer within the GPencil module, so more ops can use it

Joshua Leung noreply at git.blender.org
Fri Oct 16 16:06:42 CEST 2015


Commit: ead5d9267300ae89a0d8ec0b67e1cca50cd068b6
Author: Joshua Leung
Date:   Fri Oct 16 14:31:00 2015 +1300
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rBead5d9267300ae89a0d8ec0b67e1cca50cd068b6

GP Editing: Expose the copy-paste buffer within the GPencil module, so more ops can use it

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 84c90db..32c6cb2 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -309,7 +309,8 @@ void GPENCIL_OT_duplicate(wmOperatorType *ot)
  */
 
 /* list of bGPDstroke instances */
-static ListBase gp_strokes_copypastebuf = {NULL, NULL};
+/* NOTE: is exposed within the editors/gpencil module so that other tools can use it too */
+ListBase gp_strokes_copypastebuf = {NULL, NULL};
 
 /* Free copy/paste buffer data */
 void ED_gpencil_strokes_copybuf_free(void)
@@ -415,7 +416,7 @@ 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 (gp_strokes_copypastebuf.first == NULL) {
+	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;
 	}
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index df182db..fdebea3 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -113,6 +113,11 @@ bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, struct Scene *scene, const float
 int gp_add_poll(struct bContext *C);
 int gp_active_layer_poll(struct bContext *C);
 
+/* Copy/Paste Buffer --------------------------------- */
+/* gpencil_edit.c */
+
+extern ListBase gp_strokes_copypastebuf;
+
 /* ***************************************************** */
 /* Operator Defines */




More information about the Bf-blender-cvs mailing list