Merge branch 'master' into refactor/agc-resource-menu
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 7m11s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 7m17s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 7m24s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 7m32s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m20s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 3m51s
Project CI / Native shell tests (pull_request) Failing after 9m7s
Project CI / Backend tests (pull_request) Successful in 11m14s
Project CI / Repository checks (pull_request) Successful in 7m42s
Project CI / AI game creator shell web tests (pull_request) Failing after 2m37s
Project CI / Frontend tests (pull_request) Successful in 11m53s
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 7m11s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 7m17s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 7m24s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 7m32s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m20s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 3m51s
Project CI / Native shell tests (pull_request) Failing after 9m7s
Project CI / Backend tests (pull_request) Successful in 11m14s
Project CI / Repository checks (pull_request) Successful in 7m42s
Project CI / AI game creator shell web tests (pull_request) Failing after 2m37s
Project CI / Frontend tests (pull_request) Successful in 11m53s
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# 【里程碑】资源画布支持引擎资源预览
|
||||
|
||||
| 字段 | 值 |
|
||||
| --- | --- |
|
||||
| Version | 1.0 |
|
||||
| Status | implemented; 真机 Cocos 工程验收待补 |
|
||||
| Date | 2026-09-17 |
|
||||
| Parent Spec | `docs/technical/【技术方案】AI游戏创作智能体App实施计划-2026-06-24.md` |
|
||||
|
||||
## 目标
|
||||
|
||||
引擎(Cocos Creator 等)工程里已经存在的资源,可以被登记进 manifest,并作为资源画布的卡片**只读预览**:模型出缩略图、序列化资源出结构摘要、客户端解不了的容器出类型卡。
|
||||
|
||||
## 范围
|
||||
|
||||
- 登记与发现:模型、动画、场景/预制体/瓦片地图/地形、材质/特效、图集与字体配置、图像容器、引擎二进制容器。
|
||||
- 生成目录过滤:Cocos 工程的 `library/`、`temp/`、`profiles/`、`local/` 不进发现结果(仅当当前目录确实是引擎工程时生效)。
|
||||
- 画布准入与卡面:新增「引擎资源」三个卡面分支(模型 / 结构摘要 / 类型卡),并按扩展名给出引擎语义的类型角标。
|
||||
- 模型放大预览:选中模型卡后用工具条的「3D 预览」打开浮层,给出与三维建模软件一致的视角操作(左键旋转 / 右键或中键平移 / 滚轮缩放 / 复位视角)。
|
||||
- 只读预览通道:模型字节读取、引擎序列化文本读取(非 UTF-8 时降级)、图像容器原生转码。
|
||||
|
||||
## 不在范围内
|
||||
|
||||
- 引擎资源的编辑、派生、生成与回写(画布上仍是只读预览;「快速编辑」等现有工具链不承接这些类型)。
|
||||
- 引擎私有格式的解码:压缩纹理(`.texture` / `.cubemap` / `.rt`)、Spine 二进制(`.skel`)、DragonBones 二进制(`.dbbin`)、PSD、EXR、裸 PCM 只出类型卡。
|
||||
- 新增 manifest 契约字段(`cocosUuid` 等)、新增 canonical kind、新增画布分类轴:本轮复用既有 kind,避免旧客户端读不出 manifest(`deny_unknown_fields`)。
|
||||
- 多文件 glTF(`baseURI` 指向外部 `.bin` / 贴图)的渲染:卡面只渲染自包含的 `.glb` / 单文件 `.gltf` / `.fbx`,其余降级成类型卡(本轮选择放宽字节上限,不做资源路径解析)。
|
||||
- 项目快照 / 版本指纹 / 检查点对生成目录的口径:本轮只过滤**发现结果**,不改快照语义。
|
||||
|
||||
## 依赖与前置条件
|
||||
|
||||
- 现有四道闸门:发现(`bridge_project_file_class`)、登记(`agent_local_project_file_type`)、画布准入(`projectedResourceKind`)、卡面读取(`resourceCardPreviewModel` + 原生预览命令)。
|
||||
- 既有预览管线(可见性门禁、3 槽并发、LRU 预算、取消与失败语义)不改口径。
|
||||
- 前端新增 `three` 运行时依赖(缩略图渲染器)与 `@types/three` 类型依赖。
|
||||
|
||||
## 验收标准
|
||||
|
||||
- [x] 表内引擎资源都能通过发现层拿到非空 `mediaType`,并按 `model` / `binary` / `image` / `document` / `audio` 等类别被筛出。
|
||||
- [x] 表内引擎资源都能登记进 manifest,`kind` 只落在既有 canonical 词表内。
|
||||
- [x] 表内引擎资源都能进入资源画布,并落到预期的卡面分支与类型角标。
|
||||
- [x] 模型卡在渲染不可用时降级成类型卡,不冒泡成预览失败。
|
||||
- [x] 引擎序列化资源的非 UTF-8 变体降级成类型卡,不报错。
|
||||
- [x] 图像容器(`.tga` / `.tif` / `.tiff` / `.hdr`)由原生侧转码成 PNG 后按图片卡显示。
|
||||
- [x] 引擎工程的生成目录不出现在发现结果里,同名目录在非引擎工程里照常列出。
|
||||
- [x] 模型预览上限放宽到与通用媒体预览一致(32 MiB),超出后仍是类型卡而不是半渲染。
|
||||
- [x] 模型卡可以放大到独立浮层里交互查看:拖动与滚轮都真实改变画面,「复位视角」回到打开时的取景。
|
||||
- [x] 真机 Cocos 工程(含模型与动画资源)在客户端内滚动浏览的视觉验收。
|
||||
|
||||
## 证据要求
|
||||
|
||||
- 自动化:`cargo check`;`cargo fmt --check`;`cargo test --bin genarrative-ai-game-creator-shell cocos`(9 通过,含发现分类 / 登记 / 提示词 / 插件门禁);`cargo test … resource_inspect::tests`(7 通过:结构化预览与二进制降级、TGA→PNG 转码、模型媒体类型签名 + 既有文本 / SVG / 尺寸用例);`cargo test … agent_asset_import_tests`(9 通过);`cargo test … local_project_file_listing_skips_engine_generated_directories_only_for_engine_projects`;`npx vitest run apps/ai-game-creator-shell/tests/resourceCocosPreviewContract.test.tsx`(7 通过);`npx vitest run apps/ai-game-creator-shell/tests/resource apps/ai-game-creator-shell/tests/project`(52 文件 / 543 用例);`npx vitest run apps/ai-game-creator-shell/tests/appSurface.test.ts`(450 通过 / 20 跳过);`npm run typecheck`(app);`npm run check:encoding`;`git diff --check`;`npm run check:doc-index`。
|
||||
- 运行时(2026-09-17 完成):在真实客户端(`npm run agc` 起的 Tauri 客户端 + WebView2 CDP 驱动)里打开一个**本地临时 Cocos 夹具工程**(含模型 / 动画 / 序列化资源 / TGA / 引擎容器,不入库),经 `import_local_cocos_project` 与受控登记导入 10 个引擎资源后逐栏核对:模型卡出真实三维缩略图(`data-model-preview-status=ready`,卡面是渲染出来的 PNG data URL);`.anim` / `.scene` / `.prefab` / `.plist` / `.effect` 出结构摘要或文本预览;`.tga` 出真实图片(原生转码生效);`.texture` / `.bin` / `.pcm` 出「纹理 · TEXTURE」「二进制 · BIN」「音频片段 · PCM」类型卡。验收截图(本地留存,不入库):场景与环境栏(模型 + 摘要)、文档栏(类型卡)、待归类栏(TGA 转码)、音频栏、模型放大预览。
|
||||
- 运行时(目录过滤):同一现场调 `list_local_project_files`,根级 `library/` / `temp/` / `profiles/` **0 条**,而 `assets/library/inside.bin` 正常列出。
|
||||
- 运行时(模型交互):同一现场选中 `cube.glb` → 工具条出现「3D 预览」→ 浮层内 `data-model-viewer-status=ready`、canvas 已挂载;真实鼠标拖拽与滚轮各产生一次不同的渲染结果(三张截图 MD5 互不相同),点「复位视角」后的截图与打开时**逐字节一致**(MD5 `A6531331206456C666909F80384B53AD`)。证据:`agc-model-viewer-initial.png` / `agc-viewer-rotated.png` / `agc-viewer-zoomed-out.png` / `agc-viewer-reset.png`。
|
||||
- 运行时(卡面几何):同一现场量 `cube.glb` 卡的卡片盒 / 卡面 / 类型角标 / 缩略图四个矩形的 `x/y/w/h`,在**指针移开、悬停、选中**三种状态下**完全一致**(此前悬停会把卡面四边各吃 1px);缩略图渲染尺寸为 `356x252`(布局盒 178×126 × 2 超采样),绘制比 1.4127 与卡面盒 267×189 的比例一致,缩放后不发虚、不裁切。证据:`agc-fix-hover.png` / `agc-fix-selected.png`。
|
||||
- 边界:`.meta` 仍然只可发现、不可登记;引擎工程的 `library/` / `temp/` / `profiles/` / `local/` 不进发现结果,同名目录在非引擎工程里照常列出;`.pcm` / `.texture` 等容器不发起读取。
|
||||
- 未验证:真机客户端内的视觉验收(本机没有可用的 Cocos 工程实例)。Rust 侧其余仍用 `tempfile::tempdir()` 的既有用例在本机仍被 `Windows 安全对象不属于当前用户` 阻断(本次把预览与导入这两个模块的用例改用工程自带的 `crate::tests::canonical_test_tempdir`,它们已能真实跑通)。
|
||||
Reference in New Issue
Block a user