[Bf-blender-cvs] [f6ecefa6750] greasepencil-object: GP: Make C key works only with curves

Antonioya noreply at git.blender.org
Sat Dec 15 16:38:20 CET 2018


Commit: f6ecefa6750b0b5cb9ba88acec5fb49b6d873e4a
Author: Antonioya
Date:   Sat Dec 15 16:35:02 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBf6ecefa6750b0b5cb9ba88acec5fb49b6d873e4a

GP: Make C key works only with curves

If we enable this key in Arc it looks the curve and Arc and the same tool, but they are different, so to change the tool use toolbar not a keymap.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 698a1ef06bd..e2cbeda2733 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -155,6 +155,7 @@ typedef struct tGPDprimitive {
 	struct bGPDlayer *gpl;            /* layer */
 	struct bGPDframe *gpf;            /* frame */
 	int type;                         /* type of primitive */
+	int orign_type;                   /* original type of primitive */
 	bool curve;                       /* type of primitive is a curve */
 	short flip;                       /* flip option */
 	tGPspoint *points;                /* array of data-points for stroke */
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 6a042528f1e..db94b62131a 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -1015,6 +1015,9 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
 	tgpi->depsgraph = CTX_data_depsgraph(C);
 	tgpi->win = CTX_wm_window(C);
 
+	/* save original type */
+	tgpi->orign_type = RNA_enum_get(op->ptr, "type");
+
 	/* set current frame number */
 	tgpi->cframe = cfra_eval;
 
@@ -1420,7 +1423,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e
 		case CKEY: /* curve mode */
 		{
 			if ((event->val == KM_PRESS) &&
-				!ELEM(tgpi->type, GP_STROKE_LINE, GP_STROKE_BOX, GP_STROKE_CIRCLE))
+				(tgpi->orign_type == GP_STROKE_CURVE))
 			{
 				switch (tgpi->type) {
 					case GP_STROKE_CURVE:



More information about the Bf-blender-cvs mailing list