editor: centralize product panel manifest
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user