Files
workinf_Blender_Wasm/docs/status/WBV2-COLLADA-001.md
mes123456 63db6caf1f
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
feat(web): studio worlds, camera-view/offscreen environment parity, material and undo coverage
Environment lighting:
- ship all eight desktop studiolights/world datasets (WBENV1 float32) and a
  shared loader used by both the main viewport and the offscreen worker
- add the N-panel "studio 环境" selector
- rotate the world background together with the environment
  (backgroundRotation/backgroundIntensity), so camera view and offscreen
  renders match the desktop Mapping-node behaviour

Verification (Chromium, OPFS, NOT_CLAIMED):
- environment lighting + 8 world pixel identity
- camera-view rotation correspondence (camera matrices, 207 samples)
- offscreen vs on-screen background parity after hiding geometry (1305 samples)
- metals case extended with material-field OPFS roundtrip
- material Principled edits and rename undo/redo
- eight studio worlds: pairwise frame differences + luminance rank correlation
- undo history depth capped at 64 steps and undo across OPFS save/reopen

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 09:27:47 +08:00

74 lines
7.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# WBV2-COLLADA-001 — YT2.dae 全链路功能测试
更新:2026-11-22(CST)。验收口径 `NOT_CLAIMED`。用例编号为独立测试批次,不推进执行队列指针。
纯 Web 范围:只验证 Web Blender(WebEngine + React 前端)自身能完成的能力;工程文件全部走 OPFS。
## 范围
生产资产 `/home/mes123456/workinf_Blender_Wasm/doc2/YT2.dae`(COLLADA 1.4.1,Z_UP,毫米单位,1 节点 + 236 个 `instance_geometry`,133,926 三角面,无材质/UV)与 4 个自建模型(`tools/web/generate-collada-fixtures.py` → `web/tests/fixtures/collada/`)。
用例:`web/tests/e2e/collada-model-pipeline.spec.ts`(9 个独立测试);单一特性计划:`tools/web/workflow-cases/collada-*.json`;证据:`tests/golden/WBV2-COLLADA-001/workflow-cases/<key>/`。
## 已实现的功能路径
- **COLLADA 导入**:`web/app/src/workers/model-convert.worker.ts` 用 assimpjs(本地 v5.4 重建,`web/app/src/vendor/assimp/`)把 `.dae` 转成 glTF 2.0 GLB,再由 WebEngine 原生 `importScene('GLB')` 装配。assimpjs 的 embind 绑定改为纯 C 导出(`ajs_*`,满足 CSP)。
- **层级还原**:转换器按几何体名把 2,199 个 primitive 拆回 236 个子节点,导入结果为 `Scene` → `YT2-HA_______`(Empty)→ 236 个网格。
- **设置原点**:`web_engine_main_state.cpp` 的 `setObjectOrigin` 使用顶点算术平均(`ORIGIN_GEOMETRY`/`MEDIAN`),菜单提供中位中心 / 包围盒中心。
- **批量精简 / 材质入口**:`App.tsx` 精简面板“应用到选中物体”、材质面板“分配到选中物体”;修饰器类型建议列表改为读取真实字段。
- **原生 GLB 导出**:`web_engine_main_state.cpp` 的 `export_scene.gltf` GLB 分支(base64 回传),`web_engine_api.cpp` 放开 GLB 导出;下载仅由用户手动触发。
- **glTF 导出在 WebEngine 内的兼容修复**(本轮新增,三处 addon 脚本,随 `--embed-file` 重新链接进 wasm):
- `blender-5.2.0/scripts/addons_core/io_scene_gltf2/io/exp/draco.py`、`io/exp/meshopt.py`:`ctypes` 导入改为按需失败(WebEngine 的 Python 无 `_ctypes` 扩展),压缩未启用时不再阻断导出。
- `blender-5.2.0/scripts/addons_core/io_scene_gltf2/io/com/library.py`:`dll_exists` 处理 `dll_path` 返回 `None`(无对应平台动态库)的分支,避免 `.absolute()` 崩溃。
- **大场景超时**:`importScene` 300 s、`saveBlend` 180 s、undo/redo 300 s、视口帧 300 s。
## 独立用例结果(全部 PASS)
候选 `build_web_main_desktop/collada-export-20261122`,主 wasm SHA-256 `1db4c856dcd6892d9ae053368275449a5897586de2a972e3ee84530ca5b90ee5`。每例单独运行,单例上限 185 s。
| 用例 | attempt | 用时 | 断言 |
|---|---|---|---|
| import | `B3/source/attempt-sChQub` | 115 s | 238 对象 / 236 网格 / 133,926 三角面 / 包围盒 0.639×0.792×0.487 m |
| hierarchy | `attempt-OwV62U` | 173 s | 清除父级后世界包围盒在 1e-5 内不变;再父级回 `YT2-HA_______` |
| origin | `attempt-XhOL3V` | 116 s | 逐网格原点 = 顶点中位中心;世界包围盒尺寸不变 |
| decimate | `attempt-UuM7D6` | 104 s | DECIMATE ratio 0.5 + `modifier_apply`,面数下降 |
| material | `attempt-MXBJRz` | 115 s | 236 个网格各 1 个材质槽,材质名一致 |
| export | `attempt-VXAbkg` | 63 s | GLB 2.0:238 节点 / 236 网格节点 / 1 材质 / 10,270,100 字节,SHA-256 `ebcc50a9…` |
| opfs | `attempt-uFDsyt` | 70 s | 保存项目到 OPFS 后重开,236 网格 / 133,926 面一致 |
| glb-roundtrip | `attempt-1ZnpZi` | 157 s | 导出的 GLB 重新导入后对象/面语义一致 |
| negative | `attempt-A0Cjf3` / `attempt-PuR5JL` | 70 s | 512 字节截断 `.dae` 被拒绝(`COLLADA_PARSE_FAILED`),场景与历史游标不变;状态栏无堆栈 |
| fixture triangle_minimal | `fixture-triangle_minimal/…/attempt-vCnBTb` | 25 s | 1 网格 / 1 三角面 |
| fixture nested_hierarchy | `fixture-nested_hierarchy/…/attempt-3pDtXg` | 25 s | 2 网格 / 3 三角面 |
| fixture two_materials | `fixture-two_materials/…/attempt-tzaB2k` | 25 s | 2 网格 / 2 三角面 / 2 材质 |
| fixture millimeter_yup | `fixture-millimeter_yup/…/attempt-L4KCDf` | 25 s | 1 网格 / 12 三角面 / 包围盒 ≈1 m³ |
| undo | `undo/B3/source/attempt-OFrAEc` | 25 s | `setObjectOrigin` → undo 恢复原点与包围盒 → redo 重现编辑(导入场景) |
所有尝试目录均位于 `/home/mes123456/workinf_Blender_Wasm/tests/golden/WBV2-COLLADA-001/workflow-cases/<key>/B3/source/`。
## 导出失败的根因链
1. UI 回调层只抛 `PYTHON_UI_CALLBACK_FAILED: EXPORT_SCENE_OT_gltf.execute`,不含 Python 详情。
2. 提取 traceback 后依次暴露:`ModuleNotFoundError: No module named '_ctypes'`(导出模块顶层导入 Draco/meshopt 压缩)→ 修复后 `AttributeError: 'NoneType' object has no attribute 'absolute'`(`is_draco_available` → `dll_exists`,平台无对应动态库分支)。
3. 两处修复后原生 GLB 导出产出完整 glTF 2.0(见上表)。
## 残余缺口(真实、未修复)
1. **大工程打开后视口输入就绪标志不恢复**:打开 `yt2-imported.blend` 后 `data-native-input-ready` 保持 `false`,探针显示 `window.__nativeWorkflowGPU` 的 `requestId` 冻结、`displayAcknowledged: true`、`inputDiscarded: false`、`modalActive: false`,鼠标移动/点击未产生新帧。原因指向 `WasmGPUCanvas` 的 `readyOwnerFrames >= 2` 在 ownerGeneration 变化后需连续两帧,而空闲帧泵不再发送第二帧。影响:打开大工程后用户需要一次额外的输入唤醒才可继续操作视口。负例测试已不依赖该清理步骤;该缺口需单独立项修复。
2. **完成度评估器**:`tools/web/evaluate-wbv2-completion.mjs` → `coverage-baseline.mjs:47` “historical references must be an array”,使 manifest 落为 `BLOCKED`,与用例执行结果无关。
3. ~~**失败导入的状态文案**:状态栏直接显示转换错误堆栈。~~ 已修复(2026-11-22):`model-convert.worker.ts` 只回传 `error.message` 不再回传 `error.stack`;`App.tsx` 的 `importColladaFile` 只取首行并去掉 `Error:` 前缀。负例 `attempt-PuR5JL` 断言状态栏含 `COLLADA 导入失败` 且不含堆栈行(PASS)。
4. **满尺寸场景的 undo/redo 超出单例窗口**:对 YT2 场景执行 `setObjectOrigin` → undo/redo 在 185 s 上限内未完成(历史恢复需重开 13 MB Main 并重建 236 网格),两次尝试均被上限终止、无回执。小场景(nested_hierarchy 导入)同一路径 PASS(`attempt-OFrAEc`)。需单独评估满尺寸历史重建的耗时与预算。
5. **IO 门禁基线检查失败**:`node tools/web/check-io-format-ui-gate.mjs` 报 `IO_FORMAT_UNSUPPORTED: registry route is not declared by the capability matrix`;`web/app/src/capabilities/io-format-ui-registry.json` 与 `tests/golden/M12-05B/capability-matrix.json` 在本轮均未修改(`git diff` 为空),属仓库既有基线不一致,与 COLLADA 用例无关。
## OPFS 与文件落盘
导入、编辑、保存、自动保存、重开全部写入 OPFS;本地下载只由用户手动触发“下载 .blend/GLB”。本轮未新增任何本地落盘路径。
## 计划覆盖
B1–B8 已落地:assimpjs 转换接入、层级拆分、原点中位语义、精简/材质批量入口、原生 GLB 导出、4 个自建模型、9+5 条独立用例与证据。B8 中的“桌面 Blender oracle 对比”按纯 Web 铁律不执行。
## 下一步
- 单独立项修复视口输入就绪恢复(`WasmGPUCanvas` 帧泵 + `readyOwnerFrames`),并补一条“打开大工程后直接操作视口”的用例。
- 评估满尺寸场景 undo/redo 的历史重建耗时,使其进入单例窗口。
- 修复 `coverage-baseline` 与 IO 门禁基线的既有不一致后重跑证据评估。