Add Chromium-only Blender WebEngine parity work
This commit is contained in:
26
tools/web/generate-topology-fixture.py
Normal file
26
tools/web/generate-topology-fixture.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def add_mesh(name, vertices, faces):
|
||||
mesh = bpy.data.meshes.new(name)
|
||||
mesh.from_pydata(vertices, [], faces)
|
||||
mesh.update()
|
||||
obj = bpy.data.objects.new(name + "Object", mesh)
|
||||
bpy.context.collection.objects.link(obj)
|
||||
return obj
|
||||
|
||||
|
||||
def main(output_path: str) -> None:
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
add_mesh("OpenQuad", [(-1, -1, 0), (1, -1, 0), (1, 1, 0), (-1, 1, 0)], [(0, 1, 2, 3)])
|
||||
add_mesh("OpenNgon", [(0, 1, 0), (1, 0.3, 0), (0.6, -1, 0), (-0.6, -1, 0), (-1, 0.3, 0)], [(0, 1, 2, 3, 4)])
|
||||
add_mesh("NonManifold", [(0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1), (0, -1, 0)], [(0, 1, 2), (0, 3, 1), (0, 1, 4)])
|
||||
bpy.ops.wm.save_as_mainfile(filepath=output_path, compress=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if "--" not in sys.argv or len(sys.argv) <= sys.argv.index("--") + 1:
|
||||
raise SystemExit("usage: blender -b --python generate-topology-fixture.py -- output.blend")
|
||||
main(sys.argv[sys.argv.index("--") + 1])
|
||||
Reference in New Issue
Block a user