Refactor new editor boundaries and test ownership
This commit is contained in:
82
new_editor/app/State/EditorSession.cpp
Normal file
82
new_editor/app/State/EditorSession.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "State/EditorSession.h"
|
||||
|
||||
#include "Composition/EditorPanelIds.h"
|
||||
|
||||
#include <XCEditor/Workspace/UIEditorWorkspaceController.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 == kHierarchyPanelId) {
|
||||
return EditorActionRoute::Hierarchy;
|
||||
}
|
||||
if (panelId == kProjectPanelId) {
|
||||
return EditorActionRoute::Project;
|
||||
}
|
||||
if (panelId == kInspectorPanelId) {
|
||||
return EditorActionRoute::Inspector;
|
||||
}
|
||||
if (panelId == kConsolePanelId) {
|
||||
return EditorActionRoute::Console;
|
||||
}
|
||||
if (panelId == kScenePanelId) {
|
||||
return EditorActionRoute::Scene;
|
||||
}
|
||||
if (panelId == kGamePanelId) {
|
||||
return EditorActionRoute::Game;
|
||||
}
|
||||
return EditorActionRoute::None;
|
||||
}
|
||||
|
||||
void SyncEditorSessionFromWorkspace(
|
||||
EditorSession& session,
|
||||
const UIEditorWorkspaceController& controller) {
|
||||
session.activePanelId = controller.GetWorkspace().activePanelId;
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
Reference in New Issue
Block a user