[Bf-blender-cvs] [5ec0745e49d] greasepencil-object: Fix first edit mode change with TAB key

Antonioya noreply at git.blender.org
Sun Jul 29 16:13:27 CEST 2018


Commit: 5ec0745e49dd247db3cf13a53e7e20df44dfb458
Author: Antonioya
Date:   Sun Jul 29 16:13:19 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB5ec0745e49dd247db3cf13a53e7e20df44dfb458

Fix first edit mode change with TAB key

The operator assumed the object editable was using always OB_MODE_EDIT, but for grease pencil the mode must be OB_MODE_GPENCIL_EDIT

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

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

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

diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 43e745b23c5..48048319cb7 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1613,26 +1613,10 @@ static int object_mode_set_exec(bContext *C, wmOperator *op)
 		}
 	}
 
-#if 0 /* GPXX */
-	if (gpd) {
-		/* GP Mode is not bound to a specific object. Therefore,
-		 * we don't want it to be actually saved on any objects,
-		 * as weirdness can happen if you select other objects,
-		 * or load old files.
-		 *
-		 * Instead, we use the following 2 rules to ensure that
-		 * the mode selector works as expected:
-		 *  1) If there's no object, we want to enter editmode.
-		 *     (i.e. with no object, we're in object mode)
-		 *  2) Otherwise, exit stroke editmode, so that we can
-		 *     enter another mode...
-		 */
-		if (!ob || (gpd->flag & GP_DATA_STROKE_EDITMODE)) {
-			WM_operator_name_call(C, "GPENCIL_OT_editmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
-		}
+	/* by default the operator assume is a mesh, but if gp object change mode */
+	if ((ob != NULL) && (ob->type == OB_GPENCIL) && (mode == OB_MODE_EDIT)) {
+		mode = OB_MODE_GPENCIL_EDIT;
 	}
-#endif
-
 
 	if (!ob || !ED_object_mode_compat_test(ob, mode))
 		return OPERATOR_PASS_THROUGH;



More information about the Bf-blender-cvs mailing list