Rename Impl classes to follow Unity naming convention
- SelectionManagerImpl -> SelectionManager - EditorContextImpl -> EditorContext - Removed unused SceneManagerImpl and ISceneManager The Impl suffix was inconsistent with Unity naming conventions.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "Application.h"
|
||||
#include "Layers/EditorLayer.h"
|
||||
#include "Core/EditorContextImpl.h"
|
||||
#include "Core/EditorContext.h"
|
||||
#include "Core/EditorConsoleSink.h"
|
||||
#include <XCEngine/Debug/Logger.h>
|
||||
#include <XCEngine/Debug/FileLogSink.h>
|
||||
@@ -118,7 +118,7 @@ bool Application::Initialize(HWND hwnd) {
|
||||
m_srvHeap->GetCPUDescriptorHandleForHeapStart(),
|
||||
m_srvHeap->GetGPUDescriptorHandleForHeapStart());
|
||||
|
||||
m_editorContext = std::make_shared<EditorContextImpl>();
|
||||
m_editorContext = std::make_shared<EditorContext>();
|
||||
m_editorContext->SetProjectPath(exeDir);
|
||||
|
||||
m_editorLayer = new EditorLayer();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "IEditorContext.h"
|
||||
#include "EventBus.h"
|
||||
#include "SelectionManagerImpl.h"
|
||||
#include "SelectionManager.h"
|
||||
#include "Managers/SceneManager.h"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
@@ -10,11 +10,11 @@
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
class EditorContextImpl : public IEditorContext {
|
||||
class EditorContext : public IEditorContext {
|
||||
public:
|
||||
EditorContextImpl()
|
||||
EditorContext()
|
||||
: m_eventBus(std::make_unique<EventBus>())
|
||||
, m_selectionManager(std::make_unique<SelectionManagerImpl>(*m_eventBus))
|
||||
, m_selectionManager(std::make_unique<SelectionManager>(*m_eventBus))
|
||||
, m_sceneManager(std::make_unique<SceneManager>()) {
|
||||
m_sceneManager->SetSelectionManager(m_selectionManager.get());
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
private:
|
||||
std::unique_ptr<EventBus> m_eventBus;
|
||||
std::unique_ptr<SelectionManagerImpl> m_selectionManager;
|
||||
std::unique_ptr<SelectionManager> m_selectionManager;
|
||||
std::unique_ptr<SceneManager> m_sceneManager;
|
||||
std::string m_projectPath;
|
||||
};
|
||||
@@ -1,44 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
using GameObjectID = uint64_t;
|
||||
|
||||
class IGameObject {
|
||||
public:
|
||||
virtual ~IGameObject() = default;
|
||||
virtual GameObjectID GetID() const = 0;
|
||||
virtual const std::string& GetName() const = 0;
|
||||
virtual void SetName(const std::string& name) = 0;
|
||||
virtual IGameObject* GetParent() const = 0;
|
||||
virtual void SetParent(IGameObject* parent) = 0;
|
||||
virtual size_t GetChildCount() const = 0;
|
||||
virtual IGameObject* GetChild(size_t index) const = 0;
|
||||
virtual void DetachFromParent() = 0;
|
||||
virtual const std::vector<IGameObject*>& GetChildren() const = 0;
|
||||
};
|
||||
|
||||
class ISceneManager {
|
||||
public:
|
||||
virtual ~ISceneManager() = default;
|
||||
|
||||
virtual IGameObject* CreateEntity(const std::string& name, IGameObject* parent = nullptr) = 0;
|
||||
virtual void DeleteEntity(GameObjectID id) = 0;
|
||||
virtual void RenameEntity(GameObjectID id, const std::string& newName) = 0;
|
||||
virtual void CopyEntity(GameObjectID id) = 0;
|
||||
virtual GameObjectID PasteEntity(GameObjectID parent = 0) = 0;
|
||||
virtual GameObjectID DuplicateEntity(GameObjectID id) = 0;
|
||||
virtual void MoveEntity(GameObjectID id, GameObjectID newParent) = 0;
|
||||
virtual IGameObject* GetEntity(GameObjectID id) = 0;
|
||||
virtual const std::vector<IGameObject*>& GetRootEntities() const = 0;
|
||||
virtual bool HasClipboardData() const = 0;
|
||||
virtual void CreateDemoScene() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "ISceneManager.h"
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
class MathVector3 {
|
||||
public:
|
||||
float x, y, z;
|
||||
};
|
||||
|
||||
class MathQuaternion {
|
||||
public:
|
||||
float x, y, z, w;
|
||||
};
|
||||
|
||||
class SceneManagerImpl : public ISceneManager {
|
||||
public:
|
||||
SceneManagerImpl();
|
||||
|
||||
IGameObject* CreateEntity(const std::string& name, IGameObject* parent = nullptr) override;
|
||||
void DeleteEntity(GameObjectID id) override;
|
||||
void RenameEntity(GameObjectID id, const std::string& newName) override;
|
||||
void CopyEntity(GameObjectID id) override;
|
||||
GameObjectID PasteEntity(GameObjectID parent = 0) override;
|
||||
GameObjectID DuplicateEntity(GameObjectID id) override;
|
||||
void MoveEntity(GameObjectID id, GameObjectID newParent) override;
|
||||
IGameObject* GetEntity(GameObjectID id) override;
|
||||
const std::vector<IGameObject*>& GetRootEntities() const override;
|
||||
bool HasClipboardData() const override;
|
||||
void CreateDemoScene() override;
|
||||
|
||||
private:
|
||||
struct ClipboardData {
|
||||
std::string name;
|
||||
MathVector3 localPosition = {0, 0, 0};
|
||||
MathQuaternion localRotation = {0, 0, 0, 1};
|
||||
MathVector3 localScale = {1, 1, 1};
|
||||
std::vector<ClipboardData> children;
|
||||
};
|
||||
|
||||
ClipboardData CopyEntityRecursive(GameObjectID id);
|
||||
GameObjectID PasteEntityRecursive(const ClipboardData& data, GameObjectID parent);
|
||||
IGameObject* CastToIGameObject(GameObject* go);
|
||||
|
||||
GameObjectID m_nextId = 1;
|
||||
std::vector<IGameObject*> m_rootEntities;
|
||||
std::optional<ClipboardData> m_clipboard;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,9 @@
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
class SelectionManagerImpl : public ISelectionManager {
|
||||
class SelectionManager : public ISelectionManager {
|
||||
public:
|
||||
explicit SelectionManagerImpl(EventBus& eventBus) : m_eventBus(eventBus) {}
|
||||
explicit SelectionManager(EventBus& eventBus) : m_eventBus(eventBus) {}
|
||||
|
||||
void SetSelectedEntity(uint64_t entityId) override {
|
||||
if (m_selectedEntities.empty()) {
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "panels/ConsolePanel.h"
|
||||
#include "panels/ProjectPanel.h"
|
||||
#include "Core/IEditorContext.h"
|
||||
#include "Core/EditorContextImpl.h"
|
||||
#include "Core/EditorContext.h"
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
|
||||
@@ -22,7 +22,7 @@ void EditorLayer::SetContext(std::shared_ptr<IEditorContext> context) {
|
||||
|
||||
void EditorLayer::onAttach() {
|
||||
if (!m_context) {
|
||||
m_context = std::make_shared<EditorContextImpl>();
|
||||
m_context = std::make_shared<EditorContext>();
|
||||
}
|
||||
|
||||
m_menuBar = std::make_unique<MenuBar>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "InspectorPanel.h"
|
||||
#include "Core/EditorContextImpl.h"
|
||||
#include "Core/EditorContext.h"
|
||||
#include "Managers/SceneManager.h"
|
||||
#include "UI/UI.h"
|
||||
#include <XCEngine/Debug/Logger.h>
|
||||
|
||||
Reference in New Issue
Block a user