85ed2e8c368bb624166d5082df79faa9d983573e
Introduce `BKE_fcurve_deduplicate_keys()` to merge keys that are on the same time, or within the time comparison threshold (1/100th of a frame). When merging two consecutive keys, the last one 'wins' and determines the final key *value*. The first key's *time* is retained, to ensure the reference point for the next comparisons is stable. The only exception here is when there is a key exactly on an integer frame number, in which case that one is preferred. The function is exposed in RNA as `fcurve.keyframe_points.deduplicate()` This commit also introduces a new function `BKE_fcurve_bezt_shrink(fcu, new_totvert);` that can reallocate the `bezt` array to ensure removed keys no longer take up memory. The RNA function `fcurve.update()` currently performs two steps, which are now exposed to RNA as well, as `keyframe_points.sort()` and `keyframe_points.handles_recalc()`. This is so that Python code can sort, deduplicate, and then recalculate the handles only once (calling `update` + `deduplicate` would do the latter twice). In Blender 4.0 the deduplication will also be part of `fcurve.update()`, see #107126. Reviewed on https://projects.blender.org/blender/blender/pulls/107089
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
