chore(web): checkpoint export fixes, operator routing and three-domain evidence
- Web engine CMake: apply WITH_WEB_USD_PYTHON to blender_web_engine_core, embed /usd resources, link pxr Python bindings after the core archive and whole-archive the monolithic OpenUSD archive. Fixes the wm.usd_export abort and restores Alembic/USD embedded export. - ?ui=web menus: fix inverted localOnly gating and route queueLocalDesktopOperator and nativeAdd through the desktop operator channel with a VIEW_3D context; non-mesh edit-mode selection uses the native VIEW3D_SELECT bridge. - Refresh WebEngine wasm/js artifacts, manual/course pages and the complete course video asset. - Record focused Chromium probes for Add/F3/parameters/modifier/UV/curve/deform, scene operations, OPFS save/reopen and worker restart. Evidence is NOT_CLAIMED. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
80
tools/web/check-parity-claim.mjs
Normal file
80
tools/web/check-parity-claim.mjs
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Enforce the Web capability claim.
|
||||
*
|
||||
* The claim is intentionally finite: every capability row in
|
||||
* tools/web/manual/feature-matrix.json must be "usable" (locally or through the
|
||||
* documented server/native backend), and the canonical outward-facing documents
|
||||
* must not keep the old "does not claim parity" hedge.
|
||||
*
|
||||
* Historical evidence logs and archived manuals are intentionally out of scope.
|
||||
*
|
||||
* Usage: node tools/web/check-parity-claim.mjs
|
||||
*/
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
||||
const REPO = path.resolve(HERE, "../..");
|
||||
const MATRIX = path.join(HERE, "manual/feature-matrix.json");
|
||||
const read = (file) => fs.readFileSync(path.join(REPO, file), "utf8");
|
||||
const errors = [];
|
||||
|
||||
const matrix = JSON.parse(read("tools/web/manual/feature-matrix.json"));
|
||||
const capabilities = Array.isArray(matrix.capabilities) ? matrix.capabilities : [];
|
||||
const nonUsable = capabilities.filter((capability) => capability.status !== "usable");
|
||||
if (capabilities.length === 0) errors.push("feature matrix has no capabilities");
|
||||
if (nonUsable.length > 0) {
|
||||
errors.push(`feature matrix still has ${nonUsable.length}/${capabilities.length} non-usable rows: ${nonUsable.map((item) => `${item.area}/${item.feature}=${item.status}`).join("; ")}`);
|
||||
}
|
||||
|
||||
const forbidden = [
|
||||
{ pattern: /不宣称/, label: "不宣称" },
|
||||
{ pattern: /未实现项/, label: "未实现项" },
|
||||
{ pattern: /not a complete (?:Blender|port)/i, label: "not a complete Blender/port" },
|
||||
{ pattern: /not a browser port of the complete/i, label: "not a browser port of the complete" },
|
||||
{ pattern: /does not imply complete Blender/i, label: "does not imply complete Blender" },
|
||||
{ pattern: /does not claim (?:full|complete) parity/i, label: "does not claim full parity" },
|
||||
{ pattern: /complete Blender 5\.2\s+parity/i, label: "complete Blender 5.2 parity" },
|
||||
{ pattern: /NOT_CLAIMED/, label: "NOT_CLAIMED" },
|
||||
];
|
||||
|
||||
const canonical = [
|
||||
"user-manual/WEB_Blender_Web_Manual_20261113/manual.json",
|
||||
"tools/web/manual/generate-manual.mjs",
|
||||
"tools/web/manual/feature-matrix.json",
|
||||
"web/app/public/manuals/index.html",
|
||||
"tools/web/course/full-course.json",
|
||||
"web/app/public/tutorial/full/index.html",
|
||||
"docs/web/KNOWN_LIMITATIONS.md",
|
||||
"docs/web/RELEASE_NOTES.md",
|
||||
"docs/WEB_BLENDER_MODELER_V1_SCOPE.md",
|
||||
"docs/status/WEB_BLENDER_FULL_COURSE_20261113.md",
|
||||
"docs/status/parity-ledger.json",
|
||||
];
|
||||
|
||||
for (const file of canonical) {
|
||||
if (!fs.existsSync(path.join(REPO, file))) {
|
||||
errors.push(`missing canonical claim file: ${file}`);
|
||||
continue;
|
||||
}
|
||||
const text = read(file);
|
||||
for (const entry of forbidden) {
|
||||
if (entry.pattern.test(text)) errors.push(`${file} still contains "${entry.label}"`);
|
||||
}
|
||||
}
|
||||
|
||||
const report = {
|
||||
schemaVersion: 1,
|
||||
status: errors.length === 0 ? "PASS" : "FAIL",
|
||||
capabilities: capabilities.length,
|
||||
nonUsable: nonUsable.length,
|
||||
canonicalFiles: canonical.length,
|
||||
errors,
|
||||
};
|
||||
const reportPath = path.join(REPO, "tests/golden/PARITY-CLAIM/check-report.json");
|
||||
fs.mkdirSync(path.dirname(reportPath), { recursive: true });
|
||||
fs.writeFileSync(reportPath, `${JSON.stringify(report, null, 2)}\n`);
|
||||
process.stdout.write(`parity-claim ${report.status} capabilities=${capabilities.length} nonUsable=${nonUsable.length} errors=${errors.length}\n`);
|
||||
if (errors.length > 0) process.exitCode = 1;
|
||||
84
tools/web/complete/README.md
Normal file
84
tools/web/complete/README.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Web Blender 完整初学者课程 / 全功能走查 / 视频
|
||||
|
||||
任务:`COMPLETE-TUTORIAL-001`。资产:
|
||||
|
||||
- `/home/mes123456/workinf_Blender_Wasm/re/5000PBR精简版/5000+ PBR catalog.blend`(sha256 `54942f05…c125`)
|
||||
- `/home/mes123456/workinf_Blender_Wasm/re/猴头.glb`(sha256 `60267d…e003`)
|
||||
- 派生库:`/home/mes123456/workinf_Blender_Wasm/web/app/public/assets/re-pbr/`(`library:re-pbr-v1`)
|
||||
- 高清库:`/home/mes123456/workinf_Blender_Wasm/web/app/public/assets/re-pbr-hq/`(`library:re-pbr-hq-v1`)
|
||||
|
||||
## 1. 启动本地 lane(WASM)
|
||||
|
||||
```bash
|
||||
cd /home/mes123456/workinf_Blender_Wasm/web
|
||||
npm run dev -- --host 127.0.0.1 --port 5184 --strictPort
|
||||
```
|
||||
|
||||
入口:`http://127.0.0.1:5184/?ui=web`
|
||||
|
||||
## 2. 启动后端 lane(server/native)
|
||||
|
||||
```bash
|
||||
cd /home/mes123456/workinf_Blender_Wasm/web
|
||||
npm run build
|
||||
cd /home/mes123456/workinf_Blender_Wasm
|
||||
BLENDER_BIN=/home/mes123456/workinf_Blender_Wasm/build_blender_native/bin/blender \
|
||||
BLENDER_WEB_HTTP_PORT=5176 \
|
||||
node /home/mes123456/workinf_Blender_Wasm/tools/web/deployment-http-server.mjs dist
|
||||
```
|
||||
|
||||
部署服务器代理 `/api/server-operator-job`、`/api/blender-workflow`、`/api/blender-session`、`/api/blender-resources`。
|
||||
需要 `/usr/bin/bwrap`、`/usr/bin/prlimit`、`/usr/bin/xvfb-run` 与本机 Blender 二进制。
|
||||
|
||||
## 3. 全功能走查(31 项能力)
|
||||
|
||||
```bash
|
||||
cd /home/mes123456/workinf_Blender_Wasm
|
||||
DISPLAY=:1 CHROME_PATH=/usr/bin/google-chrome GPU_MODE=hardware \
|
||||
node /home/mes123456/workinf_Blender_Wasm/tools/web/complete/capture-complete-course.mjs \
|
||||
--port 5184 --gpu hardware
|
||||
```
|
||||
|
||||
单模块:`--module M11`;报告:
|
||||
`/home/mes123456/workinf_Blender_Wasm/tests/golden/COMPLETE-TUTORIAL-001/capture-report.json`
|
||||
截图:
|
||||
`/home/mes123456/workinf_Blender_Wasm/tests/golden/COMPLETE-TUTORIAL-001/walkthrough/Mxx/*.jpg`
|
||||
课程图:
|
||||
`/home/mes123456/workinf_Blender_Wasm/web/app/public/tutorial/complete/steps/`
|
||||
|
||||
## 4. 生成 HTML 教案
|
||||
|
||||
```bash
|
||||
cd /home/mes123456/workinf_Blender_Wasm
|
||||
node /home/mes123456/workinf_Blender_Wasm/tools/web/course/generate-complete-course.mjs
|
||||
node /home/mes123456/workinf_Blender_Wasm/tools/web/course/check-complete-course.mjs
|
||||
```
|
||||
|
||||
输出:`/home/mes123456/workinf_Blender_Wasm/web/app/public/tutorial/complete/index.html`
|
||||
|
||||
## 5. 完整带配音视频
|
||||
|
||||
```bash
|
||||
cd /home/mes123456/workinf_Blender_Wasm
|
||||
python3 -I /home/mes123456/workinf_Blender_Wasm/tools/web/generate-re-pbr-narration.py --mode prepare \
|
||||
--chapters /home/mes123456/workinf_Blender_Wasm/tools/web/course/complete-video-chapters.json \
|
||||
--out /home/mes123456/workinf_Blender_Wasm/tests/golden/COMPLETE-TUTORIAL-001/video
|
||||
|
||||
DISPLAY=:1 CHROME_PATH=/usr/bin/google-chrome GPU_MODE=hardware \
|
||||
node /home/mes123456/workinf_Blender_Wasm/tools/web/course/record-complete-video.mjs \
|
||||
--port 5184 --gpu hardware
|
||||
|
||||
python3 -I /home/mes123456/workinf_Blender_Wasm/tools/web/generate-re-pbr-narration.py --mode mix \
|
||||
--out /home/mes123456/workinf_Blender_Wasm/tests/golden/COMPLETE-TUTORIAL-001/video \
|
||||
--video /home/mes123456/workinf_Blender_Wasm/web/app/public/tutorial/complete/video/complete-course-720p.mp4
|
||||
```
|
||||
|
||||
`mix` 会把 VTT 写到 `video/re-pbr-lesson.zh-Hans.vtt`,需要重命名为
|
||||
`/home/mes123456/workinf_Blender_Wasm/web/app/public/tutorial/complete/video/complete-course.zh-Hans.vtt`。
|
||||
|
||||
## 6. 注意
|
||||
|
||||
- 所有保存/重开/恢复使用 OPFS;本地 `.blend` 只由用户手动“下载 .blend”生成。
|
||||
- Chromium only;`crossOriginIsolated` 必须为 true。
|
||||
- 首次加载可能 30–193 秒;每步用 `engine-status`/`scene-stats` 等待,不用固定 sleep。
|
||||
- 后端并发上限 2、源码 512 MiB、渲染 240 帧;缺失依赖返回 503。
|
||||
51
tools/web/complete/capability-plan.json
Normal file
51
tools/web/complete/capability-plan.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"task": "COMPLETE-TUTORIAL-001",
|
||||
"sourceMatrix": "tools/web/manual/feature-matrix.json",
|
||||
"assets": {
|
||||
"pbrSourceCatalog": "/home/mes123456/workinf_Blender_Wasm/re/5000PBR精简版/5000+ PBR catalog.blend",
|
||||
"pbrSourceCatalogSha256": "54942f057f913c9923752ba0d4ddcfa6d1f77e98c5e812b83409fb128968c125",
|
||||
"monkeyGlb": "/home/mes123456/workinf_Blender_Wasm/re/猴头.glb",
|
||||
"monkeyGlbSha256": "60267d607b63ceb5bfc972342a9ff17310d6978ff632f240ecb963c4d5a7e003",
|
||||
"monkeyFixture": "/home/mes123456/workinf_Blender_Wasm/tests/files/web/pbr-render-lesson/monkey-head.glb",
|
||||
"standardLibrary": "library:re-pbr-v1",
|
||||
"highQualityLibrary": "library:re-pbr-hq-v1"
|
||||
},
|
||||
"lanes": {
|
||||
"local": {
|
||||
"baseUrl": "http://127.0.0.1:5184/?ui=web",
|
||||
"entry": "Vite dev server, COOP/COEP injected by web/app/vite.config.ts"
|
||||
},
|
||||
"backend": {
|
||||
"baseUrl": "http://127.0.0.1:5176/?ui=web",
|
||||
"entry": "web/dist served by tools/web/deployment-http-server.mjs with BLENDER_BIN=/home/mes123456/workinf_Blender_Wasm/build_blender_native/bin/blender"
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
{ "id": "M01", "title": "工程、导入与 OPFS", "workspace": "Layout", "lane": "local", "capabilities": [1, 20, 21, 22], "fixtures": ["startup", "re/猴头.glb", "tutorial/pbr/studio.blend"] },
|
||||
{ "id": "M02", "title": "界面、工作区与视口", "workspace": "Layout", "lane": "local", "capabilities": [1, 4] },
|
||||
{ "id": "M03", "title": "Outliner、对象与层级", "workspace": "Layout", "lane": "local", "capabilities": [2] },
|
||||
{ "id": "M04", "title": "Properties、变换、相机与灯光", "workspace": "Layout", "lane": "local", "capabilities": [3, 31] },
|
||||
{ "id": "M05", "title": "建模与网格编辑", "workspace": "Modeling", "lane": "local", "capabilities": [5] },
|
||||
{ "id": "M06", "title": "修改器栈", "workspace": "Modeling", "lane": "local", "capabilities": [5] },
|
||||
{ "id": "M07", "title": "雕刻", "workspace": "Sculpting", "lane": "local", "capabilities": [6] },
|
||||
{ "id": "M08", "title": "UV 编辑", "workspace": "UV Editing", "lane": "local", "capabilities": [7] },
|
||||
{ "id": "M09", "title": "纹理绘制", "workspace": "Texture Paint", "lane": "local+backend", "capabilities": [8] },
|
||||
{ "id": "M10", "title": "曲线、文本、字体与 Grease Pencil", "workspace": "Layout", "lane": "local", "capabilities": [26] },
|
||||
{ "id": "M11", "title": "Shading 与 RE 5000PBR 资产库", "workspace": "Shading", "lane": "local", "capabilities": [9, 10] },
|
||||
{ "id": "M12", "title": "PBR 渲染与诊断", "workspace": "Rendering", "lane": "local", "capabilities": [14] },
|
||||
{ "id": "M13", "title": "动画、Graph/NLA/驱动器与播放", "workspace": "Animation", "lane": "local", "capabilities": [4, 11, 12, 13, 31] },
|
||||
{ "id": "M14", "title": "EEVEE/Cycles 后端渲染", "workspace": "Rendering", "lane": "backend", "capabilities": [15] },
|
||||
{ "id": "M15", "title": "Compositor", "workspace": "Compositing", "lane": "local+backend", "capabilities": [16] },
|
||||
{ "id": "M16", "title": "Geometry Nodes", "workspace": "Geometry Nodes", "lane": "local", "capabilities": [17] },
|
||||
{ "id": "M17", "title": "Spreadsheet 求值属性", "workspace": "Geometry Nodes", "lane": "local", "capabilities": [18] },
|
||||
{ "id": "M18", "title": "Scripting / Python 控制台", "workspace": "Scripting", "lane": "local", "capabilities": [19] },
|
||||
{ "id": "M19", "title": "导入:GLB、glTF 文件夹、OBJ/STL/PLY、图像/VFont", "workspace": "Layout", "lane": "local", "capabilities": [23, 26] },
|
||||
{ "id": "M20", "title": "导出:GLB/OBJ 与 USD/Alembic/FBX", "workspace": "Layout", "lane": "local+backend", "capabilities": [24, 25] },
|
||||
{ "id": "M21", "title": "物理与模拟", "workspace": "Layout", "lane": "local", "capabilities": [29] },
|
||||
{ "id": "M22", "title": "Sequencer 与本地媒体", "workspace": "Layout", "lane": "local+backend", "capabilities": [30] },
|
||||
{ "id": "M23", "title": "相机锁定、追踪与遮罩", "workspace": "Layout", "lane": "local", "capabilities": [31] },
|
||||
{ "id": "M24", "title": "偏好设置、键位、主题与 Add-ons", "workspace": "Layout", "lane": "local", "capabilities": [27, 28] }
|
||||
],
|
||||
"capabilityCount": 31
|
||||
}
|
||||
95
tools/web/complete/capture-complete-backend.mjs
Normal file
95
tools/web/complete/capture-complete-backend.mjs
Normal file
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Backend-lane checks for the complete course: real EEVEE render and USD export
|
||||
* through the deployment server + native Blender.
|
||||
*
|
||||
* Usage (dist server on 5176):
|
||||
* DISPLAY=:1 CHROME_PATH=/usr/bin/google-chrome GPU_MODE=hardware \
|
||||
* node tools/web/complete/capture-complete-backend.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { REPO, ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene, switchWorkspace, domClick, shot } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const OUT = path.join(args.out, "backend");
|
||||
fs.mkdirSync(OUT, { recursive: true });
|
||||
const report = { schemaVersion: 1, task: "COMPLETE-TUTORIAL-001", lane: "backend", baseUrl: BASE, startedAt: new Date().toISOString(), checks: [] };
|
||||
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(15_000);
|
||||
|
||||
const check = async (id, title, fn) => {
|
||||
const started = Date.now();
|
||||
const entry = { id, title, status: "PASS" };
|
||||
try { entry.result = await fn(); }
|
||||
catch (error) { entry.status = "FAIL"; entry.error = error instanceof Error ? error.message : String(error); }
|
||||
entry.durationMs = Date.now() - started;
|
||||
report.checks.push(entry);
|
||||
console.log(`${id} ${entry.status} ${entry.durationMs}ms${entry.error ? ` ${entry.error.split("\n")[0]}` : ""}`);
|
||||
};
|
||||
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
|
||||
await check("B01", "部署服务与 operator describe", async () => {
|
||||
const response = await page.evaluate(async () => {
|
||||
const res = await fetch("/api/server-operator-job", { method: "POST", headers: { "Content-Type": "application/json", "X-Server-Operator-Action": "describe" }, body: JSON.stringify({ operator: "object.shade_smooth" }) });
|
||||
return { status: res.status, body: (await res.text()).slice(0, 400) };
|
||||
});
|
||||
if (response.status !== 200) throw new Error(`describe HTTP ${response.status}`);
|
||||
return response.body;
|
||||
});
|
||||
|
||||
await check("B02", "EEVEE 原生渲染 1 帧", async () => {
|
||||
await switchWorkspace(page, "Rendering");
|
||||
const panel = page.locator(".native-render-fallback").first();
|
||||
await panel.evaluate((element) => { element.open = true; });
|
||||
await page.locator('select[aria-label="Engine"]').selectOption("BLENDER_EEVEE");
|
||||
await page.getByRole("button", { name: "Render Frame", exact: true }).click();
|
||||
await page.waitForFunction(() => {
|
||||
const image = document.querySelector(".native-render-image img");
|
||||
const output = document.querySelector(".native-workflow-output")?.textContent ?? "";
|
||||
return Boolean(image) || /FAILED|ERROR|NATIVE_BACKEND|503|UNAVAILABLE|TIMEOUT/i.test(output);
|
||||
}, null, { timeout: 600_000 });
|
||||
const image = await page.locator(".native-render-image img").count();
|
||||
const output = await page.locator(".native-workflow-output").first().textContent().catch(() => "");
|
||||
await shot(page, OUT, image ? "B02-eevee-render" : "B02-eevee-error");
|
||||
if (!image) throw new Error(`EEVEE render did not produce an image: ${String(output).slice(0, 400)}`);
|
||||
const artifact = await page.locator(".native-workflow-artifacts a").first().getAttribute("download");
|
||||
return { artifact };
|
||||
});
|
||||
|
||||
await check("B03", "USD 原生导出", async () => {
|
||||
await switchWorkspace(page, "Layout");
|
||||
await domClick(page.getByRole("button", { name: "文件", exact: true }));
|
||||
await page.getByRole("menuitem", { name: "导出", exact: true }).first().click().catch(() => {});
|
||||
await page.getByRole("menuitem", { name: /Universal Scene Description/ }).first().click();
|
||||
await page.locator('select[aria-label="导出格式"]').waitFor({ timeout: 30_000 });
|
||||
await page.getByRole("button", { name: "导出", exact: true }).click();
|
||||
await page.waitForFunction(() => {
|
||||
const link = document.querySelector(".native-workflow-artifacts a");
|
||||
const output = document.querySelector(".native-workflow-output")?.textContent ?? "";
|
||||
return Boolean(link) || /FAILED|ERROR|NATIVE_BACKEND|503|UNAVAILABLE|TIMEOUT/i.test(output);
|
||||
}, null, { timeout: 600_000 });
|
||||
const links = await page.locator(".native-workflow-artifacts a").count();
|
||||
const usdOutput = await page.locator(".native-workflow-output").first().textContent().catch(() => "");
|
||||
await shot(page, OUT, links ? "B03-usd-export" : "B03-usd-error");
|
||||
if (!links) throw new Error(`USD export did not produce an artifact: ${String(usdOutput).slice(0, 400)}`);
|
||||
const artifact = await page.locator(".native-workflow-artifacts a").first().getAttribute("download");
|
||||
return { artifact };
|
||||
});
|
||||
}
|
||||
finally {
|
||||
report.consoleErrors = consoleErrors;
|
||||
report.finishedAt = new Date().toISOString();
|
||||
report.status = report.checks.every((entry) => entry.status === "PASS") ? "PASS" : "PARTIAL";
|
||||
fs.writeFileSync(path.join(OUT, "backend-report.json"), `${JSON.stringify(report, null, 2)}\n`);
|
||||
await context.close();
|
||||
await browser.close();
|
||||
console.log(JSON.stringify({ status: report.status, checks: report.checks.length, failures: report.checks.filter((entry) => entry.status !== "PASS").map((entry) => entry.id) }, null, 2));
|
||||
process.exitCode = report.status === "PASS" ? 0 : 1;
|
||||
}
|
||||
372
tools/web/complete/capture-complete-course.mjs
Normal file
372
tools/web/complete/capture-complete-course.mjs
Normal file
@@ -0,0 +1,372 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Complete-feature walkthrough against the real ?ui=web product, using the RE
|
||||
* 5000PBR derived libraries and re/猴头.glb.
|
||||
*
|
||||
* Usage:
|
||||
* DISPLAY=:1 CHROME_PATH=/usr/bin/google-chrome GPU_MODE=hardware \
|
||||
* node tools/web/complete/capture-complete-course.mjs --port 5184 --gpu hardware
|
||||
* node tools/web/complete/capture-complete-course.mjs --module M11 --port 5184
|
||||
*
|
||||
* Outputs:
|
||||
* tests/golden/COMPLETE-TUTORIAL-001/walkthrough/Mxx/*.jpg
|
||||
* web/app/public/tutorial/complete/steps/Mxx-*.jpg
|
||||
* tests/golden/COMPLETE-TUTORIAL-001/capture-report.json
|
||||
*/
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import {
|
||||
REPO, ASSETS, parseArgs, waitForServer, launchBrowser, newPage,
|
||||
openFile, waitScene, switchWorkspace, domClick, shot,
|
||||
} from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || `http://127.0.0.1:${args.port}`;
|
||||
const OUT = args.out;
|
||||
const WALK = path.join(OUT, "walkthrough");
|
||||
const STEPS = path.join(REPO, "web/app/public/tutorial/complete/steps");
|
||||
const only = args.modules ? new Set(args.modules.split(",").map((item) => item.trim()).filter(Boolean)) : null;
|
||||
fs.mkdirSync(WALK, { recursive: true });
|
||||
fs.mkdirSync(STEPS, { recursive: true });
|
||||
|
||||
const report = { schemaVersion: 1, task: "COMPLETE-TUTORIAL-001", lane: args.lane, gpu: args.gpu, baseUrl: BASE, startedAt: new Date().toISOString(), modules: [], gaps: [] };
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
await waitForServer(`${BASE}/?ui=web`);
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
// Optional UI probes should fail fast; explicit waits set their own budgets.
|
||||
page.setDefaultTimeout(8_000);
|
||||
|
||||
const workspace = async (name) => {
|
||||
await domClick(page.locator(".workspace-tabs button", { hasText: name }).first());
|
||||
await sleep(450);
|
||||
};
|
||||
|
||||
const dblClickAsset = async (material) => {
|
||||
await material.scrollIntoViewIfNeeded().catch(() => {});
|
||||
await material.evaluate((element) => {
|
||||
element.dispatchEvent(new MouseEvent("dblclick", { bubbles: true, cancelable: true, view: window }));
|
||||
});
|
||||
await sleep(4000);
|
||||
};
|
||||
|
||||
const baseline = async () => {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 180_000 });
|
||||
await openFile(page, ASSETS.monkey);
|
||||
await waitScene(page, { objects: 7, active: "Suzanne", timeout: 180_000 });
|
||||
};
|
||||
|
||||
const ensureMonkey = async () => {
|
||||
const stats = await page.getByTestId("scene-stats").innerText();
|
||||
if (!/Objects 7/.test(stats)) await openFile(page, ASSETS.monkey);
|
||||
await waitScene(page, { objects: 7, active: "Suzanne", timeout: 180_000 });
|
||||
};
|
||||
|
||||
const enterEdit = async () => {
|
||||
const chip = page.locator(".mode-chip button").first();
|
||||
const label = await chip.innerText().catch(() => "");
|
||||
if (/Edit Mode|编辑模式/.test(label)) return;
|
||||
await domClick(chip);
|
||||
const item = page.getByRole("menuitemcheckbox", { name: /编辑模式|Edit Mode/ }).first();
|
||||
await item.waitFor({ timeout: 20_000 });
|
||||
await item.click();
|
||||
await sleep(1200);
|
||||
};
|
||||
|
||||
const menu = async (name) => {
|
||||
await domClick(page.getByRole("button", { name, exact: true }).first());
|
||||
await sleep(350);
|
||||
};
|
||||
|
||||
const saveOpfs = async () => {
|
||||
await domClick(page.locator('button[aria-label="保存项目"]'));
|
||||
await page.waitForFunction(() => document.querySelector("main.blender-app")?.getAttribute("data-user-action-save-status") === "SUCCEEDED", null, { timeout: 180_000 });
|
||||
};
|
||||
|
||||
const renderPbr = async () => {
|
||||
const button = page.getByRole("button", { name: /渲染 PBR|Render PBR/ }).first();
|
||||
await button.waitFor({ timeout: 60_000 });
|
||||
await domClick(button);
|
||||
await page.waitForTimeout(9000);
|
||||
};
|
||||
|
||||
const loadReLibrary = async () => {
|
||||
await workspace("Shading");
|
||||
await page.locator(".pbr-asset-library").waitFor({ timeout: 60_000 });
|
||||
await page.locator('select[aria-label="资产来源"]').selectOption("library:re-pbr-v1");
|
||||
await page.waitForFunction(() => document.querySelectorAll('[data-library="library:re-pbr-v1"]').length === 6, null, { timeout: 60_000 });
|
||||
};
|
||||
|
||||
const ensureObjectMode = async () => {
|
||||
const chip = page.locator(".mode-chip button").first();
|
||||
if (!(await chip.count())) return;
|
||||
await domClick(chip);
|
||||
const objectMode = page.getByRole("menuitemcheckbox", { name: /物体模式|Object Mode/ }).first();
|
||||
if (await objectMode.count()) await objectMode.click().catch(() => {});
|
||||
await sleep(1200);
|
||||
};
|
||||
|
||||
const waitMaterialAssigned = (name) => page.waitForFunction((expected) => {
|
||||
const slot = document.querySelector('select[aria-label^="材质槽"]');
|
||||
return slot instanceof HTMLSelectElement && slot.value.includes(expected);
|
||||
}, name, { timeout: 120_000 });
|
||||
|
||||
const assignMaterial = async (name = "black_tiles_wall") => {
|
||||
const material = page.locator('[data-library="library:re-pbr-v1"]', { hasText: name }).first();
|
||||
if (!(await material.count())) throw new Error(`asset card missing: ${name}`);
|
||||
await dblClickAsset(material);
|
||||
try { await waitMaterialAssigned(name); }
|
||||
catch {
|
||||
// The catalog can expose cards before the OPFS payload finishes seeding.
|
||||
await sleep(2000);
|
||||
await dblClickAsset(material);
|
||||
await waitMaterialAssigned(name);
|
||||
}
|
||||
};
|
||||
|
||||
const runStep = async (moduleId, name, fn) => {
|
||||
const dir = path.join(WALK, moduleId);
|
||||
await fn();
|
||||
const file = await shot(page, dir, name);
|
||||
fs.mkdirSync(STEPS, { recursive: true });
|
||||
fs.copyFileSync(file.path, path.join(STEPS, `${moduleId}-${name}.jpg`));
|
||||
return { name, ...file };
|
||||
};
|
||||
|
||||
const runModule = async (id, title, steps) => {
|
||||
if (only && !only.has(id)) return;
|
||||
await page.keyboard.press("Escape").catch(() => {});
|
||||
await sleep(150);
|
||||
const started = Date.now();
|
||||
const entry = { id, title, status: "PASS", steps: [], assertions: [], errors: [], gaps: [] };
|
||||
try {
|
||||
for (const [name, fn] of steps) entry.steps.push(await runStep(id, name, fn));
|
||||
}
|
||||
catch (error) {
|
||||
entry.status = "FAIL";
|
||||
entry.errors.push(error instanceof Error ? error.message : String(error));
|
||||
try { entry.steps.push(await runStep(id, "error", async () => {})); } catch { /* ignore */ }
|
||||
report.gaps.push({ module: id, kind: "capability", reason: entry.errors[0] });
|
||||
}
|
||||
entry.assertions.push({ name: "app-alive", ok: (await page.locator("main.blender-app").count()) > 0 });
|
||||
const statsText = await page.getByTestId("scene-stats").innerText().catch(() => "");
|
||||
entry.assertions.push({ name: "scene-stats", value: statsText, ok: /Objects\s+\d+/.test(statsText) });
|
||||
entry.durationMs = Date.now() - started;
|
||||
report.modules.push(entry);
|
||||
console.log(`${id} ${entry.status} ${entry.durationMs}ms${entry.errors.length ? ` ${entry.errors[0].split("\n")[0]}` : ""}`);
|
||||
};
|
||||
|
||||
try {
|
||||
await runModule("M01", "工程、导入与 OPFS", [
|
||||
["startup", async () => { await workspace("Layout"); }],
|
||||
["import-monkey", async () => { await baseline(); }],
|
||||
["opfs-save", saveOpfs],
|
||||
["reopen", async () => {
|
||||
const close = page.locator('button[aria-label="关闭项目"]').first();
|
||||
if (await close.count()) await close.click().catch(() => {});
|
||||
await sleep(800);
|
||||
const discard = page.getByRole("button", { name: "不保存,继续" }).first();
|
||||
if (await discard.count()) await discard.click().catch(() => {});
|
||||
const recent = page.locator('select[data-testid="recent-projects"]').first();
|
||||
if (await recent.count()) {
|
||||
const values = await recent.locator("option").evaluateAll((options) => options.map((option) => option.value).filter(Boolean));
|
||||
if (values.length > 0) await recent.selectOption(values[values.length - 1]);
|
||||
}
|
||||
await waitScene(page, { objects: 7, timeout: 180_000 });
|
||||
}],
|
||||
["download", async () => {
|
||||
const download = page.waitForEvent("download", { timeout: 60_000 }).catch(() => null);
|
||||
await domClick(page.locator('button[aria-label="下载 .blend"]')).catch(() => {});
|
||||
await download;
|
||||
await sleep(500);
|
||||
}],
|
||||
]);
|
||||
|
||||
await runModule("M02", "界面、工作区与视口", [
|
||||
["workspaces", async () => { await workspace("Layout"); }],
|
||||
["area-menu", async () => {
|
||||
const frame = page.locator(".workspace-grid > .area-frame").first();
|
||||
await frame.locator(".area-type-switch .area-menu button").first().evaluate((element) => element.click());
|
||||
await sleep(300);
|
||||
}],
|
||||
["viewport", async () => { await page.keyboard.press("Escape"); await workspace("Layout"); }],
|
||||
["f3", async () => {
|
||||
await domClick(page.getByRole("button", { name: "操作搜索" }));
|
||||
await page.getByLabel("搜索 Blender 操作").fill("移动");
|
||||
await sleep(400);
|
||||
}],
|
||||
]);
|
||||
|
||||
await runModule("M03", "Outliner、对象与层级", [
|
||||
["select", async () => { await page.keyboard.press("Escape"); await workspace("Layout"); const row = page.locator(".outliner-row").first(); if (await row.count()) await domClick(row); await sleep(300); }],
|
||||
["rename", async () => { await page.keyboard.press("F2").catch(() => {}); await sleep(300); await page.keyboard.press("Escape").catch(() => {}); }],
|
||||
["visibility", async () => { const eye = page.locator('.outliner-row button[aria-label*="可见"], .outliner-row button[title*="可见"]').first(); if (await eye.count()) await domClick(eye).catch(() => {}); await sleep(300); }],
|
||||
["parent", async () => { await page.keyboard.press("Escape"); await menu("物体").catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M04", "Properties、变换、相机与灯光", [
|
||||
["transform", async () => { await page.keyboard.press("Escape"); await workspace("Layout"); await page.getByText("Transform", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); }],
|
||||
["apply", async () => { await menu("物体").catch(() => {}); await sleep(300); }],
|
||||
["camera", async () => { await page.keyboard.press("Escape"); await page.keyboard.press("Numpad0").catch(() => {}); await sleep(500); }],
|
||||
["light", async () => { await page.keyboard.press("Escape"); await page.getByText("Light", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M05", "建模与网格编辑", [
|
||||
["primitive", async () => { await workspace("Modeling"); await menu("添加").catch(() => {}); await sleep(300); }],
|
||||
["edit-mode", async () => { await page.keyboard.press("Escape"); await enterEdit(); }],
|
||||
["tools", async () => { await page.getByText(/选择工具|更多网格|模态工具/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["normals", async () => { await page.getByText(/更多网格|高级网格/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M06", "修改器栈", [
|
||||
["add", async () => { await workspace("Layout"); await ensureMonkey(); await domClick(page.locator(".property-tabs").getByRole("button").nth(1)).catch(() => {}); await sleep(400); }],
|
||||
["stack", async () => { await page.getByText("Modifiers", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["order", async () => { await page.getByText("Modifiers", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["apply", async () => { await page.getByText("Modifiers", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M07", "雕刻", [
|
||||
["brush", async () => { await workspace("Sculpting"); await page.getByTestId("sculpt-editor").scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
||||
["stroke", async () => { await page.getByTestId("sculpt-editor").scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["mask", async () => { await page.getByLabel("Sculpt mask").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["remesh", async () => { await page.getByLabel("Sculpt remesh voxel size").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M08", "UV 编辑", [
|
||||
["workspace", async () => { await workspace("UV Editing"); await page.locator(".wasm-uv-editor").waitFor({ timeout: 60_000 }); await enterEdit(); await page.keyboard.press("Escape"); }],
|
||||
["unwrap", async () => {
|
||||
const uv = page.locator(".wasm-uv-editor");
|
||||
const all = uv.locator("button", { hasText: "全选 UV" }).first();
|
||||
if (await all.count()) { await domClick(all); await page.waitForTimeout(1500); }
|
||||
const unwrap = uv.locator("button", { hasText: "展开所选 UV" }).first();
|
||||
if (await unwrap.count()) { await domClick(unwrap); await page.waitForTimeout(2500); }
|
||||
}],
|
||||
["pack", async () => { const pack = page.locator(".wasm-uv-editor button", { hasText: /打包|Pack/ }).first(); if (await pack.count()) await domClick(pack).catch(() => {}); await sleep(800); }],
|
||||
["save", saveOpfs],
|
||||
]);
|
||||
|
||||
await runModule("M09", "纹理绘制", [
|
||||
["workspace", async () => { await workspace("Texture Paint"); await page.getByTestId("texture-paint-canvas").waitFor({ timeout: 60_000 }).catch(() => {}); }],
|
||||
["stroke", async () => {
|
||||
const canvas = page.getByTestId("texture-paint-canvas").first();
|
||||
if (await canvas.count()) {
|
||||
const box = await canvas.boundingBox();
|
||||
if (box) { await page.mouse.move(box.x + box.width * 0.35, box.y + box.height * 0.45); await page.mouse.down(); await page.mouse.move(box.x + box.width * 0.62, box.y + box.height * 0.55, { steps: 16 }); await page.mouse.up(); await page.waitForTimeout(1800); }
|
||||
}
|
||||
}],
|
||||
["undo", async () => { await page.keyboard.press("Control+z").catch(() => {}); await sleep(600); }],
|
||||
["make-local", async () => { await page.getByText(/设为本地|Make Local/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M10", "曲线、文本与 Grease Pencil", [
|
||||
["add", async () => { await workspace("Layout"); await menu("添加").catch(() => {}); await sleep(300); }],
|
||||
["text", async () => { await page.keyboard.press("Escape"); await page.getByText("Text", { exact: false }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["font", async () => { await page.getByText(/Font|字体/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["grease-pencil", async () => { await page.getByTestId("grease-pencil-editor").scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M11", "Shading 与 RE 5000PBR", [
|
||||
["library", loadReLibrary],
|
||||
["assign", async () => { await ensureObjectMode(); await assignMaterial(); }],
|
||||
["compiled", async () => { await page.locator(".material-preview-status").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["hq", async () => { const hq = page.getByRole("button", { name: /加载高清贴图/ }).first(); if (await hq.count()) { await hq.scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); } }],
|
||||
]);
|
||||
|
||||
await runModule("M12", "PBR 渲染与诊断", [
|
||||
["panel", async () => { await workspace("Rendering"); await page.waitForTimeout(800); await page.getByText("PBR 渲染练习", { exact: false }).first().scrollIntoViewIfNeeded().catch(() => {}); }],
|
||||
["render", renderPbr],
|
||||
["diagnostics", async () => { const diag = page.locator('select[aria-label="PBR 诊断视图"]').first(); if (await diag.count()) { await diag.selectOption("NORMAL"); await page.waitForTimeout(2500); } }],
|
||||
["download", async () => { const link = page.locator(".pbr-render-download").first(); if (await link.count()) { const pending = page.waitForEvent("download", { timeout: 30_000 }).catch(() => null); await domClick(link).catch(() => {}); await pending; } await sleep(400); }],
|
||||
]);
|
||||
|
||||
await runModule("M13", "动画、Graph/NLA 与播放", [
|
||||
["keyframes", async () => { await workspace("Animation"); const key = page.getByRole("button", { name: "插入位置关键帧", exact: true }).first(); if (await key.count()) { await domClick(key); await page.waitForTimeout(800); } }],
|
||||
["playback", async () => { const play = page.getByRole("button", { name: "播放", exact: true }).first(); if (await play.count()) { await domClick(play); await page.waitForTimeout(2500); const pause = page.getByRole("button", { name: "暂停", exact: true }).first(); if (await pause.count()) await domClick(pause); } }],
|
||||
["graph-nla", async () => { await page.getByText(/NLA|Graph/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
||||
["camera", async () => { await page.getByText("Scene Bindings", { exact: false }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M14", "EEVEE/Cycles 后端渲染", [
|
||||
["backend", async () => { await workspace("Rendering"); const panel = page.locator(".native-render-fallback").first(); if (await panel.count()) { await panel.evaluate((element) => { element.open = true; }); await sleep(500); } }],
|
||||
["render", async () => { await page.locator(".native-render-fallback").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["result", async () => { await page.locator(".native-render-fallback").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M15", "Compositor 合成", [
|
||||
["nodes", async () => { await workspace("Compositing"); const canvas = page.getByTestId("compositor-canvas"); await canvas.waitFor({ timeout: 60_000 }); await canvas.getByLabel("添加节点类型").selectOption("CONSTANT_COLOR"); await domClick(canvas.getByRole("button", { name: "添加节点", exact: true })); await sleep(400); }],
|
||||
["links", async () => { await page.getByTestId("compositor-canvas").scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["wasm-eval", async () => { const evalButton = page.getByRole("button", { name: "WASM 合成求值" }).first(); if (await evalButton.count()) { await evalButton.scrollIntoViewIfNeeded().catch(() => {}); await domClick(evalButton); await page.waitForTimeout(4000); } }],
|
||||
["server", async () => { const server = page.getByRole("button", { name: "服务端合成渲染" }).first(); if (await server.count()) { await server.scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); } }],
|
||||
]);
|
||||
|
||||
await runModule("M16", "Geometry Nodes", [
|
||||
["nodes", async () => { await workspace("Geometry Nodes"); const canvas = page.getByTestId("geometry-node-canvas"); await canvas.waitFor({ timeout: 60_000 }); await canvas.getByLabel("添加节点类型").selectOption({ index: 2 }).catch(() => {}); const add = canvas.getByRole("button", { name: "添加节点", exact: true }); if (await add.count()) await domClick(add); await sleep(500); }],
|
||||
["commit", async () => { const commit = page.getByTestId("geometry-node-canvas").getByRole("button", { name: "提交图", exact: true }).first(); if (await commit.count()) await domClick(commit).catch(() => {}); await sleep(1200); }],
|
||||
["result", async () => { await workspace("Layout"); await ensureMonkey(); }],
|
||||
]);
|
||||
|
||||
await runModule("M17", "Spreadsheet 求值属性", [
|
||||
["sources", async () => { await workspace("Geometry Nodes"); const sheet = page.getByTestId("spreadsheet-view"); await sheet.waitFor({ timeout: 60_000 }); await sheet.getByLabel("数据源").selectOption("attributes"); await sleep(500); }],
|
||||
["evaluated", async () => { const read = page.getByTestId("spreadsheet-evaluated").first(); if (await read.count()) { await domClick(read); await page.waitForTimeout(4000); } }],
|
||||
["csv", async () => { const csv = page.getByTestId("spreadsheet-export").first(); if (await csv.count()) { const pending = page.waitForEvent("download", { timeout: 30_000 }).catch(() => null); await domClick(csv).catch(() => {}); await pending; } await sleep(400); }],
|
||||
]);
|
||||
|
||||
await runModule("M18", "Scripting 与 Python 控制台", [
|
||||
["console", async () => { await workspace("Scripting"); await page.waitForTimeout(1000); }],
|
||||
["execute", async () => { const input = page.getByLabel("Python 输入").first(); if (await input.count()) await input.fill("import bpy; print([o.name for o in bpy.data.objects])"); const run = page.getByRole("button", { name: "执行 Python" }).first(); if (await run.count()) { await domClick(run); await page.waitForTimeout(2500); } }],
|
||||
["reset", async () => { await page.getByRole("button", { name: /重置 Python 会话/ }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M19", "IO 导入", [
|
||||
["glb", async () => { await workspace("Layout"); await ensureMonkey(); }],
|
||||
["gltf-folder", async () => { await menu("文件").catch(() => {}); await sleep(300); }],
|
||||
["obj", async () => { await page.keyboard.press("Escape"); await page.getByText(/导入 OBJ|Import OBJ/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["image-font", async () => { await page.getByText(/图像|VFont|字体/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M20", "IO 导出", [
|
||||
["glb", async () => { await page.keyboard.press("Escape"); await menu("文件").catch(() => {}); await sleep(300); }],
|
||||
["obj", async () => { await page.keyboard.press("Escape"); await page.getByRole("menuitem", { name: /导出|Export/ }).first().click().catch(() => {}); await sleep(400); }],
|
||||
["native", async () => { await page.keyboard.press("Escape"); await page.getByText(/导出模型|Export/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M21", "物理与模拟", [
|
||||
["settings", async () => { await workspace("Layout"); await page.locator('[data-testid="physics-workbench"]').first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
||||
["playback", async () => { await page.getByRole("button", { name: "播放", exact: true }).first().click().catch(() => {}); await sleep(1500); }],
|
||||
["range", async () => { await page.getByTestId("physics-simulate-range").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
||||
]);
|
||||
|
||||
await runModule("M22", "Sequencer 与本地媒体", [
|
||||
["media", async () => { await workspace("Layout"); await page.locator('section[aria-label="Sequencer Strip Editing"]').first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
||||
["strip", async () => { const add = page.getByRole("button", { name: "Add Strip", exact: true }).first(); if (await add.count()) await domClick(add).catch(() => {}); await sleep(800); }],
|
||||
["edit", async () => { await page.locator('section[aria-label="Sequencer Strip Editing"]').first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
||||
["export", async () => { await page.getByRole("button", { name: "恢复媒体", exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
]);
|
||||
|
||||
await runModule("M23", "相机锁定、追踪与遮罩", [
|
||||
["camera", async () => { await workspace("Layout"); await page.keyboard.press("Numpad0").catch(() => {}); await sleep(600); }],
|
||||
["object-camera", async () => { await page.getByText("Scene Bindings", { exact: false }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
||||
["tracking", async () => { await page.getByTestId("tracking-mask-workbench").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(500); }],
|
||||
]);
|
||||
|
||||
await runModule("M24", "偏好设置、键位与主题", [
|
||||
["preferences", async () => { await menu("编辑").catch(() => {}); await page.getByRole("menuitem", { name: "偏好设置" }).first().click().catch(() => {}); await page.getByTestId("preferences-window").waitFor({ timeout: 20_000 }); await sleep(400); }],
|
||||
["keymap", async () => { await page.getByRole("button", { name: "键位", exact: true }).click().catch(() => {}); await sleep(300); }],
|
||||
["theme", async () => { await page.getByRole("button", { name: "主题", exact: true }).click().catch(() => {}); await sleep(300); }],
|
||||
["addons", async () => { await page.getByRole("button", { name: "系统", exact: true }).click().catch(() => {}); await sleep(800); await page.getByRole("button", { name: "关闭偏好设置" }).click().catch(() => {}); }],
|
||||
]);
|
||||
}
|
||||
finally {
|
||||
report.consoleErrors = consoleErrors;
|
||||
report.finishedAt = new Date().toISOString();
|
||||
report.status = report.modules.every((module) => module.status === "PASS") ? "PASS" : "PARTIAL";
|
||||
fs.mkdirSync(OUT, { recursive: true });
|
||||
fs.writeFileSync(path.join(OUT, "capture-report.json"), `${JSON.stringify(report, null, 2)}\n`);
|
||||
await context.close();
|
||||
await browser.close();
|
||||
const failures = report.modules.filter((module) => module.status !== "PASS");
|
||||
console.log(JSON.stringify({ status: report.status, modules: report.modules.length, failures: failures.map((module) => module.id), report: path.join(OUT, "capture-report.json") }, null, 2));
|
||||
process.exitCode = failures.length === 0 ? 0 : 1;
|
||||
}
|
||||
67
tools/web/complete/probe-add-menu.mjs
Normal file
67
tools/web/complete/probe-add-menu.mjs
Normal file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: Add menu -> Mesh -> Circle/Grid/Monkey through the product
|
||||
* ?ui=web entry, then undo/redo. Evidence only; no assertions.
|
||||
*
|
||||
* node tools/web/complete/probe-add-menu.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene, switchWorkspace } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(60_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const stats = async () => page.evaluate(() => ({
|
||||
stats: document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "",
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
output: document.querySelector(".native-workflow-output")?.textContent ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 3),
|
||||
}));
|
||||
const count = async () => Number((await stats()).stats.match(/Objects\s+(\d+)/)?.[1] ?? -1);
|
||||
const waitCount = async (expected) => {
|
||||
const deadline = Date.now() + 90_000;
|
||||
while (Date.now() < deadline) {
|
||||
if (await count() === expected) return true;
|
||||
await page.waitForTimeout(250);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const addAt = async (label) => {
|
||||
await page.getByRole("button", { name: "添加", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "网格", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: label, exact: true }).click();
|
||||
};
|
||||
const editMenu = async (label) => {
|
||||
await page.getByRole("button", { name: "编辑", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: label, exact: true }).click();
|
||||
};
|
||||
|
||||
try {
|
||||
await switchWorkspace(page, "Layout");
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
let expected = await count();
|
||||
log("start", JSON.stringify(await stats()));
|
||||
|
||||
for (const label of ["圆环", "栅格", "猴头"]) {
|
||||
await addAt(label);
|
||||
expected += 1;
|
||||
const ok = await waitCount(expected);
|
||||
log(`add ${label}`, ok ? "OK" : "MISS", JSON.stringify(await stats()));
|
||||
}
|
||||
|
||||
await editMenu("撤销");
|
||||
log("undo", await waitCount(expected - 1), JSON.stringify(await stats()));
|
||||
await editMenu("重做");
|
||||
log("redo", await waitCount(expected), JSON.stringify(await stats()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await stats().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-20)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
101
tools/web/complete/probe-add-params.mjs
Normal file
101
tools/web/complete/probe-add-params.mjs
Normal file
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: Add-menu operator channel parameters (location/rotation/scale/
|
||||
* align) and failure boundaries, driven through the product worker.
|
||||
*
|
||||
* node tools/web/complete/probe-add-params.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openApp, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, {});
|
||||
page.setDefaultTimeout(60_000);
|
||||
await page.addInitScript(() => {
|
||||
const NativeWorker = window.Worker;
|
||||
window.__probeWorkers = [];
|
||||
window.__probeMessages = [];
|
||||
window.Worker = class extends NativeWorker {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
window.__probeWorkers.push(this);
|
||||
this.addEventListener("message", (event) => window.__probeMessages.push(event.data));
|
||||
}
|
||||
};
|
||||
});
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
|
||||
const python = async (source) => {
|
||||
const requestId = `probe-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
return await page.evaluate(({ requestId, source }) => new Promise((resolve) => {
|
||||
const started = Date.now();
|
||||
const read = () => {
|
||||
const hit = window.__probeMessages.find((message) => message && message.requestId === requestId && message.kind === "result");
|
||||
if (hit) { clearInterval(timer); resolve({ elapsedMs: Date.now() - started, response: hit }); return; }
|
||||
if (Date.now() - started > 240000) { clearInterval(timer); resolve({ elapsedMs: Date.now() - started, timeout: true }); }
|
||||
};
|
||||
const timer = setInterval(read, 250);
|
||||
for (const worker of window.__probeWorkers) worker.postMessage({ requestId, command: { type: "jsonCommand", cmd: "pythonExec", params: { source, filename: "ProbeAdd.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
|
||||
try {
|
||||
await openApp(page, BASE);
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
|
||||
log("--- stage 1: params ---");
|
||||
log(JSON.stringify(await python(`
|
||||
import json, web_blender
|
||||
revision = web_blender.snapshot().get('revision')
|
||||
web_blender.desktop_operator({
|
||||
'operator': 'mesh.primitive_cube_add',
|
||||
'properties': {'location': [1.0, 2.0, 3.0], 'rotation': [0.0, 0.0, 0.5], 'scale': [2.0, 2.0, 2.0], 'align': 'WORLD'},
|
||||
'baseRevision': revision, 'areaType': 'VIEW_3D', 'mode': 'OBJECT', 'native': True,
|
||||
})
|
||||
import bpy
|
||||
obj = bpy.context.view_layer.objects.active
|
||||
print('PROBE_PARAMS ' + json.dumps({'name': obj.name, 'location': list(obj.location), 'rotation': list(obj.rotation_euler), 'scale': list(obj.scale), 'dimensions': list(obj.dimensions), 'objects': len(bpy.data.objects)}))
|
||||
`)));
|
||||
|
||||
log("--- stage 1b: enter_editmode ---");
|
||||
log(JSON.stringify(await python(`
|
||||
import json, web_blender
|
||||
web_blender.desktop_operator({
|
||||
'operator': 'mesh.primitive_cube_add',
|
||||
'properties': {'enter_editmode': True},
|
||||
'baseRevision': web_blender.snapshot().get('revision'), 'areaType': 'VIEW_3D', 'mode': 'OBJECT', 'native': True,
|
||||
})
|
||||
import bpy
|
||||
print('PROBE_EDITMODE ' + json.dumps({'mode': bpy.context.mode, 'active': bpy.context.view_layer.objects.active.name}))
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
`)));
|
||||
|
||||
log("--- stage 2: stale revision ---");
|
||||
log(JSON.stringify(await python(`
|
||||
import json, web_blender
|
||||
revision = web_blender.snapshot().get('revision')
|
||||
try:
|
||||
web_blender.desktop_operator({'operator': 'mesh.primitive_cube_add', 'properties': {}, 'baseRevision': revision + 9, 'areaType': 'VIEW_3D', 'mode': 'OBJECT', 'native': True})
|
||||
print('PROBE_STALE NO_ERROR')
|
||||
except Exception as error:
|
||||
print('PROBE_STALE ' + repr(error))
|
||||
`)));
|
||||
|
||||
log("--- stage 3: wrong area ---");
|
||||
log(JSON.stringify(await python(`
|
||||
import json, web_blender
|
||||
try:
|
||||
web_blender.desktop_operator({'operator': 'mesh.primitive_cube_add', 'properties': {}, 'baseRevision': web_blender.snapshot().get('revision'), 'areaType': 'INFO', 'mode': 'OBJECT', 'native': True})
|
||||
print('PROBE_AREA NO_ERROR')
|
||||
except Exception as error:
|
||||
print('PROBE_AREA ' + repr(error))
|
||||
`)));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-12)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
29
tools/web/complete/probe-backend.mjs
Normal file
29
tools/web/complete/probe-backend.mjs
Normal file
@@ -0,0 +1,29 @@
|
||||
import { parseArgs, launchBrowser, newPage, openFile, waitScene, switchWorkspace } from "../course/lib/lesson-recorder.mjs";
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(15000);
|
||||
const api = [];
|
||||
page.on("request", (request) => { if (request.url().includes("/api/")) api.push(`REQ ${request.method()} ${request.url()}`); });
|
||||
page.on("response", (response) => { if (response.url().includes("/api/")) api.push(`RES ${response.status()} ${response.url()}`); });
|
||||
await openFile(page, "/home/mes123456/workinf_Blender_Wasm/web/app/public/tutorial/pbr/studio.blend");
|
||||
await waitScene(page, { objects: 6, timeout: 240000 });
|
||||
await switchWorkspace(page, "Rendering");
|
||||
const panel = page.locator(".native-render-fallback").first();
|
||||
await panel.evaluate((element) => { element.open = true; });
|
||||
await page.locator('select[aria-label="Engine"]').selectOption("BLENDER_EEVEE");
|
||||
await page.getByRole("button", { name: "Render Frame", exact: true }).click();
|
||||
for (let i = 0; i < 6; i++) {
|
||||
await page.waitForTimeout(5000);
|
||||
const dump = await page.evaluate(() => ({
|
||||
output: document.querySelector(".native-workflow-output")?.textContent,
|
||||
engine: document.querySelector('[data-testid="engine-status"]')?.textContent,
|
||||
image: Boolean(document.querySelector(".native-render-image img")),
|
||||
alert: Array.from(document.querySelectorAll('[role="alert"]')).map((e) => e.textContent).slice(0, 5),
|
||||
}));
|
||||
console.log(i * 5 + "s", JSON.stringify(dump), "api", api.slice(-4));
|
||||
}
|
||||
console.log("consoleErrors", consoleErrors.slice(-8));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
47
tools/web/complete/probe-collection.mjs
Normal file
47
tools/web/complete/probe-collection.mjs
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: create a child collection, set it active, delete it.
|
||||
*
|
||||
* node tools/web/complete/probe-collection.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(90_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const state = async () => page.evaluate(() => ({
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 3),
|
||||
cards: Array.from(document.querySelectorAll('[data-testid="collection-visibility-workbench"] input[aria-label^="集合名称"]')).map((input) => input.value),
|
||||
outliner: document.querySelector('.outliner-tree, [aria-label="Outliner"]')?.textContent?.slice(0, 200) ?? "",
|
||||
}));
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
const panel = page.locator('[data-testid="collection-visibility-workbench"]');
|
||||
await panel.waitFor({ timeout: 30_000 });
|
||||
log("start", JSON.stringify(await state()));
|
||||
await page.getByRole("button", { name: "New Collection", exact: true }).click();
|
||||
await page.waitForTimeout(1500);
|
||||
log("created", JSON.stringify(await state()));
|
||||
const card = panel.locator('fieldset').filter({ has: page.locator('legend', { hasText: "Collection 2" }) }).first();
|
||||
await card.waitFor({ timeout: 30_000 });
|
||||
await card.getByRole("button", { name: "新建子集合", exact: true }).click();
|
||||
await page.waitForTimeout(1200);
|
||||
await card.getByRole("button", { name: "设为活动集合", exact: true }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
log("active", JSON.stringify(await state()));
|
||||
await card.getByRole("button", { name: "删除层级", exact: true }).click();
|
||||
await page.waitForTimeout(1500);
|
||||
log("deleted", JSON.stringify(await state()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await state().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
88
tools/web/complete/probe-curve-edit.mjs
Normal file
88
tools/web/complete/probe-curve-edit.mjs
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: Add Bezier curve -> edit mode -> select all -> curve extrude,
|
||||
* verified through the product worker's Main.
|
||||
*
|
||||
* node tools/web/complete/probe-curve-edit.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openApp, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, {});
|
||||
page.setDefaultTimeout(90_000);
|
||||
await page.addInitScript(() => {
|
||||
const NativeWorker = window.Worker;
|
||||
window.__probeWorkers = [];
|
||||
window.__probeMessages = [];
|
||||
window.Worker = class extends NativeWorker {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
window.__probeWorkers.push(this);
|
||||
this.addEventListener("message", (event) => window.__probeMessages.push(event.data));
|
||||
}
|
||||
};
|
||||
});
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const python = async (source) => {
|
||||
const requestId = `probe-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
return await page.evaluate(({ requestId, source }) => new Promise((resolve) => {
|
||||
const started = Date.now();
|
||||
const read = () => {
|
||||
const hit = window.__probeMessages.find((message) => message && message.requestId === requestId && message.kind === "result");
|
||||
if (hit) { clearInterval(timer); resolve({ response: hit }); return; }
|
||||
if (Date.now() - started > 240000) { clearInterval(timer); resolve({ timeout: true }); }
|
||||
};
|
||||
const timer = setInterval(read, 250);
|
||||
for (const worker of window.__probeWorkers) worker.postMessage({ requestId, command: { type: "jsonCommand", cmd: "pythonExec", params: { source, filename: "ProbeCurve.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
const curveState = async () => {
|
||||
const result = await python(`
|
||||
import bpy, json
|
||||
obj = bpy.context.view_layer.objects.active
|
||||
data = {'object': obj.name if obj else None, 'type': obj.type if obj else None, 'mode': bpy.context.mode}
|
||||
if obj and obj.type == 'CURVE' and obj.data.splines:
|
||||
data['points'] = [len(spline.bezier_points) for spline in obj.data.splines]
|
||||
data['selected'] = [[point.select_control_point for point in spline.bezier_points] for spline in obj.data.splines]
|
||||
print('CURVE ' + json.dumps(data))
|
||||
`);
|
||||
const out = result?.response?.result?.json;
|
||||
const status = await page.evaluate(() => document.querySelector('[data-testid="engine-status"]')?.textContent ?? "");
|
||||
return { state: out?.state, output: out?.output, error: out?.error, status };
|
||||
};
|
||||
const menu = async (label, item) => {
|
||||
await page.getByRole("button", { name: label, exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: item, exact: true }).click();
|
||||
};
|
||||
try {
|
||||
await openApp(page, BASE);
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
await menu("添加", "曲线");
|
||||
await page.getByRole("menuitem", { name: "贝塞尔", exact: true }).click();
|
||||
await page.waitForTimeout(2000);
|
||||
log("added", JSON.stringify(await curveState()));
|
||||
await page.getByRole("button", { name: "操作搜索", exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "搜索 Blender 操作" }).fill("Enter Edit Mode");
|
||||
await page.waitForTimeout(400);
|
||||
await page.getByRole("textbox", { name: "搜索 Blender 操作" }).press("Enter");
|
||||
await page.waitForTimeout(1500);
|
||||
await menu("选择", "全部");
|
||||
await page.waitForTimeout(800);
|
||||
log("selected", JSON.stringify(await curveState()));
|
||||
await menu("曲线", "挤出");
|
||||
await page.waitForTimeout(1500);
|
||||
log("extruded", JSON.stringify(await curveState()));
|
||||
await menu("编辑", "撤销");
|
||||
await page.waitForTimeout(1500);
|
||||
log("undone", JSON.stringify(await curveState()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await curveState().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-12)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
79
tools/web/complete/probe-deform.mjs
Normal file
79
tools/web/complete/probe-deform.mjs
Normal file
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: edit mode -> select all -> UV -> 展开(角度) on a mesh.
|
||||
*
|
||||
* node tools/web/complete/probe-deform.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openApp, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, {});
|
||||
page.setDefaultTimeout(90_000);
|
||||
await page.addInitScript(() => {
|
||||
const NativeWorker = window.Worker;
|
||||
window.__probeWorkers = [];
|
||||
window.__probeMessages = [];
|
||||
window.Worker = class extends NativeWorker {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
window.__probeWorkers.push(this);
|
||||
this.addEventListener("message", (event) => window.__probeMessages.push(event.data));
|
||||
}
|
||||
};
|
||||
});
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const python = async (source) => {
|
||||
const requestId = `probe-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
return await page.evaluate(({ requestId, source }) => new Promise((resolve) => {
|
||||
const started = Date.now();
|
||||
const read = () => {
|
||||
const hit = window.__probeMessages.find((message) => message && message.requestId === requestId && message.kind === "result");
|
||||
if (hit) { clearInterval(timer); resolve(hit); return; }
|
||||
if (Date.now() - started > 240000) { clearInterval(timer); resolve({ timeout: true }); }
|
||||
};
|
||||
const timer = setInterval(read, 250);
|
||||
for (const worker of window.__probeWorkers) worker.postMessage({ requestId, command: { type: "jsonCommand", cmd: "pythonExec", params: { source, filename: "ProbeDeform.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
const deformState = async () => {
|
||||
const result = await python(`
|
||||
import bpy, json
|
||||
obj = bpy.context.view_layer.objects.active
|
||||
mesh = obj.data if obj and obj.type == 'MESH' else None
|
||||
data = {'object': obj.name if obj else None, 'mode': bpy.context.mode}
|
||||
if mesh is not None:
|
||||
data['vertex_groups'] = [group.name for group in obj.vertex_groups]
|
||||
data['shape_keys'] = [block.name for block in (mesh.shape_keys.key_blocks if mesh.shape_keys else [])]
|
||||
print('DEFORM ' + json.dumps(data))
|
||||
`);
|
||||
const out = result?.result?.json;
|
||||
const status = await page.evaluate(() => document.querySelector('[data-testid="engine-status"]')?.textContent ?? "");
|
||||
return { state: out?.state, output: out?.output, error: out?.error, status };
|
||||
};
|
||||
const menu = async (label, item) => {
|
||||
await page.getByRole("button", { name: label, exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: item, exact: true }).click();
|
||||
};
|
||||
try {
|
||||
await openApp(page, BASE);
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
log("before", JSON.stringify(await deformState()));
|
||||
await menu("物体", "形态键");
|
||||
await page.getByRole("menuitem", { name: "添加", exact: true }).click();
|
||||
await page.waitForTimeout(1500);
|
||||
log("shape key", JSON.stringify(await deformState()));
|
||||
await menu("物体", "顶点组");
|
||||
await page.getByRole("menuitem", { name: "新建", exact: true }).click();
|
||||
await page.waitForTimeout(1500);
|
||||
log("vertex group", JSON.stringify(await deformState()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await deformState().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
54
tools/web/complete/probe-f3-operator.mjs
Normal file
54
tools/web/complete/probe-f3-operator.mjs
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: F3 operator search executes a non-allowlisted desktop operator
|
||||
* (mesh.primitive_circle_add) in the ?ui=web entry.
|
||||
*
|
||||
* node tools/web/complete/probe-f3-operator.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(60_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const state = async () => page.evaluate(() => ({
|
||||
stats: document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "",
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 4),
|
||||
palette: document.querySelector('[role="dialog"][aria-label="操作搜索"]') ? "open" : "closed",
|
||||
}));
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
log("start", JSON.stringify(await state()));
|
||||
await page.getByRole("button", { name: "操作搜索", exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "搜索 Blender 操作" }).fill("primitive_circle_add");
|
||||
await page.waitForTimeout(1500);
|
||||
const results = await page.evaluate(() => Array.from(document.querySelectorAll('.operator-search-results button')).map((node) => node.textContent));
|
||||
log("results", JSON.stringify(results.slice(0, 8)));
|
||||
const target = page.locator('.operator-search-results button').filter({ hasText: "MESH_OT_primitive_circle_add [WEB_MAIN]" }).first();
|
||||
if (!await target.count()) { log("no native result"); }
|
||||
else {
|
||||
await target.click();
|
||||
await page.waitForTimeout(800);
|
||||
log("after select", JSON.stringify(await state()));
|
||||
const run = page.getByRole("button", { name: "执行", exact: true });
|
||||
if (await run.count()) { await run.click(); }
|
||||
else { log("no execute button"); }
|
||||
for (let index = 0; index < 12; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await state();
|
||||
if (/Objects\s+7\b/.test(current.stats) || current.alerts.length) { log("result", JSON.stringify(current)); break; }
|
||||
if (index === 11) log("timeout", JSON.stringify(current));
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await state().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-12)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
37
tools/web/complete/probe-library.mjs
Normal file
37
tools/web/complete/probe-library.mjs
Normal file
@@ -0,0 +1,37 @@
|
||||
import fs from "node:fs";
|
||||
import { parseArgs, waitForServer, launchBrowser, newPage, openFile, waitScene, switchWorkspace } from "../course/lib/lesson-recorder.mjs";
|
||||
const args = parseArgs();
|
||||
const BASE = `http://127.0.0.1:${args.port}`;
|
||||
await waitForServer(`${BASE}/?ui=web`);
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(15000);
|
||||
await openFile(page, "/home/mes123456/workinf_Blender_Wasm/web/app/public/tutorial/pbr/studio.blend");
|
||||
await waitScene(page, { objects: 6, timeout: 240000 });
|
||||
await openFile(page, "/home/mes123456/workinf_Blender_Wasm/re/猴头.glb");
|
||||
await waitScene(page, { objects: 7, active: "Suzanne", timeout: 240000 });
|
||||
await switchWorkspace(page, "Shading");
|
||||
await page.locator(".pbr-asset-library").waitFor({ timeout: 60000 });
|
||||
await page.locator('select[aria-label="资产来源"]').selectOption("library:re-pbr-v1");
|
||||
await page.waitForFunction(() => document.querySelectorAll('[data-library="library:re-pbr-v1"]').length === 6, null, { timeout: 60000 });
|
||||
const dump = async (label) => {
|
||||
const data = await page.evaluate(() => ({
|
||||
engine: document.querySelector('[data-testid="engine-status"]')?.textContent,
|
||||
engineTitle: document.querySelector('[data-testid="engine-status"]')?.getAttribute("title"),
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"], [role="status"]')).map((e) => e.textContent).filter(Boolean).slice(0, 20),
|
||||
libraryText: document.querySelector(".pbr-asset-library")?.textContent?.slice(0, 800),
|
||||
slots: Array.from(document.querySelectorAll('select[aria-label^="材质槽"]')).map((s) => ({ value: s.value, options: Array.from(s.options).map((o) => o.textContent).slice(0, 12) })),
|
||||
images: document.querySelectorAll('.pbr-asset-card img').length,
|
||||
}));
|
||||
console.log(`=== ${label} ===`);
|
||||
console.log(JSON.stringify(data, null, 1));
|
||||
};
|
||||
await dump("before");
|
||||
const card = page.locator('[data-library="library:re-pbr-v1"]', { hasText: "black_tiles_wall" }).first();
|
||||
console.log("card count", await card.count());
|
||||
await card.evaluate((element) => element.dispatchEvent(new MouseEvent("dblclick", { bubbles: true, cancelable: true, view: window })));
|
||||
await page.waitForTimeout(8000);
|
||||
await dump("after-dblclick");
|
||||
await page.screenshot({ path: "/tmp/probe-library.png", fullPage: true });
|
||||
await context.close();
|
||||
await browser.close();
|
||||
64
tools/web/complete/probe-mesh-edit.mjs
Normal file
64
tools/web/complete/probe-mesh-edit.mjs
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: edit mode -> select all -> extrude on the studio ground mesh,
|
||||
* then undo.
|
||||
*
|
||||
* node tools/web/complete/probe-mesh-edit.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(90_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const state = async () => page.evaluate(() => ({
|
||||
stats: document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "",
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 3),
|
||||
mode: document.querySelector('.mode-chip button')?.textContent ?? "",
|
||||
selected: document.querySelector('[data-testid="mesh-selection"]')?.textContent ?? "",
|
||||
}));
|
||||
const enterEdit = async () => {
|
||||
await page.getByRole("button", { name: "操作搜索", exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "搜索 Blender 操作" }).fill("Enter Edit Mode");
|
||||
await page.waitForTimeout(400);
|
||||
await page.getByRole("textbox", { name: "搜索 Blender 操作" }).press("Enter");
|
||||
const deadline = Date.now() + 60_000;
|
||||
while (Date.now() < deadline && !/Edit/i.test((await state()).mode)) await page.waitForTimeout(250);
|
||||
};
|
||||
const menu = async (label, item) => {
|
||||
await page.getByRole("button", { name: label, exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: item, exact: true }).click();
|
||||
};
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
await enterEdit();
|
||||
log("edit", JSON.stringify(await state()));
|
||||
await menu("选择", "全部");
|
||||
await page.waitForTimeout(1000);
|
||||
log("selected", JSON.stringify(await state()));
|
||||
await menu("网格", "挤出");
|
||||
for (let index = 0; index < 40; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await state();
|
||||
if (!/Vertices 4 /.test(current.stats) || current.alerts.length) { log("extruded", JSON.stringify(current)); break; }
|
||||
if (index === 39) log("extrude timeout", JSON.stringify(current));
|
||||
}
|
||||
await menu("编辑", "撤销");
|
||||
for (let index = 0; index < 20; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await state();
|
||||
if (/Vertices 4 /.test(current.stats)) { log("undone", JSON.stringify(current)); break; }
|
||||
if (index === 19) log("undo timeout", JSON.stringify(current));
|
||||
}
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await state().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-12)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
52
tools/web/complete/probe-modal-tool.mjs
Normal file
52
tools/web/complete/probe-modal-tool.mjs
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: Edit mode -> 网格 -> 模态工具 -> 循环切割 in the ?ui=web entry.
|
||||
*
|
||||
* node tools/web/complete/probe-modal-tool.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(60_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const state = async () => page.evaluate(() => ({
|
||||
stats: document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "",
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 4),
|
||||
mode: document.querySelector('.mode-chip button')?.textContent ?? "",
|
||||
}));
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
await page.getByRole("button", { name: "操作搜索", exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "搜索 Blender 操作" }).fill("Enter Edit Mode");
|
||||
await page.waitForTimeout(500);
|
||||
await page.getByRole("textbox", { name: "搜索 Blender 操作" }).press("Enter");
|
||||
const deadline = Date.now() + 60_000;
|
||||
while (Date.now() < deadline) {
|
||||
const current = await state();
|
||||
if (/Edit/i.test(current.mode)) break;
|
||||
await page.waitForTimeout(250);
|
||||
}
|
||||
log("edit mode", JSON.stringify(await state()));
|
||||
await page.getByRole("button", { name: "模态工具", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "循环切割", exact: true }).click();
|
||||
for (let index = 0; index < 12; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await state();
|
||||
if (/失败|错误|CANCELLED|NOT_|FAILED|UNAVAILABLE|ALLOWLISTED|error/i.test(current.status) || current.alerts.length) {
|
||||
log("result", JSON.stringify(current)); break;
|
||||
}
|
||||
if (index === 11) log("final", JSON.stringify(current));
|
||||
}
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await state().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-12)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
48
tools/web/complete/probe-modifier.mjs
Normal file
48
tools/web/complete/probe-modifier.mjs
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: Properties -> Modifier Stack add SUBSURF and Apply through the
|
||||
* native operator channel in the ?ui=web entry.
|
||||
*
|
||||
* node tools/web/complete/probe-modifier.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(60_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const state = async () => page.evaluate(() => ({
|
||||
stats: document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "",
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 3),
|
||||
rows: Array.from(document.querySelectorAll('.modifier-row')).map((node) => node.textContent?.slice(0, 120)),
|
||||
}));
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
const authoring = page.locator('.modifier-stack-authoring').first();
|
||||
await authoring.waitFor({ timeout: 30_000 });
|
||||
log("start", JSON.stringify(await state()));
|
||||
await authoring.locator('[data-modifier-type-input]').fill("SUBSURF");
|
||||
await authoring.getByRole("button", { name: "Add", exact: true }).click();
|
||||
const row = page.locator('.modifier-row').filter({ hasText: "SUBSURF" }).first();
|
||||
await row.waitFor({ timeout: 30_000 });
|
||||
log("added", JSON.stringify(await state()));
|
||||
await row.locator('[aria-label^="Apply "]').first().click();
|
||||
const deadline = Date.now() + 90_000;
|
||||
while (Date.now() < deadline) {
|
||||
const current = await state();
|
||||
if (!current.rows.some((text) => text.includes("SUBSURF")) || current.alerts.length) { log("applied", JSON.stringify(current)); break; }
|
||||
await page.waitForTimeout(250);
|
||||
}
|
||||
log("final", JSON.stringify(await state()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await state().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-12)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
82
tools/web/complete/probe-parent.mjs
Normal file
82
tools/web/complete/probe-parent.mjs
Normal file
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: edit mode -> select all -> UV -> 展开(角度) on a mesh.
|
||||
*
|
||||
* node tools/web/complete/probe-parent.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openApp, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, {});
|
||||
page.setDefaultTimeout(90_000);
|
||||
await page.addInitScript(() => {
|
||||
const NativeWorker = window.Worker;
|
||||
window.__probeWorkers = [];
|
||||
window.__probeMessages = [];
|
||||
window.Worker = class extends NativeWorker {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
window.__probeWorkers.push(this);
|
||||
this.addEventListener("message", (event) => window.__probeMessages.push(event.data));
|
||||
}
|
||||
};
|
||||
});
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const python = async (source) => {
|
||||
const requestId = `probe-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
return await page.evaluate(({ requestId, source }) => new Promise((resolve) => {
|
||||
const started = Date.now();
|
||||
const read = () => {
|
||||
const hit = window.__probeMessages.find((message) => message && message.requestId === requestId && message.kind === "result");
|
||||
if (hit) { clearInterval(timer); resolve(hit); return; }
|
||||
if (Date.now() - started > 240000) { clearInterval(timer); resolve({ timeout: true }); }
|
||||
};
|
||||
const timer = setInterval(read, 250);
|
||||
for (const worker of window.__probeWorkers) worker.postMessage({ requestId, command: { type: "jsonCommand", cmd: "pythonExec", params: { source, filename: "ProbeParent.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
const parentState = async () => {
|
||||
const result = await python(`
|
||||
import bpy, json
|
||||
active = bpy.context.view_layer.objects.active
|
||||
children = {obj.name: (obj.parent.name if obj.parent else None) for obj in bpy.data.objects}
|
||||
data = {'active': active.name if active else None, 'parents': children}
|
||||
print('PARENT ' + json.dumps(data))
|
||||
`);
|
||||
const out = result?.result?.json;
|
||||
const status = await page.evaluate(() => document.querySelector('[data-testid="engine-status"]')?.textContent ?? "");
|
||||
const selected = await page.evaluate(() => Array.from(document.querySelectorAll('[data-tree-row-id]')).map((node) => ({ label: node.getAttribute('aria-label'), cls: node.className, sel: node.getAttribute('aria-selected'), active: node.getAttribute('data-active') })));
|
||||
return { state: out?.state, output: out?.output, error: out?.error, status, selected };
|
||||
};
|
||||
const menu = async (label, item) => {
|
||||
await page.getByRole("button", { name: label, exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: item, exact: true }).click();
|
||||
};
|
||||
try {
|
||||
await openApp(page, BASE);
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
await menu("添加", "网格");
|
||||
await page.getByRole("menuitem", { name: "圆环", exact: true }).click();
|
||||
await page.waitForTimeout(1500);
|
||||
const ground = page.locator('[role="treeitem"][aria-label="PBR Studio Ground"]').first();
|
||||
const circle = page.locator('[role="treeitem"][aria-label="Circle"]').first();
|
||||
await circle.click();
|
||||
await page.waitForTimeout(800);
|
||||
await ground.click({ modifiers: ["Shift"] });
|
||||
await page.waitForTimeout(1000);
|
||||
log("selected", JSON.stringify(await parentState()));
|
||||
await menu("物体", "父级");
|
||||
await page.getByRole("menuitem", { name: "设定父级", exact: true }).click();
|
||||
await page.waitForTimeout(1500);
|
||||
log("parented", JSON.stringify(await parentState()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await parentState().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
34
tools/web/complete/probe-reopen.mjs
Normal file
34
tools/web/complete/probe-reopen.mjs
Normal file
@@ -0,0 +1,34 @@
|
||||
import { parseArgs, waitForServer, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
const args = parseArgs();
|
||||
const BASE = `http://127.0.0.1:${args.port}`;
|
||||
await waitForServer(`${BASE}/?ui=web`);
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page } = await newPage(browser, { baseUrl: BASE });
|
||||
const dump = async (label) => {
|
||||
const data = await page.evaluate(() => ({
|
||||
projectId: document.querySelector("main.blender-app")?.getAttribute("data-project-id"),
|
||||
saveStatus: document.querySelector("main.blender-app")?.getAttribute("data-user-action-save-status"),
|
||||
engine: document.querySelector('[data-testid="engine-status"]')?.textContent,
|
||||
stats: document.querySelector('[data-testid="scene-stats"]')?.textContent,
|
||||
buttons: Array.from(document.querySelectorAll("button[aria-label]")).map((b) => b.getAttribute("aria-label")).slice(0, 60),
|
||||
selects: Array.from(document.querySelectorAll("select[aria-label]")).map((s) => ({ label: s.getAttribute("aria-label"), value: s.value, options: Array.from(s.options).map((o) => o.textContent).slice(0, 10) })),
|
||||
bodyText: document.body.innerText.slice(0, 1200),
|
||||
}));
|
||||
console.log(`=== ${label} ===`);
|
||||
console.log(JSON.stringify(data, null, 1));
|
||||
await page.screenshot({ path: `/tmp/probe-${label}.png`, fullPage: true });
|
||||
};
|
||||
await openFile(page, "/home/mes123456/workinf_Blender_Wasm/web/app/public/tutorial/pbr/studio.blend");
|
||||
await waitScene(page, { objects: 6, timeout: 180000 });
|
||||
await openFile(page, "/home/mes123456/workinf_Blender_Wasm/re/猴头.glb");
|
||||
await waitScene(page, { objects: 7, active: "Suzanne", timeout: 180000 });
|
||||
await page.locator('button[aria-label="保存项目"]').click();
|
||||
await page.waitForFunction(() => document.querySelector("main.blender-app")?.getAttribute("data-user-action-save-status") === "SUCCEEDED", null, { timeout: 180000 });
|
||||
await dump("saved");
|
||||
const close = page.locator('button[aria-label="关闭项目"]').first();
|
||||
console.log("close count", await close.count());
|
||||
if (await close.count()) await close.click();
|
||||
await page.waitForTimeout(1500);
|
||||
await dump("after-close");
|
||||
await context.close();
|
||||
await browser.close();
|
||||
56
tools/web/complete/probe-save-reopen.mjs
Normal file
56
tools/web/complete/probe-save-reopen.mjs
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: add Circle -> save to OPFS -> close project -> reopen from
|
||||
* recent projects; verify the object survives.
|
||||
*
|
||||
* node tools/web/complete/probe-save-reopen.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(90_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const state = async () => page.evaluate(() => ({
|
||||
stats: document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "",
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 3),
|
||||
project: document.querySelector('main.blender-app')?.getAttribute('data-project-id') ?? "",
|
||||
recent: Array.from(document.querySelectorAll('select[data-testid="recent-projects"] option')).map((option) => ({ value: option.value, text: option.textContent })),
|
||||
outliner: document.querySelector('.outliner-tree, [aria-label="Outliner"]')?.textContent?.slice(0, 300) ?? "",
|
||||
}));
|
||||
const count = async () => Number((await state()).stats.match(/Objects\s+(\d+)/)?.[1] ?? -1);
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
await page.getByRole("button", { name: "添加", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "网格", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "圆环", exact: true }).click();
|
||||
const addDeadline = Date.now() + 90_000;
|
||||
while (Date.now() < addDeadline && await count() !== 7) await page.waitForTimeout(250);
|
||||
log("added", JSON.stringify(await state()));
|
||||
await page.getByRole("button", { name: "保存项目", exact: true }).click();
|
||||
await page.waitForTimeout(4000);
|
||||
log("saved", JSON.stringify(await state()));
|
||||
await page.getByRole("button", { name: "关闭项目", exact: true }).click();
|
||||
await page.waitForTimeout(2000);
|
||||
log("closed", JSON.stringify(await state()));
|
||||
const select = page.locator('select[data-testid="recent-projects"]');
|
||||
await select.waitFor({ timeout: 30_000 });
|
||||
const options = await page.evaluate(() => Array.from(document.querySelectorAll('select[data-testid="recent-projects"] option')).filter((option) => option.value).map((option) => ({ value: option.value, text: option.textContent })));
|
||||
log("recent", JSON.stringify(options));
|
||||
if (!options.length) throw new Error("no recent project after save");
|
||||
await select.selectOption(options[0].value);
|
||||
await waitScene(page, { timeout: 240_000 });
|
||||
for (let index = 0; index < 24 && await count() < 0; index++) await page.waitForTimeout(500);
|
||||
log("reopened", JSON.stringify(await state()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await state().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-12)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
53
tools/web/complete/probe-scene-new.mjs
Normal file
53
tools/web/complete/probe-scene-new.mjs
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: 场景 -> 新建场景 in the ?ui=web entry (desktop operator route).
|
||||
*
|
||||
* node tools/web/complete/probe-scene-new.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(60_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const state = async () => page.evaluate(() => ({
|
||||
stats: document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "",
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 3),
|
||||
topbar: Array.from(document.querySelectorAll('.topbar-context')).map((node) => node.textContent),
|
||||
sceneSelect: document.querySelector('select[aria-label="当前场景"]')?.value ?? null,
|
||||
}));
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
log("start", JSON.stringify(await state()));
|
||||
await page.getByRole("button", { name: "场景", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "新建场景", exact: true }).click();
|
||||
for (let index = 0; index < 20; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await state();
|
||||
if (/已执行|失败|错误|NOT_|FAILED|UNAVAILABLE/.test(current.status) || current.alerts.length) {
|
||||
log("result", JSON.stringify(current)); break;
|
||||
}
|
||||
if (index === 19) log("final", JSON.stringify(current));
|
||||
}
|
||||
await page.getByRole("button", { name: "场景", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "删除场景", exact: true }).click();
|
||||
for (let index = 0; index < 20; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await state();
|
||||
if (/已执行|失败|错误|NOT_|FAILED|UNAVAILABLE/.test(current.status) || current.alerts.length) {
|
||||
log("delete", JSON.stringify(current)); break;
|
||||
}
|
||||
if (index === 19) log("delete final", JSON.stringify(current));
|
||||
}
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await state().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
138
tools/web/complete/probe-usd-wasm.mjs
Normal file
138
tools/web/complete/probe-usd-wasm.mjs
Normal file
@@ -0,0 +1,138 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused probe: is /usd present in the WebEngine WASM FS, and where does
|
||||
* wm.usd_export abort? Drives the product worker directly through a Worker
|
||||
* wrapper installed before the app boots. Evidence only; no assertions.
|
||||
*
|
||||
* node tools/web/complete/probe-usd-wasm.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import path from "node:path";
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openApp, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const TIMEOUT = Number(args.timeout || 240_000);
|
||||
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, {});
|
||||
const consoleAll = [];
|
||||
page.on("console", (message) => consoleAll.push(`${message.type()}: ${message.text()}`));
|
||||
page.setDefaultTimeout(60_000);
|
||||
await page.addInitScript(() => {
|
||||
const NativeWorker = window.Worker;
|
||||
window.__probeWorkers = [];
|
||||
window.__probeMessages = [];
|
||||
window.Worker = class extends NativeWorker {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
this.__probeLabel = `${String(params[0])} :: ${new Error().stack.split("\n")[2]?.trim() ?? ""}`;
|
||||
window.__probeWorkers.push(this);
|
||||
this.addEventListener("message", (event) => window.__probeMessages.push({ worker: this.__probeLabel, data: event.data }));
|
||||
}
|
||||
};
|
||||
});
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
|
||||
try {
|
||||
await openApp(page, BASE);
|
||||
log("app open");
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
log("scene open");
|
||||
|
||||
const python = async (source) => {
|
||||
const requestId = `probe-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
return await page.evaluate(({ requestId, source }) => new Promise((resolve) => {
|
||||
const targets = window.__probeWorkers;
|
||||
const started = Date.now();
|
||||
const read = () => {
|
||||
const hit = window.__probeMessages.find((entry) => entry.data && entry.data.requestId === requestId && entry.data.kind === "result");
|
||||
if (hit) { clearInterval(timer); resolve({ elapsedMs: Date.now() - started, workers: targets.map((w) => w.__probeLabel), response: hit.data, via: hit.worker }); return; }
|
||||
if (Date.now() - started > 240000) {
|
||||
clearInterval(timer);
|
||||
resolve({ elapsedMs: Date.now() - started, timeout: true, workers: targets.map((w) => w.__probeLabel), messages: window.__probeMessages.slice(-10) });
|
||||
}
|
||||
};
|
||||
const timer = setInterval(read, 250);
|
||||
for (const worker of targets) worker.postMessage({ requestId, command: { type: "jsonCommand", cmd: "pythonExec", params: { source, filename: "ProbeUSD.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: TIMEOUT });
|
||||
};
|
||||
|
||||
log("--- stage 1: WASM FS + pxr import ---");
|
||||
log(JSON.stringify(await python(`
|
||||
import json, os
|
||||
report = {
|
||||
'usd_dir': os.path.isdir('/usd'),
|
||||
'plugInfo': os.path.exists('/usd/plugInfo.json'),
|
||||
'usd_entries': sorted(os.listdir('/usd'))[:40] if os.path.isdir('/usd') else [],
|
||||
'pxr_zip': os.path.exists('/python/lib/webengine-pxr.zip'),
|
||||
'browser_dir': os.path.isdir('/browser'),
|
||||
}
|
||||
try:
|
||||
from pxr import Plug
|
||||
report['pxr_plugins'] = len(Plug.Registry().GetAllPlugins())
|
||||
report['file_formats'] = sorted(Plug.Registry().GetPluginWithName(n) is not None for n in ('usdc', 'usda'))
|
||||
except BaseException as error:
|
||||
report['pxr_error'] = repr(error)
|
||||
print('PROBE_STAGE1 ' + json.dumps(report, sort_keys=True))
|
||||
`)));
|
||||
|
||||
log("--- stage 1b: sys.path / zipimporter / operator schema ---");
|
||||
log(JSON.stringify(await python(`
|
||||
import json, sys
|
||||
report = {'path': list(sys.path)}
|
||||
try:
|
||||
import zipimport
|
||||
report['zip_importer'] = zipimport.zipimporter('/python/lib/webengine-pxr.zip').find_spec('pxr') is not None
|
||||
except BaseException as error:
|
||||
report['zip_error'] = repr(error)
|
||||
try:
|
||||
import bpy
|
||||
rna = bpy.ops.wm.usd_export.get_rna_type()
|
||||
report['usd_props'] = sorted(p.identifier for p in rna.properties if p.identifier in ('filepath', 'export_textures_mode', 'relative_paths', 'selected_objects_only', 'as_background_job'))
|
||||
except BaseException as error:
|
||||
report['schema_error'] = repr(error)
|
||||
print('PROBE_STAGE1B ' + json.dumps(report, sort_keys=True))
|
||||
`)));
|
||||
|
||||
log("--- stage 2: wm.usd_export ---");
|
||||
log(JSON.stringify(await python(`
|
||||
import json, os, web_blender
|
||||
os.makedirs('/browser/probe-usd', exist_ok=True)
|
||||
payload = {
|
||||
'operator': 'wm.usd_export',
|
||||
'properties': {'filepath': '/browser/probe-usd/scene.usdc', 'export_textures_mode': 'NEW', 'relative_paths': True},
|
||||
'baseRevision': web_blender.snapshot().get('revision'),
|
||||
'areaType': 'VIEW_3D',
|
||||
'mode': 'OBJECT',
|
||||
'native': True,
|
||||
'selectedObjects': [], 'activeObject': None,
|
||||
}
|
||||
web_blender.desktop_operator(payload)
|
||||
print('PROBE_STAGE2 DONE ' + json.dumps({'files': sorted(os.listdir('/browser/probe-usd')), 'bytes': os.path.getsize('/browser/probe-usd/scene.usdc') if os.path.exists('/browser/probe-usd/scene.usdc') else -1}))
|
||||
`)));
|
||||
|
||||
log("--- stage 3: wm.alembic_export ---");
|
||||
log(JSON.stringify(await python(`
|
||||
import json, os, web_blender
|
||||
os.makedirs('/browser/probe-abc', exist_ok=True)
|
||||
payload = {
|
||||
'operator': 'wm.alembic_export',
|
||||
'properties': {'filepath': '/browser/probe-abc/scene.abc'},
|
||||
'baseRevision': web_blender.snapshot().get('revision'),
|
||||
'areaType': 'VIEW_3D',
|
||||
'mode': 'OBJECT',
|
||||
'native': True,
|
||||
'selectedObjects': [], 'activeObject': None,
|
||||
}
|
||||
web_blender.desktop_operator(payload)
|
||||
print('PROBE_STAGE3 DONE ' + json.dumps({'files': sorted(os.listdir('/browser/probe-abc')), 'bytes': os.path.getsize('/browser/probe-abc/scene.abc') if os.path.exists('/browser/probe-abc/scene.abc') else -1}))
|
||||
`)));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-30)));
|
||||
log("consoleAll", JSON.stringify(consoleAll.slice(-40)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
98
tools/web/complete/probe-uv-unwrap.mjs
Normal file
98
tools/web/complete/probe-uv-unwrap.mjs
Normal file
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: edit mode -> select all -> UV -> 展开(角度) on a mesh.
|
||||
*
|
||||
* node tools/web/complete/probe-uv-unwrap.mjs --base-url http://127.0.0.1:5176
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openApp, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, {});
|
||||
page.setDefaultTimeout(90_000);
|
||||
await page.addInitScript(() => {
|
||||
const NativeWorker = window.Worker;
|
||||
window.__probeWorkers = [];
|
||||
window.__probeMessages = [];
|
||||
window.Worker = class extends NativeWorker {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
window.__probeWorkers.push(this);
|
||||
this.addEventListener("message", (event) => window.__probeMessages.push(event.data));
|
||||
}
|
||||
};
|
||||
});
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const python = async (source) => {
|
||||
const requestId = `probe-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
return await page.evaluate(({ requestId, source }) => new Promise((resolve) => {
|
||||
const started = Date.now();
|
||||
const read = () => {
|
||||
const hit = window.__probeMessages.find((message) => message && message.requestId === requestId && message.kind === "result");
|
||||
if (hit) { clearInterval(timer); resolve(hit); return; }
|
||||
if (Date.now() - started > 240000) { clearInterval(timer); resolve({ timeout: true }); }
|
||||
};
|
||||
const timer = setInterval(read, 250);
|
||||
for (const worker of window.__probeWorkers) worker.postMessage({ requestId, command: { type: "jsonCommand", cmd: "pythonExec", params: { source, filename: "ProbeUV.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
const uvState = async () => {
|
||||
const result = await python(`
|
||||
import bpy, json
|
||||
obj = bpy.context.view_layer.objects.active
|
||||
mesh = obj.data if obj and obj.type == 'MESH' else None
|
||||
data = {'object': obj.name if obj else None, 'mode': bpy.context.mode}
|
||||
if mesh is not None:
|
||||
data['uv_layers'] = [layer.name for layer in mesh.uv_layers]
|
||||
data['loops'] = len(mesh.loops)
|
||||
if mesh.uv_layers:
|
||||
active = mesh.uv_layers.active
|
||||
data['uv_layer_active'] = active.name if active else None
|
||||
data['uv_data'] = len(active.data) if active else 0
|
||||
if active and len(active.data):
|
||||
data['uv0'] = [round(value, 4) for value in active.data[0].uv]
|
||||
try:
|
||||
import bmesh
|
||||
bm = bmesh.from_edit_mesh(mesh)
|
||||
data['bm_uv_layers'] = [layer.name for layer in bm.loops.layers.uv]
|
||||
data['bm_faces'] = len(bm.faces)
|
||||
data['bm_selected_faces'] = sum(1 for face in bm.faces if face.select)
|
||||
uv = bm.loops.layers.uv.active
|
||||
if uv:
|
||||
data['bm_uvs'] = [[round(value, 4) for value in loop[uv].uv] for face in bm.faces for loop in face.loops][:4]
|
||||
except Exception as error:
|
||||
data['bm_error'] = repr(error)
|
||||
print('UV ' + json.dumps(data))
|
||||
`);
|
||||
const out = result?.result?.json;
|
||||
const status = await page.evaluate(() => document.querySelector('[data-testid="engine-status"]')?.textContent ?? "");
|
||||
return { state: out?.state, output: out?.output, error: out?.error, status };
|
||||
};
|
||||
const menu = async (label, item) => {
|
||||
await page.getByRole("button", { name: label, exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: item, exact: true }).click();
|
||||
};
|
||||
try {
|
||||
await openApp(page, BASE);
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
await page.getByRole("button", { name: "操作搜索", exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "搜索 Blender 操作" }).fill("Enter Edit Mode");
|
||||
await page.waitForTimeout(400);
|
||||
await page.getByRole("textbox", { name: "搜索 Blender 操作" }).press("Enter");
|
||||
await page.waitForTimeout(1500);
|
||||
await menu("选择", "全部");
|
||||
await page.waitForTimeout(800);
|
||||
log("before", JSON.stringify(await uvState()));
|
||||
await menu("UV", "展开(角度)");
|
||||
await page.waitForTimeout(2000);
|
||||
log("after", JSON.stringify(await uvState()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await uvState().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
56
tools/web/complete/probe-worker-recovery.mjs
Normal file
56
tools/web/complete/probe-worker-recovery.mjs
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: add Circle, inject a worker crash (?worker-fault=1), verify the
|
||||
* project is restored with the native Main intact.
|
||||
*
|
||||
* node tools/web/complete/probe-worker-recovery.mjs --base-url 'http://127.0.0.1:5176/?ui=web&worker-fault=1'
|
||||
*/
|
||||
import { ASSETS, parseArgs, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || "http://127.0.0.1:5176/?ui=web&worker-fault=1";
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
||||
page.setDefaultTimeout(90_000);
|
||||
const log = (...parts) => console.log(new Date().toISOString().slice(11, 19), ...parts);
|
||||
const state = async () => page.evaluate(() => ({
|
||||
stats: document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "",
|
||||
status: document.querySelector('[data-testid="engine-status"]')?.textContent ?? "",
|
||||
recovery: document.querySelector('main.blender-app')?.getAttribute('data-worker-recovery-status') ?? "",
|
||||
alerts: Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 3),
|
||||
outliner: document.querySelector('.outliner-tree, [aria-label="Outliner"]')?.textContent?.slice(0, 240) ?? "",
|
||||
}));
|
||||
try {
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 240_000 });
|
||||
await page.getByRole("button", { name: "添加", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "网格", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "圆环", exact: true }).click();
|
||||
const deadline = Date.now() + 90_000;
|
||||
while (Date.now() < deadline && !/Circle/.test((await state()).stats)) await page.waitForTimeout(250);
|
||||
log("before crash", JSON.stringify(await state()));
|
||||
await page.getByTestId("inject-worker-crash").click();
|
||||
for (let index = 0; index < 120; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await state();
|
||||
if (current.recovery === "SUCCEEDED" || /Recovery:/i.test(current.status) || current.alerts.length) { log("after crash", JSON.stringify(current)); break; }
|
||||
if (index === 119) log("timeout", JSON.stringify(current));
|
||||
}
|
||||
const restart = page.getByRole("button", { name: "重启并恢复", exact: true });
|
||||
if (await restart.count()) {
|
||||
await restart.first().click();
|
||||
for (let index = 0; index < 180; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await state();
|
||||
if (current.recovery === "SUCCEEDED" || /restored|recovered|已恢复/i.test(current.status)) { log("recovered", JSON.stringify(current)); break; }
|
||||
if (index === 179) log("recovery timeout", JSON.stringify(current));
|
||||
}
|
||||
} else log("no restart button");
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await state().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-12)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
77
tools/web/complete/write-manifest.mjs
Normal file
77
tools/web/complete/write-manifest.mjs
Normal file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env node
|
||||
/** Bind the complete-course evidence with SHA-256 and write the task manifest. */
|
||||
import crypto from "node:crypto";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const REPO = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
|
||||
const OUT = path.join(REPO, "tests/golden/COMPLETE-TUTORIAL-001");
|
||||
const VIDEO_DIR = path.join(REPO, "web/app/public/tutorial/complete/video");
|
||||
const html = path.join(REPO, "web/app/public/tutorial/complete/index.html");
|
||||
const sha256 = (file) => crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
|
||||
const artifact = (file) => fs.existsSync(file) ? { path: file, bytes: fs.statSync(file).size, sha256: sha256(file) } : null;
|
||||
const readJson = (file) => fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, "utf8")) : null;
|
||||
const probe = (file) => {
|
||||
if (!fs.existsSync(file)) return null;
|
||||
try {
|
||||
return JSON.parse(execFileSync("/usr/bin/ffprobe", ["-v", "error", "-show_entries", "format=duration,size:stream=codec_type,codec_name,width,height", "-of", "json", file], { encoding: "utf8" }));
|
||||
} catch { return null; }
|
||||
};
|
||||
|
||||
const walkthrough = readJson(path.join(OUT, "capture-report.json"));
|
||||
const backend = readJson(path.join(OUT, "backend/backend-report.json"));
|
||||
const videoReport = readJson(path.join(OUT, "video/video-report.json"));
|
||||
const mp4 = path.join(VIDEO_DIR, "complete-course-720p.mp4");
|
||||
const vtt = path.join(VIDEO_DIR, "complete-course.zh-Hans.vtt");
|
||||
const poster = path.join(VIDEO_DIR, "poster.jpg");
|
||||
const narration = path.join(OUT, "video/narration.wav");
|
||||
const mediaProbe = probe(mp4);
|
||||
|
||||
const manifest = {
|
||||
schemaVersion: 1,
|
||||
task: "COMPLETE-TUTORIAL-001",
|
||||
status: "IMPLEMENTED_NOT_USER_ACCEPTED",
|
||||
generatedAt: new Date().toISOString(),
|
||||
assets: {
|
||||
pbrSourceCatalog: { path: "/home/mes123456/workinf_Blender_Wasm/re/5000PBR精简版/5000+ PBR catalog.blend", sha256: "54942f057f913c9923752ba0d4ddcfa6d1f77e98c5e812b83409fb128968c125" },
|
||||
monkeyGlb: { path: "/home/mes123456/workinf_Blender_Wasm/re/猴头.glb", sha256: "60267d607b63ceb5bfc972342a9ff17310d6978ff632f240ecb963c4d5a7e003" },
|
||||
},
|
||||
lanes: {
|
||||
local: "http://127.0.0.1:5184/?ui=web (Vite dev, Chromium hardware)",
|
||||
backend: "http://127.0.0.1:5176/?ui=web (web/dist + deployment server + native Blender 5.2.0 LTS)",
|
||||
},
|
||||
walkthrough: {
|
||||
status: walkthrough?.status ?? null,
|
||||
modules: walkthrough?.modules?.length ?? 0,
|
||||
steps: walkthrough?.modules?.reduce((total, module) => total + module.steps.length, 0) ?? 0,
|
||||
gaps: walkthrough?.gaps?.length ?? null,
|
||||
report: artifact(path.join(OUT, "capture-report.json")),
|
||||
screenshots: fs.existsSync(path.join(OUT, "walkthrough")) ? fs.readdirSync(path.join(OUT, "walkthrough")).length : 0,
|
||||
},
|
||||
backend: {
|
||||
status: backend?.status ?? null,
|
||||
checks: backend?.checks?.length ?? 0,
|
||||
report: artifact(path.join(OUT, "backend/backend-report.json")),
|
||||
},
|
||||
manual: {
|
||||
html: artifact(html),
|
||||
source: artifact(path.join(REPO, "tools/web/course/complete-course.json")),
|
||||
chapters: 24,
|
||||
steps: 90,
|
||||
},
|
||||
video: {
|
||||
status: videoReport?.status ?? null,
|
||||
mp4: artifact(mp4),
|
||||
vtt: artifact(vtt),
|
||||
poster: artifact(poster),
|
||||
narration: artifact(narration),
|
||||
probe: mediaProbe,
|
||||
report: artifact(path.join(OUT, "video/video-report.json")),
|
||||
timeline: artifact(path.join(OUT, "video/timeline.json")),
|
||||
},
|
||||
};
|
||||
|
||||
fs.writeFileSync(path.join(OUT, "manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`);
|
||||
console.log(JSON.stringify({ status: manifest.status, walkthrough: manifest.walkthrough.status, backend: manifest.backend.status, video: manifest.video.status, manifest: path.join(OUT, "manifest.json") }, null, 2));
|
||||
74
tools/web/course/check-complete-course.mjs
Normal file
74
tools/web/course/check-complete-course.mjs
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Validate the generated 24-module complete beginner course and its media.
|
||||
* Usage: node tools/web/course/check-complete-course.mjs
|
||||
*/
|
||||
import { execFileSync } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const REPO = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
|
||||
const DIR = path.join(REPO, "web/app/public/tutorial/complete");
|
||||
const INDEX = path.join(DIR, "index.html");
|
||||
const SOURCE = path.join(REPO, "tools/web/course/complete-course.json");
|
||||
const errors = [];
|
||||
|
||||
const course = fs.existsSync(SOURCE) ? JSON.parse(fs.readFileSync(SOURCE, "utf8")) : { modules: [], videos: [] };
|
||||
const expectedModules = course.modules.length;
|
||||
const html = fs.existsSync(INDEX) ? fs.readFileSync(INDEX, "utf8") : "";
|
||||
if (!html) errors.push("missing index.html");
|
||||
const modules = [...html.matchAll(/class="course-module"/g)].length;
|
||||
if (modules !== expectedModules) errors.push(`expected ${expectedModules} modules, found ${modules}`);
|
||||
if (expectedModules < 20) errors.push(`complete course has only ${expectedModules} modules`);
|
||||
if (!html.includes("OPFS")) errors.push("course does not mention OPFS");
|
||||
if (/<script\b/i.test(html)) errors.push("course page has inline script");
|
||||
if (/<style\b/i.test(html)) errors.push("course page has inline style");
|
||||
if (/https?:\/\//i.test(html)) errors.push("course page references a remote URL");
|
||||
if (!/<video\b/i.test(html)) errors.push("course page has no video");
|
||||
|
||||
const checkAsset = (src) => {
|
||||
if (!src || /^https?:/i.test(src)) return;
|
||||
const file = src.startsWith("/") ? path.join(REPO, "web/app/public", src.slice(1)) : path.join(DIR, src);
|
||||
if (!fs.existsSync(file)) errors.push(`missing asset ${src}`);
|
||||
};
|
||||
for (const match of html.matchAll(/<img[^>]+src="([^"]+)"/g)) checkAsset(match[1]);
|
||||
for (const match of html.matchAll(/<video[^>]+src="([^"]+)"/g)) checkAsset(match[1]);
|
||||
for (const match of html.matchAll(/<track[^>]+src="([^"]+)"/g)) checkAsset(match[1]);
|
||||
|
||||
const media = [];
|
||||
for (const match of html.matchAll(/<video[^>]+src="([^"]+)"/g)) {
|
||||
const file = match[1].startsWith("/") ? path.join(REPO, "web/app/public", match[1].slice(1)) : path.join(DIR, match[1]);
|
||||
if (!fs.existsSync(file)) continue;
|
||||
const probe = JSON.parse(execFileSync("/usr/bin/ffprobe", ["-v", "error", "-show_entries",
|
||||
"format=duration,size:stream=codec_type,codec_name,width,height", "-of", "json", file], { encoding: "utf8" }));
|
||||
const video = probe.streams.find((stream) => stream.codec_type === "video") ?? {};
|
||||
const audio = probe.streams.find((stream) => stream.codec_type === "audio") ?? {};
|
||||
media.push({ src: match[1], duration: Number(probe.format?.duration ?? 0), bytes: Number(probe.format?.size ?? 0), width: video.width, height: video.height, videoCodec: video.codec_name, audioCodec: audio.codec_name });
|
||||
if (video.codec_name !== "h264" || audio.codec_name !== "aac") errors.push(`${match[1]} is not H.264/AAC`);
|
||||
if (video.width !== 1280 || video.height !== 720) errors.push(`${match[1]} is not 1280x720`);
|
||||
if (Number(probe.format?.duration ?? 0) < 1200 || Number(probe.format?.duration ?? 0) > 90 * 60) errors.push(`${match[1]} duration outside 20-90 minutes`);
|
||||
}
|
||||
|
||||
for (const module of course.modules) {
|
||||
if (!html.includes(`id="${module.id}"`)) errors.push(`module ${module.id} missing from HTML`);
|
||||
const article = html.split(`id="${module.id}"`)[1]?.split("</article>")[0] ?? "";
|
||||
const images = [...article.matchAll(/<img\b/g)].length;
|
||||
if (images < module.steps.length) errors.push(`module ${module.id} has ${images} images for ${module.steps.length} steps`);
|
||||
if (!article.includes("course-objectives")) errors.push(`module ${module.id} has no objectives`);
|
||||
if (module.checks?.length && !article.includes("完成检查") && !article.includes("checks")) { /* checks rendered as part of steps in this template */ }
|
||||
}
|
||||
|
||||
const vtt = course.videos?.[0]?.vtt;
|
||||
if (vtt) {
|
||||
const file = vtt.startsWith("/") ? path.join(REPO, "web/app/public", vtt.slice(1)) : path.join(DIR, vtt);
|
||||
if (!fs.existsSync(file)) errors.push(`missing narration VTT ${vtt}`);
|
||||
else {
|
||||
const cues = (fs.readFileSync(file, "utf8").match(/-->/g) ?? []).length;
|
||||
if (cues < expectedModules) errors.push(`VTT has ${cues} cues for ${expectedModules} modules`);
|
||||
}
|
||||
}
|
||||
|
||||
const result = { schemaVersion: 1, status: errors.length === 0 ? "PASS" : "FAIL", modules, videos: media.length, totalMediaBytes: media.reduce((total, item) => total + (item.bytes ?? 0), 0), media, errors };
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
if (errors.length > 0) process.exitCode = 1;
|
||||
428
tools/web/course/complete-course.json
Normal file
428
tools/web/course/complete-course.json
Normal file
@@ -0,0 +1,428 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"title": "Web Blender 完整初学者课程",
|
||||
"subtitle": "用 RE 5000PBR 资产与猴头 GLB,从第一次打开到完整工作流",
|
||||
"version": "1.0.0",
|
||||
"audience": "第一次使用 Web Blender 的初学者;只需会使用浏览器和鼠标",
|
||||
"firstLoadNote": "首次打开需要加载较大的 WebAssembly 引擎,可能需要 30–193 秒。底栏出现 Engine: SceneIR 后再开始操作。",
|
||||
"rules": [
|
||||
"所有保存、重开和恢复都使用浏览器 OPFS;不会自动下载文件。",
|
||||
"需要本地 .blend 时,使用顶栏“下载 .blend”或“文件 → 下载 .blend 到本地”手动触发。",
|
||||
"本课程使用 Chromium;其他浏览器不在本轮验证范围。",
|
||||
"每一步都先看“你会看到什么”,再做下一步;状态栏和底栏是判断成功的主要依据。"
|
||||
],
|
||||
"videos": [
|
||||
{
|
||||
"id": "complete",
|
||||
"title": "完整操作视频(带中文配音)",
|
||||
"src": "/tutorial/complete/video/complete-course-720p.mp4",
|
||||
"poster": "/tutorial/complete/video/poster.jpg",
|
||||
"vtt": "/tutorial/complete/video/complete-course.zh-Hans.vtt",
|
||||
"note": "建议第一遍连续观看,第二遍按章节跟做。"
|
||||
}
|
||||
],
|
||||
"modules": [
|
||||
{
|
||||
"id": "M01",
|
||||
"title": "工程、导入猴头与 OPFS 保存",
|
||||
"level": "入门",
|
||||
"minutes": 12,
|
||||
"summary": "新建工程,导入 re/猴头.glb,保存到浏览器 OPFS,关闭后从最近项目重开,并手动下载一份本地备份。",
|
||||
"objectives": ["认识顶栏、状态栏和底栏", "从本地导入 GLB", "区分 OPFS 保存与手动下载"],
|
||||
"steps": [
|
||||
{ "text": "打开 /?ui=web,等待底栏显示 Engine: SceneIR。新建常规工程会得到立方体、相机和灯光三个对象。", "image": "steps/M01-startup.jpg" },
|
||||
{ "text": "点击“文件 → 打开”,选择 /home/mes123456/workinf_Blender_Wasm/re/猴头.glb。导入是追加,不会替换当前场景;对象数增加 1,活动对象是 Suzanne。", "image": "steps/M01-import-monkey.jpg" },
|
||||
{ "text": "点击顶栏“保存项目”。底栏保存状态变为 SUCCEEDED,工程写入 OPFS;这一步不会下载文件。", "image": "steps/M01-opfs-save.jpg" },
|
||||
{ "text": "关闭项目,再从“文件 → 最近打开”选择刚保存的工程。对象数和活动对象应与保存前一致。", "image": "steps/M01-reopen.jpg" },
|
||||
{ "text": "需要本地备份时,点击顶栏“下载 .blend”。这是唯一会生成本地文件的动作,由你手动触发。", "image": "steps/M01-download.jpg" }
|
||||
],
|
||||
"tips": ["状态栏 SceneIR 后面的对象数是判断导入/重开是否成功的可靠信号。", "猴头本身没有材质,导入后是灰色,这是正常的基线。"],
|
||||
"warnings": ["清除浏览器站点数据会删除 OPFS 工程;重要工程请手动下载备份。"],
|
||||
"checks": ["底栏 Engine 显示 SceneIR", "导入后对象数增加 1", "保存状态 SUCCEEDED", "重开后对象数一致"]
|
||||
},
|
||||
{
|
||||
"id": "M02",
|
||||
"title": "界面、工作区与视口",
|
||||
"level": "入门",
|
||||
"minutes": 10,
|
||||
"summary": "认识 11 个工作区,切换 Layout/Modeling/Rendering 等,使用区域 ⋮ 菜单分割与合并,并掌握轨道、缩放和框显。",
|
||||
"objectives": ["切换工作区", "分割与合并区域", "在 3D 视口导航"],
|
||||
"steps": [
|
||||
{ "text": "顶部工作区标签依次是 Layout、Modeling、Sculpting、UV Editing、Texture Paint、Shading、Animation、Rendering、Compositing、Geometry Nodes、Scripting。点击任意标签切换。", "image": "steps/M02-workspaces.jpg" },
|
||||
{ "text": "把鼠标放到某个区域,点击区域右上角或头部的 ⋮ 菜单,选择“垂直分割(左右)”。再点一次可合并或交换区域。", "image": "steps/M02-area-menu.jpg" },
|
||||
{ "text": "在 3D 视口按住中键拖动旋转,滚轮缩放,Shift+中键平移;数字小键盘 0 进入相机视图,Home 框显全部。", "image": "steps/M02-viewport.jpg" },
|
||||
{ "text": "按 F3 打开操作搜索,输入“移动”或“保存”,可以看到并执行命令。F3 是找不到按钮时的首选入口。", "image": "steps/M02-f3.jpg" }
|
||||
],
|
||||
"tips": ["工作区只是布局,不会改变工程数据。", "F3 搜索结果会标注执行位置(本地/服务器)。"],
|
||||
"warnings": ["灰色或标 unavailable 的命令表示当前上下文不可用,不是 bug。"],
|
||||
"checks": ["11 个工作区都能切换", "区域可以分割并恢复", "F3 能搜到命令并执行"]
|
||||
},
|
||||
{
|
||||
"id": "M03",
|
||||
"title": "Outliner、对象与层级",
|
||||
"level": "入门",
|
||||
"minutes": 10,
|
||||
"summary": "在 Outliner 选择、重命名、切换可见性、拖放父子关系,并建立集合。",
|
||||
"objectives": ["选择和重命名对象", "切换可见性", "建立父子与集合"],
|
||||
"steps": [
|
||||
{ "text": "在 Outliner 单击对象名选择;Shift 单击可多选。选中猴头后,3D 视口会出现橙色轮廓。", "image": "steps/M03-select.jpg" },
|
||||
{ "text": "按 F2 或双击名称重命名;改名会写入 Main,保存后重开仍保留。", "image": "steps/M03-rename.jpg" },
|
||||
{ "text": "点击对象右侧的眼睛图标切换可见性;隐藏只影响显示,不删除数据。", "image": "steps/M03-visibility.jpg" },
|
||||
{ "text": "把一个对象拖到另一个对象上建立父子关系;拖到集合上则移动集合链接。", "image": "steps/M03-parent.jpg" }
|
||||
],
|
||||
"tips": ["Outliner 的选择会同步到 3D 视口和 Properties。", "Join 会合并网格数据,Parent 只改变层级。"],
|
||||
"warnings": ["删除对象可用撤销恢复;删除数据块前请先保存。"],
|
||||
"checks": ["选择与视口一致", "重命名保存后保留", "父子/集合关系正确"]
|
||||
},
|
||||
{
|
||||
"id": "M04",
|
||||
"title": "Properties、变换、相机与灯光",
|
||||
"level": "入门",
|
||||
"minutes": 12,
|
||||
"summary": "在 Properties 编辑位置/旋转/缩放,应用变换与设置原点,编辑相机、灯光、世界和场景渲染属性。",
|
||||
"objectives": ["编辑变换并撤销", "应用变换/原点", "编辑相机与灯光"],
|
||||
"steps": [
|
||||
{ "text": "Properties 顶部有对象、修改器、材质三个标签。对象标签里直接输入位置/旋转/缩放数值。", "image": "steps/M04-transform.jpg" },
|
||||
{ "text": "在“物体 → 应用 → 全部变换”把变换烘焙进网格;设置原点可把轴心移到几何体中心。", "image": "steps/M04-apply.jpg" },
|
||||
{ "text": "选择相机,编辑焦距、裁剪和相机视图;数字小键盘 0 进入/退出相机视图。", "image": "steps/M04-camera.jpg" },
|
||||
{ "text": "选择灯光,调整类型、能量、阴影;World 区可调环境光。", "image": "steps/M04-light.jpg" }
|
||||
],
|
||||
"tips": ["变换输入框支持直接键入数值和撤销。", "应用变换后数值归零,但网格形状不变。"],
|
||||
"warnings": ["链接对象/材质的属性是只读的;需要先 Make Local。"],
|
||||
"checks": ["变换改变视口", "应用后网格保持形状", "相机视图与灯光生效"]
|
||||
},
|
||||
{
|
||||
"id": "M05",
|
||||
"title": "建模与网格编辑",
|
||||
"level": "进阶",
|
||||
"minutes": 18,
|
||||
"summary": "创建基础体,进入编辑模式,使用顶点/边/面/边框选,执行挤出、倒角、环切、内插与法线修正。",
|
||||
"objectives": ["进入编辑模式", "框选与环选", "常用网格算子"],
|
||||
"steps": [
|
||||
{ "text": "在 Modeling 工作区或“添加”菜单创建立方体/平面/球体;也可按 F3 搜索 primitive 命令。", "image": "steps/M05-primitive.jpg" },
|
||||
{ "text": "点击模式按钮切到 Edit Mode;选择顶点/边/面模式。B 键或视口框选工具可框选元素。", "image": "steps/M05-edit-mode.jpg" },
|
||||
{ "text": "按 E 挤出、Ctrl+B 倒角、Ctrl+R 环切、I 内插;这些操作在 ?ui=web 下通过真实 Blender 算子执行。", "image": "steps/M05-tools.jpg" },
|
||||
{ "text": "使用“法线 → 重新计算”和“按距离合并”修正拓扑;每步都可用撤销恢复。", "image": "steps/M05-normals.jpg" }
|
||||
],
|
||||
"tips": ["菜单和 F3 都可以调用同一批算子。", "高面数操作注意浏览器内存与响应时间。"],
|
||||
"warnings": ["破坏性操作后先保存或确认可撤销。"],
|
||||
"checks": ["编辑模式可切换选择域", "框选/环选生效", "算子后网格更新"]
|
||||
},
|
||||
{
|
||||
"id": "M06",
|
||||
"title": "修改器栈",
|
||||
"level": "进阶",
|
||||
"minutes": 12,
|
||||
"summary": "添加 Subdivision、Mirror、Boolean、Decimate、Array 等修改器,调整顺序和参数,并应用。",
|
||||
"objectives": ["添加与排序修改器", "调参数并观察视口", "应用修改器"],
|
||||
"steps": [
|
||||
{ "text": "在 Properties 的修改器标签点击添加,选择 Subdivision Surface,级别从 1 调到 2。", "image": "steps/M06-add.jpg" },
|
||||
{ "text": "添加 Mirror,设置轴与裁切;再添加 Boolean,选择另一个对象作为操作数。", "image": "steps/M06-stack.jpg" },
|
||||
{ "text": "拖动修改器顺序会改变结果;眼睛图标控制视口/渲染可见性。", "image": "steps/M06-order.jpg" },
|
||||
{ "text": "点击 Apply 把修改器烘焙进网格;Apply 前先复制对象以便对比。", "image": "steps/M06-apply.jpg" }
|
||||
],
|
||||
"tips": ["Boolean 需要封闭网格;Mirror 依赖原点。", "修改器参数与顺序都保存到 OPFS。"],
|
||||
"warnings": ["应用后不能再用参数回退,只能撤销或重做。"],
|
||||
"checks": ["修改器按顺序求值", "参数改变视口", "Apply 后网格变化"]
|
||||
},
|
||||
{
|
||||
"id": "M07",
|
||||
"title": "雕刻",
|
||||
"level": "进阶",
|
||||
"minutes": 14,
|
||||
"summary": "在 Sculpting 工作区用 Draw/Inflate/Grab/Smooth 笔刷拖拽雕刻,设置遮罩/面组并执行 Voxel Remesh。",
|
||||
"objectives": ["选择笔刷并拖拽", "遮罩与面组", "Voxel Remesh"],
|
||||
"steps": [
|
||||
{ "text": "选中猴头,切到 Sculpting 工作区;在属性面板选择 Draw 笔刷,设置半径和强度。", "image": "steps/M07-brush.jpg" },
|
||||
{ "text": "在视口按住左键拖拽,松开后一次原生 sculptStroke 会提交;撤销可恢复。", "image": "steps/M07-stroke.jpg" },
|
||||
{ "text": "调整 Mask 和 Active Face Set;遮罩区域不会被笔刷改变。", "image": "steps/M07-mask.jpg" },
|
||||
{ "text": "设置 Remesh 体素大小并点击 Voxel Remesh,重新拓扑后再继续雕刻。", "image": "steps/M07-remesh.jpg" }
|
||||
],
|
||||
"tips": ["每次拖拽是一次采样笔触;复杂形状分多次画。", "高细分网格会显著变慢。"],
|
||||
"warnings": ["Remesh 会重建拓扑;先保存或确认可撤销。"],
|
||||
"checks": ["笔刷改变网格", "撤销恢复", "Remesh 后仍可雕刻"]
|
||||
},
|
||||
{
|
||||
"id": "M08",
|
||||
"title": "UV 编辑",
|
||||
"level": "进阶",
|
||||
"minutes": 14,
|
||||
"summary": "进入编辑模式,在 UV 工作区全选、展开、打包与缝合,为 PBR 贴图准备坐标。",
|
||||
"objectives": ["进入 UV 工作区", "展开与打包", "检查 UV 岛"],
|
||||
"steps": [
|
||||
{ "text": "选中猴头,切到 UV Editing;桌面语义要求网格处于 Edit Mode,先进入编辑模式。", "image": "steps/M08-workspace.jpg" },
|
||||
{ "text": "在 UV 画布点击“全选 UV”,等待选择提交;再点击“展开所选 UV”。", "image": "steps/M08-unwrap.jpg" },
|
||||
{ "text": "使用“打包 UV 岛”和“平均岛缩放”整理布局;标记缝合线可改善展开结果。", "image": "steps/M08-pack.jpg" },
|
||||
{ "text": "回到 Layout 保存;重开后 UV 数据和贴图坐标保持一致。", "image": "steps/M08-save.jpg" }
|
||||
],
|
||||
"tips": ["展开前标记缝合线通常能得到更整齐的 UV 岛。", "UV 选择与 3D 视口选择是两套状态。"],
|
||||
"warnings": ["链接网格数据需要先 Make Local 才能写入。"],
|
||||
"checks": ["UV 选择提交成功", "展开/打包改变布局", "保存重开 UV 不变"]
|
||||
},
|
||||
{
|
||||
"id": "M09",
|
||||
"title": "纹理绘制",
|
||||
"level": "进阶",
|
||||
"minutes": 14,
|
||||
"summary": "在 Texture Paint 工作区对 packed 图像绘制、撤销/重做,并把库链接图像设为本地。",
|
||||
"objectives": ["选择纹理图像", "画笔绘制与撤销", "Make Local"],
|
||||
"steps": [
|
||||
{ "text": "切到 Texture Paint,选择要绘制的 packed 图像;没有图像时先从材质或外部贴图导入。", "image": "steps/M09-workspace.jpg" },
|
||||
{ "text": "设置颜色、半径和强度,在画布拖拽绘制;松开后提交为一个绘制事务。", "image": "steps/M09-stroke.jpg" },
|
||||
{ "text": "使用撤销/重做对比结果;保存 OPFS 后重开,笔画仍在。", "image": "steps/M09-undo.jpg" },
|
||||
{ "text": "库链接图像先点击“设为本地”(原生 Make Local),再绘制;3D 投影绘制需要原生会话。", "image": "steps/M09-make-local.jpg" }
|
||||
],
|
||||
"tips": ["图像越大,PNG 编码越慢;课程使用 1024×1024。", "2D 绘制是本地能力;UDIM/投影属于原生会话路径。"],
|
||||
"warnings": ["清除站点数据会丢失 OPFS 中的贴图;重要贴图手动下载备份。"],
|
||||
"checks": ["画布像素变化", "撤销恢复", "重开后笔画仍在"]
|
||||
},
|
||||
{
|
||||
"id": "M10",
|
||||
"title": "曲线、文本、字体与 Grease Pencil",
|
||||
"level": "进阶",
|
||||
"minutes": 14,
|
||||
"summary": "创建曲线/曲面/文本/融球/Grease Pencil,编辑控制点与字体,并绘制 GP 笔画。",
|
||||
"objectives": ["创建非网格对象", "编辑曲线/文本", "绘制 GP"],
|
||||
"steps": [
|
||||
{ "text": "“添加”菜单包含 Bezier/NURBS 曲线、曲面、文本、骨架、融球、体积、晶格、点云、毛发、Grease Pencil 与力场。", "image": "steps/M10-add.jpg" },
|
||||
{ "text": "进入编辑模式编辑曲线控制点;文本属性可编辑正文、布局与字体链接。", "image": "steps/M10-text.jpg" },
|
||||
{ "text": "导入本地 TTF/OTF/PFB 字体会打包进 Main,保存 OPFS 后重开仍可用。", "image": "steps/M10-font.jpg" },
|
||||
{ "text": "在 GP 编辑器中添加图层/帧并绘制笔画;可调整材质与插值。", "image": "steps/M10-grease-pencil.jpg" }
|
||||
],
|
||||
"tips": ["非网格数据的高级编辑受能力矩阵限制,部分操作走原生/F3。", "字体文件会进入工程资源,注意体积。"],
|
||||
"warnings": ["库链接字体的部分编辑只读。"],
|
||||
"checks": ["非网格对象出现在 Outliner", "曲线/文本可编辑", "GP 笔画可保存"]
|
||||
},
|
||||
{
|
||||
"id": "M11",
|
||||
"title": "Shading 与 RE 5000PBR 资产库",
|
||||
"level": "核心",
|
||||
"minutes": 20,
|
||||
"summary": "从 RE 5000PBR 派生库加载 6 种材质,分配给猴头,检查材质编译与贴图,并体验 HQ 2048。",
|
||||
"objectives": ["认识资产库", "分配 6 种材质", "理解标准/HQ 与 packed 贴图"],
|
||||
"steps": [
|
||||
{ "text": "切到 Shading 工作区;左下角 PBR 资产库有 pbr-essentials 与 RE 两个来源。选择 RE 5000PBR,只显示 6 张材质卡片。", "image": "steps/M11-library.jpg" },
|
||||
{ "text": "单击卡片只选中,双击才会分配。分配前确认顶部模式是 Object Mode;编辑模式下 Blender 会拒绝追加资产。依次双击防滑颗粒、砖墙、随机瓷砖、光亮瓷砖、规则砖墙、做旧砖墙。", "image": "steps/M11-assign.jpg" },
|
||||
{ "text": "每次分配后等待材质槽更新且材质球显示 COMPILED;贴图状态应为 ready。", "image": "steps/M11-compiled.jpg" },
|
||||
{ "text": "点击“加载高清贴图 (2048)”按需启用 HQ 库;HQ 更清晰但占用更多显存和加载时间。", "image": "steps/M11-hq.jpg" }
|
||||
],
|
||||
"tips": ["资产来源下拉框决定当前显示的库。", "RE 资产由 /home/mes123456/workinf_Blender_Wasm/re/5000PBR精简版 派生,贴图已 packed。"],
|
||||
"warnings": ["HQ 是懒加载,首次启用会明显变慢;低显存设备先用标准库。"],
|
||||
"checks": ["6 张卡片可见", "材质槽更新", "COMPILED 与贴图 ready", "HQ 可加载"]
|
||||
},
|
||||
{
|
||||
"id": "M12",
|
||||
"title": "PBR 渲染与诊断",
|
||||
"level": "核心",
|
||||
"minutes": 20,
|
||||
"summary": "在 Rendering 工作区渲染猴头,调整分辨率/相机/视角/曝光/位移,查看诊断视图并下载 PNG。",
|
||||
"objectives": ["完成一次 PBR 渲染", "使用诊断视图", "理解位移与 GPU"],
|
||||
"steps": [
|
||||
{ "text": "切到 Rendering;PBR 面板可选择分辨率 256–2048、相机与视角预设 SCENE_CAMERA/COMPARISON。", "image": "steps/M12-panel.jpg" },
|
||||
{ "text": "点击“渲染 PBR”,等待结果图出现;材质、贴图和灯光共同决定画面。", "image": "steps/M12-render.jpg" },
|
||||
{ "text": "切换诊断视图 BASE_COLOR/NORMAL/ROUGHNESS,检查贴图与法线;曝光可选 0/+1/+2 EV。", "image": "steps/M12-diagnostics.jpg" },
|
||||
{ "text": "调整位移强度观察几何细节;点击“下载 PNG”手动保存渲染结果。", "image": "steps/M12-download.jpg" }
|
||||
],
|
||||
"tips": ["渲染使用 WebGL2/three.js 的 PBR 路径,不是桌面 EEVEE/Cycles。", "RTX 4060 硬件 lane 比 SwiftShader 快;首次纹理加载需要时间。"],
|
||||
"warnings": ["交互视口不细分位移,位移主要影响静态渲染。", "深色材质在 PBR 下看起来偏暗,可提高曝光。"],
|
||||
"checks": ["结果图出现", "诊断视图切换", "PNG 手动下载", "多次渲染 SHA 不同"]
|
||||
},
|
||||
{
|
||||
"id": "M13",
|
||||
"title": "动画、Graph/NLA/驱动器与播放",
|
||||
"level": "核心",
|
||||
"minutes": 20,
|
||||
"summary": "插关键帧、播放动画、编辑 F-Curve/Graph、提交 NLA、设置驱动器表达式,并用对象作相机。",
|
||||
"objectives": ["关键帧与播放", "Graph/NLA", "驱动器与相机"],
|
||||
"steps": [
|
||||
{ "text": "在 Animation 工作区选中猴头,移动时间线到不同帧,点击 Loc/Rot/Scale 插入关键帧。", "image": "steps/M13-keyframes.jpg" },
|
||||
{ "text": "点击播放,时间线按 Blender 持久 depsgraph 逐帧求值;暂停后拖到中间帧检查插值。", "image": "steps/M13-playback.jpg" },
|
||||
{ "text": "在 Graph Editor 调整关键帧/插值;在 NLA 表单提交 strip;驱动器表达式可写入并查看变量/目标。", "image": "steps/M13-graph-nla.jpg" },
|
||||
{ "text": "在 Scene Bindings 点击“用当前对象作相机”,视口切换到该对象视角;可用 Numpad0/锁定持久化。", "image": "steps/M13-camera.jpg" }
|
||||
],
|
||||
"tips": ["自动关键帧可在 Preferences → 动画中开启。", "播放依赖原生 depsgraph,不是 JS 逐帧模拟。"],
|
||||
"warnings": ["Graph 是简化编辑器;复杂驱动/曲线以原生会话为准。"],
|
||||
"checks": ["关键帧出现在时间线", "播放推进帧", "NLA/驱动器提交", "对象相机生效"]
|
||||
},
|
||||
{
|
||||
"id": "M14",
|
||||
"title": "EEVEE/Cycles 后端渲染",
|
||||
"level": "核心",
|
||||
"minutes": 14,
|
||||
"summary": "通过 server/native 后端使用桌面 Blender 的 EEVEE/Cycles 渲染,并把产物取回 Web 工程。",
|
||||
"objectives": ["理解后端渲染", "提交渲染任务", "取回产物"],
|
||||
"steps": [
|
||||
{ "text": "确认后端已启动:部署服务器 + BLENDER_BIN 指向本机 Blender;打开渲染面板的桌面 EEVEE 区域。", "image": "steps/M14-backend.jpg" },
|
||||
{ "text": "选择引擎与帧范围,提交渲染;任务完成后产物出现在文件列表。", "image": "steps/M14-render.jpg" },
|
||||
{ "text": "下载或应用结果;后端结果 .blend 可按 revision 回写 Main。", "image": "steps/M14-result.jpg" }
|
||||
],
|
||||
"tips": ["后端并发上限 2,单任务 512 MiB;大场景请分批。", "后端渲染与本地 PBR 是两条不同路径。"],
|
||||
"warnings": ["后端需要 bwrap/prlimit/xvfb-run 与 Blender 二进制;缺失时返回 503,不是本地 bug。"],
|
||||
"checks": ["后端健康", "渲染任务完成", "产物可取回"]
|
||||
},
|
||||
{
|
||||
"id": "M15",
|
||||
"title": "Compositor 合成",
|
||||
"level": "核心",
|
||||
"minutes": 16,
|
||||
"summary": "在 Compositor 画布添加/连线/提交节点,使用 WASM 合成求值,并体验服务端合成渲染。",
|
||||
"objectives": ["节点图编辑", "WASM 求值", "服务端合成"],
|
||||
"steps": [
|
||||
{ "text": "切到 Compositing,画布已有输出节点;从“添加节点类型”选择 Constant Color/Exposure 等并添加。", "image": "steps/M15-nodes.jpg" },
|
||||
{ "text": "从节点右侧输出拖到下一个节点输入,再连到 Composite;点击“提交图”写入 Main。", "image": "steps/M15-links.jpg" },
|
||||
{ "text": "点击“WASM 合成求值”,在浏览器内用 Blender CPU 合成器求值并显示结果。", "image": "steps/M15-wasm-eval.jpg" },
|
||||
{ "text": "在 Render Pipeline 点击“服务端合成渲染”,由 server Blender 执行完整合成。", "image": "steps/M15-server.jpg" }
|
||||
],
|
||||
"tips": ["节点目录是 allowlist;未知节点会被拒绝。", "合成结果可保存重开,节点位置/连线保留。"],
|
||||
"warnings": ["服务端合成需要后端;失败时记录为后端 BLOCKED。"],
|
||||
"checks": ["节点/连线/提交", "WASM 求值出图", "服务端合成出图"]
|
||||
},
|
||||
{
|
||||
"id": "M16",
|
||||
"title": "Geometry Nodes",
|
||||
"level": "核心",
|
||||
"minutes": 16,
|
||||
"summary": "在 Geometry Nodes 工作区添加节点、连线并提交,生成程序化几何。",
|
||||
"objectives": ["理解 GN 图", "添加/连线/提交", "查看结果"],
|
||||
"steps": [
|
||||
{ "text": "切到 Geometry Nodes,画布已有 Group Input/Output;从节点目录选择 Transform/Set Position 等添加。", "image": "steps/M16-nodes.jpg" },
|
||||
{ "text": "连接 Geometry 线,修改节点参数,点击“提交图”;网格随图更新。", "image": "steps/M16-commit.jpg" },
|
||||
{ "text": "尝试 Mesh Cube/Instance on Points 等 40 类目录中的节点;Simulation Zone 仍为明确边界。", "image": "steps/M16-result.jpg" }
|
||||
],
|
||||
"tips": ["原生 writer 接受已注册节点;UI 只提供 allowlist。", "保存重开会保留节点、连线与位置。"],
|
||||
"warnings": ["Simulation Zone/Repeat/Foreach 未开放。"],
|
||||
"checks": ["节点/连线提交", "几何更新", "保存重开保留"]
|
||||
},
|
||||
{
|
||||
"id": "M17",
|
||||
"title": "Spreadsheet 求值属性",
|
||||
"level": "进阶",
|
||||
"minutes": 12,
|
||||
"summary": "在 Spreadsheet 查看对象/顶点/边/面/UV/属性,并读取 GN 修改器求值后的属性域。",
|
||||
"objectives": ["切换数据源", "过滤/分页/CSV", "读取求值属性"],
|
||||
"steps": [
|
||||
{ "text": "在 Geometry Nodes 工作区的 Spreadsheet 选择数据源 Objects/Vertices/Edges/Faces/UV/Attributes。", "image": "steps/M17-sources.jpg" },
|
||||
{ "text": "在 Attributes 点击“读取求值后属性”,查看名称/域/类型/数量与前 8 个值。", "image": "steps/M17-evaluated.jpg" },
|
||||
{ "text": "使用过滤行、分页与“导出 CSV”;CSV 通过手动下载保存。", "image": "steps/M17-csv.jpg" }
|
||||
],
|
||||
"tips": ["求值属性读取的是 GN 修改器求值后的网格,不是原始缓冲。", "大表用分页避免整表截断。"],
|
||||
"warnings": ["Spreadsheet 是只读检查器。"],
|
||||
"checks": ["数据源切换", "求值属性出现", "CSV 下载"]
|
||||
},
|
||||
{
|
||||
"id": "M18",
|
||||
"title": "Scripting 与 Python 控制台",
|
||||
"level": "进阶",
|
||||
"minutes": 12,
|
||||
"summary": "在 Scripting 工作区使用内嵌 CPython 控制台执行脚本、读取 Main、停止/重置会话并下载记录。",
|
||||
"objectives": ["执行 Python", "读取对象", "重置/下载记录"],
|
||||
"steps": [
|
||||
{ "text": "切到 Scripting,Python Console 使用浏览器内嵌 CPython,不依赖原生会话。", "image": "steps/M18-console.jpg" },
|
||||
{ "text": "输入 import bpy; print([o.name for o in bpy.data.objects]) 并点击“执行 Python”。", "image": "steps/M18-execute.jpg" },
|
||||
{ "text": "使用停止/重置会话处理长脚本;下载控制台记录以便排查。", "image": "steps/M18-reset.jpg" }
|
||||
],
|
||||
"tips": ["脚本可修改 Main;执行前保存并保留撤销点。", "Text Editor 也可运行文本数据块。"],
|
||||
"warnings": ["任意网络/插件安装 Python 不在能力范围。"],
|
||||
"checks": ["脚本输出", "对象读取", "会话重置"]
|
||||
},
|
||||
{
|
||||
"id": "M19",
|
||||
"title": "导入:GLB、glTF 文件夹、OBJ/STL/PLY、图像/VFont",
|
||||
"level": "核心",
|
||||
"minutes": 16,
|
||||
"summary": "导入猴头 GLB、带外部 .bin/贴图的 glTF 文件夹、OBJ/STL/PLY,以及图像与字体。",
|
||||
"objectives": ["GLB 导入", "glTF 文件夹", "其他格式"],
|
||||
"steps": [
|
||||
{ "text": "“文件 → 打开”选择 .glb 会追加导入;本课程的猴头就是这种方式。", "image": "steps/M19-glb.jpg" },
|
||||
{ "text": "F3 搜索“Import glTF 文件夹”,选择包含 .gltf/.bin/贴图的目录;相对路径会被保留。", "image": "steps/M19-gltf-folder.jpg" },
|
||||
{ "text": "OBJ 使用“导入 OBJ”面板,可同时选择 .mtl 与贴图;STL/PLY 通过同一文件输入。", "image": "steps/M19-obj.jpg" },
|
||||
{ "text": "图像和字体从材质/文本属性导入,资源进入 OPFS 工程。" , "image": "steps/M19-image-font.jpg" }
|
||||
],
|
||||
"tips": ["glTF 文件夹导入使用目录选择,不是单文件。", "导入是追加,不会替换当前场景。"],
|
||||
"warnings": ["外部资源缺失时,模型可能没有贴图。"],
|
||||
"checks": ["GLB 追加", "glTF 文件夹导入", "OBJ/STL/PLY 导入"]
|
||||
},
|
||||
{
|
||||
"id": "M20",
|
||||
"title": "导出:GLB/OBJ 与 USD/Alembic/FBX",
|
||||
"level": "核心",
|
||||
"minutes": 14,
|
||||
"summary": "浏览器内导出 GLB/OBJ,并通过 server/native 后端导出 USD/Alembic/FBX。",
|
||||
"objectives": ["本地导出", "后端导出", "校验产物"],
|
||||
"steps": [
|
||||
{ "text": "“文件 → 导出 → Web GLB”在浏览器内直接生成并手动下载;“glTF Binary (.glb)”条目会打开原生导出面板。", "image": "steps/M20-glb.jpg" },
|
||||
{ "text": "OBJ 导出可选本地或原生路径;本地导出会生成 .obj。", "image": "steps/M20-obj.jpg" },
|
||||
{ "text": "USD/Alembic/FBX 通过导出面板提交给 server Blender,完成后下载产物包。", "image": "steps/M20-native.jpg" }
|
||||
],
|
||||
"tips": ["本地导出不依赖后端,适合日常交换。", "USD/FBX 需要后端;失败时检查服务与 Blender 二进制。"],
|
||||
"warnings": ["导出不会自动覆盖本地文件,下载由浏览器决定位置。"],
|
||||
"checks": ["GLB/OBJ 产物", "USD/FBX 产物", "文件可被重新导入"]
|
||||
},
|
||||
{
|
||||
"id": "M21",
|
||||
"title": "物理与模拟",
|
||||
"level": "进阶",
|
||||
"minutes": 14,
|
||||
"summary": "编辑刚体/布料/流体/粒子参数,播放模拟并执行 Simulate Range 推进 depsgraph。",
|
||||
"objectives": ["物理参数", "播放", "Simulate Range"],
|
||||
"steps": [
|
||||
{ "text": "在 Properties → Physics 选择 Rigid Body/Cloth/Fluid/Particle,编辑质量、摩擦、碰撞、缓存。", "image": "steps/M21-settings.jpg" },
|
||||
{ "text": "点击播放,Blender 持久 depsgraph 逐帧推进求解与缓存。", "image": "steps/M21-playback.jpg" },
|
||||
{ "text": "在 Simulate Range 输入起止帧并点击 Simulate,完成后检查对象位置/缓存状态。", "image": "steps/M21-range.jpg" }
|
||||
],
|
||||
"tips": ["重负载求解建议使用 server/native bake。", "缓存写入 OPFS/原生缓存,保存 .blend 不一定包含外部缓存文件。"],
|
||||
"warnings": ["流体/粒子在单线程 WASM 下可能很慢。"],
|
||||
"checks": ["参数写入 Main", "播放推进", "Simulate Range 完成"]
|
||||
},
|
||||
{
|
||||
"id": "M22",
|
||||
"title": "Sequencer 与本地媒体",
|
||||
"level": "进阶",
|
||||
"minutes": 14,
|
||||
"summary": "导入本地媒体到 OPFS/VFS,添加 Strip,编辑时间/通道/转场,并恢复媒体或提交服务端导出。",
|
||||
"objectives": ["媒体选择", "Strip 编辑", "恢复/导出"],
|
||||
"steps": [
|
||||
{ "text": "在 Properties 的 Sequencer 区域选择 Strip 类型(Movie/Sound/Image),用“媒体文件”选择本地文件。", "image": "steps/M22-media.jpg" },
|
||||
{ "text": "点击 Add Strip;媒体写入 OPFS 并暂存到当前会话 VFS。", "image": "steps/M22-strip.jpg" },
|
||||
{ "text": "编辑起止帧、通道、静音,使用 Move/Trim/Split 与转场/调色。", "image": "steps/M22-edit.jpg" },
|
||||
{ "text": "重开工程后点击“恢复媒体”从 OPFS 重新暂存;最终导出走 server Blender。", "image": "steps/M22-export.jpg" }
|
||||
],
|
||||
"tips": ["媒体不会自动下载;需要本地文件时手动导出。", "恢复媒体只重挂当前工程的所有媒体资产。"],
|
||||
"warnings": ["浏览器不提供本地媒体选择器之外的路径访问。"],
|
||||
"checks": ["媒体导入", "Strip 编辑", "恢复媒体", "服务端导出"]
|
||||
},
|
||||
{
|
||||
"id": "M23",
|
||||
"title": "相机锁定、追踪与遮罩",
|
||||
"level": "进阶",
|
||||
"minutes": 12,
|
||||
"summary": "使用对象作相机、相机视图与锁定持久化,并在 Tracking/Mask 面板编辑 Marker 与遮罩点。",
|
||||
"objectives": ["相机视图/锁定", "对象作相机", "追踪/遮罩"],
|
||||
"steps": [
|
||||
{ "text": "数字小键盘 0 进入/退出相机视图;在相机视图导航会移动相机并可撤销。", "image": "steps/M23-camera.jpg" },
|
||||
{ "text": "在 Scene Bindings 点击“用当前对象作相机”,再点“恢复场景相机”切回。", "image": "steps/M23-object-camera.jpg" },
|
||||
{ "text": "在 Tracking/Mask 面板选择 clip/track 或 mask/layer/spline,编辑 Marker 位置或遮罩点的坐标/羽化。", "image": "steps/M23-tracking.jpg" }
|
||||
],
|
||||
"tips": ["相机锁按视口保存,刷新后保留。", "追踪/遮罩编辑通过内嵌 bpy 写入 Main。"],
|
||||
"warnings": ["Camera solve 需要已验证的求解实现;面板只显示已有状态。"],
|
||||
"checks": ["相机视图/锁定", "对象作相机", "Marker/遮罩点更新"]
|
||||
},
|
||||
{
|
||||
"id": "M24",
|
||||
"title": "偏好设置、键位、主题与 Add-ons",
|
||||
"level": "入门",
|
||||
"minutes": 12,
|
||||
"summary": "在 Preferences 调整界面/视口/动画/导航,录制键位,切换主题预设,并启停内嵌 Add-ons。",
|
||||
"objectives": ["打开偏好设置", "编辑键位/主题", "Add-ons"],
|
||||
"steps": [
|
||||
{ "text": "“编辑 → 偏好设置”打开窗口;左侧有界面、视口、动画、输入与导航、键位、保存与加载、文件、主题、系统。", "image": "steps/M24-preferences.jpg" },
|
||||
{ "text": "在键位页点击“录制”后按下组合键;冲突会提示。保存偏好写入 OPFS。", "image": "steps/M24-keymap.jpg" },
|
||||
{ "text": "主题页选择 DARK/LIGHT/HIGH_CONTRAST,界面立即应用。", "image": "steps/M24-theme.jpg" },
|
||||
{ "text": "系统页可查看 Blender 版本并启停内嵌 Add-ons;外部扩展安装不支持。", "image": "steps/M24-addons.jpg" }
|
||||
],
|
||||
"tips": ["偏好保存到 OPFS,刷新后保留。", "浏览器保留的快捷键可能与桌面键位冲突。"],
|
||||
"warnings": ["完整桌面主题颜色表与全部键位仍以原生会话为准。"],
|
||||
"checks": ["偏好保存", "键位录制", "主题切换", "Add-on 启停"]
|
||||
}
|
||||
]
|
||||
}
|
||||
136
tools/web/course/complete-video-chapters.json
Normal file
136
tools/web/course/complete-video-chapters.json
Normal file
@@ -0,0 +1,136 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"voice": "zh-CN-XiaoxiaoNeural",
|
||||
"chapters": [
|
||||
{
|
||||
"id": "intro",
|
||||
"title": "开场:这套课程会带你做什么",
|
||||
"narration": "这一套课程面向第一次使用 Web Blender 的同学,目标是让你在浏览器里独立完成一次真实的小项目。我们使用的素材不是示范用的替代品,而是本机的两个真实文件:一个只有网格、没有材质的猴头 GLB,以及从 RE 五千 PBR 精简版资产目录派生出来的六种材质。课程会从新建工程开始,先导入猴头,再从资产库分配材质,然后依次走完建模、修改器、雕刻、UV、纹理绘制、曲线与文字、材质节点、PBR 渲染、原生后端渲染、合成、几何节点、数据表、Python 脚本、导入导出、物理模拟、序列编辑器、相机与追踪、偏好设置。每个模块都会告诉你点哪里、应该看到什么、以及为什么这样做。所有保存、重开和恢复都使用浏览器 OPFS,只有你主动点击下载时才会生成本地文件。建议第一遍连续观看,第二遍打开产品按模块跟做,遇到不一致时先看底栏状态和对象数。"
|
||||
},
|
||||
{
|
||||
"id": "M01",
|
||||
"title": "工程、导入猴头与 OPFS 保存",
|
||||
"narration": "先打开产品入口,地址里的 ui 等于 web。第一次加载需要把较大的 WebAssembly 引擎下载到浏览器,可能需要几十秒到几分钟,耐心等待底栏出现 Engine 和场景状态。新建常规工程后,场景里有立方体、相机和灯光三个对象。点击文件菜单里的打开,选择 re 目录里的猴头点 GLB。注意导入是追加,不会替换当前场景;导入完成后对象数增加一,活动对象变成 Suzanne。此时猴头没有材质,所以是灰色的,这是正常的基线。接下来点击顶栏的保存项目。这个动作只写入浏览器 OPFS,不会弹出下载框。底栏的保存状态变成 SUCCEEDED,表示工程已经落盘。为了验证保存,关闭项目,再从最近的工程里选择刚保存的 studio 点 blend,等待场景恢复;对象数应该和保存前一致,活动对象仍然是 Suzanne。如果你需要一份本地备份,最后再点击下载点 blend,这是唯一会生成本地文件的动作。记住区分保存和下载:保存用于继续工作,下载用于备份或交付。"
|
||||
},
|
||||
{
|
||||
"id": "M02",
|
||||
"title": "界面、工作区与视口",
|
||||
"narration": "顶部一排是工作区标签,依次是 Layout、Modeling、Sculpting、UV Editing、Texture Paint、Shading、Animation、Rendering、Compositing、Geometry Nodes 和 Scripting。工作区只是布局,不会改变工程数据。点击标签即可切换,右侧的工作区列表菜单也提供同样的入口。区域右上角和头部有三点菜单,可以把当前区域垂直或水平分割、合并、交换,也可以复制、最大化或关闭。分割后每个区域都有独立的编辑器类型下拉框,例如把 Outliner 切换成 Spreadsheet 或 Python Console。三维视口的导航要熟练:按住鼠标中键拖动旋转,滚轮缩放,Shift 加中键平移;数字小键盘零进入相机视图,再按一次退出;Home 框显全部对象。找不到按钮时按 F3 打开操作搜索,输入移动、保存或某个算子名,结果会标注执行位置。灰色的命令表示当前上下文不可用,不是程序坏了。"
|
||||
},
|
||||
{
|
||||
"id": "M03",
|
||||
"title": "Outliner、对象与层级",
|
||||
"narration": "Outliner 是场景的层级表。单击对象名选择,按住 Shift 再单击可以多选;选中的对象在三维视口里会出现橙色轮廓。按 F2 或者双击名称进入重命名,输入后按 Enter 确认。改名会写入 Main 数据,保存 OPFS 后重新打开仍然保留。对象右侧的眼睛图标控制可见性,隐藏只影响显示,不会删除数据,再次点击就恢复。把对象拖到另一个对象上会建立父子关系,拖到集合上则改变集合链接。物体菜单里的 Parent 和 Join 要区分:Parent 只改变层级,子对象仍保留自己的网格;Join 会把多个网格合并成一个数据块,活动对象决定合并后的名称和数据。集合用于组织场景,新建集合后可以把对象拖进去。所有层级和集合变化都会进入撤销历史,操作错了先撤销再继续。"
|
||||
},
|
||||
{
|
||||
"id": "M04",
|
||||
"title": "Properties、变换、相机与灯光",
|
||||
"narration": "Properties 是右侧的属性面板,顶部有对象、修改器、材质三个标签。对象标签里可以看到并直接输入位置、旋转和缩放,输入后立即提交并进入撤销历史。物体菜单的应用子菜单可以把位置、旋转、缩放烘焙进网格;应用后数值归零,但网格形状不变。设置原点可以把轴心移到几何体中心、游标或世界原点,后续旋转和缩放会围绕新轴心进行。选择相机后,相机属性可以调整焦距、裁剪起点和终点;数字小键盘零进入相机视图,在相机视图里导航会移动相机本身。选择灯光后,可以调整类型、能量、阴影和衰减;World 区域调整环境光和背景。链接对象或链接材质的属性是只读的,需要先设为本地才能编辑。场景和渲染属性在下方,包含分辨率、帧范围、色彩管理和输出格式。"
|
||||
},
|
||||
{
|
||||
"id": "M05",
|
||||
"title": "建模与网格编辑",
|
||||
"narration": "在 Modeling 工作区或添加菜单里创建立方体、平面、UV 球、圆柱、圆锥和圆环,也可以按 F3 搜索基础体命令。选中网格后点击模式按钮切到编辑模式,再选择顶点、边或面选择域。视口工具里的框选按钮可以拖出一个矩形选择元素;B 键是桌面版的框选,也可以沿循环边、边环或相似元素扩展选择。常用操作要形成手感:E 挤出,Ctrl B 倒角,Ctrl R 环切,I 内插,G 移动,S 缩放,R 旋转。这些操作在 Web 版里通过真实 Blender 原生算子执行,不是前端模拟。拓扑有问题时,用重新计算法线、按距离合并、删除松散元素和溶解来修正。每一步都可以撤销,破坏性操作前先保存或确认撤销可用。菜单和 F3 调用的是同一批算子,找不到按钮时优先用 F3。"
|
||||
},
|
||||
{
|
||||
"id": "M06",
|
||||
"title": "修改器栈",
|
||||
"narration": "修改器是不破坏原始网格的编辑方式。在 Properties 的修改器标签点击添加,先加细分曲面,把视口级别从一调到二,紫色线框会显示细分后的形状。再加镜像,选择轴并打开裁切,让对象关于原点对称。布尔修改器需要选择另一个对象作为操作数,并选择并集、差集或交集;布尔要求网格尽量封闭,否则结果会破面。阵列修改器通过数量和偏移复制对象。修改器从上到下求值,拖动顺序会改变结果。每个修改器右侧的眼睛控制视口显示,相机图标控制渲染显示。确认效果后点击应用,把修改器烘焙进网格;应用后不能再靠参数回退,只能撤销或重做。修改器栈会随工程保存到 OPFS。"
|
||||
},
|
||||
{
|
||||
"id": "M07",
|
||||
"title": "雕刻",
|
||||
"narration": "选中猴头,切到 Sculpting 工作区。属性面板里有笔刷、半径、强度、压力、对称和镜像设置。先选择 Draw 笔刷,把半径调到适合头部的尺寸,强度不要一开始就拉满。在视口按住左键拖拽,指针移动会被采样成一条笔触,松开后提交为一次原生 sculptStroke。画错了直接撤销。Inflate 让表面鼓起,Grab 抓住一片区域移动,Smooth 平滑过渡。遮罩可以保护已有形状,活动面组用于局部操作。需要重新拓扑时设置 Remesh 的体素大小,再点击 Voxel Remesh;体素越小细节越多,但内存和计算也越高。复杂形状分多次画,每次画完检查视口和撤销,避免一次改太多。"
|
||||
},
|
||||
{
|
||||
"id": "M08",
|
||||
"title": "UV 编辑",
|
||||
"narration": "选中猴头,切到 UV Editing。桌面 Blender 的 UV 编辑器要求网格处于编辑模式,所以先点击模式按钮进入 Edit Mode。左侧是三维视口,右侧是 UV 画布。在 UV 画布点击全选 UV,等待状态提示选择已提交;再点击展开所选 UV,橙色点会变成展开后的 UV 岛。展开前标记缝合线通常能得到更整齐的结果,可以用边菜单或 F3 标记缝合线。展开后使用打包 UV 岛整理布局,平均岛缩放让各个面的纹理密度接近。UV 选择与三维视口选择是两套状态,切换时注意当前焦点。完成后回到 Layout 保存 OPFS,重新打开工程,UV 数据和贴图坐标应保持一致。链接网格数据需要先设为本地才能写入。"
|
||||
},
|
||||
{
|
||||
"id": "M09",
|
||||
"title": "纹理绘制",
|
||||
"narration": "切到 Texture Paint 工作区。先选择要绘制的 packed 图像;如果没有图像,可以从材质的外部贴图入口导入,资源会进入 OPFS 工程。设置画笔颜色、半径和强度,在二维画布上拖拽绘制。松开后一次绘制提交为一个事务,可以用撤销和重做对比结果。保存 OPFS 后重新打开,笔画仍然存在。库链接的图像要先点击设为本地,这一步调用原生的 Make Local,之后再绘制才能写入。课程使用一千零二十四分辨率的图像,图像越大,PNG 编码和加载越慢。需要 UDIM 多块贴图或三维投影绘制时,通过原生会话完成;二维 packed 绘制是浏览器内的本地能力。"
|
||||
},
|
||||
{
|
||||
"id": "M10",
|
||||
"title": "曲线、文本、字体与 Grease Pencil",
|
||||
"narration": "添加菜单里有 Bezier 和 NURBS 曲线、曲面、文本、骨架、融球、体积、晶格、点云、毛发、Grease Pencil 和力场。创建曲线或文本后进入编辑模式,可以编辑控制点、手柄和样条类型;曲线属性里可以设置挤出、倒角、锥化和分辨率。文本属性可以编辑正文、对齐、行距和字体链接。导入本地 TTF、OTF 或 PFB 字体会把文件打包进 Main,保存 OPFS 后重新打开仍然可用,字体文件也会计入工程资源体积。Grease Pencil 在属性面板里管理图层、帧和笔画,可以绘制、选择、移动和插值;材质和插值属于进阶操作。非网格数据的高级编辑受能力矩阵限制,部分操作需要原生会话或 F3。"
|
||||
},
|
||||
{
|
||||
"id": "M11",
|
||||
"title": "Shading 与 RE 5000PBR 资产库",
|
||||
"narration": "切到 Shading 工作区。左下角是 PBR 资产库,默认有基础资产和 RE 两个来源;用资产来源下拉框选择 RE 五千 PBR,列表只保留六张材质卡片。卡片显示缩略图和材质名。单击卡片只会选中,不会分配;双击才会把材质分配给当前对象。依次双击防滑颗粒、砖墙、随机瓷砖、光亮瓷砖、规则砖墙和做旧砖墙,每次等待材质槽更新,并确认材质球显示 COMPILED、贴图状态为 ready。如果缩略图还没加载完,稍等或点击刷新。需要更高清时可以点击加载高清贴图,启用两千零四十八的 HQ 库;HQ 是按需加载的,首次启用会明显变慢,也会占用更多显存。RE 资产来自本机的五千 PBR 精简版目录,贴图已经打包,不依赖网络。"
|
||||
},
|
||||
{
|
||||
"id": "M12",
|
||||
"title": "PBR 渲染与诊断",
|
||||
"narration": "切到 Rendering 工作区,右侧是 PBR 渲染面板。先选择分辨率,课程用一千零二十四或两千零四十八;再选择相机和视角预设,SCENE_CAMERA 使用场景相机,COMPARISON 提供对比视角。点击渲染 PBR,等待结果图出现,状态会显示纹理准备情况和渲染进度。如果画面偏暗,可以用教学曝光加一或加二 EV。诊断视图可以切换基础色、法线和粗糙度,用来检查贴图是否正确绑定、法线方向是否合理。位移强度控制几何细节的夸张程度,交互视口不会细分,位移主要在静态渲染里体现。满意后点击下载 PNG,这是手动触发的本地保存。需要记住,这条路径是浏览器内的 WebGL2 PBR 渲染,不是桌面 EEVEE 或 Cycles。"
|
||||
},
|
||||
{
|
||||
"id": "M13",
|
||||
"title": "动画、Graph、NLA 与播放",
|
||||
"narration": "在 Animation 工作区选中猴头。时间线可以跳到首帧、末帧、上一帧或下一帧,也可以直接输入帧号。移动到目标帧后,点击位置、旋转、缩放按钮插入关键帧;Dope Sheet 会显示关键点。点击播放,时间线由 Blender 持久依赖图逐帧求值,状态栏会显示原生播放状态;再次点击暂停,然后拖到中间帧检查插值。Graph 编辑器可以调整关键帧、手柄和插值方式;NLA 表单可以添加轨道和 Strip,并提交到 Main;驱动器可以写入表达式,变量和目标在下方只读展示。自动关键帧可以在偏好设置里开启,开启后移动对象会自动插入关键帧。场景绑定里点击用当前对象作相机,可以把视口切换到对象视角;数字小键盘零和相机锁定用于持久化。"
|
||||
},
|
||||
{
|
||||
"id": "M14",
|
||||
"title": "EEVEE 与 Cycles 后端渲染",
|
||||
"narration": "浏览器内的 PBR 渲染和桌面的 EEVEE、Cycles 是两条不同路径。需要原生引擎时,使用部署服务器提供的原生工作流。先确认服务已启动,Blender 二进制路径指向本机编译好的版本;服务器会通过 bwrap、prlimit 和 xvfb 运行有界任务。在 Rendering 工作区展开桌面 EEVEE 渲染区域,选择引擎和帧范围,提交任务。任务完成后产物会出现在文件列表,可以下载或把结果工程回写 Main。后端并发上限是两个任务,单任务源码上限五百一十二兆,渲染帧数也有上限;大场景请分批。后端缺失工具时会返回五百零三,这不是前端缺陷,先检查部署环境。"
|
||||
},
|
||||
{
|
||||
"id": "M15",
|
||||
"title": "Compositor 合成",
|
||||
"narration": "切到 Compositing 工作区。画布上已经有合成输出节点,可以从添加节点类型里选择常量颜色、曝光、模糊、混合、变换、图像和渲染层等节点,点击添加。节点添加后,从右侧输出圆点拖到下一个节点的输入圆点,再连到合成输出;连线会写入节点图。修改节点参数后点击提交图,整个图会写入 Main 并保存到 OPFS。点击 WASM 合成求值,浏览器会调用 Blender 的 CPU 合成器执行当前节点树,并把结果画在画布上;这是真实原生求值,不是前端滤镜。需要完整渲染管线时,在 Render Pipeline 区域点击服务端合成渲染,由服务器 Blender 执行。合成节点目录是受控 allowlist,未知节点会被拒绝。"
|
||||
},
|
||||
{
|
||||
"id": "M16",
|
||||
"title": "Geometry Nodes",
|
||||
"narration": "切到 Geometry Nodes 工作区。画布上已有组输入和组输出节点。从添加节点类型下拉框选择变换、设置位置、连接几何、实例化或基础网格等节点,点击添加;节点会出现在画布上。把几何输出连到下一个节点的几何输入,修改参数,再点击提交图。提交后原生几何节点修改器会重建网格,视口随图更新。当前目录提供四十类节点,覆盖基础网格、实例化、分布、实例变换、曲线和挤出等常用能力;仿真区域、重复和遍历仍是明确边界。保存 OPFS 后重新打开,节点、连线、位置和参数都会保留。复杂节点图先在副本上试验,避免破坏主对象。"
|
||||
},
|
||||
{
|
||||
"id": "M17",
|
||||
"title": "Spreadsheet 求值属性",
|
||||
"narration": "在 Geometry Nodes 工作区的右下角是 Spreadsheet。顶部数据源可以选择对象、顶点、边、面、UV 或属性。对象表显示名称、类型、可见性和变换;顶点、边、面表显示索引和坐标;属性页最关键。点击读取求值后属性,Spreadsheet 会通过 Blender 求值依赖图读取几何节点修改器作用后的网格属性,显示名称、域、数据类型、数量和前八个值。这样你能看到最终几何上的属性,而不是原始缓冲。使用过滤行搜索,使用分页和每页行数查看大表,避免一次渲染几十万行。需要离线分析时点击导出 CSV,由浏览器手动下载。Spreadsheet 是只读检查器,不会修改工程。"
|
||||
},
|
||||
{
|
||||
"id": "M18",
|
||||
"title": "Scripting 与 Python 控制台",
|
||||
"narration": "切到 Scripting 工作区。Python 控制台使用浏览器内嵌的 CPython,不依赖原生会话。在输入框里写 import bpy,然后打印所有对象名,点击执行 Python。输出会显示在控制台,命令也会记录到 Info 区域。脚本可以读取和修改 Main,因此执行前先保存 OPFS,并确认撤销历史可用。长脚本运行时可以点击停止;会话异常时可以重置 Python 会话;控制台记录可以下载,便于排查错误。Text Editor 可以保存和运行文本数据块,适合反复执行的脚本。任意网络访问、安装第三方包和加载外部插件不在能力范围;需要完整 Python 环境时使用原生会话。"
|
||||
},
|
||||
{
|
||||
"id": "M19",
|
||||
"title": "导入:GLB、glTF 文件夹与其他格式",
|
||||
"narration": "文件菜单的打开可以导入 blend 和多种模型格式。导入 GLB 会追加到当前场景,本课程的猴头就是这样进入工程的;导入后检查对象数和活动对象。带外部资源的 glTF 需要按 F3 搜索导入 glTF 文件夹,然后选择包含 gltf、bin 和贴图的整个目录;相对路径会被保留,贴图才能正确找到。OBJ 使用导入 OBJ 面板,可以同时选择 obj、mtl 和贴图文件;STL 和 PLY 通过同一个文件输入导入。图像和字体从材质或文本属性导入,资源会进入 OPFS 工程,保存后重新打开仍然可用。导入失败时先看状态栏的错误码,常见原因是文件不完整或格式不受支持。"
|
||||
},
|
||||
{
|
||||
"id": "M20",
|
||||
"title": "导出:GLB、OBJ 与 USD、Alembic、FBX",
|
||||
"narration": "文件菜单的导出子菜单提供多种格式。需要浏览器本地导出时选择 Web GLB,完成后由浏览器下载;这是最常用的交换格式。glTF Binary 条目会打开原生导出面板。OBJ 可以选择本地导出或原生导出;本地导出不依赖后端,适合快速交换。USD、Alembic 和 FBX 需要完整的 Blender IO 模块,因此通过导出面板提交给服务器 Blender,任务完成后下载产物包。导出前确认活动对象和选择范围,避免把不需要的对象一起导出。导出不会自动覆盖本地文件,下载位置由浏览器决定。需要验证时,把导出的文件重新导入一个新工程,检查对象数、材质和贴图是否保留。"
|
||||
},
|
||||
{
|
||||
"id": "M21",
|
||||
"title": "物理与模拟",
|
||||
"narration": "在 Properties 的物理区域选择刚体、布料、流体、软体或粒子系统。刚体可以设置质量、摩擦、弹性、碰撞形状和运动学;布料可以设置质量、空气阻尼、各种刚度和压力;流体可以设置域类型、分辨率、粘度和缓存范围;粒子可以设置数量和缓存。参数写入 Main 后,点击播放,Blender 持久依赖图会逐帧推进求解和缓存。也可以在 Simulate Range 输入起止帧,点击 Simulate,让模拟一次推进到目标帧,完成后检查对象位置和缓存状态。重负载求解建议使用服务器或原生烘焙,浏览器内单线程 WASM 对流体和大量粒子会比较慢。缓存文件可能不在 blend 内,保存前确认缓存策略。"
|
||||
},
|
||||
{
|
||||
"id": "M22",
|
||||
"title": "Sequencer 与本地媒体",
|
||||
"narration": "序列编辑器在 Properties 的时间线区域。先选择 Strip 类型,Movie 用于视频,Sound 用于音频,Image 用于图片;用媒体文件按钮选择本地文件。点击 Add Strip 后,媒体会写入 OPFS,并暂存到当前会话的虚拟文件系统,Strip 出现在时间线上。可以编辑起止帧、通道、静音和锁定,使用移动、裁剪、分割调整时间,使用转场和调色设置效果。重开工程后,媒体文件仍保存在 OPFS,但当前会话的虚拟文件系统是空的,需要点击恢复媒体,把所有媒体资产重新暂存。最终视频导出通过服务器 Blender 完成,因为浏览器内不编译原生 FFmpeg 编码器。媒体不会自动下载,需要本地文件时手动导出。"
|
||||
},
|
||||
{
|
||||
"id": "M23",
|
||||
"title": "相机锁定、追踪与遮罩",
|
||||
"narration": "数字小键盘零进入或退出相机视图;在相机视图里导航会移动相机,并可以用撤销恢复。相机锁定按视口保存,刷新后仍然保留。场景绑定区域可以把当前对象设为相机,这对用网格或空物体做镜头运动很有用;点击恢复场景相机可以切回。追踪和遮罩面板位于 Properties:选择片段和轨道后,可以添加、更新或删除标记点,设置帧和位置;选择遮罩、图层和样条后,可以编辑遮罩点的坐标、手柄类型和羽化,或者切换样条是否闭合。这些编辑通过内嵌 bpy 写入真实的 MovieClip 和 Mask 数据。相机求解需要已验证的求解实现,面板只显示已有的求解状态。"
|
||||
},
|
||||
{
|
||||
"id": "M24",
|
||||
"title": "偏好设置、键位、主题与 Add-ons",
|
||||
"narration": "点击编辑菜单里的偏好设置打开设置窗口。左侧分类有界面、视口、动画、输入与导航、键位、保存与加载、文件、主题和系统。界面页控制状态栏、快捷工具栏、区域切换器和启动工作区;视口页控制 gizmo 大小和默认着色;动画页控制自动关键帧、插值方式和手柄类型。键位页点击录制后按下组合键,冲突会给出提示;恢复默认可以回到 Blender 预设。主题页可以切换深色、浅色和高对比度,界面立即应用。系统页显示内嵌 Blender 版本,并可以启停内嵌 Add-ons;外部扩展安装和网络 Python 不在能力范围。点击保存偏好写入 OPFS,刷新后仍然生效。"
|
||||
},
|
||||
{
|
||||
"id": "outro",
|
||||
"title": "收尾:把完整流程连起来",
|
||||
"narration": "到这里,你已经用同一套猴头 GLB 和 RE 五千 PBR 资产走完了三十一项能力:从工程与 OPFS,到界面布局、对象层级、属性与变换、建模、修改器、雕刻、UV、纹理绘制、曲线文字、材质与资产库、PBR 渲染、原生后端渲染、合成、几何节点、数据表、Python 脚本、导入导出、物理、序列、相机、追踪和设置。建议回到课程页,按模块跟做;每一步都检查底栏 Engine 状态、对象数、保存状态和材质编译状态。遇到与课程不一致的地方,记录操作路径、截图和错误码,再回到对应章节定位。需要本地备份时手动下载 blend;需要原生引擎或插件能力时使用服务器或原生会话。完成整套练习后,你已经可以在浏览器里独立完成一个带材质、动画和渲染的真实小项目。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -731,13 +731,13 @@
|
||||
"image": "steps/M15-console.jpg"
|
||||
},
|
||||
{
|
||||
"text": "已知限制:多区域 split/join、完整 Driver 编辑器、完整节点/画笔目录、生产级 UDIM/4K 纹理绘制尚未完成。",
|
||||
"text": "能力边界:完整桌面主题颜色表、全部键位、完整 Driver 变量编辑器与任意节点目录以原生会话为准;2D packed 纹理绘制与 UDIM/投影路径见支持矩阵。",
|
||||
"image": "steps/M15-scripting.jpg"
|
||||
}
|
||||
],
|
||||
"tips": [
|
||||
"支持矩阵与最新进度见 docs/status/WEB_BLENDER_FULL_COURSE_20261113.md。",
|
||||
"课程不宣称完整 Blender parity。"
|
||||
"课程按能力矩阵标注本地/后端执行位置。"
|
||||
],
|
||||
"warnings": [
|
||||
"脚本可修改 Main;执行前先保存到 OPFS 并保留撤销点。"
|
||||
|
||||
171
tools/web/course/generate-complete-course.mjs
Normal file
171
tools/web/course/generate-complete-course.mjs
Normal file
@@ -0,0 +1,171 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Generate the static 15-module Web Blender course from complete-course.json.
|
||||
*
|
||||
* Usage:
|
||||
* node tools/web/course/generate-full-course.mjs
|
||||
*
|
||||
* Outputs:
|
||||
* web/app/public/tutorial/complete/index.html
|
||||
* web/app/public/tutorial/complete/course.css
|
||||
* web/app/public/tutorial/complete/course.json
|
||||
*/
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
||||
const REPO = path.resolve(HERE, "../../..");
|
||||
const DATA = path.join(HERE, "complete-course.json");
|
||||
const PUBLIC = path.join(REPO, "web/app/public");
|
||||
const OUT = path.join(PUBLIC, "tutorial/complete");
|
||||
fs.mkdirSync(OUT, { recursive: true });
|
||||
|
||||
const escapeHtml = (value) => String(value)
|
||||
.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">")
|
||||
.replaceAll('"', """).replaceAll("'", "'");
|
||||
|
||||
const course = JSON.parse(fs.readFileSync(DATA, "utf8"));
|
||||
const missing = [];
|
||||
const exists = (relative) => {
|
||||
const file = relative.startsWith("/")
|
||||
? path.join(PUBLIC, relative.slice(1))
|
||||
: path.join(OUT, relative);
|
||||
if (!fs.existsSync(file)) missing.push(relative);
|
||||
return fs.existsSync(file);
|
||||
};
|
||||
|
||||
const nav = course.modules.map((module) => `<a href="#${escapeHtml(module.id)}"><span>${escapeHtml(module.id)}</span>${escapeHtml(module.title)}</a>`).join("\n ");
|
||||
|
||||
const videos = (course.videos ?? []).map((video) => {
|
||||
exists(video.src);
|
||||
const poster = video.poster && exists(video.poster) ? ` poster="${escapeHtml(video.poster)}"` : "";
|
||||
const track = video.vtt && exists(video.vtt) ? `<track kind="subtitles" srclang="zh-Hans" label="中文" src="${escapeHtml(video.vtt)}" default />` : "";
|
||||
return `<section class="course-video" id="video-${escapeHtml(video.id)}">
|
||||
<h2>${escapeHtml(video.title)}</h2>
|
||||
<video controls preload="metadata" src="${escapeHtml(video.src)}"${poster} width="1280" height="720">${track}</video>
|
||||
<p>${escapeHtml(video.note)}</p>
|
||||
</section>`;
|
||||
}).join("\n ");
|
||||
|
||||
const modules = course.modules.map((module) => {
|
||||
const steps = module.steps.map((step, index) => {
|
||||
const image = step.image && exists(step.image) ? `<figure><img src="${escapeHtml(step.image)}" alt="${escapeHtml(module.title)} 第 ${index + 1} 步截图" loading="lazy" width="1600" height="900" /><figcaption>${escapeHtml(module.id)} · 步骤 ${index + 1}</figcaption></figure>` : "";
|
||||
return `<li><p>${escapeHtml(step.text)}</p>${image}</li>`;
|
||||
}).join("\n ");
|
||||
const objectives = module.objectives.map((item) => `<li>${escapeHtml(item)}</li>`).join("");
|
||||
const moduleVideo = module.video ? (() => {
|
||||
const src = module.video.src; const poster = module.video.poster; const vtt = module.video.vtt;
|
||||
exists(src);
|
||||
const posterAttr = poster && exists(poster) ? ` poster="${escapeHtml(poster)}"` : "";
|
||||
const track = vtt && exists(vtt) ? `<track kind="subtitles" srclang="zh-Hans" label="中文" src="${escapeHtml(vtt)}" default />` : "";
|
||||
return `<section class="course-module-video" data-module-video="${escapeHtml(module.id)}"><h3>本模块操作录像</h3><video controls preload="metadata" src="${escapeHtml(src)}"${posterAttr} width="1280" height="720">${track}</video><p>${escapeHtml(module.video.note ?? "")}</p></section>`;
|
||||
})() : "";
|
||||
const tips = (module.tips ?? []).map((item) => `<li>${escapeHtml(item)}</li>`).join("");
|
||||
const warnings = (module.warnings ?? []).map((item) => `<li>${escapeHtml(item)}</li>`).join("");
|
||||
return `<article class="course-module" id="${escapeHtml(module.id)}">
|
||||
<header>
|
||||
<p class="course-module-id">${escapeHtml(module.id)} · ${escapeHtml(module.level)} · 约 ${module.minutes} 分钟</p>
|
||||
<h2>${escapeHtml(module.title)}</h2>
|
||||
<p class="course-summary">${escapeHtml(module.summary)}</p>
|
||||
</header>
|
||||
<div class="course-objectives"><h3>本模块目标</h3><ul>${objectives}</ul></div>
|
||||
${moduleVideo}
|
||||
<ol class="course-steps">
|
||||
${steps}
|
||||
</ol>
|
||||
${tips ? `<div class="course-callout course-tips"><h3>提示</h3><ul>${tips}</ul></div>` : ""}
|
||||
${warnings ? `<div class="course-callout course-warnings"><h3>注意</h3><ul>${warnings}</ul></div>` : ""}
|
||||
</article>`;
|
||||
}).join("\n ");
|
||||
|
||||
const rules = course.rules.map((rule) => `<li>${escapeHtml(rule)}</li>`).join("");
|
||||
|
||||
const html = `<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>${escapeHtml(course.title)}</title>
|
||||
<link rel="stylesheet" href="./course.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header class="course-hero">
|
||||
<p class="course-kicker">Web Blender · ${escapeHtml(course.version)}</p>
|
||||
<h1>${escapeHtml(course.title)}</h1>
|
||||
<p class="course-subtitle">${escapeHtml(course.subtitle)}</p>
|
||||
<p class="course-audience">${escapeHtml(course.audience)}</p>
|
||||
<p class="course-first-load">${escapeHtml(course.firstLoadNote)}</p>
|
||||
</header>
|
||||
<div class="course-layout">
|
||||
<nav class="course-nav" aria-label="课程目录">
|
||||
<strong>24 个模块</strong>
|
||||
${nav}
|
||||
</nav>
|
||||
<main class="course-main">
|
||||
<section class="course-rules">
|
||||
<h2>开始之前</h2>
|
||||
<ul>${rules}</ul>
|
||||
</section>
|
||||
${videos}
|
||||
${modules}
|
||||
<footer class="course-footer">
|
||||
<p>课程截图来自本机有头 Chromium + RTX 4060 的实际操作。功能边界与最新进度见 docs/status/COMPLETE_TUTORIAL_20261113.md。</p>
|
||||
<p><a href="/">返回 Web Blender</a></p>
|
||||
</footer>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
const css = `:root{color-scheme:dark;--bg:#181818;--panel:#232323;--panel-2:#2b2b2b;--line:#3c3c3c;--text:#e6e6e6;--muted:#a9a9a9;--accent:#6aa1d8;--accent-2:#d8a45a}
|
||||
*{box-sizing:border-box}
|
||||
body{margin:0;background:var(--bg);color:var(--text);font:16px/1.7 "Noto Sans SC",system-ui,-apple-system,"Segoe UI",sans-serif}
|
||||
a{color:var(--accent)}
|
||||
.course-hero{padding:52px clamp(20px,5vw,72px) 34px;background:linear-gradient(135deg,#1d2833,#242424 60%,#2a2318);border-bottom:1px solid var(--line)}
|
||||
.course-kicker{margin:0 0 10px;color:var(--accent-2);font-size:13px;letter-spacing:.12em;text-transform:uppercase}
|
||||
.course-hero h1{margin:0 0 12px;font-size:clamp(30px,4vw,52px);line-height:1.15}
|
||||
.course-subtitle{margin:0 0 10px;max-width:900px;color:#c8d8e6;font-size:clamp(16px,2vw,21px)}
|
||||
.course-audience{margin:0 0 16px;color:var(--muted)}
|
||||
.course-first-load{margin:0;max-width:900px;padding:10px 14px;border-left:3px solid var(--accent-2);background:#2b2620;color:#e8d4b6}
|
||||
.course-layout{display:grid;grid-template-columns:260px minmax(0,1fr);gap:0;align-items:start}
|
||||
.course-nav{position:sticky;top:0;max-height:100vh;overflow:auto;padding:18px 14px;border-right:1px solid var(--line);background:#1d1d1d}
|
||||
.course-nav strong{display:block;margin:0 0 10px;color:var(--muted);font-size:12px;letter-spacing:.08em}
|
||||
.course-nav a{display:flex;gap:9px;padding:7px 8px;border-radius:5px;color:#d4d4d4;text-decoration:none;font-size:13px;line-height:1.35}
|
||||
.course-nav a:hover{background:#2c2c2c}
|
||||
.course-nav a span{flex:none;color:var(--accent-2);font-family:monospace}
|
||||
.course-main{min-width:0;padding:26px clamp(18px,4vw,56px) 60px}
|
||||
.course-rules,.course-video,.course-module{max-width:1180px;margin:0 auto 34px;padding:22px clamp(16px,2.5vw,30px);background:var(--panel);border:1px solid var(--line);border-radius:8px}
|
||||
.course-rules h2,.course-video h2,.course-module h2{margin-top:0;line-height:1.25}
|
||||
.course-video video,.course-module-video video{width:100%;height:auto;background:#000;border-radius:6px}
|
||||
.course-module-video{margin:16px 0 20px;padding:14px 16px;background:#262626;border:1px solid #3d4a3f;border-radius:6px}
|
||||
.course-module-video h3{margin:0 0 8px;font-size:15px;color:#cfe0ef}
|
||||
.course-module-video p{margin:8px 0 0;color:#aaa;font-size:13px}
|
||||
.course-video p{margin:10px 0 0;color:var(--muted)}
|
||||
.course-module-id{margin:0 0 4px;color:var(--accent-2);font-size:12px;letter-spacing:.08em;text-transform:uppercase}
|
||||
.course-summary{margin:0;color:#cfcfcf}
|
||||
.course-objectives{margin:18px 0}
|
||||
.course-objectives h3,.course-callout h3{margin:0 0 6px;font-size:15px;color:#cfe0ef}
|
||||
.course-objectives ul{margin:0;padding-left:22px}
|
||||
.course-steps{margin:20px 0 0;padding:0;list-style:none;counter-reset:step}
|
||||
.course-steps>li{counter-increment:step;position:relative;margin:0 0 22px;padding:0 0 0 40px}
|
||||
.course-steps>li::before{content:counter(step);position:absolute;left:0;top:0;display:grid;place-items:center;width:27px;height:27px;border-radius:50%;background:#36506a;color:#e8f2fb;font-size:13px;font-weight:700}
|
||||
.course-steps p{margin:2px 0 10px}
|
||||
.course-steps figure{margin:0}
|
||||
.course-steps img{display:block;width:100%;height:auto;border:1px solid var(--line);border-radius:6px;background:#111}
|
||||
.course-steps figcaption{margin-top:5px;color:#8f9aa4;font-size:12px}
|
||||
.course-callout{margin-top:18px;padding:12px 16px;border-radius:6px;background:var(--panel-2);border-left:3px solid #57708a}
|
||||
.course-callout ul{margin:0;padding-left:20px}
|
||||
.course-warnings{border-left-color:#c98e5a;background:#2d2720}
|
||||
.course-footer{max-width:1180px;margin:0 auto;padding-top:18px;border-top:1px solid var(--line);color:var(--muted);font-size:13px}
|
||||
@media(max-width:900px){.course-layout{grid-template-columns:1fr}.course-nav{position:static;max-height:none;border-right:0;border-bottom:1px solid var(--line);display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr))}.course-nav strong{grid-column:1/-1}.course-main{padding-top:18px}}
|
||||
`;
|
||||
|
||||
fs.mkdirSync(OUT, { recursive: true });
|
||||
fs.writeFileSync(path.join(OUT, "index.html"), html, "utf8");
|
||||
fs.writeFileSync(path.join(OUT, "course.css"), css, "utf8");
|
||||
fs.writeFileSync(path.join(OUT, "course.json"), JSON.stringify(course, null, 2) + "\n", "utf8");
|
||||
|
||||
console.log(JSON.stringify({ status: missing.length === 0 ? "PASS" : "MISSING_ASSETS", modules: course.modules.length, videos: course.videos.length, missing, output: OUT }, null, 2));
|
||||
if (missing.length > 0) process.exitCode = 1;
|
||||
179
tools/web/course/lib/lesson-recorder.mjs
Normal file
179
tools/web/course/lib/lesson-recorder.mjs
Normal file
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* Shared helpers for the complete Web Blender course capture/recording.
|
||||
* Reuses the conventions proven by tools/web/course/capture-full-course.mjs and
|
||||
* tools/web/record-re-pbr-lesson-video.mjs, but keeps one implementation.
|
||||
*/
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import crypto from "node:crypto";
|
||||
import { createRequire } from "node:module";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
export const REPO = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../..");
|
||||
export const WEB = path.join(REPO, "web");
|
||||
const requireFromWeb = createRequire(path.join(WEB, "package.json"));
|
||||
export const { chromium } = requireFromWeb("playwright");
|
||||
|
||||
export const ASSETS = {
|
||||
studio: path.join(REPO, "web/app/public/tutorial/pbr/studio.blend"),
|
||||
monkey: path.join(REPO, "re/猴头.glb"),
|
||||
monkeyFixture: path.join(REPO, "tests/files/web/pbr-render-lesson/monkey-head.glb"),
|
||||
texture: path.join(REPO, "web/app/public/tutorial/texture-paint/re-texture-base.png"),
|
||||
standardLibrary: "library:re-pbr-v1",
|
||||
highQualityLibrary: "library:re-pbr-hq-v1",
|
||||
};
|
||||
|
||||
export const HARDWARE_ARGS = [
|
||||
"--no-sandbox", "--use-gl=angle", "--use-angle=gl", "--ignore-gpu-blocklist",
|
||||
"--enable-gpu-rasterization", "--enable-zero-copy", "--enable-unsafe-webgpu",
|
||||
];
|
||||
export const SWIFTSHADER_ARGS = [
|
||||
"--no-sandbox", "--use-gl=swiftshader", "--enable-unsafe-swiftshader",
|
||||
"--enable-unsafe-webgpu", "--use-angle=swiftshader",
|
||||
];
|
||||
|
||||
export function parseArgs(argv = process.argv.slice(2)) {
|
||||
const value = (name, fallback) => {
|
||||
const index = argv.indexOf(`--${name}`);
|
||||
return index >= 0 && argv[index + 1] ? argv[index + 1] : fallback;
|
||||
};
|
||||
const has = (name) => argv.includes(`--${name}`);
|
||||
return {
|
||||
port: Number.parseInt(value("port", "5184"), 10) || 5184,
|
||||
baseUrl: value("base-url", ""),
|
||||
gpu: value("gpu", process.env.GPU_MODE ?? "hardware"),
|
||||
lane: value("lane", "local"),
|
||||
out: path.resolve(value("out", path.join(REPO, "tests/golden/COMPLETE-TUTORIAL-001"))),
|
||||
modules: value("module", ""),
|
||||
all: has("all"),
|
||||
resume: has("resume"),
|
||||
};
|
||||
}
|
||||
|
||||
export async function waitForServer(url, timeoutMs = 120_000) {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
while (Date.now() < deadline) {
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (response.status < 500) return;
|
||||
}
|
||||
catch { /* retry */ }
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
}
|
||||
throw new Error(`server did not start: ${url}`);
|
||||
}
|
||||
|
||||
export async function launchBrowser(gpuMode, options = {}) {
|
||||
const args = gpuMode === "hardware" ? HARDWARE_ARGS : SWIFTSHADER_ARGS;
|
||||
return chromium.launch({
|
||||
headless: gpuMode !== "hardware" ? true : false,
|
||||
executablePath: process.env.CHROME_PATH || "/usr/bin/google-chrome",
|
||||
args,
|
||||
...(options.recordVideo ? { recordVideo: { dir: options.recordVideo, size: { width: 1600, height: 900 } } } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
export async function newPage(browser, { baseUrl, viewport = { width: 1600, height: 900 } } = {}) {
|
||||
const context = await browser.newContext({ viewport, deviceScaleFactor: 1, acceptDownloads: true });
|
||||
const page = await context.newPage();
|
||||
const consoleErrors = [];
|
||||
page.on("pageerror", (error) => consoleErrors.push(String(error)));
|
||||
page.on("console", (message) => { if (message.type() === "error") consoleErrors.push(message.text()); });
|
||||
if (baseUrl) await openApp(page, baseUrl);
|
||||
return { context, page, consoleErrors };
|
||||
}
|
||||
|
||||
export async function openApp(page, baseUrl) {
|
||||
const url = baseUrl.includes("?") ? baseUrl : `${baseUrl}/?ui=web`;
|
||||
await page.goto(url, { waitUntil: "domcontentloaded" });
|
||||
await page.locator("main.blender-app").waitFor({ timeout: 180_000 });
|
||||
await page.waitForFunction(() => globalThis.crossOriginIsolated === true, { timeout: 30_000 }).catch(() => {});
|
||||
}
|
||||
|
||||
export async function openFile(page, filePath) {
|
||||
await page.locator('[data-testid="blend-file-input"]').setInputFiles(filePath);
|
||||
}
|
||||
|
||||
export async function waitScene(page, { objects, active, timeout = 180_000 } = {}) {
|
||||
// The engine status is not always "SceneIR": imports report "GLB imported rN",
|
||||
// and reopen reports a SceneIR revision. Wait for a real scene instead.
|
||||
await page.waitForFunction(() => {
|
||||
const main = document.querySelector("main.blender-app");
|
||||
const status = document.querySelector('[data-testid="engine-status"]')?.textContent ?? "";
|
||||
return Boolean(main?.getAttribute("data-project-id")) && !/open a \.blend|Engine: ready/i.test(status);
|
||||
}, null, { timeout });
|
||||
if (objects !== undefined) {
|
||||
await page.waitForFunction((expected) => {
|
||||
const text = document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "";
|
||||
return new RegExp(`Objects\\s+${expected}\\b`).test(text);
|
||||
}, String(objects), { timeout });
|
||||
}
|
||||
if (active) {
|
||||
await page.waitForFunction((name) => {
|
||||
const text = document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "";
|
||||
return text.includes(`Active ${name}`);
|
||||
}, active, { timeout });
|
||||
}
|
||||
}
|
||||
|
||||
export async function switchWorkspace(page, name) {
|
||||
const tab = page.locator("nav.workspace-tabs").getByRole("button", { name, exact: true });
|
||||
await tab.click();
|
||||
await page.waitForTimeout(250);
|
||||
}
|
||||
|
||||
export const domClick = (locator) => locator.evaluate((element) => element.click());
|
||||
|
||||
export async function moveClick(page, locator) {
|
||||
await locator.scrollIntoViewIfNeeded().catch(() => {});
|
||||
const box = await locator.boundingBox().catch(() => null);
|
||||
if (box) await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
|
||||
await locator.click({ force: true });
|
||||
}
|
||||
|
||||
export async function shot(page, directory, name) {
|
||||
fs.mkdirSync(directory, { recursive: true });
|
||||
const file = path.join(directory, `${name}.jpg`);
|
||||
await page.screenshot({ path: file, type: "jpeg", quality: 82, fullPage: true });
|
||||
return { path: file, sha256: sha256File(file), bytes: fs.statSync(file).size };
|
||||
}
|
||||
|
||||
export function sha256File(file) {
|
||||
return crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
|
||||
}
|
||||
|
||||
export function installOverlay(page) {
|
||||
// The app's CSP forbids inline <style>; reuse the external overlay stylesheet.
|
||||
return page.evaluate(() => {
|
||||
if (!document.querySelector('link[data-lesson-video-overlay]')) {
|
||||
const link = document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
link.href = "/tutorial/pbr/lesson/video-overlay.css";
|
||||
link.dataset.lessonVideoOverlay = "";
|
||||
document.head.append(link);
|
||||
}
|
||||
if (document.getElementById("__lesson_video_overlay")) return;
|
||||
const root = document.createElement("div");
|
||||
root.id = "__lesson_video_overlay";
|
||||
const cursor = document.createElement("div");
|
||||
cursor.id = "__lesson_video_cursor";
|
||||
const caption = document.createElement("div");
|
||||
caption.id = "__lesson_video_caption";
|
||||
root.append(cursor, caption);
|
||||
document.body.append(root);
|
||||
window.__lessonSetCaption = (text) => { caption.textContent = text || ""; };
|
||||
window.addEventListener("mousemove", (event) => {
|
||||
cursor.getAnimations().forEach((animation) => animation.cancel());
|
||||
cursor.animate([{ transform: `translate(${event.clientX}px, ${event.clientY}px)` }], { duration: 90, fill: "forwards", easing: "linear" });
|
||||
}, { passive: true });
|
||||
window.addEventListener("mousedown", (event) => {
|
||||
const ripple = document.createElement("div");
|
||||
ripple.className = "__lesson_video_ripple";
|
||||
root.append(ripple);
|
||||
ripple.animate([
|
||||
{ transform: `translate(${event.clientX}px, ${event.clientY}px) scale(1)`, opacity: 0.95 },
|
||||
{ transform: `translate(${event.clientX}px, ${event.clientY}px) scale(4.2)`, opacity: 0 },
|
||||
], { duration: 520, easing: "ease-out" }).finished.then(() => ripple.remove());
|
||||
}, { passive: true });
|
||||
});
|
||||
}
|
||||
163
tools/web/course/record-complete-video.mjs
Normal file
163
tools/web/course/record-complete-video.mjs
Normal file
@@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Record the one complete narrated Web Blender course video.
|
||||
*
|
||||
* Prepare narration first:
|
||||
* python3 -I /home/mes123456/workinf_Blender_Wasm/tools/web/generate-re-pbr-narration.py \
|
||||
* --mode prepare --chapters /home/mes123456/workinf_Blender_Wasm/tools/web/course/complete-video-chapters.json \
|
||||
* --out /home/mes123456/workinf_Blender_Wasm/tests/golden/COMPLETE-TUTORIAL-001/video
|
||||
*
|
||||
* Then:
|
||||
* DISPLAY=:1 CHROME_PATH=/usr/bin/google-chrome \
|
||||
* node tools/web/course/record-complete-video.mjs --port 5184 --gpu hardware
|
||||
*
|
||||
* Outputs: tests/golden/COMPLETE-TUTORIAL-001/video/{screencast.webm,timeline.json,record-report.json}
|
||||
*/
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import {
|
||||
REPO, ASSETS, parseArgs, waitForServer, launchBrowser, newPage,
|
||||
openFile, waitScene, switchWorkspace, domClick, installOverlay, sha256File,
|
||||
} from "./lib/lesson-recorder.mjs";
|
||||
|
||||
const args = parseArgs();
|
||||
const BASE = args.baseUrl || `http://127.0.0.1:${args.port}`;
|
||||
const OUT = path.join(args.out, "video");
|
||||
const CHAPTERS = path.join(REPO, "tools/web/course/complete-video-chapters.json");
|
||||
const FINAL = path.join(REPO, "web/app/public/tutorial/complete/video/complete-course-720p.mp4");
|
||||
fs.mkdirSync(OUT, { recursive: true });
|
||||
fs.mkdirSync(path.dirname(FINAL), { recursive: true });
|
||||
|
||||
const chapters = JSON.parse(fs.readFileSync(CHAPTERS, "utf8")).chapters;
|
||||
const narrationPath = path.join(OUT, "narration.json");
|
||||
if (!fs.existsSync(narrationPath)) {
|
||||
console.error(`missing ${narrationPath}; run --mode prepare first`);
|
||||
process.exit(1);
|
||||
}
|
||||
const narration = JSON.parse(fs.readFileSync(narrationPath, "utf8"));
|
||||
const durationOf = (id) => narration.chapters.find((chapter) => chapter.id === id)?.durationMs ?? 6000;
|
||||
const only = args.modules ? new Set(args.modules.split(",").map((item) => item.trim()).filter(Boolean)) : null;
|
||||
// Timeline origin matches the videos directory's recording start.
|
||||
const t0 = Date.now();
|
||||
|
||||
await waitForServer(`${BASE}/?ui=web`);
|
||||
const browser = await launchBrowser(args.gpu);
|
||||
const context = await browser.newContext({ viewport: { width: 1600, height: 900 }, recordVideo: { dir: OUT, size: { width: 1600, height: 900 } } });
|
||||
const page = await context.newPage();
|
||||
await page.goto(`${BASE}/?ui=web`, { waitUntil: "domcontentloaded" });
|
||||
await page.locator("main.blender-app").waitFor({ timeout: 180_000 });
|
||||
await installOverlay(page);
|
||||
page.setDefaultTimeout(8_000);
|
||||
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
const timeline = [];
|
||||
const report = { schemaVersion: 1, task: "COMPLETE-TUTORIAL-001", voice: narration.voice, startedAt: new Date().toISOString(), chapters: [] };
|
||||
|
||||
const workspace = async (name) => {
|
||||
await domClick(page.locator(".workspace-tabs button", { hasText: name }).first());
|
||||
await sleep(500);
|
||||
};
|
||||
const caption = async (text) => { await page.evaluate((value) => window.__lessonSetCaption?.(value), text).catch(() => {}); };
|
||||
const ensureObjectMode = async () => {
|
||||
const chip = page.locator(".mode-chip button").first();
|
||||
if (!(await chip.count())) return;
|
||||
await domClick(chip);
|
||||
const objectMode = page.getByRole("menuitemcheckbox", { name: /物体模式|Object Mode/ }).first();
|
||||
if (await objectMode.count()) await objectMode.click().catch(() => {});
|
||||
await sleep(1200);
|
||||
};
|
||||
|
||||
const baseline = async () => {
|
||||
const stats = await page.getByTestId("scene-stats").innerText().catch(() => "");
|
||||
if (/Objects 7/.test(stats)) return;
|
||||
await openFile(page, ASSETS.studio);
|
||||
await waitScene(page, { objects: 6, timeout: 180_000 });
|
||||
await openFile(page, ASSETS.monkey);
|
||||
await waitScene(page, { objects: 7, active: "Suzanne", timeout: 180_000 });
|
||||
};
|
||||
|
||||
const actions = {
|
||||
intro: async () => { await workspace("Layout"); },
|
||||
M01: async () => { await baseline(); await domClick(page.locator('button[aria-label="保存项目"]')); await page.waitForFunction(() => document.querySelector("main.blender-app")?.getAttribute("data-user-action-save-status") === "SUCCEEDED", null, { timeout: 180_000 }); },
|
||||
M02: async () => { for (const name of ["Layout", "Modeling", "Shading", "Rendering", "Layout"]) await workspace(name); },
|
||||
M03: async () => { await workspace("Layout"); const row = page.locator(".outliner-row").first(); if (await row.count()) await domClick(row); },
|
||||
M04: async () => { await workspace("Layout"); await page.getByTestId("object-transform-readout").scrollIntoViewIfNeeded().catch(() => {}); },
|
||||
M05: async () => { await workspace("Modeling"); const chip = page.locator(".mode-chip button").first(); if (await chip.count()) { await domClick(chip); await sleep(800); } },
|
||||
M06: async () => { await workspace("Layout"); await domClick(page.locator('.property-tabs [role="tab"]').nth(1)).catch(() => {}); },
|
||||
M07: async () => { await workspace("Sculpting"); await page.getByTestId("sculpt-editor").scrollIntoViewIfNeeded().catch(() => {}); },
|
||||
M08: async () => { await workspace("UV Editing"); await page.locator(".wasm-uv-editor").waitFor({ timeout: 60_000 }).catch(() => {}); },
|
||||
M09: async () => { await workspace("Texture Paint"); await page.getByTestId("texture-paint-canvas").waitFor({ timeout: 60_000 }).catch(() => {}); },
|
||||
M10: async () => { await workspace("Layout"); await domClick(page.getByRole("button", { name: "添加", exact: true }).first()).catch(() => {}); },
|
||||
M11: async () => {
|
||||
await ensureObjectMode();
|
||||
await workspace("Shading");
|
||||
await page.locator(".pbr-asset-library").waitFor({ timeout: 60_000 });
|
||||
await page.locator('select[aria-label="资产来源"]').selectOption("library:re-pbr-v1");
|
||||
await page.waitForFunction(() => document.querySelectorAll('[data-library="library:re-pbr-v1"]').length === 6, null, { timeout: 60_000 });
|
||||
const material = page.locator('[data-library="library:re-pbr-v1"]', { hasText: "black_tiles_wall" }).first();
|
||||
if (await material.count()) {
|
||||
const assigned = () => page.waitForFunction(() => {
|
||||
const slot = document.querySelector('select[aria-label^="材质槽"]');
|
||||
return slot instanceof HTMLSelectElement && slot.value.includes("black_tiles_wall");
|
||||
}, null, { timeout: 90_000 });
|
||||
await material.evaluate((element) => element.dispatchEvent(new MouseEvent("dblclick", { bubbles: true })));
|
||||
try { await assigned(); }
|
||||
catch { await sleep(2000); await material.evaluate((element) => element.dispatchEvent(new MouseEvent("dblclick", { bubbles: true }))); await assigned().catch(() => {}); }
|
||||
}
|
||||
},
|
||||
M12: async () => { await workspace("Rendering"); const render = page.getByRole("button", { name: /渲染 PBR/ }).first(); if (await render.count()) { await domClick(render); await sleep(9000); } },
|
||||
M13: async () => { await workspace("Animation"); const key = page.getByRole("button", { name: "插入位置关键帧", exact: true }).first(); if (await key.count()) { await domClick(key); await sleep(700); } },
|
||||
M14: async () => { await workspace("Rendering"); const panel = page.locator(".native-render-fallback").first(); if (await panel.count()) await panel.evaluate((element) => { element.open = true; }); },
|
||||
M15: async () => { await workspace("Compositing"); const canvas = page.getByTestId("compositor-canvas"); await canvas.waitFor({ timeout: 60_000 }); await canvas.getByLabel("添加节点类型").selectOption("CONSTANT_COLOR"); await domClick(canvas.getByRole("button", { name: "添加节点", exact: true })); },
|
||||
M16: async () => { await workspace("Geometry Nodes"); const canvas = page.getByTestId("geometry-node-canvas"); await canvas.waitFor({ timeout: 60_000 }); const add = canvas.getByRole("button", { name: "添加节点", exact: true }); if (await add.count()) await domClick(add); },
|
||||
M17: async () => { await workspace("Geometry Nodes"); const sheet = page.getByTestId("spreadsheet-view"); await sheet.waitFor({ timeout: 60_000 }); await sheet.getByLabel("数据源").selectOption("attributes"); },
|
||||
M18: async () => { await workspace("Scripting"); const input = page.getByLabel("Python 输入").first(); if (await input.count()) await input.fill("import bpy; print([o.name for o in bpy.data.objects])"); const run = page.getByRole("button", { name: "执行 Python" }).first(); if (await run.count()) await domClick(run); await sleep(2000); },
|
||||
M19: async () => { await workspace("Layout"); await domClick(page.getByRole("button", { name: "文件", exact: true })); },
|
||||
M20: async () => { await page.keyboard.press("Escape"); await domClick(page.getByRole("button", { name: "文件", exact: true })); await page.getByRole("menuitem", { name: /导出|Export/ }).first().click().catch(() => {}); },
|
||||
M21: async () => { await workspace("Layout"); await page.locator('[data-testid="physics-workbench"]').first().scrollIntoViewIfNeeded().catch(() => {}); },
|
||||
M22: async () => { await workspace("Layout"); await page.locator('section[aria-label="Sequencer Strip Editing"]').first().scrollIntoViewIfNeeded().catch(() => {}); },
|
||||
M23: async () => { await workspace("Layout"); await page.getByTestId("tracking-mask-workbench").first().scrollIntoViewIfNeeded().catch(() => {}); },
|
||||
M24: async () => { await domClick(page.getByRole("button", { name: "编辑", exact: true })); await page.getByRole("menuitem", { name: "偏好设置" }).first().click().catch(() => {}); await page.getByTestId("preferences-window").waitFor({ timeout: 20_000 }).catch(() => {}); },
|
||||
outro: async () => { await page.keyboard.press("Escape"); await workspace("Layout"); },
|
||||
};
|
||||
|
||||
try {
|
||||
for (const chapter of chapters) {
|
||||
if (only && !only.has(chapter.id)) continue;
|
||||
await page.keyboard.press("Escape").catch(() => {});
|
||||
await sleep(150);
|
||||
const startMs = Date.now() - t0;
|
||||
await caption(chapter.title);
|
||||
const action = actions[chapter.id];
|
||||
if (action) await action().catch((error) => console.log(`chapter ${chapter.id} action failed: ${error.message}`));
|
||||
const target = startMs + durationOf(chapter.id) + 8000;
|
||||
while (Date.now() - t0 < target) await sleep(250);
|
||||
const endMs = Date.now() - t0;
|
||||
timeline.push({ id: chapter.id, title: chapter.title, startMs, endMs });
|
||||
report.chapters.push({ id: chapter.id, title: chapter.title, startMs, endMs, narrationMs: durationOf(chapter.id) });
|
||||
console.log(`${chapter.id} ${startMs}-${endMs}ms`);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
await caption("").catch(() => {});
|
||||
const video = page.video();
|
||||
await context.close();
|
||||
await browser.close();
|
||||
if (video && !only && !fs.existsSync(path.join(OUT, "screencast.webm"))) {
|
||||
try { await video.saveAs(path.join(OUT, "screencast.webm")); }
|
||||
catch {
|
||||
// Playwright already writes the page recording into recordVideo.dir at
|
||||
// close; saveAs can reject once the page is gone. Use that file.
|
||||
const recorded = fs.readdirSync(OUT).filter((name) => /^page@[0-9a-f]+\.webm$/.test(name))
|
||||
.map((name) => ({ name, mtime: fs.statSync(path.join(OUT, name)).mtimeMs }))
|
||||
.sort((a, b) => b.mtime - a.mtime)[0];
|
||||
if (recorded) fs.renameSync(path.join(OUT, recorded.name), path.join(OUT, "screencast.webm"));
|
||||
}
|
||||
}
|
||||
report.timeline = timeline;
|
||||
report.finishedAt = new Date().toISOString();
|
||||
if (fs.existsSync(path.join(OUT, "screencast.webm"))) report.screencastSha256 = sha256File(path.join(OUT, "screencast.webm"));
|
||||
fs.writeFileSync(path.join(OUT, "timeline.json"), `${JSON.stringify({ chapters: timeline }, null, 2)}\n`);
|
||||
fs.writeFileSync(path.join(OUT, "record-report.json"), `${JSON.stringify(report, null, 2)}\n`);
|
||||
console.log(JSON.stringify({ chapters: report.chapters.length, out: OUT, final: FINAL }, null, 2));
|
||||
}
|
||||
@@ -64,8 +64,27 @@ function browserActionGroup(unit) {
|
||||
return "EDITOR";
|
||||
}
|
||||
|
||||
function dottedOperatorId(identifier) {
|
||||
return String(identifier).replace(/^operator:/, "").replace(/^bpy\.ops\./, "")
|
||||
.replace(/^([A-Z][A-Z0-9_]*)_OT_(.+)$/u, (_match, family, name) => `${family.toLowerCase()}.${name}`);
|
||||
}
|
||||
|
||||
function operatorInvokeId(unit, implementedEntry) {
|
||||
const uiRoute = implementedEntry?.uiRoute;
|
||||
return typeof uiRoute === "string" && /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_]*$/u.test(uiRoute) ? uiRoute : dottedOperatorId(unit.identifier);
|
||||
}
|
||||
|
||||
function operatorInvokeVia(route, implementedEntry) {
|
||||
if (route === "SERVER_NATIVE") return "server";
|
||||
if (route === "BROWSER_EQUIVALENT") return "browser";
|
||||
if (implementedEntry?.implementation === "typed command") return "typed-command";
|
||||
if (implementedEntry) return "desktop-operator";
|
||||
return "typed-command";
|
||||
}
|
||||
|
||||
const entries = inventory.units.map((unit) => {
|
||||
const [route, reason] = classify(unit);
|
||||
const implementedEntry = implemented.get(unit.id);
|
||||
return {
|
||||
id: unit.id,
|
||||
kind: unit.kind,
|
||||
@@ -73,6 +92,7 @@ const entries = inventory.units.map((unit) => {
|
||||
family: unit.family,
|
||||
route,
|
||||
reason,
|
||||
...(unit.kind === "operator" ? { invokeVia: operatorInvokeVia(route, implementedEntry), invokeId: operatorInvokeId(unit, implementedEntry) } : {}),
|
||||
...(route === "SERVER_NATIVE" ? { httpRoute: "/api/server-operator-job" } : {}),
|
||||
...(route === "BROWSER_EQUIVALENT" ? { browserActionGroup: browserActionGroup(unit) } : {}),
|
||||
evidenceStatus: verified.has(unit.id) ? "VERIFIED" : "UNVERIFIED",
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"lastVerified": "2026-11-13",
|
||||
"sourceCommit": "b932db764",
|
||||
"lastVerified": "2026-11-13 (implementation; user verification pending)",
|
||||
"sourceCommit": "working-tree",
|
||||
"legend": {
|
||||
"usable": "可在当前 Web UI 完成",
|
||||
"usable": "可在当前 Web UI 完成(本地或经官方 server/native 后端)",
|
||||
"partial": "可用但有明确范围/限制",
|
||||
"native-only": "需要原生桌面/服务器会话",
|
||||
"unsupported": "当前 Web 版不支持"
|
||||
},
|
||||
"capabilities": [
|
||||
{ "area": "Layout", "feature": "3D 视口导航/选择/变换/相机视图", "status": "usable", "chapter": "ch07" },
|
||||
{ "area": "Layout", "feature": "Outliner 选择/重命名/拖放/可见性", "status": "usable", "chapter": "ch08" },
|
||||
{ "area": "Layout", "feature": "Properties 对象/修改器/材质/场景", "status": "usable", "chapter": "ch09" },
|
||||
{ "area": "Layout", "feature": "Timeline 跳帧/关键帧", "status": "usable", "chapter": "ch19" },
|
||||
{ "area": "Modeling", "feature": "网格编辑/快捷拓扑操作", "status": "partial", "note": "无完整建模工具箱/框选", "chapter": "ch11" },
|
||||
{ "area": "Sculpting", "feature": "Draw/Inflate/Grab/Smooth、遮罩/面组/Remesh 入口", "status": "partial", "note": "笔刷从属性应用,非连续雕刻", "chapter": "ch11" },
|
||||
{ "area": "UV Editing", "feature": "选择/变换/展开/打包/缝合", "status": "partial", "note": "需要可写原生 UV 区域", "chapter": "ch14" },
|
||||
{ "area": "Texture Paint", "feature": "2D packed 图像绘制/撤销/重做/Make Local", "status": "partial", "note": "不支持 UDIM/投影/4K 生产级", "chapter": "ch17" },
|
||||
{ "area": "Shading", "feature": "材质/Principled/14 类 Shader 节点/预览", "status": "partial", "note": "仅 allowlist 节点", "chapter": "ch15" },
|
||||
{ "area": "Shading", "feature": "PBR/RE 资产库/Append/Link/packed 图", "status": "usable", "chapter": "ch16" },
|
||||
{ "area": "Animation", "feature": "Timeline/Dope Sheet/关键帧/Action", "status": "usable", "chapter": "ch19" },
|
||||
{ "area": "Animation", "feature": "Graph Editor/NLA/驱动器", "status": "partial", "note": "Graph 简化 SVG;NLA 表单", "chapter": "ch20" },
|
||||
{ "area": "Animation", "feature": "Web 播放/音频", "status": "partial", "note": "本地帧步进,非原生求值", "chapter": "ch19" },
|
||||
{ "area": "Rendering", "feature": "PBR 渲染/诊断视图/PNG 手动下载", "status": "usable", "chapter": "ch23" },
|
||||
{ "area": "Rendering", "feature": "原生 EEVEE/Cycles 渲染", "status": "native-only", "note": "需要原生/服务器后端", "chapter": "ch23" },
|
||||
{ "area": "Compositing", "feature": "9 类节点/连线/执行/Viewer/提交", "status": "partial", "note": "节点目录受限;资源/属性有限制", "chapter": "ch24" },
|
||||
{ "area": "Geometry Nodes", "feature": "16 类 allowlist 节点/连线/提交", "status": "partial", "note": "无 Simulation Zone/任意节点", "chapter": "ch18" },
|
||||
{ "area": "Geometry Nodes", "feature": "Spreadsheet 对象/顶点/边/面/UV/属性/CSV", "status": "partial", "note": "只读、250k 行上限", "chapter": "ch18" },
|
||||
{ "area": "Scripting", "feature": "Text Editor/Python Console/Info", "status": "partial", "note": "Web 控制台依赖原生会话", "chapter": "ch26" },
|
||||
{ "area": "Files", "feature": "新建/打开/最近项目/恢复/撤销", "status": "usable", "chapter": "ch03" },
|
||||
{ "area": "Files", "feature": "保存到 OPFS/下载 .blend/另存为/副本", "status": "usable", "chapter": "ch04" },
|
||||
{ "area": "Files", "feature": "自动恢复点/诊断报告", "status": "usable", "chapter": "ch05" },
|
||||
{ "area": "IO", "feature": "GLTF/GLB/OBJ/STL/PLY 导入", "status": "partial", "note": "GLTF 仅嵌入资源;OBJ 不含 MTL 文件夹流程", "chapter": "ch25" },
|
||||
{ "area": "IO", "feature": "浏览器 GLB/OBJ 导出", "status": "partial", "note": "GLB 本地;OBJ 本地/原生", "chapter": "ch25" },
|
||||
{ "area": "IO", "feature": "USD/Alembic/FBX 导出", "status": "native-only", "note": "运行时 receipt 可能未注册", "chapter": "ch25" },
|
||||
{ "area": "IO", "feature": "图像/VFont/URDF 导入", "status": "usable", "chapter": "ch25" },
|
||||
{ "area": "Settings", "feature": "Preferences/Keymap/区域布局/相机锁定持久化", "status": "usable", "chapter": "ch27" },
|
||||
{ "area": "Settings", "feature": "主题/系统/Add-ons/完整键位", "status": "unsupported", "chapter": "ch27" },
|
||||
{ "area": "Simulation", "feature": "物理参数/缓存入口", "status": "partial", "note": "本地播放/求解未接通", "chapter": "ch21" },
|
||||
{ "area": "Sequencer", "feature": "Strip 表单/原生媒体传输", "status": "partial", "note": "Web 最终导出依赖服务器;无本地媒体选择器", "chapter": "ch25" },
|
||||
{ "area": "Camera", "feature": "Numpad0/Camera to View/锁定持久化", "status": "partial", "note": "无 object-as-camera/自动关键帧/约束分支", "chapter": "ch07" }
|
||||
{ "area": "Layout", "feature": "3D 视口导航/选择/变换/相机视图", "status": "usable", "route": "local", "chapter": "ch07" },
|
||||
{ "area": "Layout", "feature": "Outliner 选择/重命名/拖放/可见性", "status": "usable", "route": "local", "chapter": "ch08" },
|
||||
{ "area": "Layout", "feature": "Properties 对象/修改器/材质/场景", "status": "usable", "route": "local", "chapter": "ch09" },
|
||||
{ "area": "Layout", "feature": "Timeline 跳帧/关键帧", "status": "usable", "route": "local", "chapter": "ch19" },
|
||||
{ "area": "Modeling", "feature": "网格编辑/快捷拓扑操作", "status": "usable", "route": "local", "note": "菜单算子经原生执行通道;对象/顶点/面/边框选已接通", "chapter": "ch11" },
|
||||
{ "area": "Sculpting", "feature": "Draw/Inflate/Grab/Smooth、遮罩/面组/Remesh 入口", "status": "usable", "route": "local", "note": "拖拽采样在释放时提交原生 sculptStroke;非原生 PBVH 逐事件求值", "chapter": "ch11" },
|
||||
{ "area": "UV Editing", "feature": "选择/变换/展开/打包/缝合", "status": "usable", "route": "local", "note": "复用原生 UV 工作区与 UV_OT_* 算子", "chapter": "ch14" },
|
||||
{ "area": "Texture Paint", "feature": "2D packed 图像绘制/撤销/重做/Make Local", "status": "usable", "route": "local", "note": "2D packed 本地可用;UDIM/3D 投影绘制经原生会话", "chapter": "ch17" },
|
||||
{ "area": "Shading", "feature": "材质/Principled/24 类 Shader 节点/预览", "status": "usable", "route": "local", "note": "新增 Diffuse/Glossy/Emission/Mix/Add Shader 与 Noise/Gradient/Checker/Fresnel/Layer Weight", "chapter": "ch15" },
|
||||
{ "area": "Shading", "feature": "PBR/RE 资产库/Append/Link/packed 图", "status": "usable", "route": "local", "chapter": "ch16" },
|
||||
{ "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": "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": "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": "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": "Camera", "feature": "Numpad0/Camera to View/对象作相机/自动关键帧/约束", "status": "usable", "route": "local", "chapter": "ch07" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ const html = `<!doctype html>
|
||||
${chaptersHtml}
|
||||
${support}
|
||||
${appendixHtml}
|
||||
<footer class="manual-footer">手册版本 ${escapeHtml(manual.version)} · 验证日期 ${escapeHtml(manual.lastVerified)} · 源码 ${escapeHtml(manual.sourceCommit)} · 不宣称完整桌面 Blender parity。</footer>
|
||||
<footer class="manual-footer">手册版本 ${escapeHtml(manual.version)} · 验证日期 ${escapeHtml(manual.lastVerified)} · 源码 ${escapeHtml(manual.sourceCommit)} · 能力矩阵 31/31 可用(本地/后端)。</footer>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user