| |
| """Exhaustive check of EVERY animation & character FBX + full API cross-check of |
| every prompt and character. Usage: python3 full_check.py [tokfile]""" |
| import json, os, re, sys, time |
| HERE=os.path.dirname(os.path.abspath(__file__)); sys.path.insert(0,HERE) |
| from fbx_frames import parse as fp |
| import mixamo_download as M |
| ROOT=os.path.dirname(HERE) |
| ADIR,CDIR=os.path.join(ROOT,"animation"),os.path.join(ROOT,"character") |
| tok=sys.argv[1] if len(sys.argv)>1 else None |
| MAGIC=b"Kaydara FBX Binary" |
| prob=[]; W=lambda m:(prob.append(m),print(" ✗",m)) |
|
|
| P=json.load(open(os.path.join(ROOT,"animation_prompts.json"))) |
| F=json.load(open(os.path.join(ROOT,"animation_frames.json"))) |
| C=json.load(open(os.path.join(ROOT,"characters.json"))) |
| af=sorted(f for f in os.listdir(ADIR) if f.endswith(".fbx")) |
| cf=sorted(f for f in os.listdir(CDIR) if f.endswith(".fbx")) |
|
|
| print("=== A. EVERY animation FBX (%d) ==="%len(af)) |
| noanim=[]; tiny=[]; norig=[]; badhdr=[]; badparse=[]; fmax={}; bones={} |
| for i,f in enumerate(af): |
| p=os.path.join(ADIR,f); b=open(p,"rb").read() |
| if MAGIC not in b[:64]: badhdr.append(f); continue |
| if len(b)<2000: tiny.append(f) |
| try: r=fp(p); fmax[f]=r["keys_max"] |
| except Exception as e: badparse.append((f,str(e)[:40])); continue |
| if b"LimbNode" not in b: norig.append(f) |
| if b"KeyTime" not in b: noanim.append(f) |
| bones[f]=len(set(re.findall(rb'mixamorig:[A-Za-z0-9_]+',b))) |
| if (i+1)%500==0: print(" parsed",i+1,flush=True) |
| for lbl,lst in [("bad header",badhdr),("parse fail",badparse),("too small",tiny), |
| ("no skeleton",norig),("no animation curves",noanim)]: |
| if lst: W("%d %s: %s"%(len(lst),lbl,lst[:5])) |
| if not any([badhdr,badparse,tiny,norig,noanim]): print(" ✓ all rigged, animated, non-truncated") |
| bc=sorted(set(bones.values())); print(" bone-name counts across files:",bc[:8],"... " if len(bc)>8 else "") |
|
|
| print("=== B. EVERY character FBX (%d) ==="%len(cf)) |
| cnomesh=[]; cnorig=[]; ctiny=[]; cbad=[] |
| for f in cf: |
| p=os.path.join(CDIR,f); b=open(p,"rb").read() |
| if MAGIC not in b[:64]: cbad.append(f); continue |
| if len(b)<10000: ctiny.append((f,len(b))) |
| try: fp(p) |
| except Exception as e: cbad.append((f,str(e)[:30])); continue |
| if b.count(b"Vertices")<1: cnomesh.append(f) |
| if b"LimbNode" not in b: cnorig.append(f) |
| for lbl,lst in [("bad/parse",cbad),("no mesh",cnomesh),("no skeleton",cnorig),("tiny",ctiny)]: |
| if lst: W("%d %s: %s"%(len(lst),lbl,lst[:5])) |
| if not any([cbad,cnomesh,cnorig,ctiny]): print(" ✓ all 114 valid, skinned, rigged") |
|
|
| print("=== C. three-way key consistency ===") |
| sa=set(af) |
| for nm,keys in [("prompts",P),("frames",F)]: |
| if set(keys)!=sa: W("%s keys != animation files (miss %d, extra %d)"%(nm,len(sa-set(keys)),len(set(keys)-sa))) |
| if set(C)!=set(cf): W("characters.json != character files") |
| if set(P)==set(F)==sa and set(C)==set(cf): print(" ✓ prompts == frames == 2446 anim files; characters == 114") |
|
|
| print("=== D. frames == freshly parsed (ALL) ===") |
| mm=[(k,F[k],fmax.get(k)) for k in F if fmax.get(k)!=F[k]] |
| if mm: W("%d frame mismatches: %s"%(len(mm),mm[:5])) |
| else: print(" ✓ all %d frame values == parsed FBX keyframes"%len(F)) |
| z=[k for k,v in F.items() if not isinstance(v,int) or v<1]; |
| if z: W("%d non-positive frame values: %s"%(len(z),z[:5])) |
| print(" frame stats: min %d max %d mean %.0f"%(min(F.values()),max(F.values()),sum(F.values())/len(F))) |
|
|
| print("=== E. prompts well-formed + unique ids ===") |
| badp=[k for k,v in P.items() if not v.get("prompt") or not re.match(r'^[0-9a-f-]{20,}$',str(v.get("motion_id","")))] |
| if badp: W("%d malformed prompt entries: %s"%(len(badp),badp[:5])) |
| else: print(" ✓ all prompts have text + well-formed motion_id") |
| ids=[v["motion_id"] for v in P.values()] |
| if len(ids)!=len(set(ids)): W("duplicate motion_ids: %d"%(len(ids)-len(set(ids)))) |
| else: print(" ✓ %d motion_ids all unique"%len(ids)) |
|
|
| if tok: |
| import requests |
| t=open(tok).read().strip(); s=requests.Session(); s.headers.update(M.headers(t)) |
| print("=== F. FULL API cross-check: ALL %d prompts ==="%len(P)) |
| nmiss=[]; idfail=[]; done=0 |
| for f in af: |
| mid=P[f]["motion_id"] |
| try: |
| det=M.get(s,"https://www.mixamo.com/api/v1/products/%s"%mid,params={"character_id":M.Y_BOT}) |
| if det.get("name")!=P[f]["prompt"]: nmiss.append((f,det.get("name"),P[f]["prompt"])) |
| except Exception as e: idfail.append((f,str(e)[:30])) |
| done+=1 |
| if done%400==0: print(" checked %d/%d (name-mismatch %d, id-fail %d)"%(done,len(af),len(nmiss),len(idfail)),flush=True) |
| time.sleep(0.08) |
| if nmiss: W("%d prompt-name mismatches: %s"%(len(nmiss),nmiss[:8])) |
| else: print(" ✓ all %d prompt names match Mixamo API"%len(af)) |
| if idfail: W("%d motion_id lookups failed: %s"%(len(idfail),idfail[:8])) |
| else: print(" ✓ all %d motion_ids resolve on the API"%len(af)) |
|
|
| print("=== G. FULL API cross-check: ALL %d characters ==="%len(C)) |
| cmiss=[]; cfail=[] |
| for f in cf: |
| u=C[f]["uuid"] |
| try: |
| det=M.get(s,"https://www.mixamo.com/api/v1/characters/%s"%u) |
| if det.get("name")!=C[f]["name"]: cmiss.append((f,det.get("name"),C[f]["name"])) |
| except Exception as e: cfail.append((f,str(e)[:30])) |
| time.sleep(0.08) |
| if cmiss: W("%d character-name mismatches: %s"%(len(cmiss),cmiss[:8])) |
| else: print(" ✓ all 114 character names match API") |
| if cfail: W("%d character uuids failed: %s"%(len(cfail),cfail[:5])) |
|
|
| print("\n===== FINAL: PROBLEMS = %d ====="%len(prob)) |
| print("✓✓ EVERYTHING VERIFIED — animations, characters, prompts, frames all complete & correct" if not prob else "SEE PROBLEMS ABOVE") |
|
|