The first cut of QX-Core played its whole choreography in 4 seconds, which felt rushed. Re-keying dozens of objects by hand would take an afternoon. Scaling the time axis of every key takes a few lines.
Find the F-curves in Blender 5
Blender 5 uses layered actions: an action holds layers, a layer holds strips, a strip holds channel bags, and the F-curves live there. Scripts that loop over action.fcurves run without errors and change nothing. This helper handles both layouts:
def iter_action_fcurves(action):
if hasattr(action, "layers") and len(action.layers) > 0:
for layer in action.layers:
for strip in layer.strips:
for bag in strip.channelbags:
yield from bag.fcurves
elif hasattr(action, "fcurves"): # Blender 4.x and older
yield from action.fcurvesScale keys and handles together
def retime_all_actions(factor=2.0, pivot=1.0):
for action in bpy.data.actions:
for fc in iter_action_fcurves(action):
for kp in fc.keyframe_points:
for attr in ("co", "handle_left", "handle_right"):
v = getattr(kp, attr)
v.x = pivot + (v.x - pivot) * factor
fc.update()
retime_all_actions(2.0)
scene.frame_end = 192 # 4 s -> 8 s at 24 fps- Scale the handles too, or the easing curves get squashed into the old timing and moves look snappy at the ends.
- Call
fc.update()so Blender re-sorts keys and recalculates auto handles. - Anything baked from the animation (simulation caches, exported anchor positions) has to be baked again afterwards.