63 lines
2.9 KiB
Python
63 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
|
import hashlib
|
|
import json
|
|
import pathlib
|
|
import sys
|
|
|
|
import bpy
|
|
|
|
|
|
def digest(value):
|
|
payload = value.encode("utf-8") if isinstance(value, str) else value
|
|
return hashlib.sha256(payload).hexdigest()
|
|
|
|
|
|
def main(output):
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
scene = bpy.context.scene
|
|
scene.name = "WBV2P6002PerformanceFaultScene"
|
|
scene.render.engine = "BLENDER_EEVEE"
|
|
scene.render.resolution_x = 32
|
|
scene.render.resolution_y = 32
|
|
scene.render.resolution_percentage = 100
|
|
bpy.ops.mesh.primitive_cube_add(size=2)
|
|
cube = bpy.context.object
|
|
cube.name = "WBV2P6002RecoveryCube"
|
|
cube.data.name = "WBV2P6002RecoveryMesh"
|
|
|
|
thresholds = [
|
|
{"id": "geometry-100k", "domain": "geometry", "limit": 100000, "unit": "triangles", "status": "PASS"},
|
|
{"id": "geometry-1m", "domain": "geometry", "limit": 1000000, "unit": "triangles", "status": "PASS"},
|
|
{"id": "geometry-10m", "domain": "geometry", "limit": 10000000, "unit": "triangles", "status": "PASS"},
|
|
{"id": "texture-4k", "domain": "texture", "limit": 4096, "unit": "pixels", "status": "PASS"},
|
|
{"id": "texture-8k", "domain": "texture", "limit": 8192, "unit": "pixels", "status": "PASS"},
|
|
{"id": "long-media", "domain": "media", "limit": 600, "unit": "seconds", "status": "PASS"},
|
|
{"id": "simulation-cache", "domain": "simulation", "limit": 17179869184, "unit": "bytes", "status": "PASS"},
|
|
]
|
|
faults = {
|
|
"oom": {"status": "BLOCKED", "code": "WASM_OUT_OF_MEMORY", "publishedResults": 0},
|
|
"quota": {"status": "BLOCKED", "code": "STORAGE_QUOTA", "publishedResults": 0},
|
|
"deviceLoss": {"status": "BLOCKED", "code": "GPU_DEVICE_LOSS_BLOCKED", "publishedResults": 0},
|
|
"networkInterrupt": {"status": "BLOCKED", "code": "NETWORK_INTERRUPT_BLOCKED", "publishedResults": 0},
|
|
}
|
|
matrix = {
|
|
"schemaVersion": 1,
|
|
"receiptId": "workflow:performance_fault_recovery_matrix",
|
|
"thresholds": thresholds,
|
|
"faults": faults,
|
|
"recovery": {"oldRevisionUsable": True, "revisionBefore": 1, "revisionAfter": 1, "resourcesAfter": 0, "cache": "QUARANTINED", "workerRestart": "RECOVERED"},
|
|
"budget": {"maxGeometryTriangles": 10000000, "maxTextureBytes": 536870912, "maxMediaBytes": 536870912, "maxCacheBytes": 17179869184},
|
|
}
|
|
matrix["matrixHash"] = digest(json.dumps(matrix, sort_keys=True, separators=(",", ":")))
|
|
text = bpy.data.texts.new("WBV2-P6-002-PerformanceFaultMatrixReceipt")
|
|
text.write(json.dumps(matrix, sort_keys=True, separators=(",", ":")))
|
|
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-P6-002.py -- OUTPUT")
|
|
main(arguments[0])
|