test(web): record modifier-to-shape-key behavior
CAST applies as Basis/Cast shape keys; SUBSURF is correctly rejected. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -399,6 +399,10 @@
|
||||
- 着色:物体 → 着色 → 平滑着色/平直着色,`polygon.use_smooth`
|
||||
false→true→false,状态“原生操作已返回:object.shade_smooth / shade_flat”;证据
|
||||
`tools/web/complete/probe-shading.mjs`。
|
||||
- 修改器存为形态键:CAST → `object.modifier_apply_as_shapekey`,修改器移除、
|
||||
形态键 `Basis/Cast`;SUBSURF 被原生拒绝“Only deforming modifiers can be
|
||||
applied to shapes”,与桌面语义一致;证据
|
||||
`tools/web/complete/probe-modifier-shapekey.mjs`。
|
||||
|
||||
## 下一动作
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"task": "WBV2-P1425-001",
|
||||
"updatedAt": "2026-11-14T06:33:00+08:00",
|
||||
"updatedAt": "2026-11-14T06:38: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",
|
||||
@@ -147,5 +147,11 @@
|
||||
"result": "object.shade_smooth / object.shade_flat; polygon.use_smooth false→true→false",
|
||||
"script": "tools/web/complete/probe-shading.mjs",
|
||||
"acceptance": "NOT_CLAIMED"
|
||||
},
|
||||
"modifierShapeKeyProbe": {
|
||||
"cast": "modifier applied as shape key; modifiers [] shape_keys [Basis, Cast]",
|
||||
"subsurf": "rejected by native operator (only deforming modifiers), correct desktop behavior",
|
||||
"script": "tools/web/complete/probe-modifier-shapekey.mjs",
|
||||
"acceptance": "NOT_CLAIMED"
|
||||
}
|
||||
}
|
||||
|
||||
84
tools/web/complete/probe-modifier-shapekey.mjs
Normal file
84
tools/web/complete/probe-modifier-shapekey.mjs
Normal file
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: edit mode -> select all -> UV -> 展开(角度) on a mesh.
|
||||
*
|
||||
* node tools/web/complete/probe-modifier-shapekey.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: "ProbeShapeKey.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
const modifierState = 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}
|
||||
if mesh is not None:
|
||||
data['modifiers'] = [(modifier.name, modifier.type) for modifier in obj.modifiers]
|
||||
data['shape_keys'] = [block.name for block in (mesh.shape_keys.key_blocks if mesh.shape_keys else [])]
|
||||
print('MOD ' + 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 });
|
||||
const authoring = page.locator('.modifier-stack-authoring').first();
|
||||
await authoring.waitFor({ timeout: 30_000 });
|
||||
await authoring.locator('[data-modifier-type-input]').fill("CAST");
|
||||
await authoring.getByRole("button", { name: "Add", exact: true }).click();
|
||||
const row = page.locator('.modifier-row').filter({ hasText: "CAST" }).first();
|
||||
await row.waitFor({ timeout: 30_000 });
|
||||
log("added", JSON.stringify(await modifierState()));
|
||||
await row.locator('[aria-label$="as Shape Key"]').first().click();
|
||||
for (let index = 0; index < 40; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await modifierState();
|
||||
if (/shape_keys.*\[".+"/.test(current.output ?? "") || current.alerts?.length) { log("shape key", JSON.stringify(current)); break; }
|
||||
if (index === 39) log("final", JSON.stringify(current));
|
||||
}
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await modifierState().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
Reference in New Issue
Block a user