Files
XCEngine/new_editor/app/Scene/EditorSceneRuntime.h

60 lines
1.7 KiB
C++

#pragma once
#include "Scene/EditorSceneBridge.h"
#include <optional>
#include <string>
#include <string_view>
namespace XCEngine::Components {
class GameObject;
class Scene;
} // namespace XCEngine::Components
namespace XCEngine::UI::Editor::App {
class EditorSceneRuntime {
public:
bool Initialize(const std::filesystem::path& projectRoot);
void RefreshScene();
void EnsureSceneSelection();
const EditorStartupSceneResult& GetStartupResult() const;
::XCEngine::Components::Scene* GetActiveScene() const;
bool HasSceneSelection() const;
std::optional<::XCEngine::Components::GameObject::ID> GetSelectedGameObjectId() const;
std::string GetSelectedItemId() const;
std::string GetSelectedDisplayName() const;
const ::XCEngine::Components::GameObject* GetSelectedGameObject() const;
bool SetSelection(std::string_view itemId);
bool SetSelection(::XCEngine::Components::GameObject::ID id);
void ClearSelection();
::XCEngine::Components::GameObject* FindGameObject(std::string_view itemId) const;
bool RenameGameObject(
std::string_view itemId,
std::string_view newName);
bool DeleteGameObject(std::string_view itemId);
std::string DuplicateGameObject(std::string_view itemId);
bool ReparentGameObject(
std::string_view itemId,
std::string_view parentItemId);
bool MoveGameObjectToRoot(std::string_view itemId);
private:
bool HasValidSelection() const;
bool SelectFirstAvailableGameObject();
std::filesystem::path m_projectRoot = {};
EditorStartupSceneResult m_startupSceneResult = {};
std::optional<::XCEngine::Components::GameObject::ID> m_selectedGameObjectId = std::nullopt;
};
} // namespace XCEngine::UI::Editor::App