chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
52
web/tests/e2e/b3-pack-setpath-probe.spec.ts
Normal file
52
web/tests/e2e/b3-pack-setpath-probe.spec.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { test } from "@playwright/test";
|
||||
import { NativeUIWorkflow, observeNative } from "../fixtures/native-ui-workflow";
|
||||
|
||||
const root = path.resolve(import.meta.dirname, "../../..");
|
||||
const fixture = path.join(root, "blender-5.2.0/tests/files/sequence_editing/effects/fx_comp.blend");
|
||||
const mask = fs.readFileSync(path.join(root, "blender-5.2.0/tests/files/sequence_editing/effects/mask.png"));
|
||||
|
||||
test("probe pack_all after assigning bpy.data.filepath", async ({ page }, testInfo) => {
|
||||
test.setTimeout(180_000);
|
||||
await observeNative(page);
|
||||
await page.goto("/");
|
||||
const flow = new NativeUIWorkflow(page, testInfo.outputPath("cases"));
|
||||
await flow.command(() => page.getByTestId("blend-file-input").setInputFiles(fixture));
|
||||
const out = await page.evaluate(async (maskBase64) => {
|
||||
const worker = (window as any).__nativeWorkflowEngine as Worker;
|
||||
const send = (command: any) => new Promise<any>((resolve, reject) => {
|
||||
const requestId = `sp-${crypto.randomUUID()}`;
|
||||
const receive = (event: MessageEvent) => {
|
||||
if (event.data?.requestId !== requestId || event.data?.kind !== 'result') return;
|
||||
worker.removeEventListener('message', receive);
|
||||
if (event.data.ok) resolve(event.data.result); else reject(new Error(`${event.data.error?.code ?? 'NATIVE'}: ${event.data.error?.message ?? JSON.stringify(event.data.error)}`));
|
||||
};
|
||||
worker.addEventListener('message', receive); worker.postMessage({ requestId, command });
|
||||
});
|
||||
const log: any = {};
|
||||
try {
|
||||
const r = await send({ type: 'jsonCommand', cmd: 'pythonExec', params: {
|
||||
filename: 'SetPath.py', console: false,
|
||||
source: [
|
||||
"import bpy, os, base64",
|
||||
"root = '/browser/pack-case'",
|
||||
"os.makedirs(root, exist_ok=True)",
|
||||
"open(root + '/mask.png', 'wb').write(base64.b64decode('" + maskBase64 + "'))",
|
||||
"print('STAGED', sorted(os.listdir(root)))",
|
||||
"bpy.data.filepath = root + '/fx_comp.blend'",
|
||||
"print('FILEPATH', repr(bpy.data.filepath))",
|
||||
"print('ABS', bpy.path.abspath('//mask.png'), os.path.exists(bpy.path.abspath('//mask.png')))",
|
||||
"print('BEFORE', [(i.name, i.packed_file is not None) for i in bpy.data.images])",
|
||||
"print('PACK', bpy.ops.file.pack_all())",
|
||||
"print('AFTER', [(i.name, i.packed_file is not None, i.packed_file.size if i.packed_file else None) for i in bpy.data.images])",
|
||||
].join("\n"),
|
||||
} });
|
||||
log.state = r.json?.state;
|
||||
log.output = String(r.json?.output ?? '').slice(0, 2500);
|
||||
log.revision = r.snapshot?.revision;
|
||||
} catch (e: any) { log.error = String(e?.message ?? e); }
|
||||
return log;
|
||||
}, mask.toString("base64"));
|
||||
fs.writeFileSync("/tmp/pack-setpath-probe.json", JSON.stringify(out, null, 2));
|
||||
});
|
||||
Reference in New Issue
Block a user