diff options
author | Joshua Leung <aligorith@gmail.com> | 2006-12-02 09:00:31 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2006-12-02 09:00:31 +0300 |
commit | ac43fe5afdb4eb2d5684c686c31b087495e350d9 (patch) | |
tree | ac8f751c58f7e2dfec18b3c0d7186b557f87b3d0 /source/blender/src/editipo_mods.c | |
parent | 28bbf2d61616f7b8b3c59b54b46af7ee4dbf1e11 (diff) |
== Action Editor ==
Now it is possible to mirror selected keyframes in the action editor;
either over the current frame or the vertical axis.
Hotkey is: SHIFT M (like in ipo editor).
Diffstat (limited to 'source/blender/src/editipo_mods.c')
-rw-r--r-- | source/blender/src/editipo_mods.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/src/editipo_mods.c b/source/blender/src/editipo_mods.c index 822b085e734..fd9a60edf3e 100644 --- a/source/blender/src/editipo_mods.c +++ b/source/blender/src/editipo_mods.c @@ -585,6 +585,45 @@ void snap_ipo_keys(Ipo *ipo, short snaptype) } } +static int mirror_bezier_cframe(BezTriple *bezt) +{ + float diff; + + if(bezt->f2 & SELECT) { + diff= ((float)CFRA - bezt->vec[1][0]); + bezt->vec[1][0]= ((float)CFRA + diff); + } + + return 0; +} + +static int mirror_bezier_yaxis(BezTriple *bezt) +{ + float diff; + + if(bezt->f2 & SELECT) { + diff= (0.0f - bezt->vec[1][0]); + bezt->vec[1][0]= (0.0f + diff); + } + + return 0; +} + +void mirror_ipo_keys(Ipo *ipo, short mirror_type) +{ + switch (mirror_type) { + case 1: /* mirror over current frame */ + ipo_keys_bezier_loop(ipo, mirror_bezier_cframe, calchandles_ipocurve); + break; + case 2: /* snap over frame 0 */ + ipo_keys_bezier_loop(ipo, mirror_bezier_yaxis, calchandles_ipocurve); + break; + default: /* just in case */ + ipo_keys_bezier_loop(ipo, mirror_bezier_yaxis, calchandles_ipocurve); + break; + } +} + static void ipo_curves_auto_horiz(void) { EditIpo *ei; |