feat(web): studio worlds, camera-view/offscreen environment parity, material and undo coverage
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

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:
mes123456
2026-11-23 09:27:47 +08:00
parent f96654b158
commit 63db6caf1f
325 changed files with 20004 additions and 762 deletions

View File

@@ -126,6 +126,124 @@ async function main() {
await shot("ch25-export-menu");
await closeMenu();
// Rendering chapters (24-26). The workspace tabs come from the native
// editor workflow once a scene is open, and only those carry `aria-current`;
// clicking the static fallback list would switch React state without
// switching the native screen, so wait for the workflow tabs first.
await page.waitForFunction(
() => [...document.querySelectorAll(".workspace-tab")].some((tab) => tab.getAttribute("aria-current") !== null),
null, { timeout: 60_000 });
const openRendering = async () => {
await page.evaluate(() => {
const tab = [...document.querySelectorAll(".workspace-tab")].find((item) => item.textContent === "Rendering");
if (tab instanceof HTMLElement) tab.click();
});
await page.waitForFunction(() => [...document.querySelectorAll(".workspace-tab")]
.some((tab) => tab.getAttribute("aria-current") !== null && tab.textContent === "Rendering"), null, { timeout: 30_000 });
await page.waitForTimeout(900);
};
await openRendering();
await shot("ch24-render-paths");
const pbrPanel = page.locator('section[aria-label="Web PBR 渲染"]');
await pbrPanel.scrollIntoViewIfNeeded();
await page.waitForTimeout(300);
await shot("ch24-pbr-panel");
// A real PBR render, so the screenshot shows an actual frame and the OPFS
// copy line rather than an empty result area.
await pbrPanel.locator('select[aria-label="PBR 渲染分辨率"]').selectOption("512");
await pbrPanel.getByRole("button", { name: "渲染 PBR", exact: true }).click();
await pbrPanel.locator(".pbr-render-result img").waitFor({ timeout: 120_000 });
await page.waitForTimeout(400);
await shot("ch24-opfs-render-record");
const nativeFallback = page.locator("details.native-render-fallback");
if (!await nativeFallback.evaluate((element) => element.open)) {
await nativeFallback.locator("summary").click();
}
await nativeFallback.locator(".native-render-panel").waitFor({ timeout: 30_000 });
await page.waitForTimeout(600);
await shot("ch25-native-panel");
await nativeFallback.locator('select[aria-label="Engine"]').selectOption("BLENDER_EEVEE");
await nativeFallback.locator('select[aria-label="Format"]').selectOption("PNG");
await page.waitForTimeout(300);
await shot("ch25-engine-format");
// A real EEVEE frame: the chapter tells the reader what the status line and
// artifact list look like after it succeeds, so capture that state.
await nativeFallback.getByRole("button", { name: "Render Frame", exact: true }).click();
await page.waitForFunction(
() => /SUCCEEDED|FAILED|failed/i.test(document.querySelector("details.native-render-fallback pre[role=status]")?.textContent ?? ""),
null, { timeout: 120_000 });
await page.waitForTimeout(600);
await shot("ch25-render-frame");
await nativeFallback.locator('select[aria-label="Format"]').selectOption("FFMPEG");
await page.waitForTimeout(300);
await shot("ch25-animation-format");
// Chapter 26 runs the same project at the default address, where the WASM
// engine renders inside the page instead of the server backend.
const embedded = await browser.newPage({ viewport: { width: 1600, height: 900 } });
try {
await embedded.goto(`${baseUrl}/`, { waitUntil: "domcontentloaded" });
await embedded.locator("main.blender-app").waitFor({ timeout: 120_000 });
await embedded.locator('[data-testid="blend-file-input"]').setInputFiles(STUDIO);
await embedded.waitForFunction(() => /Objects 6/.test(document.querySelector('[data-testid="scene-stats"]')?.textContent ?? ""), null, { timeout: 120_000 });
// In the embedded path the React workspace stays mounted but hidden behind
// the native canvas, and F12 silently does nothing until the native editor
// workflow is parsed: `runNativeWorkflow` returns early unless
// `editorWorkflowStatus === "AVAILABLE"`. Workflow tabs carrying
// `aria-current` are that ready signal (the static fallback list has none).
await embedded.waitForFunction(
() => [...document.querySelectorAll(".workspace-tab")].some((tab) => tab.getAttribute("aria-current") !== null),
null, { timeout: 90_000 });
await embedded.evaluate(() => {
const tab = [...document.querySelectorAll(".workspace-tab")].find((item) => item.textContent === "Rendering");
if (tab instanceof HTMLElement) tab.click();
});
await embedded.waitForFunction(() => [...document.querySelectorAll(".workspace-tab")]
.some((tab) => tab.getAttribute("aria-current") !== null && tab.textContent === "Rendering"), null, { timeout: 30_000 });
await embedded.waitForTimeout(900);
// F12 has two handlers and the wrong one fails silently: the window
// listener returns early when the target is the native desktop canvas or
// a form control. Blur first so it runs `renderFromMenu`.
await embedded.evaluate(() => {
const active = document.activeElement;
if (active instanceof HTMLElement) active.blur();
});
await embedded.keyboard.press("F12");
// The React subtree holding `.native-render-panel` is unmounted while the
// native canvas owns the viewport, and it remounts *with the render
// finished* — the panel mounts closed, so wait for existence, not
// visibility, and expand it afterwards.
await embedded.waitForFunction(() => document.querySelector(".native-render-panel") !== null, null, { timeout: 90_000 });
const embeddedDetails = embedded.locator("details.native-render-fallback");
if (!await embeddedDetails.evaluate((element) => element.open)) await embeddedDetails.locator("summary").click();
await embedded.locator(".native-render-panel").scrollIntoViewIfNeeded();
await embedded.waitForTimeout(600);
const embedFile = path.join(OUT, "ch26-embedded-result.jpg");
await embedded.screenshot({ path: embedFile, type: "jpeg", quality: 82 });
images.push({ name: "ch26-embedded-result", file: path.relative(REPO, embedFile) });
console.log("captured ch26-embedded-result");
// The default address keeps the native desktop screen behind a toggle;
// capture it with the way back ("Web 业务工具") on screen.
await embedded.locator('.workspace-topbar button:has-text("Blender 桌面"), button:has-text("Blender 桌面")').first().click();
await embedded.waitForTimeout(900);
const desktopFile = path.join(OUT, "ch26-default-address.jpg");
await embedded.screenshot({ path: desktopFile, type: "jpeg", quality: 82 });
images.push({ name: "ch26-default-address", file: path.relative(REPO, desktopFile) });
console.log("captured ch26-default-address");
await embedded.getByTestId("native-web-tools-toggle").click();
await embedded.waitForTimeout(900);
const toggleFile = path.join(OUT, "ch26-web-tools.jpg");
await embedded.screenshot({ path: toggleFile, type: "jpeg", quality: 82 });
images.push({ name: "ch26-web-tools", file: path.relative(REPO, toggleFile) });
console.log("captured ch26-web-tools");
}
finally {
await embedded.close().catch(() => undefined);
}
await page.getByRole("button", { name: "编辑", exact: true }).click();
await page.getByRole("menuitem", { name: "偏好设置", exact: true }).click();
await page.getByTestId("preferences-window").waitFor({ timeout: 30_000 });

View File

@@ -22,23 +22,23 @@
{ "area": "Animation", "feature": "Timeline/Dope Sheet/关键帧/Action", "status": "usable", "route": "local", "chapter": "ch19" },
{ "area": "Animation", "feature": "Graph Editor/NLA/驱动器", "status": "usable", "route": "local", "note": "Graph 为简化 SVG;NLA 表单式;驱动器表达式可写、变量/目标只读", "chapter": "ch20" },
{ "area": "Animation", "feature": "Web 播放/音频", "status": "usable", "route": "local", "note": "原生持久 depsgraph 逐帧求值;音频走 WebAudio", "chapter": "ch19" },
{ "area": "Rendering", "feature": "PBR 渲染/诊断视图/PNG 手动下载", "status": "usable", "route": "local", "chapter": "ch23" },
{ "area": "Rendering", "feature": "原生 EEVEE/Cycles 渲染", "status": "usable", "route": "server", "note": "经 server Blender 渲染并回写产物", "chapter": "ch23" },
{ "area": "Compositing", "feature": "节点/连线/执行/Viewer/提交", "status": "usable", "route": "server", "note": "节点图写入 Main;WASM CPU 求值命令已接通,服务端合成渲染可用", "chapter": "ch24" },
{ "area": "Rendering", "feature": "PBR 渲染/诊断视图/PNG 手动下载", "status": "usable", "route": "local", "note": "ch23 为猴头 GLB 实操;配套 11 章中文解说视频课 /tutorial/rendering/monkey-render-lesson.html", "chapter": "ch23" },
{ "area": "Rendering", "feature": "原生 EEVEE/Cycles 渲染", "status": "usable", "route": "server", "note": "经 server Blender 渲染并回写产物", "chapter": "ch25" },
{ "area": "Compositing", "feature": "节点/连线/执行/Viewer/提交", "status": "usable", "route": "server", "note": "节点图写入 Main;WASM CPU 求值命令已接通,服务端合成渲染可用", "chapter": "ch27" },
{ "area": "Geometry Nodes", "feature": "allowlist 节点/连线/提交", "status": "usable", "route": "local", "note": "目录已扩到 40 类;Simulation Zone/Repeat/Foreach 仍为明确边界", "chapter": "ch18" },
{ "area": "Geometry Nodes", "feature": "Spreadsheet 对象/顶点/边/面/UV/属性/CSV", "status": "usable", "route": "local", "note": "可读取 GN 修改器求值后的属性域;分页替代整表截断", "chapter": "ch18" },
{ "area": "Scripting", "feature": "Text Editor/Python Console/Info", "status": "usable", "route": "local", "note": "WASM 内嵌 CPython 控制台与文本执行", "chapter": "ch26" },
{ "area": "Scripting", "feature": "Text Editor/Python Console/Info", "status": "usable", "route": "local", "note": "WASM 内嵌 CPython 控制台与文本执行", "chapter": "ch29" },
{ "area": "Files", "feature": "新建/打开/最近项目/恢复/撤销", "status": "usable", "route": "local", "chapter": "ch03" },
{ "area": "Files", "feature": "保存到 OPFS/下载 .blend/另存为/副本", "status": "usable", "route": "local", "chapter": "ch04" },
{ "area": "Files", "feature": "自动恢复点/诊断报告", "status": "usable", "route": "local", "chapter": "ch05" },
{ "area": "IO", "feature": "GLTF/GLB/OBJ/STL/PLY 导入", "status": "usable", "route": "local", "note": "新增 glTF 文件夹导入(外部 .bin/贴图);OBJ 走 OBJ 导入面板", "chapter": "ch25" },
{ "area": "IO", "feature": "浏览器 GLB/OBJ 导出", "status": "usable", "route": "local", "chapter": "ch25" },
{ "area": "IO", "feature": "USD/Alembic/FBX 导出", "status": "usable", "route": "server", "note": "USD/Alembic 由浏览器引擎导出;FBX 经 server Blender 导出并下载产物", "chapter": "ch25" },
{ "area": "IO", "feature": "图像/VFont/URDF 导入", "status": "usable", "route": "local", "chapter": "ch25" },
{ "area": "Settings", "feature": "Preferences/Keymap/区域布局/相机锁定持久化", "status": "usable", "route": "local", "chapter": "ch27" },
{ "area": "Settings", "feature": "主题预设/系统/Add-ons/键位编辑", "status": "usable", "route": "local", "note": "主题预设与 Add-ons 启停已接通;完整桌面主题颜色表与全部键位为明确边界", "chapter": "ch27" },
{ "area": "IO", "feature": "GLTF/GLB/OBJ/STL/PLY 导入", "status": "usable", "route": "local", "note": "新增 glTF 文件夹导入(外部 .bin/贴图);OBJ 走 OBJ 导入面板", "chapter": "ch28" },
{ "area": "IO", "feature": "浏览器 GLB/OBJ 导出", "status": "usable", "route": "local", "chapter": "ch28" },
{ "area": "IO", "feature": "USD/Alembic/FBX 导出", "status": "usable", "route": "server", "note": "USD/Alembic 由浏览器引擎导出;FBX 经 server Blender 导出并下载产物", "chapter": "ch28" },
{ "area": "IO", "feature": "图像/VFont/URDF 导入", "status": "usable", "route": "local", "chapter": "ch28" },
{ "area": "Settings", "feature": "Preferences/Keymap/区域布局/相机锁定持久化", "status": "usable", "route": "local", "chapter": "ch30" },
{ "area": "Settings", "feature": "主题预设/系统/Add-ons/键位编辑", "status": "usable", "route": "local", "note": "主题预设与 Add-ons 启停已接通;完整桌面主题颜色表与全部键位为明确边界", "chapter": "ch30" },
{ "area": "Simulation", "feature": "物理参数/缓存入口/播放", "status": "usable", "route": "local", "note": "参数写入 Main;Simulate Range 逐帧推进 depsgraph;重负载走 server bake", "chapter": "ch21" },
{ "area": "Sequencer", "feature": "Strip 表单/本地媒体/原生传输", "status": "usable", "route": "local", "note": "本地媒体写入 OPFS 并暂存 VFS;最终导出走 server Blender", "chapter": "ch25" },
{ "area": "Sequencer", "feature": "Strip 表单/本地媒体/原生传输", "status": "usable", "route": "local", "note": "本地媒体写入 OPFS 并暂存 VFS;最终导出走 server Blender", "chapter": "ch28" },
{ "area": "Camera", "feature": "Numpad0/Camera to View/对象作相机/自动关键帧/约束", "status": "usable", "route": "local", "chapter": "ch07" }
]
}