Files
workinf_Blender_Wasm/tools/web/generated/WBV2-P1-003.py
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

44 lines
1.5 KiB
Python

#!/usr/bin/env python3
import json
import pathlib
import sys
import bpy
TEXT_NAME = "WBV2-P1-003-TransactionContract"
def main(output):
bpy.ops.wm.read_factory_settings(use_empty=True)
mesh = bpy.data.meshes.new("WBV2P1003CubeMesh")
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("WBV2P1003CubeObject", mesh)
bpy.context.collection.objects.link(obj)
text = bpy.data.texts.new(TEXT_NAME)
text.write(json.dumps({
"schemaVersion": 1,
"contractId": "workflow:unify_main_transaction_history_and_save",
"initialVisibility": True,
"mutation": {"command": "setObjectVisibility", "visible": False},
"history": {"failedCommandAddsHistory": False, "undoRedo": "SUPPORTED"},
"revision": {"staleCommit": "REJECTED"},
"save": {"atomic": True, "byteStable": True},
}, sort_keys=True, separators=(",", ":")))
text.use_fake_user = True
bpy.ops.wm.save_as_mainfile(filepath=str(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-P1-003.py -- OUTPUT")
main(pathlib.Path(arguments[0]))