I was trying to use bits from the 257 PDF Code Snippets document to script the adding of a follow path constraint. It wasn’t working so I tried the whole example, it too didn’t work.
After reading this I had a play with ‘Eavaluation Time’ in the ‘Path Animation’ panel. If I change current frame to 1 and set the evaluation time to 1 and insert a keyframe on evaluation time, then change both to 251 and insert another keyframe, then the example works.
However, how do I do this by script?
What is the keying set known as?
ob_curve=bpy.context.active_object
oc=ob_curve.data
oc.keyframe_insert('eval_time', index=0, frame=1)
Instead of ‘eval_time’ i’ve tried, ‘oc.eval_time’, ‘bpy.ops.anim.eval_time’, ‘Curve.eval_time’, ‘curve.eval_time’, ‘bpy.types.Curve.eval_time’, ‘evaluation_time’, ‘Evaluation Time’, and the list goes on, all to no avail…
I’ve also tried to get the name from an existing path made manually…
>>> ob=bpy.context.active_object
>>> action = ob.animation_data.action
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'action'
>>> action = ob.animation_data
animation_data animation_data_clear( animation_data_create(
>>> action = ob.animation_data
>>> action
>>> print(action)
None
>>> type(action)
<class 'NoneType'>
But i’m obviously going wrong there…
Any ideas or solutions would be great!