add unique entity name and select it on click

This commit is contained in:
SweetId 2023-10-11 23:48:59 -04:00
parent 58bf25ff16
commit e48605b8d3
1 changed files with 14 additions and 4 deletions

View File

@ -22,10 +22,20 @@ namespace NzEditor
std::function<void(Nz::Node*)> drawHierarchy = [&](Nz::Node* c)
{
entt::handle entity = m_nodeToEntity[c];
Nz::EditorImgui::Begin(entity, "", "");
for (auto& child : c->GetChilds())
drawHierarchy(child);
Nz::EditorImgui::End(entity);
std::ostringstream oss;
oss << "(" << (uint32_t)entity.entity() << ")";
if (Nz::EditorImgui::Begin(entity, oss.str(), ""))
{
for (auto& child : c->GetChilds())
drawHierarchy(child);
Nz::EditorImgui::End(entity);
}
if (ImGui::IsItemClicked())
{
GetApplication()->OnEntitySelected(entity);
}
};
for (auto& node : m_rootNodes)