Fix T101996: merge fcurve keyframes on the same frame after snapping
Use recently introduced BKE_fcurve_merge_duplicate_keys (that was moved from the transform system to BKE) to merge keyframes on the same frame after snapping (same as what would happen with the transform system). This makes behavior consistent and prevents a state after snapping that cannot be reproduced in any other way. NOTE: same probably has to be done for greasepencil, but that is for another commit.
This commit is contained in:
@@ -2279,6 +2279,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
|
||||
edit_cb = ANIM_editkeyframes_snap(mode);
|
||||
|
||||
/* Snap keyframes. */
|
||||
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
|
||||
|
||||
@@ -2296,10 +2297,12 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
|
||||
if (adt) {
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
|
||||
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc);
|
||||
BKE_fcurve_merge_duplicate_keys(ale->key_data, BEZT_FLAG_TEMP_TAG, use_handle);
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
|
||||
}
|
||||
else {
|
||||
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc);
|
||||
BKE_fcurve_merge_duplicate_keys(ale->key_data, BEZT_FLAG_TEMP_TAG, use_handle);
|
||||
}
|
||||
|
||||
ale->update |= ANIM_UPDATE_DEFAULT;
|
||||
|
||||
Reference in New Issue
Block a user