#include "SceneHierarchyPanel.h" #include "Scene/Components.h" #include #include namespace Light { SceneHierarchyPanel::SceneHierarchyPanel(Ref context) : m_Context(context) { } void SceneHierarchyPanel::SetContext(Ref context) { m_Context = context; } void SceneHierarchyPanel::OnUserInterfaceUpdate() { ImGui::Begin("Hierarchy"); m_Context->m_Registry. each([&](auto& entityID) { Entity entity(entityID, m_Context.get()); const std::string& tag = entity.GetComponent(); DrawNode(entity, tag); }); ImGui::End(); } void SceneHierarchyPanel::DrawNode(Entity entity, const std::string& label) { ImGuiTreeNodeFlags flags = (m_SelectionContext == entity ? ImGuiTreeNodeFlags_Selected : NULL) | ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_SpanFullWidth; bool expanded = ImGui::TreeNodeEx((void*)(uint64_t)(uint32_t)(entity), flags, label.c_str()); if (ImGui::IsItemClicked()) m_SelectionContext = entity; if(expanded) { ImGui::Text("TEST_OPENED_TREE!"); ImGui::TreePop(); } } }