editor: centralize product panel manifest

This commit is contained in:
2026-04-28 04:33:44 +08:00
parent ea765b9481
commit 8c66cdac07
12 changed files with 574 additions and 136 deletions

View File

@@ -7,6 +7,7 @@
#include "Project/ProjectPanel.h"
#include "Scene/SceneEditCommandRoute.h"
#include "Scene/SceneViewportFeature.h"
#include "Product/EditorProductManifest.h"
#include <XCEditor/Panels/UIEditorHostedPanelDispatch.h>
@@ -449,15 +450,36 @@ private:
SceneEditCommandRoute m_commandRoute = {};
};
std::unique_ptr<EditorWorkspacePanel> CreateWorkspacePanelRuntime(
const EditorProductPanelDescriptor& panel) {
switch (panel.runtimeKind) {
case EditorProductPanelRuntimeKind::Console:
return std::make_unique<ConsoleWorkspacePanel>();
case EditorProductPanelRuntimeKind::Hierarchy:
return std::make_unique<HierarchyWorkspacePanel>();
case EditorProductPanelRuntimeKind::Inspector:
return std::make_unique<InspectorWorkspacePanel>();
case EditorProductPanelRuntimeKind::Project:
return std::make_unique<ProjectWorkspacePanel>();
case EditorProductPanelRuntimeKind::Scene:
return std::make_unique<SceneWorkspacePanel>();
case EditorProductPanelRuntimeKind::None:
default:
return nullptr;
}
}
} // namespace
EditorWorkspacePanelRuntimeSet CreateEditorWorkspacePanelRuntimeSet() {
EditorWorkspacePanelRuntimeSet panels = {};
panels.AddPanel(std::make_unique<ConsoleWorkspacePanel>());
panels.AddPanel(std::make_unique<HierarchyWorkspacePanel>());
panels.AddPanel(std::make_unique<InspectorWorkspacePanel>());
panels.AddPanel(std::make_unique<ProjectWorkspacePanel>());
panels.AddPanel(std::make_unique<SceneWorkspacePanel>());
for (const EditorProductPanelDescriptor& panel : GetEditorProductPanels()) {
if (std::unique_ptr<EditorWorkspacePanel> runtime =
CreateWorkspacePanelRuntime(panel);
runtime != nullptr) {
panels.AddPanel(std::move(runtime));
}
}
return panels;
}