26 lines
971 B
Python
26 lines
971 B
Python
#!/usr/bin/env python3
|
|
import sys
|
|
import bpy
|
|
|
|
def main(output):
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
curve = bpy.data.curves.new("WebGapCurve", type="CURVE")
|
|
curve.dimensions = "3D"
|
|
curve.resolution_u = 8
|
|
spline = curve.splines.new("BEZIER")
|
|
spline.bezier_points.add(2)
|
|
points = [((-1, 0, 0), (1, 1, 1)), ((0, 1, 0.5), (1, 1, 1)), ((1, 0, 1), (1, 1, 1))]
|
|
for point, (co, handle) in zip(spline.bezier_points, points):
|
|
point.co = co
|
|
point.handle_left_type = "AUTO"
|
|
point.handle_right_type = "AUTO"
|
|
spline.use_cyclic_u = False
|
|
object_ = bpy.data.objects.new("WebGapCurveObject", curve)
|
|
bpy.context.collection.objects.link(object_)
|
|
bpy.ops.wm.save_as_mainfile(filepath=output, compress=True)
|
|
|
|
if __name__ == "__main__":
|
|
args = sys.argv[sys.argv.index("--") + 1:]
|
|
if len(args) != 1: raise SystemExit("usage: blender -b --python generate-curve-fixture.py -- OUTPUT")
|
|
main(args[0])
|