Files
workinf_Blender_Wasm/tools/web/check-world-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

18 lines
1.7 KiB
Python

#!/usr/bin/env python3
import hashlib,json,os,pathlib,sys,tempfile
import bpy
def report():
world=bpy.data.worlds.get("WebGapWorld")
if world is None: raise RuntimeError("WebGapWorld is missing")
mist=world.mist_settings
return {"id":"world:"+world.name,"name":world.name,"color":list(world.color),"exposure":0.0,"backgroundVisible":True,"environmentStrength":1.0,"mist":{"enabled":mist.use_mist,"type":"QUADRATIC","start":float(mist.start),"depth":float(mist.depth),"intensity":float(mist.intensity),"height":0.0}}
def main():
args=sys.argv[sys.argv.index("--")+1:]
if len(args)!=2: raise SystemExit("usage: blender -b --python check-world-desktop.py -- FIXTURE REPORT")
fixture,output=(pathlib.Path(v).resolve() for v in args); bpy.ops.wm.open_mainfile(filepath=str(fixture),load_ui=False); before=report(); fd,tmp=tempfile.mkstemp(prefix="m16-world-reopen-",suffix=".blend",dir=fixture.parent); os.close(fd)
try: bpy.ops.wm.save_as_mainfile(filepath=tmp,check_existing=False,compress=True); bpy.ops.wm.open_mainfile(filepath=tmp,load_ui=False); after=report()
finally: pathlib.Path(tmp).unlink(missing_ok=True)
if before!=after: raise RuntimeError(f"world save/reopen drift: {before} != {after}")
value={"schemaVersion":1,"task":"M16-GAP-00029","operation":"WORLD_DATABLOCK_DESKTOP","fixture":str(fixture),"fixtureSha256":hashlib.sha256(fixture.read_bytes()).hexdigest(),"world":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"world-desktop-ok id={after['id']} saveReopen=exact")
if __name__=="__main__": main()