mirror of
https://github.com/HappyLifeOk/cc-3-8-x-mcp.git
synced 2026-08-20 13:37:13 +00:00
[cli] 新增: nested 路径查找 + classid-resolver 多目录扫描
This commit is contained in:
+4
-4
@@ -361,7 +361,7 @@ stub 节点(嵌套 prefab 实例)在 prefab JSON 里 `_name = ""`(空字
|
||||
|---|---|---|
|
||||
| `add-node` | `parent`, `node: {name, lpos?, active?, components?, width?, height?, anchor?}` | 新增 cc.Node;parent 是 stub 时走 mountedChildren。`components: ["UITransform"]` 自动建 UITransform |
|
||||
| `add-spine-socket` | `node`, `path`, `target` | 给普通节点上的 `sp.Skeleton` 新增 / 更新 `sp.Skeleton.SpineSocket`。`path` 是 Spine socket path(如 `root/zk/tou2`),`target` 是绑定节点;同 path 幂等更新 target,不重复追加 |
|
||||
| `remove-node` | `target` | 从父节点移除引用;元素本身保留(orphan),保持其他 `__id__` 稳定 |
|
||||
| `remove-node` | `target` / `node` | 从父节点移除引用;元素本身保留(orphan),保持其他 `__id__` 稳定。`node` 是旧文档兼容字段,推荐新脚本用 `target` |
|
||||
| `sync-nested-roots` | (无) | 重建根 `PrefabInfo.nestedPrefabInstanceRoots`,剔除「删了一半」残留的悬空嵌套实例根(节点 `_parent` 已移除但根登记残留 → 残留嵌套 prefab 的 asset 仍被当依赖加载,运行时 404)。只重写该数组,不删 elements、不动其他 `__id__`、不产生 null 槽;被孤立的残留对象成为不可达 orphan。复用 remove-node 内部同名逻辑 |
|
||||
| `clone-node` | `source`, `parent`, `name` | 深拷贝整棵子树,分配新 `__id__` + 新 fileId |
|
||||
|
||||
@@ -395,7 +395,7 @@ stub 节点(嵌套 prefab 实例)在 prefab JSON 里 `_name = ""`(空字
|
||||
| `property` | string | ✓ | @property 字段名(如 `"_role"`) |
|
||||
| `refNode` | name / `{id}` / `{path}` | ✓ | 要绑定的目标节点。**stub 必须用 `{id:N}`**(_name 为 null) |
|
||||
| `refType` | string | 可选 | 目标类型。省略 = 取 refNode 第一个非引擎组件;`"cc.Node"` = 绑节点本身(localID = 嵌套 prefab 根节点 PrefabInfo.fileId) |
|
||||
| `refSubNode` | string \| string[] | 可选 | stub 内部子节点定位。**字符串**指定单层 stub 的子节点名;**字符串数组**走多层嵌套(每层一段名字,最后一段配合 refType 决定终点) |
|
||||
| `refSubNode` | string \| string[] | 可选 | stub 内部子节点定位。**字符串**指定单层 stub 的子节点名;**字符串数组**优先按普通节点路径(如 `["content","title"]`)解析;找不到普通路径时再按多层嵌套 stub 链解析 |
|
||||
|
||||
**常见拼错**:`"comp"` → `componentType`,`"ref"` → `refNode`。schema 校验会友好提示。
|
||||
|
||||
@@ -416,7 +416,7 @@ stub 节点(嵌套 prefab 实例)在 prefab JSON 里 `_name = ""`(空字
|
||||
| 一次改一批节点(按组件类型 / 名前缀 / 正则) | `bulk-set` |
|
||||
| 改 cc.Label / Sprite / Button / EditBox / Layout / RichText 多字段 | `set-label` / `set-sprite` / `set-button` / `set-editbox` / `set-layout` / `set-richtext` |
|
||||
| 改节点 _color | `set-node-color` |
|
||||
| 给脚本 @property 挂引用(节点 / 组件 / 单层 stub / 多层 stub) | `set-component-ref`(多层用 `refSubNode: ["A","B"]`) |
|
||||
| 给脚本 @property 挂引用(节点 / 组件 / 单层 stub / 内部路径 / 多层 stub) | `set-component-ref`(内部普通路径如 `refSubNode: ["content","title"]`;多层 stub 链仍用 `["A","B"]`) |
|
||||
| 加 / 删 / 复制节点 | `add-node` / `remove-node` / `clone-node` |
|
||||
| 加 / 删组件 | `add-component` / `remove-component` |
|
||||
| 合并重复组件 | `dedupe-component` |
|
||||
@@ -667,7 +667,7 @@ Cocos 编辑器反序列化时 `__type__` 可填 @ccclass 名(`"GMUI"`)或
|
||||
|
||||
CLI 两端防护:
|
||||
|
||||
1. **写入前**:`add-component` / `set-component-ref` 的 `componentType` / `refType` 自动扫 `assets/scripts` 反查 `.ts.meta` uuid,转 23 字符压缩 classId 写入。引擎类(`cc.*`/`sp.*`/`dragonBones.*`)和已压缩格式原样透传
|
||||
1. **写入前**:`add-component` / `set-component-ref` 的 `componentType` / `refType` 自动扫 `assets/scripts` 和 `extensions` 下带 `.ts.meta` 的脚本,反查 uuid 后转 23 字符压缩 classId 写入。引擎类(`cc.*`/`sp.*`/`dragonBones.*`)和已压缩格式原样透传
|
||||
2. **写入后兜底**:用 `dedupe-component` op 合并已经被 round-trip 过的 prefab
|
||||
|
||||
### 坑 13:stub-node-field override 的 localID 用错 fileId
|
||||
|
||||
Reference in New Issue
Block a user