You can join Blender Studio for €11.50/month and get access to all of our training & film content instantly!
Aug. 16th, 2017
License: CC-BYThis is the first video in a series of "tech videos" in which Sybren discusses concrete problems seen on Stack Exchange. This video is all about modifying animation data from Python scripts.
fcurve.update()
after making changesSlides are only visible to Blender Cloud susbcribers
For the record, from time to time I return to pick a few things again from this. Today I remembered that curves could be evaluated so I went back and behold, its there. Great and helpful tutorial, thank you!
for lazy ones as me:
import bpy
reset_to = 1.0
for object in bpy.context.selected_objects:
# in case the object is not animated, we should also change its y-coordinate
object.location.y = reset_to
if not object.animation_data or not object.animation_data.action:
# no action so nothing to do
continue
action = object.animation_data.action
fcurve = action.fcurves.find('location', index=1)
if not fcurve:
# y location not animated so nothing left do
continue
for keypoint in fcurve.keyframe_points:
keypoint.co.y = reset_to
fcurve.update()
Sybren very nice video,
I am missing only how to insert a new keyframe at say time 60 in the timeline ...
As the title says: existing ke;yframes , so my wish is something new ;-)
oh oh the triple ` does not as im MD.
Possible here? If so, please tell me Greets Peter
@Peter K.H. Gragert ah yes, lazy indeed, thanks :-)
@Peter K.H. Gragert From what I found, keypoint.co.x represents the frame number
still waiting for tech9ne
Thank you once again Sybren, this wasn't easy to figure out alone but with this tutorial a n entire array of possilibities is opened up to me.
is there a blend file containing the suzanne animation that is being corrected here?
Very nice explanation! Thank you Dr.
Join to comment publicly.