[Bf-blender-cvs] [db08a30cd93] greasepencil-object: New toggle MultiEdit operator with Key Q
Antonio Vazquez
noreply at git.blender.org
Wed Aug 30 11:26:40 CEST 2017
Commit: db08a30cd93e4798e5a78d311541d636216848d6
Author: Antonio Vazquez
Date: Wed Aug 30 11:26:30 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBdb08a30cd93e4798e5a78d311541d636216848d6
New toggle MultiEdit operator with Key Q
This allows to switch very fast between edit modes
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_intern.h
M source/blender/editors/gpencil/gpencil_ops.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 5b66c7b823e..97a2320e2a8 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -529,6 +529,38 @@ void GPENCIL_OT_selection_opacity_toggle(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER;
}
+/* toggle multi edit strokes support */
+static int gpencil_multiedit_toggle_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+
+ if (gpd == NULL)
+ return OPERATOR_CANCELLED;
+
+ /* Just toggle value */
+ gpd->flag ^= GP_DATA_STROKE_MULTIEDIT;
+
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_multiedit_toggle(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "MultiEdit Toggle";
+ ot->idname = "GPENCIL_OT_multiedit_toggle";
+ ot->description = "Enable/Disable multiedit strokes support";
+
+ /* callbacks */
+ ot->exec = gpencil_multiedit_toggle_exec;
+ ot->poll = gp_stroke_edit_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER;
+}
+
/* ************** Duplicate Selected Strokes **************** */
/* Make copies of selected point segments in a selected stroke */
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 57abc007cc0..589fe529034 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -159,6 +159,7 @@ void GPENCIL_OT_paintmode_toggle(struct wmOperatorType *ot);
void GPENCIL_OT_sculptmode_toggle(struct wmOperatorType *ot);
void GPENCIL_OT_weightmode_toggle(struct wmOperatorType *ot);
void GPENCIL_OT_selection_opacity_toggle(struct wmOperatorType *ot);
+void GPENCIL_OT_multiedit_toggle(struct wmOperatorType *ot);
void GPENCIL_OT_select(struct wmOperatorType *ot);
void GPENCIL_OT_select_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 756ac67ee9c..624812cd3e8 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -344,7 +344,10 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "unselected", true);
WM_keymap_add_item(keymap, "GPENCIL_OT_selection_opacity_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
-
+
+ /* toogle multiedit support */
+ WM_keymap_add_item(keymap, "GPENCIL_OT_multiedit_toggle", QKEY, KM_PRESS, 0, 0);
+
/* Isolate Layer */
WM_keymap_add_item(keymap, "GPENCIL_OT_layer_isolate", PADASTERKEY, KM_PRESS, 0, 0);
@@ -587,6 +590,7 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_sculptmode_toggle);
WM_operatortype_append(GPENCIL_OT_weightmode_toggle);
WM_operatortype_append(GPENCIL_OT_selection_opacity_toggle);
+ WM_operatortype_append(GPENCIL_OT_multiedit_toggle);
WM_operatortype_append(GPENCIL_OT_select);
WM_operatortype_append(GPENCIL_OT_select_all);
More information about the Bf-blender-cvs
mailing list