diff options
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 33 | ||||
-rw-r--r-- | source/blender/editors/include/ED_keyframes_edit.h | 13 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_select.c | 1 |
3 files changed, 45 insertions, 2 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index dd01e53d099..ba98702e639 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -44,6 +44,7 @@ #include "DNA_scene_types.h" #include "BKE_fcurve.h" +#include "BKE_nla.h" #include "ED_anim_api.h" #include "ED_keyframes_edit.h" @@ -290,9 +291,39 @@ static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, Key case ALE_MASKLAY: case ALE_GPFRAME: break; + + case ALE_FCURVE: default: - ret_code = ANIM_fcurve_keyframes_loop(ked, ale->data, key_ok, key_cb, fcu_cb); + { + if (ked->iterflags) { + /* make backups of the current values, so that a localised fix + * (e.g. NLA time remapping) can be applied to these values + */ + float f1 = ked->f1; + float f2 = ked->f2; + + if (ked->iterflags & (KED_F1_NLA_UNMAP | KED_F2_NLA_UNMAP)) { + AnimData *adt = ANIM_nla_mapping_get(ac, ale); + + if (ked->iterflags & KED_F1_NLA_UNMAP) + ked->f1 = BKE_nla_tweakedit_remap(adt, f1, NLATIME_CONVERT_UNMAP); + if (ked->iterflags & KED_F2_NLA_UNMAP) + ked->f2 = BKE_nla_tweakedit_remap(adt, f2, NLATIME_CONVERT_UNMAP); + } + + /* now operate on the channel as per normal */ + ret_code = ANIM_fcurve_keyframes_loop(ked, ale->data, key_ok, key_cb, fcu_cb); + + /* reset */ + ked->f1 = f1; + ked->f2 = f2; + } + else { + /* no special handling required... */ + ret_code = ANIM_fcurve_keyframes_loop(ked, ale->data, key_ok, key_cb, fcu_cb); + } break; + } } if (ret_code) diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 910b6470086..7528594ecdf 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -132,9 +132,20 @@ typedef struct KeyframeEditData { /* flags */ short curflags; /* current flags for the keyframe we're reached in the iteration process */ - short iterflags; /* settings for iteration process */ // XXX: unused... + short iterflags; /* settings for iteration process */ } KeyframeEditData; +/* Flags for controlling the iteration process (to supply additional capabilities, etc.) */ +typedef enum eKeyframeEditData_IterFlags { + /* Perform NLA time remapping (global -> strip) for the "f1" parameter + * (e.g. used for selection tools on summary tracks) + */ + KED_F1_NLA_UNMAP = (1 << 0), + + /* Perform NLA time remapping (global -> strip) for the "f2" parameter */ + KED_F2_NLA_UNMAP = (1 << 1), +} eKeyframeEditData_IterFlags; + /* ------- Function Pointer Typedefs ---------------- */ /* callback function that refreshes the F-Curve after use */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 3c9c88a0ae6..574d3f6f2c9 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -948,6 +948,7 @@ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short s select_cb = ANIM_editkeyframes_select(select_mode); ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME); ked.f1 = selx; + ked.iterflags |= KED_F1_NLA_UNMAP; /* select the nominated keyframe on the given frame */ if (ale->type == ANIMTYPE_GPLAYER) { |