fix(web): route voxel remesh to the server backend
The WASM handler is a FEATURE_ROUTE_SERVER_REQUIRED stub while the catalog advertised WEB_MAIN, so the Sculpt Voxel Remesh button always failed. Route the operator to SERVER_NATIVE and drop the hard-coded route check. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -482,6 +482,11 @@
|
||||
`setObjectVisibility` 成功后自动发送 `OUTLINER_REFRESH`;复测 hide →
|
||||
树保持、显示“显示 PBR Studio Ground”,show → `hide_viewport=false`、
|
||||
revision r5。证据 `tools/web/complete/probe-object-visibility.mjs`。
|
||||
- Voxel Remesh(修复):路由目录将 `OBJECT_OT_voxel_remesh` 标为
|
||||
`SERVER_NATIVE`(WASM 处理器是显式 `FEATURE_ROUTE_SERVER_REQUIRED` 桩),
|
||||
`applySculptRemesh` 不再硬性要求 `SERVER_NATIVE`、错误改为 code/message。
|
||||
复测:Voxel Remesh 后 Ground 顶点 4→968、面 1→966(server job 约 3 分钟)。
|
||||
证据 `tools/web/complete/probe-sculpt-remesh.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:00:00+08:00",
|
||||
"updatedAt": "2026-11-14T10:45: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",
|
||||
@@ -323,5 +323,15 @@
|
||||
"after": "hide → tree retained, eye 显示 PBR Studio Ground; show → hide_viewport=false, revision r5",
|
||||
"script": "tools/web/complete/probe-object-visibility.mjs",
|
||||
"acceptance": "NOT_CLAIMED"
|
||||
},
|
||||
"voxelRemeshFix": {
|
||||
"fix": [
|
||||
"generator special-cases OBJECT_OT_voxel_remesh to SERVER_NATIVE",
|
||||
"applySculptRemesh uses invokeFeatureRoute without hard-coding SERVER_NATIVE",
|
||||
"sculpt remesh errors surface code/message"
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
||||
78
tools/web/complete/probe-sculpt-remesh.mjs
Normal file
78
tools/web/complete/probe-sculpt-remesh.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-sculpt-remesh.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: "ProbeRemesh.py", console: false } } });
|
||||
}), { requestId, source }, { timeout: 300_000 });
|
||||
};
|
||||
const remeshState = 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
|
||||
print('REMESH ' + json.dumps({'object': obj.name if obj else None, 'mode': bpy.context.mode, 'vertices': len(mesh.vertices) if mesh else None, 'polygons': len(mesh.polygons) if mesh else None}))
|
||||
`);
|
||||
const out = result?.result?.json;
|
||||
const status = await page.evaluate(() => document.querySelector('[data-testid="engine-status"]')?.textContent ?? "");
|
||||
const alerts = await page.evaluate(() => Array.from(document.querySelectorAll('[role="alert"]')).map((node) => node.textContent).slice(0, 3));
|
||||
return { state: out?.state, output: out?.output, error: out?.error, status, alerts };
|
||||
};
|
||||
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 editor = page.locator('[data-testid="sculpt-editor"]').first();
|
||||
await editor.waitFor({ timeout: 30_000 });
|
||||
log("before", JSON.stringify(await remeshState()));
|
||||
await editor.locator('[aria-label="Sculpt remesh voxel size"]').fill("1");
|
||||
await editor.getByRole("button", { name: "Voxel Remesh", exact: true }).evaluate((element) => element.click());
|
||||
for (let index = 0; index < 240; index++) {
|
||||
await page.waitForTimeout(500);
|
||||
const current = await remeshState();
|
||||
if (/原生操作|失败|错误|未执行|NOT_|FAILED|UNAVAILABLE/.test(current.status) || (current.alerts?.length ?? 0) > 0) { log("result", JSON.stringify(current)); break; }
|
||||
if (index === 239) log("timeout", JSON.stringify(current));
|
||||
}
|
||||
} catch (error) {
|
||||
log("probe error", error instanceof Error ? error.message : String(error));
|
||||
log("state", JSON.stringify(await remeshState().catch(() => null)));
|
||||
} finally {
|
||||
log("consoleErrors", JSON.stringify(consoleErrors.slice(-10)));
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
@@ -38,6 +38,11 @@ function classify(unit) {
|
||||
? ["BROWSER_EQUIVALENT", "non-runtime modifier sentinel or desktop UI helper"]
|
||||
: ["WEB_MAIN", "metadata-driven native modifier stack route"];
|
||||
}
|
||||
if (unit.kind === "operator" && unit.identifier === "OBJECT_OT_voxel_remesh") {
|
||||
// The native WASM handler for this id is a stub returning
|
||||
// FEATURE_ROUTE_SERVER_REQUIRED; the bounded server Blender route runs it.
|
||||
return ["SERVER_NATIVE", "native handler defers to the server Blender operator route"];
|
||||
}
|
||||
if (implemented.has(unit.id)) {
|
||||
const entry = implemented.get(unit.id);
|
||||
return ["WEB_MAIN", `implemented Web operator route (${entry.implementation}): ${entry.uiRoute}`];
|
||||
|
||||
@@ -3164,10 +3164,12 @@ function Properties({ selectedEdgeIndices, nonMeshGeometryBuffers, client, snaps
|
||||
try {
|
||||
const { routes } = await client.listFeatureRoutes();
|
||||
const route = routes.find((entry) => entry.id === "operator:OBJECT_OT_voxel_remesh");
|
||||
if (!route || route.route !== "SERVER_NATIVE") throw new Error("Voxel Remesh native route is unavailable");
|
||||
if (!route) throw new Error("Voxel Remesh route is unavailable");
|
||||
await client.invokeFeatureRoute({ route, properties: { voxel_size: sculptRemeshVoxelSize } });
|
||||
} catch (error) {
|
||||
setSculptRemeshError(error instanceof Error ? error.message : String(error));
|
||||
const failure = error && typeof error === "object" ? error as { code?: unknown; message?: unknown } : null;
|
||||
const message = failure?.message ? String(failure.message) : error instanceof Error ? error.message : String(error);
|
||||
setSculptRemeshError(failure?.code ? `${String(failure.code)}: ${message}` : message);
|
||||
} finally {
|
||||
setSculptRemeshBusy(false);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
"unclassifiedCount": 0,
|
||||
"counts": {
|
||||
"BROWSER_EQUIVALENT": 434,
|
||||
"SERVER_NATIVE": 1151,
|
||||
"WEB_MAIN": 2226
|
||||
"SERVER_NATIVE": 1152,
|
||||
"WEB_MAIN": 2225
|
||||
},
|
||||
"behavioralEvidence": {
|
||||
"status": "PARTIAL",
|
||||
@@ -34171,10 +34171,11 @@
|
||||
"kind": "operator",
|
||||
"identifier": "OBJECT_OT_voxel_remesh",
|
||||
"family": "EDITOR",
|
||||
"route": "WEB_MAIN",
|
||||
"reason": "implemented Web operator route (F3 operator palette (generic desktop_operator channel)): object.voxel_remesh",
|
||||
"invokeVia": "desktop-operator",
|
||||
"route": "SERVER_NATIVE",
|
||||
"reason": "native handler defers to the server Blender operator route",
|
||||
"invokeVia": "server",
|
||||
"invokeId": "object.voxel_remesh",
|
||||
"httpRoute": "/api/server-operator-job",
|
||||
"evidenceStatus": "UNVERIFIED",
|
||||
"locations": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user