Fix #121463: Graph Editor Keyframe jump operator shifts keyframes

Caused by 598af45459

Above commit added respect for the NLA strip offset (rightfully so, by
using `ANIM_nla_mapping_apply_fcurve`).
However, when no closest frame was found, the code moved on to the next
FCurve without restoring to the original FCurve --
`ANIM_nla_mapping_apply_fcurve` needs to be called in pairs.

To resolve, now always restore to the original FCurve.

Pull Request: https://projects.blender.org/blender/blender/pulls/121483
This commit is contained in:
Philipp Oeser
2024-05-07 15:17:26 +02:00
committed by Philipp Oeser
parent b57916463c
commit 734a9dec43

View File

@@ -2284,18 +2284,22 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
continue;
}
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
ANIM_nla_mapping_apply_fcurve(adt, fcu, false, true);
float closest_fcu_frame;
if (!find_closest_frame(fcu, current_frame, next, &closest_fcu_frame)) {
ANIM_nla_mapping_apply_fcurve(adt, fcu, false, true);
const bool success = find_closest_frame(fcu, current_frame, next, &closest_fcu_frame);
ANIM_nla_mapping_apply_fcurve(adt, fcu, true, true);
if (!success) {
continue;
}
if ((next && closest_fcu_frame < closest_frame) ||
(!next && closest_fcu_frame > closest_frame))
{
closest_frame = closest_fcu_frame;
found = true;
}
ANIM_nla_mapping_apply_fcurve(adt, fcu, true, true);
}
if (!found) {