81 lines
2.1 KiB
C++
81 lines
2.1 KiB
C++
|
|
#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
|
||
|
|
|