MetaCore/MetaEditor/EditorPresenter.h

73 lines
2.9 KiB
C++

#pragma once
#include "MetaCore/engine/editor_core/EditorActions.h"
#include "MetaCore/engine/assets/AssetDatabase.h"
#include "MetaCore/engine/editor_core/EditorSession.h"
#include "MetaCore/engine/editor_core/PanelViewModels.h"
#include "MetaCore/engine/editor_core/SelectionService.h"
#include "MetaCore/engine/editor_core/ShellComposition.h"
#include "MetaCore/engine/editor_core/TransformGizmoService.h"
#include "MetaCore/engine/editor_core/ViewportService.h"
#include "MetaCore/engine/editor_core/WorkspaceLayout.h"
#include "MetaCore/engine/scene/Scene.h"
#include <array>
#include <string>
#include <vector>
namespace metacore::editor {
struct EditorFrameSnapshot {
struct ViewportSnapshot {
std::string selected_object_id;
std::string selected_object_name;
std::array<float, 3> camera_position{0.0F, -10.0F, 3.0F};
std::array<float, 3> object_position{0.0F, 0.0F, 0.0F};
std::array<float, 3> object_rotation{0.0F, 0.0F, 0.0F};
std::array<float, 3> object_scale{1.0F, 1.0F, 1.0F};
std::array<float, 3> snap_values{1.0F, 1.0F, 1.0F};
std::string gizmo_operation = "Translate";
std::string gizmo_space = "Local";
std::string focus_target_id;
bool has_selection = false;
bool snap_enabled = false;
};
std::vector<metacore::engine::editor_core::EditorAction> actions;
metacore::engine::editor_core::WorkspaceLayout workspace;
metacore::engine::editor_core::ShellComposition shell;
std::vector<metacore::engine::editor_core::HierarchyItem> hierarchy;
std::vector<metacore::engine::editor_core::ProjectAssetItem> assets;
metacore::engine::editor_core::InspectorViewModel inspector;
ViewportSnapshot viewport;
std::vector<metacore::engine::editor_core::ConsoleMessage> console;
std::string status_text;
std::size_t scene_object_count = 0;
bool hierarchy_visible = true;
bool inspector_visible = true;
bool project_visible = true;
bool console_visible = true;
bool runtime_preview_visible = true;
bool toolbar_visible = true;
};
class EditorPresenter {
public:
EditorFrameSnapshot build_snapshot(
const metacore::engine::scene::Scene& scene,
const metacore::engine::assets::AssetDatabase& asset_database,
const metacore::engine::editor_core::SelectionService& selection_service,
const metacore::engine::editor_core::TransformGizmoService& gizmo_service,
const metacore::engine::editor_core::ViewportService& viewport_service,
const metacore::engine::editor_core::EditorSession& session
) const;
private:
metacore::engine::editor_core::PanelViewModels panel_view_models_{};
metacore::engine::editor_core::EditorActionCatalog action_catalog_{};
metacore::engine::editor_core::ShellCompositionBuilder shell_builder_{};
metacore::engine::editor_core::WorkspaceLayoutFactory workspace_factory_{};
};
} // namespace metacore::editor