#!/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("WebGapMesh") mesh.from_pydata( [(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.25), (-1.0, 1.0, 0.25)], [], [(0, 1, 2, 3)], ) uv_layer = mesh.uv_layers.new(name="WebGapUV") for loop, uv in zip(uv_layer.data, [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)]): loop.uv = uv mesh.update() mesh_object = bpy.data.objects.new("WebGapMeshObject", mesh) bpy.context.collection.objects.link(mesh_object) 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-00014.py -- OUTPUT") main(pathlib.Path(arguments[0]))