Checkpoint workspace changes

This commit is contained in:
2026-04-29 01:24:21 +08:00
parent 9b6adf1806
commit ef11651ec2
67 changed files with 3161 additions and 1904 deletions

View File

@@ -9,22 +9,12 @@
#include <memory>
#include <filesystem>
#include <functional>
#include <optional>
#include <cstdint>
#include <string>
#include <string_view>
#include <vector>
namespace XCEngine::Components {
class CameraComponent;
class Component;
class GameObject;
class Scene;
} // namespace XCEngine::Components
namespace XCEngine::Math {
struct Quaternion;
@@ -51,30 +41,29 @@ public:
void EnsureSceneSelection();
const EditorStartupSceneResult& GetStartupResult() const;
::XCEngine::Components::Scene* GetActiveScene() const;
EditorSceneHierarchySnapshot BuildHierarchySnapshot() const;
::XCEngine::Components::CameraComponent* GetSceneViewCamera();
const ::XCEngine::Components::CameraComponent* GetSceneViewCamera() const;
float GetSceneViewOrbitDistance() const;
SceneViewportRenderRequest BuildSceneViewportRenderRequest();
EditorSceneCameraSnapshot BuildSceneViewCameraSnapshot() const;
std::vector<EditorSceneViewportIconSnapshot> BuildSceneViewportIconSnapshots() const;
std::optional<EditorSceneViewportSelectionSnapshot> BuildSceneViewportSelectionSnapshot() const;
void ApplySceneViewportCameraInput(const SceneViewportCameraInputState& input);
bool FocusSceneSelection();
bool HasSceneSelection() const;
std::optional<::XCEngine::Components::GameObject::ID> GetSelectedGameObjectId() const;
std::optional<EditorSceneObjectId> GetSelectedObjectId() const;
std::string GetSelectedItemId() const;
std::string GetSelectedDisplayName() const;
const ::XCEngine::Components::GameObject* GetSelectedGameObject() const;
std::optional<EditorSceneObjectSnapshot> GetSelectedObjectSnapshot() const;
std::vector<EditorSceneComponentDescriptor> GetSelectedComponents() const;
std::uint64_t GetSelectionStamp() const;
std::uint64_t GetInspectorRevision() const;
bool SetSelection(std::string_view itemId);
bool SetSelection(::XCEngine::Components::GameObject::ID id);
bool SetSelection(EditorSceneObjectId id);
void ClearSelection();
bool OpenSceneAsset(const std::filesystem::path& scenePath);
::XCEngine::Components::GameObject* FindGameObject(std::string_view itemId) const;
bool RenameGameObject(
std::string_view itemId,
std::string_view newName);
@@ -103,8 +92,7 @@ public:
std::string_view componentId,
const ::XCEngine::Math::Vector3& scale);
bool ApplySelectedComponentMutation(
std::string_view componentId,
const std::function<bool(::XCEngine::Components::Component&)>& mutation);
const EditorSceneComponentMutation& mutation);
const SceneToolState& GetToolState() const;
SceneToolMode GetToolMode() const;
@@ -145,24 +133,18 @@ public:
bool RedoTransformEdit();
private:
struct SceneViewCameraState {
std::unique_ptr<::XCEngine::Components::GameObject> gameObject = {};
::XCEngine::Components::CameraComponent* camera = nullptr;
SceneViewportCameraController controller = {};
};
struct TransformEditTransaction {
SceneTransformSnapshot before = {};
SceneTransformSnapshot after = {};
};
bool EnsureSceneViewCamera();
void ApplySceneViewCameraController();
EditorSelectionService& SelectionService();
const EditorSelectionService& SelectionService() const;
bool HasHierarchySelection() const;
void RevalidateSelection();
bool HasValidSelection() const;
std::optional<EditorSceneObjectSnapshot> GetObjectSnapshot(
std::string_view itemId) const;
EditorSceneComponentDescriptor ResolveSelectedComponentDescriptor(
std::string_view componentId) const;
bool SelectFirstAvailableGameObject();
@@ -170,17 +152,22 @@ private:
void ResetToolInteractionTransientState();
void ClearInvalidToolInteractionState();
void IncrementInspectorRevision();
void IncrementSceneContentRevision();
void IncrementSceneViewCameraRevision();
std::uint64_t BuildSceneViewportRequestRevision() const;
std::filesystem::path m_projectRoot = {};
std::unique_ptr<EditorSceneBackend> m_backend = {};
EditorStartupSceneResult m_startupSceneResult = {};
EditorSelectionService m_ownedSelectionService = {};
EditorSelectionService* m_selectionService = &m_ownedSelectionService;
SceneViewCameraState m_sceneViewCamera = {};
SceneViewportCameraController m_sceneViewCameraController = {};
SceneToolState m_toolState = {};
std::vector<TransformEditTransaction> m_transformUndoStack = {};
std::vector<TransformEditTransaction> m_transformRedoStack = {};
std::uint64_t m_inspectorRevision = 0u;
std::uint64_t m_sceneContentRevision = 0u;
std::uint64_t m_sceneViewCameraRevision = 0u;
};
} // namespace XCEngine::UI::Editor::App