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>
This commit is contained in:
@@ -91,7 +91,13 @@ async function finish(entry){
|
||||
await entry.process.completion;
|
||||
if(entry.result)return;
|
||||
if(entry.process.receipt.cancelRequested)throw new Error('NATIVE_JOB_TIMEOUT');
|
||||
if(entry.process.child.exitCode!==0)throw new Error('NATIVE_PROCESS_FAILED: '+entry.stderr.slice(-4096));
|
||||
if(entry.process.child.exitCode!==0){
|
||||
// `Killed` in stderr says a signal ended the process, not which one or who
|
||||
// sent it. Record the child's own signal and the supervisor's tree signal
|
||||
// so the next occurrence identifies its source instead of being guessed at.
|
||||
const receipt=entry.process.receipt,detail=`exit=${entry.process.child.exitCode} signal=${entry.process.child.signalCode??'none'} treeSignal=${receipt?.treeSignal??'none'} cancel=${receipt?.cancelRequested??false}`;
|
||||
throw new Error(`NATIVE_PROCESS_FAILED[${detail}]: `+entry.stderr.slice(-4096));
|
||||
}
|
||||
const p=path.join(entry.workspace,'result.json');
|
||||
if(fs.lstatSync(p).isSymbolicLink()||fs.statSync(p).size>2*1024*1024)throw new Error('NATIVE_RESULT_INVALID');
|
||||
const result=JSON.parse(fs.readFileSync(p,'utf8'));if(result.status==='FAILED'&&typeof result.error==='string'){const code=/^([A-Z][A-Z0-9_.-]*)(?::|$)/u.exec(result.error)?.[1];if(code)result.errorCode=code;}
|
||||
@@ -164,7 +170,18 @@ function launch(workspace,request,options,persistent=false,sessionWorkspace){
|
||||
args.push('--setenv',`BLENDER_USER_${name.toUpperCase()}`,directory);
|
||||
}
|
||||
const prlimit=executable('prlimit');if(!prlimit)fail('NATIVE_RESOURCE_LIMITER_NOT_INSTALLED',503);
|
||||
args.push(prlimit,'--as=8589934592','--fsize=536870912',persistent?'--cpu=7200':'--cpu=600','--');
|
||||
// RLIMIT_CPU counts CPU-seconds summed over every thread, not wall time, so a
|
||||
// threaded EEVEE render burns a 600 s budget in tens of seconds (measured:
|
||||
// 3821 s CPU in 250 s wall on 20 cores) and dies by SIGKILL mid-animation.
|
||||
// Blender's own animation render has no CPU-time cap; the job's wall-clock
|
||||
// timeoutMs already bounds the run, so only guard against a CPU runaway.
|
||||
// RLIMIT_AS is the address-space cap, and an FFMPEG animation render needs
|
||||
// more than a still: measured 8 GiB dying with a bare `Killed` two frames in.
|
||||
// Keep a bounded default but let a deployment raise it, and give renders
|
||||
// headroom because encoding holds frames in memory.
|
||||
const memoryLimit=Number(options.memoryBytes??process.env.BLENDER_WORKFLOW_MEMORY_BYTES??0)
|
||||
|| (request.kind==='RENDER'?16*1024*1024*1024:8*1024*1024*1024);
|
||||
args.push(prlimit,`--as=${Math.trunc(memoryLimit)}`,'--fsize=536870912',persistent?'--cpu=86400':'--cpu=21600','--');
|
||||
const width=persistent?request.desktop?.width??1280:1280,height=persistent?request.desktop?.height??900:900;
|
||||
if(gui){const xvfb=executable('xvfb-run');if(!xvfb)fail('NATIVE_VIRTUAL_DISPLAY_NOT_INSTALLED',503);args.push(xvfb,'-a',`--server-args=-screen 0 ${width}x${height}x24 -nolisten tcp`);}
|
||||
if(persistent)args.push('/usr/bin/python3',path.join(ROOT,'tools/web/native-desktop-host.py'),workspace);
|
||||
|
||||
Reference in New Issue
Block a user