def create_bezier(objname, points, origin):
curvedata = bpy.data.curves.new(name=objname, type='CURVE')
curvedata.dimensions = '3D'
myobject = bpy.data.objects.new(objname, curvedata)
myobject.location = origin
myobject.rotation_euler[2] = radians(90)
bpy.context.scene.objects.link(myobject)
polyline = curvedata.splines.new('BEZIER')
polyline.bezier_points.add(len(points) - 1)
for idx, (knot, h1, h2) in enumerate(points):
point = polyline.bezier_points[idx]
point.co = knot
point.handle_left = h1
point.handle_right = h2
point.handle_left_type = 'FREE'
point.handle_right_type = 'FREE'
return myobject
评论列表
文章目录