Files
mes123456 c2c65d3a09
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
Rebuild local Blender WASM environment and recovery evidence
2026-08-27 20:22:15 +08:00

46 lines
1.7 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 = "WBV2P3002AnimationScene"
scene.frame_start = 1
scene.frame_end = 40
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 0, 0))
cube = bpy.context.object
cube.name = "WBV2P3002AnimatedCube"
cube.data.name = "WBV2P3002AnimatedCubeMesh"
cube.select_set(True)
bpy.context.view_layer.objects.active = cube
keyframes = {
1: ((0, 0, 0), (0, 0, 0), (1, 1, 1)),
10: ((1, 2, 0.5), (0.1, 0.2, 0.3), (1.2, 0.8, 1.1)),
20: ((2, 0, 1), (0.4, 0.1, 0.6), (0.9, 1.3, 1.0)),
}
for frame, (location, rotation, scale) in keyframes.items():
scene.frame_set(frame)
cube.location = location
cube.rotation_euler = rotation
cube.scale = scale
cube.keyframe_insert(data_path="location", frame=frame)
cube.keyframe_insert(data_path="rotation_euler", frame=frame)
cube.keyframe_insert(data_path="scale", frame=frame)
if cube.animation_data and cube.animation_data.action:
cube.animation_data.action.name = "WBV2P3002TRSAction"
scene.frame_set(1)
scene.world = bpy.data.worlds.new("WBV2P3002AnimationWorld")
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-P3-002.py -- OUTPUT")
main(arguments[0])