test(web): record apply-transform evidence
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -487,6 +487,9 @@
|
||||
`applySculptRemesh` 不再硬性要求 `SERVER_NATIVE`、错误改为 code/message。
|
||||
复测:Voxel Remesh 后 Ground 顶点 4→968、面 1→966(server job 约 3 分钟)。
|
||||
证据 `tools/web/complete/probe-sculpt-remesh.mjs`。
|
||||
- 应用全部变换:`g` 移动后 物体→应用→全部变换,location 归零、网格顶点
|
||||
烘焙(v0 -10→-9.9、z 0→-1),撤销恢复原变换;证据
|
||||
`tools/web/complete/probe-transform-apply.mjs`。
|
||||
- Sequencer:Properties 的 Sequencer Strip Editing → Add Strip 创建
|
||||
`Web MOVIE`(MOVIE);证据 `tools/web/complete/probe-sequencer.mjs`。
|
||||
- Outliner:右键 `Data` 菜单 → 重命名,`PBR Studio Ground` → `GroundRenamed`,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"task": "WBV2-P1425-001",
|
||||
"updatedAt": "2026-11-14T10:45:00+08:00",
|
||||
"updatedAt": "2026-11-14T10:53: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",
|
||||
@@ -333,5 +333,10 @@
|
||||
"result": "Ground vertices 4→968, polygons 1→966 via the server job (~3 min)",
|
||||
"script": "tools/web/complete/probe-sculpt-remesh.mjs",
|
||||
"acceptance": "NOT_CLAIMED"
|
||||
},
|
||||
"transformApplyProbe": {
|
||||
"result": "apply all transforms zeroes location and bakes mesh (v0 -10→-9.9, z 0→-1); undo restores",
|
||||
"script": "tools/web/complete/probe-transform-apply.mjs",
|
||||
"acceptance": "NOT_CLAIMED"
|
||||
}
|
||||
}
|
||||
|
||||
77
tools/web/complete/probe-transform-apply.mjs
Normal file
77
tools/web/complete/probe-transform-apply.mjs
Normal file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: edit mode -> select all -> UV -> 展开(角度) on a mesh.
|
||||
*
|
||||
* node tools/web/complete/probe-transform-apply.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: "ProbeTransformApply.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
const transformState = async () => {
|
||||
const result = await python(`
|
||||
import bpy, json
|
||||
obj = bpy.context.view_layer.objects.active
|
||||
mesh = obj.data if obj.type == 'MESH' else None
|
||||
print('TRANSFORM ' + json.dumps({'object': obj.name, 'location': [round(v, 4) for v in obj.location], 'rotation': [round(v, 4) for v in obj.rotation_euler], 'scale': [round(v, 4) for v in obj.scale], 'v0': [round(v, 4) for v in mesh.vertices[0].co] if mesh and len(mesh.vertices) else None}))
|
||||
`);
|
||||
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 transformState()));
|
||||
await page.keyboard.press("g");
|
||||
await page.waitForTimeout(1200);
|
||||
log("moved", JSON.stringify(await transformState()));
|
||||
await menu("物体", "应用");
|
||||
await page.getByRole("menuitem", { name: "全部变换", exact: true }).click();
|
||||
await page.waitForTimeout(2000);
|
||||
log("applied", JSON.stringify(await transformState()));
|
||||
await menu("编辑", "撤销");
|
||||
await page.waitForTimeout(1500);
|
||||
log("undone", JSON.stringify(await transformState()));
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await transformState().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
Reference in New Issue
Block a user