feat(editor): unify component registration pipeline
This commit is contained in:
30
editor/src/ComponentEditors/ComponentEditorRegistry.h
Normal file
30
editor/src/ComponentEditors/ComponentEditorRegistry.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "IComponentEditor.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
class ComponentEditorRegistry {
|
||||
public:
|
||||
static ComponentEditorRegistry& Get();
|
||||
|
||||
void RegisterEditor(std::unique_ptr<IComponentEditor> editor);
|
||||
IComponentEditor* FindEditor(::XCEngine::Components::Component* component) const;
|
||||
IComponentEditor* FindEditorByTypeName(const std::string& componentTypeName) const;
|
||||
const std::vector<std::unique_ptr<IComponentEditor>>& GetEditors() const;
|
||||
|
||||
private:
|
||||
ComponentEditorRegistry();
|
||||
|
||||
std::vector<std::unique_ptr<IComponentEditor>> m_editors;
|
||||
std::unordered_map<std::string, IComponentEditor*> m_editorsByType;
|
||||
};
|
||||
|
||||
} // namespace Editor
|
||||
} // namespace XCEngine
|
||||
Reference in New Issue
Block a user