docs: sync project browser docs
This commit is contained in:
94
docs/api/XCEngine/Editor/panels/ProjectPanel/Render.md
Normal file
94
docs/api/XCEngine/Editor/panels/ProjectPanel/Render.md
Normal file
@@ -0,0 +1,94 @@
|
||||
# ProjectPanel::Render
|
||||
|
||||
**命名空间**: `XCEngine::Editor`
|
||||
|
||||
**类型**: `method`
|
||||
|
||||
**源文件**: `editor/src/panels/ProjectPanel.h`
|
||||
|
||||
## 签名
|
||||
|
||||
```cpp
|
||||
void Render() override;
|
||||
```
|
||||
|
||||
## 作用
|
||||
|
||||
绘制完整的 Project Browser,并驱动目录树、搜索、资源网格、拖放移动和延迟上下文菜单动作。
|
||||
|
||||
## 当前实现行为
|
||||
|
||||
### 1. 建立面板与焦点路由
|
||||
|
||||
当前会先:
|
||||
|
||||
- 打开 `UI::PanelWindowScope`
|
||||
- 调用 `Actions::ObserveFocusedActionRoute(*m_context, EditorActionRoute::Project)`
|
||||
|
||||
这保证 Project 面板获得焦点时,项目相关动作和 Inspector 资源检查模式都能看到正确 route。
|
||||
|
||||
### 2. 初始化本帧拖放状态
|
||||
|
||||
每帧开始时会:
|
||||
|
||||
- `BeginAssetDragDropFrame()`
|
||||
- 清空 `m_deferredContextAction`
|
||||
- 渲染顶部 toolbar
|
||||
|
||||
当前这个 toolbar 不只是搜索框,还会读取 `ResourceManager::GetProjectAssetImportStatus()`,在左侧显示 `Library: ...` 状态文案,并在 hover 时展开导入状态 tooltip。
|
||||
|
||||
拖放不是在单个 tile 里直接提交,而是作为整帧状态机统一收口。
|
||||
|
||||
### 3. 组织双栏主体布局
|
||||
|
||||
主体内容当前包括:
|
||||
|
||||
- 左侧目录树 pane
|
||||
- 中间 splitter
|
||||
- 右侧浏览区 pane
|
||||
|
||||
其中 `m_navigationWidth` 会在当前帧按:
|
||||
|
||||
- 最小导航宽度
|
||||
- 最小浏览区宽度
|
||||
|
||||
进行夹取,避免 splitter 把任一侧拖到不可用。
|
||||
|
||||
### 4. 渲染目录树与浏览区
|
||||
|
||||
左侧目录树通过 `RenderFolderTreePane(manager)` 完成,右侧浏览区通过 `RenderBrowserPane(manager)` 完成。
|
||||
|
||||
浏览区内部进一步包括:
|
||||
|
||||
- 面包屑 header
|
||||
- 搜索过滤后的资源卡片网格
|
||||
- 行内重命名
|
||||
- 右键上下文菜单
|
||||
|
||||
### 5. 统一提交拖放与 deferred action
|
||||
|
||||
当前渲染末尾会依次执行:
|
||||
|
||||
1. `FinalizeAssetDragDrop(manager)`
|
||||
2. 若存在 `m_deferredContextAction`,则在本帧最后执行
|
||||
|
||||
这意味着:
|
||||
|
||||
- 资源移动不会在 UI 遍历过程中直接打断当前逻辑
|
||||
- 创建资源、重命名、Show in Explorer 这类上下文菜单动作也会延后到本帧收尾阶段
|
||||
|
||||
## 设计含义
|
||||
|
||||
`Render()` 当前承担的是“项目浏览器壳层主流程”,而不是具体资源命令实现。真正的打开、创建、删除、重命名和移动语义仍下沉在:
|
||||
|
||||
- `Actions::*`
|
||||
- `Commands::*`
|
||||
- `IProjectManager`
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [ProjectPanel](ProjectPanel.md)
|
||||
- [Constructor](Constructor.md)
|
||||
- [Initialize](Initialize.md)
|
||||
- [ProjectCommands](../../Commands/ProjectCommands/ProjectCommands.md)
|
||||
- [ProjectActionRouter](../../Actions/ProjectActionRouter/ProjectActionRouter.md)
|
||||
Reference in New Issue
Block a user