def draw_curve(props, context):
if props.spiral_type == 1:
verts = make_spiral(props, context)
if props.spiral_type == 2:
verts = make_spiral(props, context)
if props.spiral_type == 3:
verts = make_spiral_spheric(props, context)
if props.spiral_type == 4:
verts = make_spiral_torus(props, context)
curve_data = bpy.data.curves.new(name='Spiral', type='CURVE')
curve_data.dimensions = '3D'
if props.curve_type == 0:
spline = curve_data.splines.new(type='POLY')
elif props.curve_type == 1:
spline = curve_data.splines.new(type='NURBS')
spline.points.add( len(verts)*0.25-1 ) #Add only one quarter of points as elements in verts, because verts looks like: "x,y,z,?,x,y,z,?,x,..."
spline.points.foreach_set('co', verts)
new_obj = object_data_add(context, curve_data)
评论列表
文章目录