MetaCore/MetaEditor/IEditorShell.h
2026-03-19 18:01:50 +08:00

58 lines
1.8 KiB
C++

#pragma once
#include "MetaEditor/EditorPresenter.h"
#include "MetaCore/engine/render/RenderTypes.h"
#include <array>
#include <filesystem>
#include <memory>
#include <optional>
#include <string>
namespace metacore::editor {
struct PendingShellEdits {
struct GizmoStateEdit {
std::string operation;
std::string space;
std::array<float, 3> snap_values{1.0F, 1.0F, 1.0F};
bool has_operation = false;
bool has_space = false;
bool has_snap_enabled = false;
bool snap_enabled = false;
bool has_snap_values = false;
};
struct TransformEdit {
std::string entity_id;
std::array<float, 3> position{0.0F, 0.0F, 0.0F};
std::array<float, 3> rotation{0.0F, 0.0F, 0.0F};
std::array<float, 3> scale{1.0F, 1.0F, 1.0F};
};
std::optional<GizmoStateEdit> gizmo_state_edit;
std::optional<TransformEdit> transform_edit;
};
class IEditorShell {
public:
virtual ~IEditorShell() = default;
virtual bool initialize() = 0;
virtual void shutdown() = 0;
virtual void consume_snapshot(const EditorFrameSnapshot& snapshot) = 0;
[[nodiscard]] virtual bool initialized() const = 0;
[[nodiscard]] virtual const EditorFrameSnapshot& last_snapshot() const = 0;
[[nodiscard]] virtual std::string summarize_snapshot() const = 0;
[[nodiscard]] virtual std::string describe_workspace() const = 0;
[[nodiscard]] virtual std::string shell_name() const = 0;
[[nodiscard]] virtual PendingShellEdits consume_pending_edits() = 0;
[[nodiscard]] virtual metacore::engine::render::UiDrawFrame consume_render_frame() = 0;
virtual void set_debug_export_path(std::filesystem::path path) = 0;
};
std::unique_ptr<IEditorShell> create_default_editor_shell();
} // namespace metacore::editor