docs: add Editor API documentation

This commit is contained in:
2026-03-27 14:40:29 +08:00
parent 3e2608a802
commit 94c56dd279
87 changed files with 3795 additions and 2 deletions

View File

@@ -0,0 +1,49 @@
# SceneCommands
**命名空间**: `XCEngine::Editor::Commands`
**类型**: `header utility set`
**源文件**: `editor/src/Commands/SceneCommands.h`
**描述**: 提供场景新建、加载、保存、启动场景加载和脏场景保存回退等高层编辑命令。
## 概述
`SceneCommands.h` 当前是一组 inline 命令函数,不是 class。
当前包含的核心命令包括:
- `ResetSceneEditingState()`
- `NewScene()`
- `LoadScene()`
- `OpenSceneWithDialog()`
- `SaveCurrentScene()`
- `SaveSceneAsWithDialog()`
- `LoadStartupScene()`
- `SaveDirtySceneWithFallback()`
## 当前实现说明
- 这些命令统一依赖 [IEditorContext](../../Core/IEditorContext/IEditorContext.md)。
- 新建/切换场景前会通过 `SceneEditorUtils::ConfirmSceneSwitch()` 进行确认。
- 成功切换场景后会清空选择并清理 undo 历史。
- `SaveSceneAsWithDialog()` 成功后会刷新项目面板当前目录。
- `SaveDirtySceneWithFallback()` 在当前场景脏且普通保存失败时,会尝试保存到给定回退路径。
## 设计说明
这类命令层让:
- 菜单栏
- 快捷键
- 工具栏
- 关闭工作区流程
都能复用同一套场景操作语义。
## 相关文档
- [Commands](../Commands.md)
- [IEditorContext](../../Core/IEditorContext/IEditorContext.md)
- [EditorWorkspace](../../Core/EditorWorkspace/EditorWorkspace.md)