(Help) python thing
i would like to get something like in the image
i have this code, but it move all the keyframe 10 time right
<code> import bpy for action in bpy.data.actions: for fcurve in action.fcurves: for point in fcurve.keyframe_points: point.co.x += 10 </code>
i need to move each frame 10 time more than the las one. how could i do that? and how could i access to a specific key bone and move just it?
2 Comments
I achieved it this way it needs polish btw <pre > <source> 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:
print(point.co.x) point.co.x += amount
</source> </pre>
You can access to a specific key bone trough Fcurve.data_path
<pre> # selected pose bones in POSE mode bone_names = [ b.name for b in bpy.context.selected_pose_bones] # Fcurves of the active armature fcurves = bpy.context.active_object.animation_data.action.fcurves for curve in fcurves: # skip object transform curves if armature itself is animated try: if curve.data_path.split('"')[1] in bone_names: # print names of the selected pose bones that has animation curves print(curve.data_path.split('"')[1]) except IndexError: pass </pre>