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) std::function<void(Nz::Node*)> drawHierarchy = [&](Nz::Node* c)
{ {
entt::handle entity = m_nodeToEntity[c]; entt::handle entity = m_nodeToEntity[c];
Nz::EditorImgui::Begin(entity, "", ""); std::ostringstream oss;
for (auto& child : c->GetChilds()) oss << "(" << (uint32_t)entity.entity() << ")";
drawHierarchy(child); if (Nz::EditorImgui::Begin(entity, oss.str(), ""))
Nz::EditorImgui::End(entity); {
for (auto& child : c->GetChilds())
drawHierarchy(child);
Nz::EditorImgui::End(entity);
}
if (ImGui::IsItemClicked())
{
GetApplication()->OnEntitySelected(entity);
}
}; };
for (auto& node : m_rootNodes) for (auto& node : m_rootNodes)