2026-03-27 14:40:29 +08:00
|
|
|
|
# ComponentEditors
|
|
|
|
|
|
|
|
|
|
|
|
**命名空间**: `XCEngine::Editor`
|
|
|
|
|
|
|
|
|
|
|
|
**类型**: `submodule`
|
|
|
|
|
|
|
2026-04-02 21:29:08 +08:00
|
|
|
|
**描述**: Inspector 组件编辑器层,负责把运行时组件映射成可撤销、可交互的专用编辑 UI。
|
2026-03-27 14:40:29 +08:00
|
|
|
|
|
|
|
|
|
|
## 概述
|
|
|
|
|
|
|
2026-04-02 21:29:08 +08:00
|
|
|
|
当前组件编辑器系统走的是典型的“按组件类型注册专用 editor”路线:
|
|
|
|
|
|
|
|
|
|
|
|
- [IComponentEditor](IComponentEditor/IComponentEditor.md) 定义统一契约
|
|
|
|
|
|
- [ComponentEditorRegistry](ComponentEditorRegistry/ComponentEditorRegistry.md) 负责注册、拥有和查找 editor
|
|
|
|
|
|
- 各个具体 editor 只处理自己的组件 UI 与交互规则
|
|
|
|
|
|
|
|
|
|
|
|
这比把所有组件字段塞进一个通用 Inspector 渲染器更容易扩展,也更方便为特殊组件接入脚本元数据、引用选择器和撤销逻辑。
|
|
|
|
|
|
|
|
|
|
|
|
## 当前已记录的 editor
|
2026-03-27 14:40:29 +08:00
|
|
|
|
|
|
|
|
|
|
- [TransformComponentEditor](TransformComponentEditor/TransformComponentEditor.md)
|
|
|
|
|
|
- [CameraComponentEditor](CameraComponentEditor/CameraComponentEditor.md)
|
|
|
|
|
|
- [LightComponentEditor](LightComponentEditor/LightComponentEditor.md)
|
2026-04-02 21:29:08 +08:00
|
|
|
|
- [ScriptComponentEditor](ScriptComponentEditor/ScriptComponentEditor.md)
|
2026-03-27 14:40:29 +08:00
|
|
|
|
|
2026-04-02 21:29:08 +08:00
|
|
|
|
## 当前注册但尚未单独补页的 editor
|
2026-03-27 14:40:29 +08:00
|
|
|
|
|
2026-04-02 21:29:08 +08:00
|
|
|
|
按 `ComponentEditorRegistry.cpp` 当前实现,registry 还会注册:
|
2026-03-27 14:40:29 +08:00
|
|
|
|
|
2026-04-02 21:29:08 +08:00
|
|
|
|
- `MeshFilterComponentEditor`
|
|
|
|
|
|
- `MeshRendererComponentEditor`
|
2026-03-27 14:40:29 +08:00
|
|
|
|
|
2026-04-02 21:29:08 +08:00
|
|
|
|
## ScriptComponentEditor 在这层里的位置
|
|
|
|
|
|
|
|
|
|
|
|
[ScriptComponentEditor](ScriptComponentEditor/ScriptComponentEditor.md) 是这套系统里最依赖运行时元数据的一个 editor。它不是直接读取 `ScriptComponent` 自身的字段列表,而是通过 `ScriptEngine::TryGetScriptFieldModel()` 获取:
|
|
|
|
|
|
|
|
|
|
|
|
- 当前脚本类是否已分配 / 可用 / 缺失
|
|
|
|
|
|
- 字段元数据
|
|
|
|
|
|
- 默认值、stored override 和 live managed value 的合成结果
|
|
|
|
|
|
- stored-only / type mismatch 一类问题状态
|
|
|
|
|
|
|
|
|
|
|
|
因此它也是 `ComponentEditors` 子模块和 `Scripting` 子模块的主要交汇点。
|
2026-03-27 14:40:29 +08:00
|
|
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
|
2026-04-02 21:29:08 +08:00
|
|
|
|
- [ComponentEditorRegistry](ComponentEditorRegistry/ComponentEditorRegistry.md)
|
|
|
|
|
|
- [ScriptComponentEditor](ScriptComponentEditor/ScriptComponentEditor.md)
|
|
|
|
|
|
- [ScriptComponentEditorUtils](ScriptComponentEditorUtils/ScriptComponentEditorUtils.md)
|
|
|
|
|
|
- [InspectorPanel](../panels/InspectorPanel/InspectorPanel.md)
|
2026-03-27 14:40:29 +08:00
|
|
|
|
- [Components](../../Components/Components.md)
|