Can now rename entities pressing f2 or double clicking and selecting an entity should unfold the tree

This commit is contained in:
Antoine Pilote
2024-08-16 17:59:06 -04:00
parent 9c2a6f9019
commit 27488ae5bf
6 changed files with 89 additions and 4 deletions

View File

@@ -213,6 +213,31 @@ namespace Nuake
return currentEntity;
}
bool Scene::EntityIsParent(Entity entity, Entity parent)
{
if (!entity.IsValid())
return false;
if (entity.GetComponent<ParentComponent>().HasParent && entity.GetComponent<ParentComponent>().Parent == parent)
{
return true;
}
Entity current = entity;
while (current.GetComponent<ParentComponent>().HasParent && current != parent)
{
current = current.GetComponent<ParentComponent>().Parent;
if (current == parent)
{
return true;
}
}
return false;
}
bool Scene::OnInit()
{
for (auto& system : m_Systems)

View File

@@ -74,6 +74,8 @@ namespace Nuake
Entity GetEntityFromPath(const std::string& path);
Entity GetRelativeEntityFromPath(Entity entity, const std::string& path);
bool EntityIsParent(Entity entity, Entity parent);
template<typename Component>
static void CopyComponent(entt::registry& dst, entt::registry& src);