I’m trying to make an animation by growing a curve. I have a python script like this, which is based on http://blenderscripting.blogspot.fr/2011/05/blender-25-python-bezier-from-list-of.html
import bpy
from mathutils import Vector
w = 1 # weight
Scale = 0.03
def readCoords(filename):
with open(filename, 'r') as File:
Coords = [[float(x) * Scale for x in line.split()] for line in File]
return list(map(Vector, Coords))
ListOfVectors = readCoords("/Volumes/Stuff/3d/Lorenz/3d-data.txt")
def makePolyLine(objname, curvename, cList):
curvedata = bpy.data.curves.new(name=curvename, type='CURVE')
curvedata.dimensions = '3D'
objectdata = bpy.data.objects.new(objname, curvedata)
objectdata.location = (0,0,0) #object origin
bpy.context.scene.objects.link(objectdata)
polyline = curvedata.splines.new('NURBS')
for i in range(len(cList)):
# bpy.context.scene.frame_set(i+1)
if i > 0:
polyline.points.add(1)
x, y, z = cList[i]
polyline.points[i].co = (x, y, z, w)
makePolyLine("NameOfMyCurveObject", "NameOfMyCurve", ListOfVectors)
Basically I read the coordinates of points from a file, and add them to a curve in sequence. My question is, how can I animate this process (eg. add 1 point per frame)? I notice there’s a build modifier, but I want precise control on this, so that I know the exact coordinate of the end of the curve at each frame.
len(cList)
points all at the same location then animate moving them into place. You would have to create a hook for each point and keyframe the movement of each hook. see wiki page on hooks $\endgroup$