diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-11-23 14:48:04 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-11-23 14:48:04 +0300 |
commit | e4ca1fc4ea43f795441a319ea96b63a58553f070 (patch) | |
tree | 2dcb89adb56958fc26d41ceac51af6dc9dd72814 /source/blender/blenkernel/intern/fcurve.c | |
parent | 1318eaf166947e080c05ed689dbc295817496f1a (diff) |
Animation: New Euler filter implementation
This new discontinuity filter performs actions on the entire Euler
rotation, rather than only on the individual X/Y/Z channels. This makes
it fix a wider range of discontinuities, for example those in T52744.
The filter now runs twice on the selected channels, in this order:
- New: Convert X+Y+Z rotation to matrix, then back to Euler angles.
- Old: Add/remove factors of 360° to minimize jumps.
The messaging is streamlined; it now reports how many channels were
filtered, and only warns (instead of errors) when there was an actual
problem with the selected channels (like selecting three or more
channels, but without X/Y/Z triplet).
A new kernel function `BKE_fcurve_keyframe_move_value_with_handles()` is
introduced, to make it possible to move a keyframe's value and move its
handles at the same time.
Manifest Task: T52744
Reviewed By: looch
Differential Revision: https://developer.blender.org/D9602
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index e6d3696b198..bcd2fe098b7 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -884,6 +884,14 @@ int BKE_fcurve_active_keyframe_index(const FCurve *fcu) /** \} */ +void BKE_fcurve_keyframe_move_value_with_handles(struct BezTriple *keyframe, const float new_value) +{ + const float value_delta = new_value - keyframe->vec[1][1]; + keyframe->vec[0][1] += value_delta; + keyframe->vec[1][1] = new_value; + keyframe->vec[2][1] += value_delta; +} + /* -------------------------------------------------------------------- */ /** \name Status Checks * \{ */ |