2026-04-10 17:10:42 +08:00
|
|
|
|
# Foundation
|
|
|
|
|
|
|
|
|
|
|
|
**命名空间**: `XCEngine::UI::Editor`
|
|
|
|
|
|
|
2026-04-10 17:43:30 +08:00
|
|
|
|
**类型**: `module`
|
2026-04-10 17:10:42 +08:00
|
|
|
|
|
2026-04-10 17:43:30 +08:00
|
|
|
|
**描述**: `XCEditor` 的基础协议层,覆盖命令注册、命令派发、快捷键管理以及主题度量解析入口。
|
2026-04-10 17:10:42 +08:00
|
|
|
|
|
2026-04-10 17:43:30 +08:00
|
|
|
|
## 概览
|
2026-04-10 17:10:42 +08:00
|
|
|
|
|
2026-04-10 17:43:30 +08:00
|
|
|
|
`Foundation` 解决的是“shell 和控件真正运行前,需要先有一套什么样的 editor 级基础协议”。
|
|
|
|
|
|
|
|
|
|
|
|
按当前代码,职责主要分成四块:
|
2026-04-10 17:10:42 +08:00
|
|
|
|
|
|
|
|
|
|
- `UIEditorCommandRegistry.h`
|
2026-04-10 17:43:30 +08:00
|
|
|
|
- 定义 editor 命令描述、workspace 命令描述以及注册表校验规则。
|
2026-04-10 17:10:42 +08:00
|
|
|
|
- `UIEditorCommandDispatcher.h`
|
2026-04-10 17:43:30 +08:00
|
|
|
|
- 把 `commandId` 解析为 workspace command 或 host command,并执行 preview / dispatch。
|
2026-04-10 17:10:42 +08:00
|
|
|
|
- `UIEditorShortcutManager.h`
|
2026-04-10 17:43:30 +08:00
|
|
|
|
- 复用 `XCEngine::UI::UIShortcutRegistry` 完成快捷键绑定、冲突校验与调度。
|
2026-04-10 17:10:42 +08:00
|
|
|
|
- `UIEditorTheme.h`
|
2026-04-10 17:43:30 +08:00
|
|
|
|
- 为 `Collections / Fields / Shell` 汇总默认 metrics / palette 解析入口。
|
|
|
|
|
|
|
|
|
|
|
|
这层不直接渲染 widget,也不直接拥有 workspace 状态;它更像 `XCEditor` 的“命令 + 输入 + 主题”底座。
|
2026-04-10 17:10:42 +08:00
|
|
|
|
|
2026-04-10 17:43:30 +08:00
|
|
|
|
## 当前调用链
|
|
|
|
|
|
|
|
|
|
|
|
- `new_editor/src/Shell/UIEditorShellAsset.cpp` 会从 shell asset 构造命令注册表和快捷键管理器。
|
|
|
|
|
|
- `new_editor/src/Shell/UIEditorMenuModel.cpp` 通过命令注册表、命令派发器和快捷键管理器生成 menu item 的启用态与 shortcut 文案。
|
|
|
|
|
|
- 多组 `tests/UI/Editor/unit/**` 与 `tests/UI/Editor/integration/**` 当前直接把这层当作 editor shell 的最小可验证基础设施。
|
2026-04-10 17:10:42 +08:00
|
|
|
|
|
|
|
|
|
|
## 公开头文件
|
|
|
|
|
|
|
2026-04-10 17:43:30 +08:00
|
|
|
|
- [UIEditorCommandRegistry](UIEditorCommandRegistry/UIEditorCommandRegistry.md) - editor 命令描述与注册表校验规则。
|
|
|
|
|
|
- [UIEditorCommandDispatcher](UIEditorCommandDispatcher/UIEditorCommandDispatcher.md) - `commandId -> workspace/host dispatch` 入口。
|
|
|
|
|
|
- [UIEditorShortcutManager](UIEditorShortcutManager/UIEditorShortcutManager.md) - editor 快捷键绑定、校验和调度入口。
|
|
|
|
|
|
- [UIEditorTheme](UIEditorTheme/UIEditorTheme.md) - 默认 metrics / palette 解析入口。
|
2026-04-10 17:10:42 +08:00
|
|
|
|
|
|
|
|
|
|
## 当前实现边界
|
|
|
|
|
|
|
2026-04-10 17:43:30 +08:00
|
|
|
|
- 该模块不直接渲染 UI,而是为 `Shell`、`Collections` 和 `Fields` 提供命令、快捷键和主题基础能力。
|
|
|
|
|
|
- 当前主题解析函数统一返回静态默认值,还没有引入动态主题切换或 style 覆盖链。
|
|
|
|
|
|
- host command 仍然通过 `UIEditorHostCommandHandler` 抽象对外,不把宿主实现细节泄漏回 public header。
|
2026-04-10 17:10:42 +08:00
|
|
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
|
|
|
|
|
|
- [XCEditor](../XCEditor.md)
|
|
|
|
|
|
- [Shell](../Shell/Shell.md)
|
2026-04-10 17:43:30 +08:00
|
|
|
|
- [Collections](../Collections/Collections.md)
|
|
|
|
|
|
- [Fields](../Fields/Fields.md)
|