54 lines
1.8 KiB
Python
54 lines
1.8 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 = "WBV2P4001ModifierScene"
|
|
mesh = bpy.data.meshes.new("WBV2P4001ModifierMesh")
|
|
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), (0, 2, 3), (4, 6, 5), (4, 7, 6),
|
|
(0, 4, 5), (0, 5, 1), (1, 5, 6), (1, 6, 2),
|
|
(2, 6, 7), (2, 7, 3), (4, 0, 3), (4, 3, 7)],
|
|
)
|
|
mesh.update()
|
|
obj = bpy.data.objects.new("WBV2P4001ModifierObject", mesh)
|
|
bpy.context.collection.objects.link(obj)
|
|
bpy.context.view_layer.objects.active = obj
|
|
obj.select_set(True)
|
|
|
|
bevel = obj.modifiers.new("WBV2P4001Bevel", "BEVEL")
|
|
bevel.width = 0.12
|
|
bevel.segments = 2
|
|
bevel.profile = 0.5
|
|
bevel.show_viewport = True
|
|
bevel.show_render = True
|
|
decimate = obj.modifiers.new("WBV2P4001Decimate", "DECIMATE")
|
|
decimate.ratio = 0.75
|
|
decimate.iterations = 1
|
|
decimate.show_viewport = True
|
|
decimate.show_render = False
|
|
bpy.ops.object.particle_system_add()
|
|
particle_modifier = obj.modifiers[-1]
|
|
particle_modifier.name = "WBV2P4001UnsupportedParticle"
|
|
particle_modifier.show_viewport = True
|
|
particle_modifier.show_render = False
|
|
scene.frame_start = 1
|
|
scene.frame_end = 10
|
|
scene.frame_set(1)
|
|
bpy.ops.wm.save_as_mainfile(filepath=str(pathlib.Path(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-P4-001.py -- OUTPUT")
|
|
main(arguments[0])
|