Files
XCEngine/docs/api/XCEngine/Editor/Commands/Commands.md

38 lines
1.3 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.
# Commands
**命名空间**: `XCEngine::Editor::Commands`
**类型**: `submodule`
**描述**: 编辑器高层命令封装层,把场景、项目、实体与组件编辑工作流收束成可复用操作。
## 概述
`Commands` 层的定位,是把 UI 或 action router 中触发的具体操作,收口为更高层的编辑命令。
当前目录中包括:
- [SceneCommands](SceneCommands/SceneCommands.md)
- [ProjectCommands](ProjectCommands/ProjectCommands.md)
- [EntityCommands](EntityCommands/EntityCommands.md)
- [ComponentCommands](ComponentCommands/ComponentCommands.md)
## 设计说明
把面板代码里的按钮逻辑收束到命令层,是必要的。否则菜单、工具栏、快捷键和上下文菜单会各自复制一套场景操作流程。
从当前代码看,`Commands` 的职责边界已经比较清楚:
- `SceneCommands` 负责场景文件生命周期
- `ProjectCommands` 负责资源动作、项目描述保存和项目文档级 helper
- `EntityCommands` 负责场景树结构编辑
- `ComponentCommands` 负责 Inspector 中的组件增删
这正是商业级编辑器 API 文档里应当强调的部分:用户不应只知道“这里有几个 helper”而应明确知道“不同级别的修改应该落到哪一层”。
## 相关文档
- [Editor 模块](../Editor.md)
- [Actions](../Actions/Actions.md)
- [Core](../Core/Core.md)