Capture M16 gap execution artifacts
This commit is contained in:
65
tools/web/check-action-stash-desktop.py
Normal file
65
tools/web/check-action-stash-desktop.py
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def nla_report():
|
||||
obj = bpy.data.objects.get("WebGapStashObject")
|
||||
if obj is None or obj.animation_data is None:
|
||||
raise RuntimeError("WebGapStashObject animation data is missing")
|
||||
tracks = []
|
||||
for track in obj.animation_data.nla_tracks:
|
||||
tracks.append({
|
||||
"name": track.name,
|
||||
"strips": [{
|
||||
"name": strip.name,
|
||||
"action": strip.action.name if strip.action else None,
|
||||
"frameStart": round(float(strip.frame_start), 6),
|
||||
"frameEnd": round(float(strip.frame_end), 6),
|
||||
} for strip in track.strips],
|
||||
})
|
||||
return {"activeAction": obj.animation_data.action.name if obj.animation_data.action else None, "tracks": tracks}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-stash-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = nla_report()
|
||||
if before["activeAction"] is not None or len(before["tracks"]) != 1 or len(before["tracks"][0]["strips"]) != 1:
|
||||
raise RuntimeError(f"unexpected action.stash result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-stash-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 = nla_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.stash save/reopen drift: {before} != {after}")
|
||||
report = {
|
||||
"schemaVersion": 1,
|
||||
"task": "M16-GAP-00144",
|
||||
"operation": "ACTION_STASH_DESKTOP",
|
||||
"fixture": str(fixture),
|
||||
"fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(),
|
||||
"nla": after,
|
||||
"saveReopen": "EXACT",
|
||||
"blenderVersion": bpy.app.version_string,
|
||||
}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-stash-desktop-ok tracks=1 strips=1 activeAction=none saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user