Bridge-C evidence spike: unitypackage extraction, rest-pose recon, garment transplant onto the Quaternius rig (Data Transfer POLYINTERP_NEAREST), 11-body batch fit, Godot QA scenes. Technical PASS; route nonetheless REJECTED by product call (cost, baked body-segment modularity, style) — full trail on T-1089. Salvage: source-agnostic transplant/batch-fit scripts (the G1-family pipeline for any donor mesh) and the T-1090 discovery (5 body types misrender bare). Extracted vendor payload (spikes/**/raw/) now gitignored. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Extract a .unitypackage (gzipped tar of GUID dirs) into real paths.
|
|
|
|
Copies the raw `asset` bytes of every FBX/texture/metadata entry to
|
|
raw/<original pathname>. Prints a summary by extension.
|
|
"""
|
|
import sys
|
|
import tarfile
|
|
import shutil
|
|
from pathlib import Path
|
|
from collections import Counter
|
|
|
|
KEEP = {".fbx", ".png", ".tga", ".json", ".txt", ".sk", ".asset"}
|
|
|
|
|
|
def main(pkg: str, out_root: str) -> None:
|
|
out = Path(out_root)
|
|
out.mkdir(parents=True, exist_ok=True)
|
|
counts: Counter = Counter()
|
|
with tarfile.open(pkg, "r:gz") as tar:
|
|
members = {m.name: m for m in tar.getmembers()}
|
|
guids = sorted({name.split("/")[0] for name in members if "/" in name})
|
|
for guid in guids:
|
|
pn = members.get(f"{guid}/pathname")
|
|
asset = members.get(f"{guid}/asset")
|
|
if pn is None or asset is None:
|
|
continue
|
|
pathname = tar.extractfile(pn).read().decode("utf-8").splitlines()[0].strip()
|
|
ext = Path(pathname).suffix.lower()
|
|
if ext not in KEEP:
|
|
counts[f"(skipped {ext or 'dir'})"] += 1
|
|
continue
|
|
dest = out / pathname
|
|
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
with tar.extractfile(asset) as src, open(dest, "wb") as dst:
|
|
shutil.copyfileobj(src, dst)
|
|
counts[ext] += 1
|
|
for ext, n in sorted(counts.items()):
|
|
print(f"{ext}\t{n}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main(sys.argv[1], sys.argv[2])
|