**Status:** `Cleanup`
---
=====Description=====
**Big picture:**
Blender already has the pose sliding tools, that allow you to interactively create breakdowns in Pose mode.
It uses a modal operator and the mouse cursor to interactively set the pose. Using the same interaction, we could add similar functionality to the graph editor to manipulate multiple keyframes.
**Use cases**:
* During animation when using the graph editor and trying to change multiple keyframes.
**Design:**
* T81836
**Engineer plan:**
In order to implement the new operators efficiently there is some cleanup work to do
* Create a new file for all the keyframe operators to live in and move `GRAPH_OT_decimate` in there
* Extract functions from `GRAPH_OT_decimate` into generic functions that can be shared between all new operators
* Implement a generic slider that calculates the percentage based on cursor position
Then implement all new operators, with each new operator being a new patch.
=====Work plan=====
**Cleanup**
* The sliding functionality should only exist once in code. At the moment it does exist in the pose sliding tools and also for the keyframe decimate operator. Maybe also in different areas that I haven’t found yet.
* All the keyframe operators will work on selection and most of them on keyframe segments (a segment being a continuous selection of keyframes) Some operators already calculate segments, but I think this would be better in a function as well.
* Make it easy to implement new operators, that will share a lot of functionality
[] Phase 1 (Moving code around. Commits are independent)
[] Break up `graph_edit.c`. This file is scraping the 4000 lines and if I recall correctly that is the limit for files defined in the docs. D9312
[] Create `editors/util/ed_draw.c` as the place in which the generic slider will be located D9313
[] Phase 2 (Refactoring Code. Dependent on Phase 1 and dependent on patches coming before)
[] Implement generic slider as it currently is in Blender D9314
[] Extract helper functions from `GRAPH_OT_decimate` so they can be reused for future ops D9317
[] Implement generic ´invoke´, ´modal´ and ´exec´ for `GRAPH_OT_decimate`
[] Phase 3 (Change functionality under the hood without changing functionality for the user. Dependent on Phase 2)
[] Function to calculate keyframe selection segments in `keyframes_general.c` and store them in `tDecimateGraphOp`
**Implement keyframe manipulation operators**
[] Tween (similar to Pose Slide Breakdowner but for keyframes)
[] Blend to neighbour (blend to left or right keyframe from currrent keyframe value)
[] Blend to default
[] Smooth (There is a smooth operator already, but it would be better if it is interactive)
[] Bake keyframes (Decimate already exists, but the other way is useful as well)
**UI and UX**
Once all operators are implemented it is time for user testing. Apart from general feedback I'd like to test multiple ways of calling the tools:
* Floating panel like the quick favorites panel. This would scale quite well, but it is not as fast or intuitive as pie menus. An option to improve that would be to add hotkeys to the entries.
* Embedded in a pie menu. This would make a lot of them accessible with only one hotkey. However I think the pie menu would be quite crowded and if more operators get added where would we put them?
* I will definitely put them in a menu in the graph editor, but I think this is just for discoverability. They are not easy to access there. However the hotkeys will be listed there as well for the user to discover.