I would like to get something like in the image:

enter image description here

I have this code, but it moves all the keyframes 10 frames to the right:

import bpy
for action in bpy.data.actions:
   for fcurve in action.fcurves:
     for point in fcurve.keyframe_points:
        point.co.x += 10

I need to move each bone's keyframes 10 more frames than the last one. How could I do that? And how could I access a specific bone's keyframes and move just them?

  • $\begingroup$ Are 'CTR_FK.031' and '...032' etc. bones? $\endgroup$ Commented May 21, 2020 at 23:42
  • $\begingroup$ yeah, actuality there are 50 bones CTR_FK.000 to CTR_FK.049 $\endgroup$ Commented May 21, 2020 at 23:50
  • $\begingroup$ Related blender.stackexchange.com/a/111326/15543 $\endgroup$
    – batFINGER
    Commented May 22, 2020 at 3:39

2 Answers 2


Amended code to do somewhat what you want.

Shifts keyframes 0 for first fcurve, 10 for next, 20, 30...

Have made it adjust only the action on the active object.

import bpy

ob = bpy.context.object
ob.animation_data_create()  # lazy way to make animation data exist
action = ob.animation_data.action
if action:
    for i, fcurve in enumerate(action.fcurves):
        for point in fcurve.keyframe_points:
            point.co.x += i * 10

Please use consistent 4 space indent

Re finding which fcurve is which see https://blender.stackexchange.com/a/111326/15543

To order the fcurves firstly by data_path, and secondly by array index eg


Use something like

fcurves = sorted(action.fcurves, key=lambda fc: (fc.data_path, fc.array_index))

I achieved it in this way (it needs polish btw):

import re
import bpy

def lookFor(txt):
    t = re.findall(r'"([^"]*)"', txt)
    return t

amount = 1
boneName = 'null'
boneNameLast = "null"

for action in bpy.data.actions:        
    for fcurve in action.fcurves:         
        boneName = lookFor(fcurve.data_path)

        if  boneName != boneNameLast:
            boneNameLast = lookFor(fcurve.data_path)
            amount = amount + 1

        for point in fcurve.keyframe_points:            
            point.co.x += amount

You must log in to answer this question.

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