I generated a curve using the following python code
curve = bpy.data.curves.new("Curve", type='CURVE')
polyline = curve.splines.new(type='POLY')
polyline.points.add(n - 1) # The polyline has one point when created
polyline.points.foreach_set('co', data) # data is the array of coordinates
This works perfectly in generating the data I want. And now I want to create an animation for this curve by using pre-calculated data stored in a file.
Thus I am trying to use in a different script the following:
curve= bpy.data.objects["Curve"]
# for i ...
# get new data
curve.data.splines.foreach_set("location", data)
curve.keyframe_insert(data_path="location", frame=i)
I tried different variations of the above segment to find a way to get to the points in the splines but no attributes exist for that.
Any suggestions?