21 lines
809 B
Python
21 lines
809 B
Python
#!/usr/bin/env python3
|
|
import sys
|
|
import bpy
|
|
|
|
def main(output):
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
parent = bpy.data.collections.new("WebGapCollection")
|
|
child = bpy.data.collections.new("WebGapChild")
|
|
bpy.context.scene.collection.children.link(parent)
|
|
parent.children.link(child)
|
|
mesh = bpy.data.meshes.new("WebGapCollectionMesh")
|
|
mesh.from_pydata([(0, 0, 0), (1, 0, 0), (0, 1, 0)], [], [(0, 1, 2)])
|
|
object_ = bpy.data.objects.new("WebGapCollectionObject", mesh)
|
|
child.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-collection-fixture.py -- OUTPUT")
|
|
main(args[0])
|