**Status:** `Implement generic slider`
---
=====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.
**Issues**
* Bezier keyframes with //free// or //aligned// tangent handles cause problems where the tangent handles don't follow the keyframe. Might be related to T81813
* Use LISTBASE_FOREACH when iterating through lists. There are a lot of places where this could be used. Refactor at the end.
* Decimate/Sample can be combined on one slider "Key Density"
=====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
[x] Phase 1 (Moving code around. Commits are independent)
[x] D9312 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.
[x] D9313 Create `editors/util/ed_draw.c` as the place in which the generic slider will be located
[] Phase 2 (Implement generic slider)
[x] D9314 Implement generic slider as it currently is in Blender
[] D11878 Change color of slider to make proper use of theme
[x] D11883 Remove auto hiding when using the pose sliding tools
[] D9361 Change `GRAPH_OT_decimate` to use the generic slider
[] TODO Change Generic slider to make use of keymap
[] Phase 3 (Refactoring Code. Dependent on Phase 1 and dependent on patches coming before)
[] D9317 Extract helper functions from `GRAPH_OT_decimate` so they can be reused for future ops
[] D9326 Implement generic ´invoke´, ´modal´ and ´exec´ for `GRAPH_OT_decimate`
[] Phase 4 (Change functionality under the hood without changing functionality for the user. Dependent on Phase 2)
[] D9360 Function to calculate keyframe selection segments in `keyframes_general.c`
**Implement keyframe manipulation operators**
[] D9374 Blend to neighbour (blend to left or right keyframe from currrent keyframe value)
[] D9375 Tween (similar to Pose Slide Breakdowner but for keyframes)
[] D9376 Blend to default
[] D9477 Smooth (There is a smooth operator already, but it would be better if it is interactive)
[] D9478 Sample keyframes (Decimate already exists, but the other way is useful as well)
[] D9479 Ease (Align keyframe segments in a gamma curve that either favors the left or the right key)
**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.
* An idea by @looch is that there would be a dropdown to choose the active slider, which can then be called with just a hotkey
[] D9512 add operators to menu and pie menu
[] D9513 implement improved generic slider