fix(web): pass screen context to embedded menu operators
- Add screen=window.screen to the desktop_operator temp_override and invoke repeat-last/history with a VIEW_3D area. repeat_last still requires a WM runtime operator stack, which the embedded host does not retain; recorded as a residual. - Refresh WebEngine wasm (58325d97) and record view-layer add/remove and repeat-last evidence. Acceptance remains NOT_CLAIMED. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -61,12 +61,8 @@ try {
|
||||
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);
|
||||
await page.getByRole("button", { name: "全选大纲对象", exact: true }).click();
|
||||
await page.waitForTimeout(1500);
|
||||
log("selected", JSON.stringify(await parentState()));
|
||||
await menu("物体", "父级");
|
||||
await page.getByRole("menuitem", { name: "设定父级", exact: true }).click();
|
||||
|
||||
83
tools/web/complete/probe-repeat-viewlayer.mjs
Normal file
83
tools/web/complete/probe-repeat-viewlayer.mjs
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Focused case: repeat-last operation and scene view-layer add/remove.
|
||||
*
|
||||
* node tools/web/complete/probe-repeat-viewlayer.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: "ProbeRepeat.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
const state = async () => {
|
||||
const result = await python(`
|
||||
import bpy, json
|
||||
scene = bpy.context.scene
|
||||
print('CASE ' + json.dumps({'objects': len(bpy.data.objects), 'view_layers': [layer.name for layer in scene.view_layers]}))
|
||||
`);
|
||||
const out = result?.result?.json;
|
||||
const ui = await 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),
|
||||
}));
|
||||
return { state: out?.state, output: out?.output, error: out?.error, ...ui };
|
||||
};
|
||||
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("start", JSON.stringify(await state()));
|
||||
await menu("添加", "网格");
|
||||
await page.getByRole("menuitem", { name: "圆环", exact: true }).click();
|
||||
await page.waitForTimeout(1500);
|
||||
log("added", JSON.stringify(await state()));
|
||||
await menu("编辑", "重复上一步");
|
||||
await page.waitForTimeout(2000);
|
||||
log("repeat", JSON.stringify(await state()));
|
||||
await menu("场景", "添加视图层");
|
||||
await page.waitForTimeout(1500);
|
||||
log("layer add", JSON.stringify(await state()));
|
||||
await menu("场景", "删除视图层");
|
||||
await page.waitForTimeout(1500);
|
||||
log("layer remove", 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();
|
||||
}
|
||||
Reference in New Issue
Block a user