[Bf-blender-cvs] [bdd290cb810] greasepencil-object: Modify mode set routine to enable grease pencil modes

Antonio Vazquez noreply at git.blender.org
Wed May 30 16:00:13 CEST 2018


Commit: bdd290cb81042bc865ea0324197cb7204dd1d075
Author: Antonio Vazquez
Date:   Wed May 30 16:00:04 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBbdd290cb81042bc865ea0324197cb7204dd1d075

Modify mode set routine to enable grease pencil modes

Now, when you press the numeric key to change mode, if the object is grease pencil, the grease pencil mode is enabled.

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

M	source/blender/editors/object/object_edit.c
M	source/blender/editors/object/object_ops.c

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

diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 45684d8763f..9ecdee32e70 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1369,6 +1369,23 @@ static int object_mode_set_exec(bContext *C, wmOperator *op)
 					mode = OB_MODE_POSE;
 				}
 			}
+			/* grease pencil modes that reuse the same modes but only
+			 * for grease pencil objects
+			 */
+			if (ob->type == OB_GPENCIL) {
+				if (mode == OB_MODE_EDIT) {
+					mode = OB_MODE_GPENCIL_EDIT;
+				}
+				if (mode == OB_MODE_SCULPT) {
+					mode = OB_MODE_GPENCIL_SCULPT;
+				}
+				if (mode == OB_MODE_VERTEX_PAINT) {
+					mode = OB_MODE_GPENCIL_PAINT;
+				}
+				if (mode == OB_MODE_WEIGHT_PAINT) {
+					mode = OB_MODE_GPENCIL_WEIGHT;
+				}
+			}
 		}
 
 		if (toggle == false) {
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 83acf567d4a..9c475bfe77c 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -294,11 +294,11 @@ void ED_keymap_object(wmKeyConfig *keyconf)
 		short key_mode_pair[][2] = {
 			{ACCENTGRAVEKEY, OB_MODE_OBJECT},
 			{ONEKEY, OB_MODE_OBJECT},
-			{TWOKEY, OB_MODE_EDIT},
-			{THREEKEY, OB_MODE_SCULPT},
+			{TWOKEY, OB_MODE_EDIT},            /* or OB_MODE_GPENCIL_EDIT */
+			{THREEKEY, OB_MODE_SCULPT},        /* or OB_MODE_GPENCIL_SCULPT */
 			{FOURKEY, OB_MODE_TEXTURE_PAINT},  /* or OB_MODE_POSE */
-			{FIVEKEY, OB_MODE_VERTEX_PAINT},
-			{SIXKEY, OB_MODE_WEIGHT_PAINT},
+			{FIVEKEY, OB_MODE_VERTEX_PAINT},   /* or OB_MODE_GPENCIL_PAINT */
+			{SIXKEY, OB_MODE_WEIGHT_PAINT},    /* or OB_MODE_GPENCIL_WEIGHT */
 			{SEVENKEY, OB_MODE_PARTICLE_EDIT},
 		};



More information about the Bf-blender-cvs mailing list