Rebuild local Blender WASM environment and recovery evidence
This commit is contained in:
36
tools/web/generated/WBV2-P2-004.py
Normal file
36
tools/web/generated/WBV2-P2-004.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
from mathutils import Vector
|
||||
|
||||
|
||||
def main(output):
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
scene = bpy.context.scene
|
||||
scene.name = "WBV2P2004ViewportScene"
|
||||
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 0, 0))
|
||||
cube = bpy.context.object
|
||||
cube.name = "WBV2P2004ViewportCube"
|
||||
cube.data.name = "WBV2P2004ViewportCubeMesh"
|
||||
cube.select_set(True)
|
||||
bpy.context.view_layer.objects.active = cube
|
||||
|
||||
camera_data = bpy.data.cameras.new("WBV2P2004ViewportCamera")
|
||||
camera = bpy.data.objects.new("WBV2P2004ViewportCamera", camera_data)
|
||||
scene.collection.objects.link(camera)
|
||||
camera.location = (6.5, -6.5, 4.75)
|
||||
camera.rotation_euler = (Vector((0, 0, 0)) - camera.location).to_track_quat("-Z", "Y").to_euler()
|
||||
camera_data.lens = 52
|
||||
scene.camera = camera
|
||||
scene.world = bpy.data.worlds.new("WBV2P2004ViewportWorld")
|
||||
scene.world.color = (0.055, 0.065, 0.08)
|
||||
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-P2-004.py -- OUTPUT")
|
||||
main(arguments[0])
|
||||
Reference in New Issue
Block a user