test(web): record geometry node graph editing
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -417,6 +417,10 @@
|
||||
`tools/web/complete/probe-shadergraph-canvas.mjs`。旧的内联 Shader Graph
|
||||
草稿面板因 `shaderGraphDraft` 始终为 null 而不可达,实际编辑走
|
||||
`WasmShaderEditor`。
|
||||
- 几何节点:Geometry Node Graph 添加 Subdivision Surface 并提交,生成
|
||||
`NODES` 修改器与节点组,节点 `NodeGroupInput/NodeGroupOutput/`
|
||||
`GeometryNodeSubdivisionSurface`;证据
|
||||
`tools/web/complete/probe-geometry-nodes.mjs`。
|
||||
|
||||
## 下一动作
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"task": "WBV2-P1425-001",
|
||||
"updatedAt": "2026-11-14T06:51:00+08:00",
|
||||
"updatedAt": "2026-11-14T06:52:00+08:00",
|
||||
"status": "in_progress",
|
||||
"focus": "COMPLETE-TUTORIAL-001 backend export gap (USD/Alembic)",
|
||||
"breakpoint": "blender-5.2.0/source/blender/web_engine/CMakeLists.txt (USD wiring); WASM 6ee2b261",
|
||||
@@ -176,5 +176,10 @@
|
||||
"script": "tools/web/complete/probe-shadergraph-canvas.mjs",
|
||||
"note": "legacy inline shader draft panel unreachable (shaderGraphDraft always null); WasmShaderEditor is the live path",
|
||||
"acceptance": "NOT_CLAIMED"
|
||||
},
|
||||
"geometryNodesProbe": {
|
||||
"result": "add GeometryNodeSubdivisionSurface + commit → NODES modifier/node group with Input/Output/SubdivisionSurface",
|
||||
"script": "tools/web/complete/probe-geometry-nodes.mjs",
|
||||
"acceptance": "NOT_CLAIMED"
|
||||
}
|
||||
}
|
||||
|
||||
78
tools/web/complete/probe-geometry-nodes.mjs
Normal file
78
tools/web/complete/probe-geometry-nodes.mjs
Normal file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: edit mode -> select all -> UV -> 展开(角度) on a mesh.
|
||||
*
|
||||
* node tools/web/complete/probe-geometry-nodes.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: "ProbeGN.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
const gnState = async () => {
|
||||
const result = await python(`
|
||||
import bpy, json
|
||||
obj = bpy.context.view_layer.objects.active
|
||||
mods = []
|
||||
for modifier in obj.modifiers:
|
||||
nodes = [node.bl_idname for node in modifier.node_group.nodes] if modifier.type == 'NODES' and modifier.node_group else []
|
||||
mods.append({'name': modifier.name, 'type': modifier.type, 'group': modifier.node_group.name if modifier.type == 'NODES' and modifier.node_group else None, 'nodes': nodes})
|
||||
print('GN ' + json.dumps({'object': obj.name, 'modifiers': mods}))
|
||||
`);
|
||||
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 });
|
||||
const authoring = page.locator('[data-testid="geometry-node-authoring"]').first();
|
||||
await authoring.waitFor({ timeout: 30_000 });
|
||||
log("before", JSON.stringify(await gnState()));
|
||||
await authoring.locator('select').first().selectOption("GeometryNodeSubdivisionSurface");
|
||||
await authoring.locator('input').first().fill("TestSubsurf");
|
||||
await authoring.getByRole("button", { name: "添加节点", exact: true }).click();
|
||||
await authoring.getByRole("button", { name: /提交/ }).first().click();
|
||||
await page.waitForTimeout(2000);
|
||||
log("after", JSON.stringify(await gnState()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await gnState().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
Reference in New Issue
Block a user