GPencil: use ctrl+x/del for dissolve

Move dissolve into own operator (as with mesh/armature)
This commit is contained in:
Campbell Barton 2015-07-05 14:34:17 +10:00
parent 68d72e2164
commit 6de7f3c747
4 changed files with 42 additions and 12 deletions

@ -2471,6 +2471,20 @@ class VIEW3D_MT_edit_mesh_delete(Menu):
class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
_operator_name = "mesh"
class VIEW3D_MT_edit_gpencil_delete(Menu):
bl_label = "Delete"
def draw(self, context):
layout = self.layout
layout.operator_enum("gpencil.delete", "type")
layout.separator()
layout.operator("gpencil.dissolve")
# Edit Curve
# draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface

@ -495,8 +495,6 @@ typedef enum eGP_DeleteMode {
GP_DELETEOP_STROKES = 1,
/* delete active frame */
GP_DELETEOP_FRAME = 2,
/* delete selected stroke points (without splitting stroke) */
GP_DELETEOP_POINTS_DISSOLVE = 3,
} eGP_DeleteMode;
@ -759,11 +757,7 @@ static int gp_delete_exec(bContext *C, wmOperator *op)
case GP_DELETEOP_POINTS: /* selected points (breaks the stroke into segments) */
result = gp_delete_selected_points(C);
break;
case GP_DELETEOP_POINTS_DISSOLVE: /* selected points (without splitting the stroke) */
result = gp_dissolve_selected_points(C);
break;
case GP_DELETEOP_FRAME: /* active frame */
result = gp_actframe_delete_exec(C, op);
break;
@ -778,9 +772,6 @@ void GPENCIL_OT_delete(wmOperatorType *ot)
{GP_DELETEOP_POINTS, "POINTS", 0, "Points", "Delete selected points and split strokes into segments"},
{GP_DELETEOP_STROKES, "STROKES", 0, "Strokes", "Delete selected strokes"},
{GP_DELETEOP_FRAME, "FRAME", 0, "Frame", "Delete active frame"},
{0, "", 0, NULL, NULL},
{GP_DELETEOP_POINTS_DISSOLVE, "DISSOLVE_POINTS", 0, "Dissolve Points",
"Delete selected points without splitting strokes"},
{0, NULL, 0, NULL, NULL}
};
@ -801,4 +792,24 @@ void GPENCIL_OT_delete(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_gpencil_delete_types, 0, "Type", "Method used for deleting Grease Pencil data");
}
static int gp_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
{
return gp_dissolve_selected_points(C);
}
void GPENCIL_OT_dissolve(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Dissolve";
ot->idname = "GPENCIL_OT_dissolve";
ot->description = "Delete selected points without splitting strokes";
/* callbacks */
ot->exec = gp_dissolve_exec;
ot->poll = gp_stroke_edit_poll;
/* flags */
ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER;
}
/* ************************************************ */

@ -131,6 +131,7 @@ void GPENCIL_OT_select_less(struct wmOperatorType *ot);
void GPENCIL_OT_duplicate(struct wmOperatorType *ot);
void GPENCIL_OT_delete(struct wmOperatorType *ot);
void GPENCIL_OT_dissolve(struct wmOperatorType *ot);
void GPENCIL_OT_copy(struct wmOperatorType *ot);
void GPENCIL_OT_paste(struct wmOperatorType *ot);

@ -171,8 +171,11 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "GPENCIL_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
/* delete */
WM_keymap_add_item(keymap, "GPENCIL_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "GPENCIL_OT_delete", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_gpencil_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_gpencil_delete", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "GPENCIL_OT_dissolve", XKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "GPENCIL_OT_dissolve", DELKEY, KM_PRESS, KM_CTRL, 0);
/* copy + paste */
WM_keymap_add_item(keymap, "GPENCIL_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
@ -258,6 +261,7 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_duplicate);
WM_operatortype_append(GPENCIL_OT_delete);
WM_operatortype_append(GPENCIL_OT_dissolve);
WM_operatortype_append(GPENCIL_OT_copy);
WM_operatortype_append(GPENCIL_OT_paste);