Change set handle types back to menu now menus have key access - V+A, V+V, V+L, V+F

for Graph & Edit Curve view.

Editcurve can be Hkey for hide again.
This commit is contained in:
Campbell Barton 2010-12-14 10:17:13 +00:00
parent 996bc87793
commit 58f31f8a5d
6 changed files with 25 additions and 40 deletions

@ -250,18 +250,6 @@ class INFO_MT_surface_add(bpy.types.Menu):
layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
class INFO_MT_curve_handle_type_set(bpy.types.Menu):
bl_idname = "INFO_MT_curve_handle_type_set"
bl_label = "Handle Type"
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("curve.handle_type_set", text="Automatic").type = "AUTOMATIC"
layout.operator("curve.handle_type_set", text="Vector").type = "VECTOR"
layout.operator("curve.handle_type_set", text="Align").type = "ALIGN"
layout.operator("curve.handle_type_set", text="Free Align").type = "FREE_ALIGN"
class INFO_MT_armature_add(bpy.types.Menu):
bl_idname = "INFO_MT_armature_add"

@ -196,12 +196,9 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
keymap->poll= ED_operator_editsurfcurve;
WM_keymap_add_menu(keymap, "INFO_MT_edit_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
/* XXX will fix it with proper defines (ton) */
RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, 0, 0)->ptr, "type", 5);
RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", HD_AUTO);
RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", 6);
RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0)->ptr, "type", HD_VECT);
WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 0, 0);
@ -226,7 +223,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN);
WM_keymap_add_item(keymap, "CURVE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_ALT, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "unselected", 1);
WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);

@ -3538,11 +3538,12 @@ static int set_handle_type_exec(bContext *C, wmOperator *op)
void CURVE_OT_handle_type_set(wmOperatorType *ot)
{
static EnumPropertyItem type_items[]= {
/* keep in sync with graphkeys_handle_type_items */
static EnumPropertyItem editcurve_handle_type_items[]= {
{HD_AUTO, "AUTOMATIC", 0, "Automatic", ""},
{HD_VECT, "VECTOR", 0, "Vector", ""},
{5, "ALIGN", 0, "Align", ""},
{6, "FREE_ALIGN", 0, "Free Align", ""},
{5, "ALIGNED", 0, "Aligned", ""},
{6, "FREE_ALIGN", 0, "Free", ""},
{3, "TOGGLE_FREE_ALIGN", 0, "Toggle Free/Align", ""},
{0, NULL, 0, NULL, NULL}};
@ -3551,6 +3552,7 @@ void CURVE_OT_handle_type_set(wmOperatorType *ot)
ot->idname= "CURVE_OT_handle_type_set";
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= set_handle_type_exec;
ot->poll= ED_operator_editcurve;
@ -3558,7 +3560,7 @@ void CURVE_OT_handle_type_set(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "type", type_items, 1, "Type", "Spline type");
ot->prop= RNA_def_enum(ot->srna, "type", editcurve_handle_type_items, 1, "Type", "Spline type");
}
/***************** make segment operator **********************/

@ -1352,14 +1352,6 @@ void GRAPH_OT_interpolation_type (wmOperatorType *ot)
/* ******************** Set Handle-Type Operator *********************** */
EnumPropertyItem graphkeys_handle_type_items[] = {
{HD_FREE, "FREE", 0, "Free", ""},
{HD_VECT, "VECTOR", 0, "Vector", ""},
{HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
{HD_AUTO, "AUTO", 0, "Auto", "Handles that are automatically adjusted upon moving the keyframe. Whole curve"},
{HD_AUTO_ANIM, "ANIM_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot. Whole curve"},
{0, NULL, 0, NULL, NULL}};
/* ------------------- */
/* this function is responsible for setting handle-type of selected keyframes */
@ -1424,14 +1416,24 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
void GRAPH_OT_handle_type (wmOperatorType *ot)
void GRAPH_OT_handle_type_set (wmOperatorType *ot)
{
/* sync with editcurve_handle_type_items */
static EnumPropertyItem graphkeys_handle_type_items[] = {
{HD_AUTO, "AUTO", 0, "Automatic", "Handles that are automatically adjusted upon moving the keyframe. Whole curve"},
{HD_VECT, "VECTOR", 0, "Vector", ""},
{HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
{HD_FREE, "FREE_ALIGN", 0, "Free", ""},
{HD_AUTO_ANIM, "ANIM_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot. Whole curve"},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
ot->name= "Set Keyframe Handle Type";
ot->idname= "GRAPH_OT_handle_type";
ot->idname= "GRAPH_OT_handle_type_set";
ot->description= "Set type of handle for selected keyframes";
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= graphkeys_handletype_exec;
ot->poll= graphop_editable_keyframes_poll;

@ -106,7 +106,7 @@ void GRAPH_OT_bake(struct wmOperatorType *ot);
void GRAPH_OT_sound_bake(struct wmOperatorType *ot);
void GRAPH_OT_smooth(struct wmOperatorType *ot);
void GRAPH_OT_handle_type(struct wmOperatorType *ot);
void GRAPH_OT_handle_type_set(struct wmOperatorType *ot);
void GRAPH_OT_interpolation_type(struct wmOperatorType *ot);
void GRAPH_OT_extrapolation_type(struct wmOperatorType *ot);

@ -239,7 +239,7 @@ void graphedit_operatortypes(void)
WM_operatortype_append(GRAPH_OT_snap);
WM_operatortype_append(GRAPH_OT_mirror);
WM_operatortype_append(GRAPH_OT_frame_jump);
WM_operatortype_append(GRAPH_OT_handle_type);
WM_operatortype_append(GRAPH_OT_handle_type_set);
WM_operatortype_append(GRAPH_OT_interpolation_type);
WM_operatortype_append(GRAPH_OT_extrapolation_type);
WM_operatortype_append(GRAPH_OT_sample);
@ -332,12 +332,8 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
WM_keymap_add_item(keymap, "GRAPH_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_mirror", MKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_handle_type", HKEY, KM_PRESS, 0, 0)->ptr, "type", HD_ALIGN);
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_handle_type", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", HD_AUTO);
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_handle_type", HKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", HD_FREE);
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_handle_type", VKEY, KM_PRESS, 0, 0)->ptr, "type", HD_VECT);
WM_keymap_add_item(keymap, "GRAPH_OT_handle_type_set", VKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_interpolation_type", TKEY, KM_PRESS, KM_SHIFT, 0);
/* destructive */