105 lines
4.3 KiB
C++
105 lines
4.3 KiB
C++
#pragma once
|
|
|
|
#include "Environment/EditorRuntimePaths.h"
|
|
#include "Windowing/EditorFrameServices.h"
|
|
#include "Scene/EditorSceneRuntime.h"
|
|
#include "Project/EditorProjectRuntime.h"
|
|
#include "Runtime/EditorRuntimeCoordinator.h"
|
|
#include "UtilityWindows/EditorUtilityWindowRuntime.h"
|
|
|
|
#include "State/EditorColorPickerToolState.h"
|
|
#include "State/EditorSelectionService.h"
|
|
#include "State/EditorSession.h"
|
|
#include "State/EditorUtilityWindowRequestState.h"
|
|
#include <XCEditor/Shell/UIEditorShellAsset.h>
|
|
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
|
|
|
|
#include <filesystem>
|
|
#include <functional>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
namespace XCEngine::UI::Editor::System {
|
|
class SystemInteractionService;
|
|
}
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
class EditorEditCommandRoute;
|
|
class EditorSceneBackendFactory;
|
|
|
|
class EditorContext : public EditorFrameServices {
|
|
public:
|
|
bool Initialize(
|
|
const EditorRuntimePaths& runtimePaths,
|
|
EditorSceneBackendFactory& sceneBackendFactory);
|
|
void AttachTextMeasurer(const UIEditorTextMeasurer& textMeasurer) override;
|
|
void SetSystemInteractionHost(
|
|
::XCEngine::UI::Editor::System::SystemInteractionService* systemInteractionHost);
|
|
const EditorSession& GetSession() const;
|
|
EditorProjectRuntime& GetProjectRuntime();
|
|
const EditorProjectRuntime& GetProjectRuntime() const;
|
|
EditorSceneRuntime& GetSceneRuntime();
|
|
const EditorSceneRuntime& GetSceneRuntime() const;
|
|
EditorColorPickerToolState& GetColorPickerToolState();
|
|
const EditorColorPickerToolState& GetColorPickerToolState() const;
|
|
void RequestOpenUtilityWindow(EditorUtilityWindowKind kind);
|
|
const UIEditorTextMeasurer* GetTextMeasurer() const override;
|
|
bool RequestOpenSceneAsset(const std::filesystem::path& scenePath);
|
|
void TickEditorRuntime();
|
|
|
|
bool IsValid() const override;
|
|
const std::string& GetValidationMessage() const override;
|
|
const EditorShellAsset& GetShellAsset() const;
|
|
EditorRuntimeCoordinator& GetRuntimeCoordinator();
|
|
const EditorRuntimeCoordinator& GetRuntimeCoordinator() const;
|
|
std::optional<EditorUtilityWindowKind> ConsumeOpenUtilityWindowRequest() override;
|
|
void SetSelection(EditorSelectionState selection);
|
|
void ClearSelection();
|
|
void SyncSessionFromSelectionService();
|
|
|
|
UIEditorWorkspaceController BuildWorkspaceController() const;
|
|
|
|
UIEditorShellInteractionDefinition BuildShellDefinition(
|
|
const UIEditorWorkspaceController& workspaceController,
|
|
std::string_view captureText,
|
|
EditorShellVariant variant = EditorShellVariant::Primary) const override;
|
|
|
|
void SetReadyStatus();
|
|
void SetStatus(std::string status, std::string message) override;
|
|
void UpdateStatusFromShellResult(
|
|
const UIEditorWorkspaceController& workspaceController,
|
|
const UIEditorShellInteractionResult& result) override;
|
|
std::string DescribeWorkspaceState(
|
|
const UIEditorWorkspaceController& workspaceController,
|
|
const UIEditorShellInteractionState& interactionState) const override;
|
|
std::vector<WorkspaceTraceEntry> SyncWorkspacePanelFrameEvents(
|
|
const std::vector<EditorWorkspacePanelFrameEvent>& panelEvents) override;
|
|
void SyncSceneViewportRenderRequest(
|
|
EditorSceneViewportRuntime& sceneViewportRuntime) override;
|
|
|
|
private:
|
|
void AppendConsoleEntry(std::string channel, std::string message);
|
|
std::vector<WorkspaceTraceEntry> SyncWorkspacePanelEvents(
|
|
const std::vector<EditorWorkspacePanelFrameEvent>& panelEvents);
|
|
|
|
EditorShellAsset m_shellAsset = {};
|
|
EditorShellAssetValidationResult m_shellValidation = {};
|
|
EditorSession m_session = {};
|
|
EditorSelectionService m_selectionService = {};
|
|
EditorProjectRuntime m_projectRuntime = {};
|
|
EditorSceneRuntime m_sceneRuntime = {};
|
|
EditorRuntimeCoordinator m_runtimeCoordinator = {};
|
|
EditorColorPickerToolState m_colorPickerToolState = {};
|
|
EditorUtilityWindowRequestState m_utilityWindowRequestState = {};
|
|
const UIEditorTextMeasurer* m_textMeasurer = nullptr;
|
|
::XCEngine::UI::Editor::System::SystemInteractionService* m_systemInteractionHost = nullptr;
|
|
bool m_valid = false;
|
|
std::string m_validationMessage = {};
|
|
std::string m_lastStatus = {};
|
|
std::string m_lastMessage = {};
|
|
};
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|