diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-10-22 13:07:19 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-10-22 13:07:19 +0400 |
commit | 5777c624a54c4d834ec755a92079b504f04035e8 (patch) | |
tree | 849650b13e6a82a59f480d6eb79c7dbd98a0a5b0 /source/blender/editors | |
parent | c9092a6738d8f1dbf9fc76330d506771af4f90bb (diff) |
Animation Editors: Menu Tweaks
* Submenus displaying the options available for certain operators now will now show the hotkey for the operator on the menu entries.
* Added an option for mirroring keyframes in the Graph Editor which makes use of the new cursor
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 11 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 15 | ||||
-rw-r--r-- | source/blender/editors/include/ED_keyframes_edit.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_header.c | 63 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_header.c | 54 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_header.c | 14 |
9 files changed, 48 insertions, 123 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 7414d2fdf85..8c4f10fb222 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -373,9 +373,18 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) * * - id: ID block which should have an AnimData pointer following it immediately, to use * - adtOk: line or block of code to execute for AnimData-blocks case (usually ANIMDATA_ADD_ANIMDATA) - * - nlaOk: line or block of code to execute for NLA case + * - nlaOk: line or block of code to execute for NLA tracks+strips case * - driversOk: line or block of code to execute for Drivers case * - keysOk: line or block of code for Keyframes case + * + * The checks for the various cases are as follows: + * 0) top level: checks for animdata and also that all the F-Curves for the block will be visible + * 1) animdata check: for filtering animdata blocks only + * 2A) nla tracks: include animdata block's data as there are NLA tracks+strips there + * 2B) actions to convert to nla: include animdata block's data as there is an action that can be + * converted to a new NLA strip, and the filtering options allow this + * 3) drivers: include drivers from animdata block (for Drivers mode in Graph Editor) + * 4) normal keyframes: only when there is an active action */ #define ANIMDATA_FILTER_CASES(id, adtOk, nlaOk, driversOk, keysOk) \ {\ diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 3b2830e9045..7373edb6841 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -669,6 +669,19 @@ static short mirror_bezier_marker(BeztEditData *bed, BezTriple *bezt) return 0; } +static short mirror_bezier_value(BeztEditData *bed, BezTriple *bezt) +{ + float diff; + + /* value to mirror over is stored in the custom data -> first float value slot */ + if (bezt->f2 & SELECT) { + diff= (bed->f1 - bezt->vec[1][1]); + bezt->vec[1][1]= (bed->f1 + diff); + } + + return 0; +} + /* Note: for markers case, need to set global vars (eww...) */ // calchandles_fcurve BeztEditFunc ANIM_editkeyframes_mirror(short type) @@ -682,6 +695,8 @@ BeztEditFunc ANIM_editkeyframes_mirror(short type) return mirror_bezier_xaxis; case MIRROR_KEYS_MARKER: /* mirror over marker */ return mirror_bezier_marker; + case MIRROR_KEYS_VALUE: /* mirror over given value */ + return mirror_bezier_value; default: /* just in case */ return mirror_bezier_yaxis; break; diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 57a6c5fc773..4a0a3ee24db 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -82,6 +82,7 @@ typedef enum eEditKeyframes_Mirror { MIRROR_KEYS_YAXIS, MIRROR_KEYS_XAXIS, MIRROR_KEYS_MARKER, + MIRROR_KEYS_VALUE, } eEditKeyframes_Mirror; /* ************************************************ */ diff --git a/source/blender/editors/space_action/action_header.c b/source/blender/editors/space_action/action_header.c index aaf4b51c75e..6ec106077f7 100644 --- a/source/blender/editors/space_action/action_header.c +++ b/source/blender/editors/space_action/action_header.c @@ -167,62 +167,11 @@ static void act_edit_transformmenu(bContext *C, uiLayout *layout, void *arg_unus uiItemEnumO(layout, "Scale", 0, "TFM_OT_transform", "mode", TFM_TIME_SCALE); } -static void act_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_CFRA); - uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_NEAREST_FRAME); - uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_NEAREST_SECOND); - uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_NEAREST_MARKER); -} - -static void act_edit_mirrormenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_CFRA); - uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_YAXIS); - uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_XAXIS); - uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_MARKER); -} - -static void act_edit_keytypesmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "ACT_OT_keyframe_type", "type", BEZT_KEYTYPE_KEYFRAME); - uiItemEnumO(layout, NULL, 0, "ACT_OT_keyframe_type", "type", BEZT_KEYTYPE_BREAKDOWN); - uiItemEnumO(layout, NULL, 0, "ACT_OT_keyframe_type", "type", BEZT_KEYTYPE_EXTREME); -} - -static void act_edit_handlesmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_FREE); - uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_AUTO); - uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_VECT); - uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_ALIGN); - uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_AUTO_ANIM); // xxx? -} - -static void act_edit_ipomenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "ACT_OT_interpolation_type", "type", BEZT_IPO_CONST); - uiItemEnumO(layout, NULL, 0, "ACT_OT_interpolation_type", "type", BEZT_IPO_LIN); - uiItemEnumO(layout, NULL, 0, "ACT_OT_interpolation_type", "type", BEZT_IPO_BEZ); -} - -static void act_edit_expomenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "ACT_OT_extrapolation_type", "type", FCURVE_EXTRAPOLATE_CONSTANT); - uiItemEnumO(layout, NULL, 0, "ACT_OT_extrapolation_type", "type", FCURVE_EXTRAPOLATE_LINEAR); -} - static void act_editmenu(bContext *C, uiLayout *layout, void *arg_unused) { uiItemMenuF(layout, "Transform", 0, act_edit_transformmenu, NULL); - uiItemMenuF(layout, "Snap", 0, act_edit_snapmenu, NULL); - uiItemMenuF(layout, "Mirror", 0, act_edit_mirrormenu, NULL); + uiItemMenuEnumO(layout, "Snap", 0, "ACT_OT_snap", "type"); + uiItemMenuEnumO(layout, "Mirror", 0, "ACT_OT_mirror", "type"); uiItemS(layout); @@ -235,10 +184,10 @@ static void act_editmenu(bContext *C, uiLayout *layout, void *arg_unused) uiItemS(layout); - uiItemMenuF(layout, "Keyframe Type", 0, act_edit_keytypesmenu, NULL); - uiItemMenuF(layout, "Handle Type", 0, act_edit_handlesmenu, NULL); - uiItemMenuF(layout, "Interpolation Mode", 0, act_edit_ipomenu, NULL); - uiItemMenuF(layout, "Extrapolation Mode", 0, act_edit_expomenu, NULL); + uiItemMenuEnumO(layout, "Keyframe Type", 0, "ACT_OT_keyframe_type", "type"); + uiItemMenuEnumO(layout, "Handle Type", 0, "ACT_OT_handle_type", "type"); + uiItemMenuEnumO(layout, "Interpolation Type", 0, "ACT_OT_interpolation_type", "type"); + uiItemMenuEnumO(layout, "Extrapolation Type", 0, "ACT_OT_extrapolation_type", "type"); uiItemS(layout); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 5baa2372e0d..052c5c4a743 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -87,9 +87,6 @@ #include "UI_resources.h" #include "UI_view2d.h" -/* XXX */ -extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad); - /* *************************** */ /* Utility Drawing Defines */ @@ -881,7 +878,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri draw_fcurve_vertices(sipo, ar, fcu); } else { - /* samples: should we only draw two indicators at either end as indicators? */ + /* samples: only draw two indicators at either end as indicators */ draw_fcurve_samples(sipo, ar, fcu); } } diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index bcd57aa233f..a87cc54fad9 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1551,7 +1551,8 @@ void GRAPH_OT_snap (wmOperatorType *ot) /* defines for mirror keyframes tool */ EnumPropertyItem prop_graphkeys_mirror_types[] = { - {GRAPHKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current frame", ""}, + {GRAPHKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current Frame", ""}, + {GRAPHKEYS_MIRROR_VALUE, "VALUE", 0, "By Values over Cursor Value", ""}, {GRAPHKEYS_MIRROR_YAXIS, "YAXIS", 0, "By Times over Time=0", ""}, {GRAPHKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", ""}, {GRAPHKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker", ""}, @@ -1594,6 +1595,10 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) else return; } + else if (mode == GRAPHKEYS_MIRROR_VALUE) { + SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first; + bed.f1= (sipo) ? sipo->cursorVal : 0.0f; + } /* filter data */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); diff --git a/source/blender/editors/space_graph/graph_header.c b/source/blender/editors/space_graph/graph_header.c index 7385642801a..63c95b18e2d 100644 --- a/source/blender/editors/space_graph/graph_header.c +++ b/source/blender/editors/space_graph/graph_header.c @@ -159,55 +159,11 @@ static void graph_edit_transformmenu(bContext *C, uiLayout *layout, void *arg_un uiItemEnumO(layout, "Scale", 0, "TFM_OT_transform", "mode", TFM_TIME_SCALE); } -static void graph_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_snap", "type", GRAPHKEYS_SNAP_CFRA); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_snap", "type", GRAPHKEYS_SNAP_VALUE); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_snap", "type", GRAPHKEYS_SNAP_NEAREST_FRAME); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_snap", "type", GRAPHKEYS_SNAP_NEAREST_SECOND); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_snap", "type", GRAPHKEYS_SNAP_NEAREST_MARKER); -} - -static void graph_edit_mirrormenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_mirror", "type", GRAPHKEYS_MIRROR_CFRA); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_mirror", "type", GRAPHKEYS_MIRROR_YAXIS); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_mirror", "type", GRAPHKEYS_MIRROR_XAXIS); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_mirror", "type", GRAPHKEYS_MIRROR_MARKER); -} - -static void graph_edit_handlesmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_handle_type", "type", HD_FREE); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_handle_type", "type", HD_AUTO); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_handle_type", "type", HD_VECT); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_handle_type", "type", HD_ALIGN); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_handle_type", "type", HD_AUTO_ANIM); // xxx? -} - -static void graph_edit_ipomenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_interpolation_type", "type", BEZT_IPO_CONST); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_interpolation_type", "type", BEZT_IPO_LIN); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_interpolation_type", "type", BEZT_IPO_BEZ); -} - -static void graph_edit_expomenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_extrapolation_type", "type", FCURVE_EXTRAPOLATE_CONSTANT); - uiItemEnumO(layout, NULL, 0, "GRAPH_OT_extrapolation_type", "type", FCURVE_EXTRAPOLATE_LINEAR); -} - static void graph_editmenu(bContext *C, uiLayout *layout, void *arg_unused) { uiItemMenuF(layout, "Transform", 0, graph_edit_transformmenu, NULL); - uiItemMenuF(layout, "Snap", 0, graph_edit_snapmenu, NULL); - uiItemMenuF(layout, "Mirror", 0, graph_edit_mirrormenu, NULL); + uiItemMenuEnumO(layout, "Snap", 0, "GRAPH_OT_snap", "type"); + uiItemMenuEnumO(layout, "Mirror", 0, "GRAPH_OT_mirror", "type"); uiItemS(layout); @@ -221,9 +177,9 @@ static void graph_editmenu(bContext *C, uiLayout *layout, void *arg_unused) uiItemS(layout); - uiItemMenuF(layout, "Handle Type", 0, graph_edit_handlesmenu, NULL); - uiItemMenuF(layout, "Interpolation Mode", 0, graph_edit_ipomenu, NULL); - uiItemMenuF(layout, "Extrapolation Mode", 0, graph_edit_expomenu, NULL); + uiItemMenuEnumO(layout, "Handle Type", 0, "GRAPH_OT_handle_type", "type"); + uiItemMenuEnumO(layout, "Interpolation Mode", 0, "GRAPH_OT_interpolation_type", "type"); + uiItemMenuEnumO(layout, "Extrapolation Mode", 0, "GRAPH_OT_extrapolation_type", "type"); uiItemS(layout); diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index f03c9ece262..1e0f66751f0 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -130,6 +130,7 @@ enum { GRAPHKEYS_MIRROR_YAXIS, GRAPHKEYS_MIRROR_XAXIS, GRAPHKEYS_MIRROR_MARKER, + GRAPHKEYS_MIRROR_VALUE, } eGraphKeys_Mirror_Mode; /* ----------- */ diff --git a/source/blender/editors/space_nla/nla_header.c b/source/blender/editors/space_nla/nla_header.c index be0b4381f00..a2524a1b2dc 100644 --- a/source/blender/editors/space_nla/nla_header.c +++ b/source/blender/editors/space_nla/nla_header.c @@ -139,20 +139,12 @@ static void nla_edit_transformmenu(bContext *C, uiLayout *layout, void *arg_unus uiItemEnumO(layout, "Scale", 0, "TFM_OT_transform", "mode", TFM_TIME_SCALE); } -static void nla_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemEnumO(layout, NULL, 0, "NLA_OT_snap", "type", NLAEDIT_SNAP_CFRA); - uiItemEnumO(layout, NULL, 0, "NLA_OT_snap", "type", NLAEDIT_SNAP_NEAREST_FRAME); - uiItemEnumO(layout, NULL, 0, "NLA_OT_snap", "type", NLAEDIT_SNAP_NEAREST_SECOND); - uiItemEnumO(layout, NULL, 0, "NLA_OT_snap", "type", NLAEDIT_SNAP_NEAREST_MARKER); -} - static void nla_editmenu(bContext *C, uiLayout *layout, void *arg_unused) { Scene *scene= CTX_data_scene(C); uiItemMenuF(layout, "Transform", 0, nla_edit_transformmenu, NULL); - uiItemMenuF(layout, "Snap", 0, nla_edit_snapmenu, NULL); + uiItemMenuEnumO(layout, "Snap", 0, "NLA_OT_snap", "type"); uiItemS(layout); @@ -248,13 +240,13 @@ void nla_header_buttons(const bContext *C, ARegion *ar) /* auto-snap selector */ if (snla->flag & SNLA_DRAWTIME) { uiDefButS(block, MENU, B_REDR, - "Auto-Snap Keyframes %t|No Time-Snap %x0|Nearest Second %x2|Nearest Marker %x3", + "Auto-Snap %t|No Time-Snap %x0|Nearest Second %x2|Nearest Marker %x3", xco,yco,90,YIC, &snla->autosnap, 0, 1, 0, 0, "Auto-snapping mode for times when transforming"); } else { uiDefButS(block, MENU, B_REDR, - "Auto-Snap Keyframes %t|No Time-Snap %x0|Nearest Frame %x2|Nearest Marker %x3", + "Auto-Snap %t|No Time-Snap %x0|Nearest Frame %x2|Nearest Marker %x3", xco,yco,90,YIC, &snla->autosnap, 0, 1, 0, 0, "Auto-snapping mode for times when transforming"); } |