29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
import pathlib
|
|
import sys
|
|
|
|
import bpy
|
|
|
|
|
|
def main(output: pathlib.Path) -> None:
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
mesh = bpy.data.meshes.new("WebGapPointCloudSeed")
|
|
mesh.from_pydata([(-1.0, 0.0, 0.0), (0.0, 1.0, 0.5), (1.0, 0.0, 1.0), (0.0, -1.0, 1.5)], [], [])
|
|
obj = bpy.data.objects.new("WebGapPointCloudObject", mesh)
|
|
bpy.context.collection.objects.link(obj)
|
|
bpy.context.view_layer.objects.active = obj
|
|
obj.select_set(True)
|
|
bpy.ops.object.convert(target="POINTCLOUD")
|
|
data = obj.data
|
|
data.name = "WebGapPointCloud"
|
|
radius = data.attributes.new("radius", "FLOAT", "POINT")
|
|
radius.data.foreach_set("value", [0.25, 0.5, 0.75, 1.0])
|
|
bpy.ops.wm.save_as_mainfile(filepath=str(output.resolve()), check_existing=False, compress=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
|
if len(arguments) != 1:
|
|
raise SystemExit("usage: blender -b --python M16-GAP-00019.py -- OUTPUT")
|
|
main(pathlib.Path(arguments[0]))
|