38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
import pathlib
|
|
import sys
|
|
|
|
import bpy
|
|
|
|
|
|
def main(output):
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
scene = bpy.context.scene
|
|
scene.name = "WBV2P2001Scene"
|
|
root = scene.collection
|
|
|
|
collection = bpy.data.collections.new("WBV2P2001OutlinerCollection")
|
|
root.children.link(collection)
|
|
mesh = bpy.data.meshes.new("WBV2P2001StableMesh")
|
|
mesh.from_pydata(
|
|
[(-1, -1, 0), (1, -1, 0), (0, 1, 0)],
|
|
[],
|
|
[(0, 1, 2)],
|
|
)
|
|
mesh.update()
|
|
obj = bpy.data.objects.new("WBV2P2001SelectedObject", mesh)
|
|
collection.objects.link(obj)
|
|
bpy.context.view_layer.objects.active = obj
|
|
obj.select_set(True)
|
|
|
|
# Keep the standard workspace/screen in the file so editorWorkflow has a
|
|
# real context while the data tree remains deliberately minimal.
|
|
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 --factory-startup --python WBV2-P2-001.py -- OUTPUT")
|
|
main(pathlib.Path(arguments[0]))
|