Fix editor selection system: SelectionManager ID types and Scene lookup

- SelectionManager now implements ISelectionManager interface with uint64_t IDs
- Remove SelectionManager/SceneManager circular dependency via EventBus
- Add Scene::FindByID() for proper ID-based entity lookup
- SceneManager::GetEntity() now uses FindByID instead of name-based Find
- Fix editor CMakeLists.txt XCEngine.lib path
- EventBus now thread-safe with shared_mutex
This commit is contained in:
2026-03-25 17:51:15 +08:00
parent 6612330347
commit b0d0576763
8 changed files with 77 additions and 39 deletions

View File

@@ -30,6 +30,7 @@ public:
void DestroyGameObject(GameObject* gameObject);
GameObject* Find(const std::string& name) const;
GameObject* FindByID(GameObjectID id) const;
GameObject* FindGameObjectWithTag(const std::string& tag) const;
template<typename T>

View File

@@ -79,6 +79,14 @@ GameObject* Scene::Find(const std::string& name) const {
return nullptr;
}
GameObject* Scene::FindByID(GameObjectID id) const {
auto it = m_gameObjects.find(id);
if (it != m_gameObjects.end()) {
return it->second.get();
}
return nullptr;
}
GameObject* Scene::FindInChildren(GameObject* parent, const std::string& name) const {
for (size_t i = 0; i < parent->GetChildCount(); ++i) {
GameObject* child = parent->GetChild(i);