tornavis/source
Christoph Lendenfeld f06fd85d97 Anim: Restrict range of fcurve_to_keylist
# Issue
Having a lot of keys in your scene can dramatically slow down the Dope Sheet.
That is because everytime the Dope Sheet is redrawn,
the Keylists have to be recomputed.
In the case of the summary channel, that means going through
all keyframes of all the `FCurves` and adding them to the keylist.
That eats up 95% of the time it takes to draw a frame.

# This PR
It's not a perfect solution, rather it solves the performance issue
for the case when you are not displaying all keys.
Instead of going through all the keys, only add the
keys visible in the view to the keylist.
This speeds up the Dope Sheet significantly
depending on the zoom level.

This also improves the responsiveness when selecting and transforming keyframes.

# Performance changes

The function measured is `ED_channel_list_flush`
which is responsible for building the keylists and drawing them.
The test setup contains 62 bones with all
10 channels keyed (location, rot quaternion, scale) on 6000 frames.
So 3.720.000 keys. The heavier the dataset the bigger the performance impact.

The data was recorded with only the Dope Sheet open, and 3 channels visible
* Summary
* Object
* Action

The more channels are visible, the greater the performance gain. This can be seen in the video.

| visible range | before | after |
| - | - | - |
| 200f | 250ms | 10ms |
| 400f | 250ms | 18ms |
| 3000f | 250ms | 130ms |
| 6000f | 250ms | 250ms |

Pull Request: https://projects.blender.org/blender/blender/pulls/114854
2023-11-23 16:37:32 +01:00
..
blender Anim: Restrict range of fcurve_to_keylist 2023-11-23 16:37:32 +01:00
creator Cleanup: Move several blenkernel headers to C++ 2023-11-16 11:41:55 +01:00
CMakeLists.txt License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00