From e48605b8d3c7fae8022907fb70f71e9f6d860298 Mon Sep 17 00:00:00 2001 From: SweetId <2630750+SweetId@users.noreply.github.com> Date: Wed, 11 Oct 2023 23:48:59 -0400 Subject: [PATCH] add unique entity name and select it on click --- src/NazaraEditor/Editor/UI/LevelWindow.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/NazaraEditor/Editor/UI/LevelWindow.cpp b/src/NazaraEditor/Editor/UI/LevelWindow.cpp index dca33a8..0adda07 100644 --- a/src/NazaraEditor/Editor/UI/LevelWindow.cpp +++ b/src/NazaraEditor/Editor/UI/LevelWindow.cpp @@ -22,10 +22,20 @@ namespace NzEditor std::function 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)