refactor(new_editor/app): reorganize host structure and add smoke test
This commit is contained in:
80
new_editor/app/State/EditorSession.cpp
Normal file
80
new_editor/app/State/EditorSession.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
#include "EditorSession.h"
|
||||
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
|
||||
std::string_view GetEditorRuntimeModeName(EditorRuntimeMode mode) {
|
||||
switch (mode) {
|
||||
case EditorRuntimeMode::Edit:
|
||||
return "Edit";
|
||||
case EditorRuntimeMode::Play:
|
||||
return "Play";
|
||||
case EditorRuntimeMode::Paused:
|
||||
return "Paused";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view GetEditorActionRouteName(EditorActionRoute route) {
|
||||
switch (route) {
|
||||
case EditorActionRoute::Hierarchy:
|
||||
return "Hierarchy";
|
||||
case EditorActionRoute::Project:
|
||||
return "Project";
|
||||
case EditorActionRoute::Inspector:
|
||||
return "Inspector";
|
||||
case EditorActionRoute::Console:
|
||||
return "Console";
|
||||
case EditorActionRoute::Scene:
|
||||
return "Scene";
|
||||
case EditorActionRoute::Game:
|
||||
return "Game";
|
||||
case EditorActionRoute::None:
|
||||
default:
|
||||
return "None";
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view GetEditorSelectionKindName(EditorSelectionKind kind) {
|
||||
switch (kind) {
|
||||
case EditorSelectionKind::HierarchyNode:
|
||||
return "HierarchyNode";
|
||||
case EditorSelectionKind::ProjectItem:
|
||||
return "ProjectItem";
|
||||
case EditorSelectionKind::None:
|
||||
default:
|
||||
return "None";
|
||||
}
|
||||
}
|
||||
|
||||
EditorActionRoute ResolveEditorActionRoute(std::string_view panelId) {
|
||||
if (panelId == "hierarchy") {
|
||||
return EditorActionRoute::Hierarchy;
|
||||
}
|
||||
if (panelId == "project") {
|
||||
return EditorActionRoute::Project;
|
||||
}
|
||||
if (panelId == "inspector") {
|
||||
return EditorActionRoute::Inspector;
|
||||
}
|
||||
if (panelId == "console") {
|
||||
return EditorActionRoute::Console;
|
||||
}
|
||||
if (panelId == "scene") {
|
||||
return EditorActionRoute::Scene;
|
||||
}
|
||||
if (panelId == "game") {
|
||||
return EditorActionRoute::Game;
|
||||
}
|
||||
return EditorActionRoute::None;
|
||||
}
|
||||
|
||||
void SyncEditorSessionFromWorkspace(
|
||||
EditorSession& session,
|
||||
const UIEditorWorkspaceController& controller) {
|
||||
session.activePanelId = controller.GetWorkspace().activePanelId;
|
||||
session.activeRoute = ResolveEditorActionRoute(session.activePanelId);
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
|
||||
Reference in New Issue
Block a user