Files
workinf_Blender_Wasm/web/probes/diag-cavity.mjs
mes123456 63db6caf1f
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
feat(web): studio worlds, camera-view/offscreen environment parity, material and undo coverage
Environment lighting:
- ship all eight desktop studiolights/world datasets (WBENV1 float32) and a
  shared loader used by both the main viewport and the offscreen worker
- add the N-panel "studio 环境" selector
- rotate the world background together with the environment
  (backgroundRotation/backgroundIntensity), so camera view and offscreen
  renders match the desktop Mapping-node behaviour

Verification (Chromium, OPFS, NOT_CLAIMED):
- environment lighting + 8 world pixel identity
- camera-view rotation correspondence (camera matrices, 207 samples)
- offscreen vs on-screen background parity after hiding geometry (1305 samples)
- metals case extended with material-field OPFS roundtrip
- material Principled edits and rename undo/redo
- eight studio worlds: pairwise frame differences + luminance rank correlation
- undo history depth capped at 64 steps and undo across OPFS save/reopen

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 09:27:47 +08:00

50 lines
2.5 KiB
JavaScript

import { createRequire } from 'node:module';
const WEB='/home/mes123456/workinf_Blender_Wasm/web';
const { chromium }=createRequire(WEB+'/package.json')('playwright');
const BASE='http://127.0.0.1:5184';
const args=['--no-sandbox','--use-gl=angle','--use-angle=gl','--ignore-gpu-blocklist'];
const browser=await chromium.launch({headless:false,args,executablePath:'/usr/bin/google-chrome'});
const page=await browser.newPage({viewport:{width:1500,height:950}});
const cdp=await page.context().newCDPSession(page);
await cdp.send('Network.enable');
await cdp.send('Network.setCacheDisabled',{cacheDisabled:true});
const seen=[]; page.on('response',async r=>{ if(r.url().includes('workbench-post')) seen.push({url:r.url().slice(-60),status:r.status()}); });
const errs=[]; page.on('pageerror',e=>errs.push(String(e).slice(0,240)));
await page.goto(BASE+'/?ui=web',{waitUntil:'domcontentloaded'});
await page.waitForTimeout(22000);
const canvas=page.locator('canvas.viewport-canvas').first();
await canvas.click({position:{x:420,y:320}}).catch(()=>{});
await page.waitForTimeout(900);
for(let i=0;i<5;i++){
const s=await page.evaluate(()=>document.querySelector('canvas.viewport-canvas')?.dataset.shadingMode);
if(s==='solid')break;
await page.locator('[aria-label="着色模式"]').click().catch(()=>{});
await page.waitForTimeout(900);
}
const ROW=`(y)=>{
const c=document.querySelector('canvas.viewport-canvas');
const gl=c.getContext('webgl2',{preserveDrawingBuffer:true});
const w=gl.drawingBufferWidth,h=gl.drawingBufferHeight;
const px=new Uint8Array(w*4);
gl.readPixels(0,Math.round(h*(y??0.5)),w,1,gl.RGBA,gl.UNSIGNED_BYTE,px);
const out=[];
for(let x=0;x<w;x+=Math.max(1,Math.round(w/40))){
out.push([x,px[x*4],px[x*4+1],px[x*4+2]]);
}
return {w,h,px:out};
}`;
const row=(y)=>page.evaluate(`(${ROW})(${y})`);
const off=await row(0.5);
await page.evaluate(`(()=>{const el=document.querySelector('[aria-label="空腔"]');const s=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,'checked').set;s.call(el,true);el.dispatchEvent(new Event('click',{bubbles:true}));el.dispatchEvent(new Event('change',{bubbles:true}));})()`);
await page.waitForTimeout(2500);
const on=await row(0.5);
console.log('drawingBuffer', off.w, off.h);
console.log('x OFF r,g,b ON r,g,b');
for(let i=0;i<off.px.length;i++){
const [x,r1,g1,b1]=off.px[i], [,r2,g2,b2]=on.px[i];
console.log(String(x).padStart(4), `depth r=${r2} g=${g2} b=${b2}`);
}
console.log('workbench-post fetches:',JSON.stringify(seen));
console.log('errors:',errs.slice(0,4));
await browser.close();