diff --git a/docs/status/WBV2-P1425-001-web-operator-dispatch.md b/docs/status/WBV2-P1425-001-web-operator-dispatch.md index 4cd79e93b..0d375c5cd 100644 --- a/docs/status/WBV2-P1425-001-web-operator-dispatch.md +++ b/docs/status/WBV2-P1425-001-web-operator-dispatch.md @@ -459,6 +459,9 @@ - 菜单 operator 审计:从 `App.tsx` 抽取 nativeAdd / queueLocalDesktopOperator / invokeNativeOperator 的 329 个标识,逐一调用 `get_rna_type()`;缺失 0。 证据 `tools/web/complete/probe-menu-operators.mjs`。 +- UV Editor 控件:展开“展开 UV”面板,ANGLE_BASED 展开后 UV 归一化到 + 0.0001–0.9999;“打包 UV 岛屿”执行后 revision r5、范围保持。证据 + `tools/web/complete/probe-uv-controls.mjs`。 - Sequencer:Properties 的 Sequencer Strip Editing → Add Strip 创建 `Web MOVIE`(MOVIE);证据 `tools/web/complete/probe-sequencer.mjs`。 - Outliner:右键 `Data` 菜单 → 重命名,`PBR Studio Ground` → `GroundRenamed`, diff --git a/tests/golden/WBV2-P1425-001/continuation-20261113-web-export.json b/tests/golden/WBV2-P1425-001/continuation-20261113-web-export.json index 4b4f18416..19d202fa6 100644 --- a/tests/golden/WBV2-P1425-001/continuation-20261113-web-export.json +++ b/tests/golden/WBV2-P1425-001/continuation-20261113-web-export.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "task": "WBV2-P1425-001", - "updatedAt": "2026-11-14T09:28:00+08:00", + "updatedAt": "2026-11-14T09:31: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", @@ -293,5 +293,10 @@ "missing": 0, "script": "tools/web/complete/probe-menu-operators.mjs", "acceptance": "NOT_CLAIMED" + }, + "uvControlsProbe": { + "result": "ANGLE_BASED unwrap → UV 0.0001–0.9999; pack islands → r5, range preserved", + "script": "tools/web/complete/probe-uv-controls.mjs", + "acceptance": "NOT_CLAIMED" } } diff --git a/tools/web/complete/probe-uv-controls.mjs b/tools/web/complete/probe-uv-controls.mjs new file mode 100644 index 000000000..ce0e69216 --- /dev/null +++ b/tools/web/complete/probe-uv-controls.mjs @@ -0,0 +1,113 @@ +#!/usr/bin/env node +/** + * Focused case: edit mode -> select all -> UV -> 展开(角度) on a mesh. + * + * node tools/web/complete/probe-uv-controls.mjs --base-url http://127.0.0.1:5176 + */ +import { ASSETS, parseArgs, launchBrowser, newPage, openApp, 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, {}); +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: "ProbeUVControls.py", console: false } } }); + }), { requestId, source }, { timeout: 300_000 }); +}; +const uvState = async () => { + const result = await python(` +import bpy, bmesh, 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: + bm = bmesh.from_edit_mesh(mesh) if obj.mode == 'EDIT' else bmesh.new() + if obj.mode != 'EDIT': bm.from_mesh(mesh) + uv = bm.loops.layers.uv.active + values = [] + if uv: + for face in bm.faces: + for loop in face.loops: + values.append([round(float(v), 4) for v in loop[uv].uv]) + data['uv_count'] = len(values) + data['uv_sample'] = values[:8] + data['uv_min'] = [min(v[i] for v in values) for i in range(2)] if values else None + data['uv_max'] = [max(v[i] for v in values) for i in range(2)] if values else None + if obj.mode != 'EDIT': bm.free() +print('UVC ' + 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 switchWorkspace(page, "UV Editing"); + await page.waitForTimeout(1500); + log("dom", JSON.stringify(await page.evaluate(() => { + const editors = Array.from(document.querySelectorAll('.wasm-uv-editor')); + return editors.map((editor) => { + const rect = editor.getBoundingClientRect(); + const controls = editor.querySelector('.uv-controls'); + const controlsRect = controls?.getBoundingClientRect(); + const select = editor.querySelector('select[aria-label="UV 展开方法"]'); + return { editor: [rect.x, rect.y, rect.width, rect.height], controls: controls ? [controlsRect?.x, controlsRect?.y, controlsRect?.width, controlsRect?.height] : null, select: Boolean(select), selectDisplay: select ? getComputedStyle(select).display : null }; + }); + }))); + await page.screenshot({ path: "/tmp/uv-editing.png" }); + await page.locator('summary').filter({ hasText: "展开 UV" }).first().click(); + await page.waitForTimeout(600); + const unwrap = page.locator('select[aria-label="UV 展开方法"]:visible').first(); + await unwrap.waitFor({ timeout: 30_000 }); + const methods = await unwrap.locator('option').evaluateAll((nodes) => nodes.map((node) => node.value)); + log("methods", JSON.stringify(methods)); + const method = methods.includes("ANGLE_BASED") ? "ANGLE_BASED" : methods.find((value) => value) ?? ""; + if (method) await unwrap.selectOption(method); + await page.locator('button:visible').filter({ hasText: "展开所选 UV" }).first().evaluate((element) => element.click()); + await page.waitForTimeout(2500); + log("unwrapped", JSON.stringify(await uvState())); + await page.locator('summary').filter({ hasText: "打包 UV 岛屿" }).first().click(); + await page.waitForTimeout(600); + const pack = page.locator('button:visible').filter({ hasText: "打包岛屿" }).first(); + if (await pack.count()) { + await pack.evaluate((element) => element.click()); + await page.waitForTimeout(2500); + } + log("packed", 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(); +}