Govern task context and advance execution pointer
This commit is contained in:
32
tools/web/generated/modifier_gap_fixture.py
Normal file
32
tools/web/generated/modifier_gap_fixture.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def create_mesh_object(name: str):
|
||||
mesh = bpy.data.meshes.new(name + "Mesh")
|
||||
mesh.from_pydata(
|
||||
[(-1, -1, -1), (1, -1, -1), (1, 1, -1), (-1, 1, -1),
|
||||
(-1, -1, 1), (1, -1, 1), (1, 1, 1), (-1, 1, 1)],
|
||||
[],
|
||||
[(0, 1, 2, 3), (4, 7, 6, 5), (0, 4, 5, 1),
|
||||
(1, 5, 6, 2), (2, 6, 7, 3), (4, 0, 3, 7)],
|
||||
)
|
||||
mesh.update()
|
||||
obj = bpy.data.objects.new(name, mesh)
|
||||
bpy.context.collection.objects.link(obj)
|
||||
return obj
|
||||
|
||||
|
||||
def generate(output: pathlib.Path, modifier_type: str, stem: str) -> None:
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
obj = create_mesh_object(stem + "Object")
|
||||
modifier = obj.modifiers.new(name=stem, type=modifier_type)
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = True
|
||||
modifier.show_in_editmode = False
|
||||
modifier.show_on_cage = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(output.resolve()), check_existing=False, compress=True)
|
||||
Reference in New Issue
Block a user