Rebuild local Blender WASM environment and recovery evidence
This commit is contained in:
73
tools/web/generated/WBV2-P1-004.py
Normal file
73
tools/web/generated/WBV2-P1-004.py
Normal file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
TEXT_NAME = "WBV2-P1-004-WorkerLifecycleContract"
|
||||
CONTRACT_ID = "workflow:harden_worker_cancel_restart_and_dispose"
|
||||
|
||||
|
||||
def contract():
|
||||
value = {
|
||||
"schemaVersion": 1,
|
||||
"contractId": CONTRACT_ID,
|
||||
"cancel": {
|
||||
"code": "OPEN_CANCELLED",
|
||||
"preservesRevision": True,
|
||||
"resultPublished": False,
|
||||
},
|
||||
"generation": {
|
||||
"afterRestart": 2,
|
||||
"initial": 1,
|
||||
"staleResult": "REJECTED",
|
||||
},
|
||||
"owners": {
|
||||
"cpu": {"afterCancel": 0, "afterDispose": 0, "afterRestart": 0, "peak": 1},
|
||||
"gpu": {"afterCancel": 0, "afterDispose": 0, "afterRestart": 0, "peak": 1},
|
||||
"wasm": {"afterCancel": 0, "afterDispose": 0, "afterRestart": 0, "peak": 1},
|
||||
},
|
||||
"budget": {
|
||||
"maxInputBytes": 1024 * 1024,
|
||||
"maxLiveRequests": 1,
|
||||
"releaseAfterCancel": True,
|
||||
},
|
||||
"dispose": {
|
||||
"doubleDispose": "NOOP",
|
||||
"idempotent": True,
|
||||
"released": True,
|
||||
},
|
||||
"extensions": {"futureField": {"kind": "opaque", "value": "preserve-me"}},
|
||||
}
|
||||
encoded = json.dumps(value, sort_keys=True, separators=(",", ":"))
|
||||
value["schemaHash"] = hashlib.sha256(encoded.encode("utf-8")).hexdigest()
|
||||
return value
|
||||
|
||||
|
||||
def main(output):
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WBV2P1004LifecycleMesh")
|
||||
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("WBV2P1004LifecycleObject", mesh)
|
||||
bpy.context.collection.objects.link(obj)
|
||||
text = bpy.data.texts.new(TEXT_NAME)
|
||||
text.write(json.dumps(contract(), 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-004.py -- OUTPUT")
|
||||
main(pathlib.Path(arguments[0]))
|
||||
Reference in New Issue
Block a user