Files
workinf_Blender_Wasm/tools/web/generate-curve-fixture.py
mes123456 10640aeb3c
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
Govern task context and advance execution pointer
2026-08-20 06:02:43 -04:00

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])