Animation: Paste Keys in Graph Editor with value offset

Extend the `GRAPH_OT_paste` operator with an enum to define the value offset.

Options are:

| Option              | Effect                                                                        |
| ------------------- | ----------------------------------------------------------------------------- |
| No Offset           | use the same key values as the copied keys                                    |
| Cursor Value        | align the leftmost key with the cursor value                                  |
| Current Frame Value | Evaluate the curve under the cursor align the leftmost key with it            |
| Right Key           | Align the rightmost key with the first key that is to the right of the cursor |
| Left Key            | Align the leftmost key with the first key that is to the left of the cursor   |

Pull Request #104512
This commit is contained in:
2023-02-23 09:46:47 +01:00
committed by Christoph Lendenfeld
parent 8756671084
commit 7267682017
5 changed files with 126 additions and 21 deletions

View File

@@ -218,6 +218,19 @@ typedef enum eKeyPasteOffset {
KEYFRAME_PASTE_OFFSET_NONE,
} eKeyPasteOffset;
typedef enum eKeyPasteValueOffset {
/* Paste keys with the first key matching the key left of the cursor. */
KEYFRAME_PASTE_VALUE_OFFSET_LEFT_KEY,
/* Paste keys with the last key matching the key right of the cursor. */
KEYFRAME_PASTE_VALUE_OFFSET_RIGHT_KEY,
/* Paste keys relative to the value of the curve under the cursor. */
KEYFRAME_PASTE_VALUE_OFFSET_CFRA,
/* Paste values relative to the cursor position. */
KEYFRAME_PASTE_VALUE_OFFSET_CURSOR,
/* Paste keys with the exact copied value. */
KEYFRAME_PASTE_VALUE_OFFSET_NONE,
} eKeyPasteValueOffset;
typedef enum eKeyMergeMode {
/* overlay existing with new keys */
KEYFRAME_PASTE_MERGE_MIX,
@@ -427,6 +440,7 @@ short copy_animedit_keys(struct bAnimContext *ac, ListBase *anim_data);
eKeyPasteError paste_animedit_keys(struct bAnimContext *ac,
ListBase *anim_data,
eKeyPasteOffset offset_mode,
eKeyPasteValueOffset value_offset_mode,
eKeyMergeMode merge_mode,
bool flip);