Partial implementation of new entity accesors from scene tree path

This commit is contained in:
Antoine Pilote
2024-04-19 00:03:59 -04:00
parent 5cb99f7ef6
commit 512cb3336c
5 changed files with 426 additions and 2 deletions

View File

@@ -108,6 +108,29 @@ namespace Nuake
return Entity{ (entt::entity)0, this };
}
Entity Scene::GetEntityFromPath(const std::string& path)
{
auto splits = String::Split(path, '/');
std::vector<Entity> rootEntities;
const auto& view = m_Registry.view<ParentComponent, NameComponent>();
for (const auto& e : view)
{
auto [parent, name] = view.get<ParentComponent, NameComponent>(e);
if (!parent.HasParent)
{
rootEntities.push_back({ e, this });
}
}
return Entity();
}
Entity Scene::GetRelativeEntityFromPath(Entity entity, const std::string& path)
{
return Entity();
}
bool Scene::OnInit()
{
for (auto& system : m_Systems)