1
$\begingroup$

How to evenly distribute the selected animation keys in the Graph Editor along the X axis and separately along the Y axis? enter image description here Advantage / application uniform distribution of animation keys:

  1. Quickly evenly distribute animation keys of harmonic oscillation vertices by timing.
  2. Quickly make a smooth transition through an even distribution of adjacent animation keys between two adjacent gait or run cycles.
$\endgroup$

1 Answer 1

0
$\begingroup$

Python script

import bpy
from bpy import data as D

cube = D.objects['Cube']
curves = cube.animation_data.action.fcurves
# find the curve of interest, here rotation euler Z
curve = next(c for c in curves if c.data_path == 'rotation_euler' and c.array_index == 2)
points = curve.keyframe_points
delta_sum = points[-1].co - points[0].co
delta = delta_sum / (len(points)-1)
for i, keyframe in enumerate(points):
    keyframe.interpolation = 'LINEAR'
    keyframe.co = points[0].co + delta*i
$\endgroup$
1
  • $\begingroup$ Great! Thank you! $\endgroup$
    – Fix379
    Commented Jan 8, 2022 at 23:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .