Files
workinf_Blender_Wasm/tools/web/check-curves-desktop.py
mes123456 10640aeb3c
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
Govern task context and advance execution pointer
2026-08-20 06:02:43 -04:00

26 lines
1.8 KiB
Python

#!/usr/bin/env python3
import hashlib
import json
import pathlib
import sys
import tempfile
import os
import bpy
def report():
curves = bpy.data.hair_curves.get("WebGapCurves") or bpy.data.curves.get("WebGapCurves")
if curves is None: raise RuntimeError("WebGapCurves is missing")
geometry = getattr(curves, "curves", None)
return {"name": curves.name, "pointCount": len(curves.attributes.get("position").data) if curves.attributes.get("position") else 0, "curveCount": len(geometry) if geometry is not None else 0}
def main():
args = sys.argv[sys.argv.index("--") + 1:]
if len(args) != 2: raise SystemExit("usage: blender -b --python check-curves-desktop.py -- FIXTURE REPORT")
fixture, output = (pathlib.Path(value).resolve() for value in args)
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False); before = report(); descriptor, temporary = tempfile.mkstemp(prefix="m16-curves-reopen-", suffix=".blend"); os.close(descriptor)
try: bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True); bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False); after = report()
finally: pathlib.Path(temporary).unlink(missing_ok=True)
if before != after: raise RuntimeError(f"Curves save/reopen drift: {before} != {after}")
value = {"schemaVersion": 1, "task": "M16-GAP-00007", "operation": "CURVES_DATABLOCK_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "curves": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}; output.parent.mkdir(parents=True, exist_ok=True); output.write_text(json.dumps(value, indent=2, sort_keys=True) + "\n", encoding="utf-8"); print(f"curves-desktop-ok name={after['name']} saveReopen=exact")
if __name__ == "__main__": main()