#!/usr/bin/env python3 import hashlib import json import pathlib import sys import tempfile import os import bpy def report(): brush = bpy.data.brushes.get("WebGapBrush") if brush is None: raise RuntimeError("WebGapBrush is missing") return {"name": brush.name, "size": brush.size, "alpha": round(float(brush.strength), 6), "hardness": round(float(brush.hardness), 6), "spacing": brush.spacing, "jitter": round(float(brush.jitter), 6), "sculptTool": str(brush.sculpt_brush_type)} def main(): args = sys.argv[sys.argv.index("--") + 1:] if len(args) != 2: raise SystemExit("usage: blender -b --python check-brush-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-brush-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"brush save/reopen drift: {before} != {after}") value = {"schemaVersion": 1, "task": "M16-GAP-00003", "operation": "BRUSH_DATABLOCK_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "brush": 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"brush-desktop-ok name={after['name']} size={after['size']} saveReopen=exact") if __name__ == "__main__": main()