From ef6e7ac0dcb594cdb7e0324c67a0a31009893c12 Mon Sep 17 00:00:00 2001 From: antopilo Date: Sat, 21 Sep 2024 13:00:35 -0400 Subject: [PATCH] Prevented displaying child of prefab --- Editor/src/Windows/EditorInterface.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 96963f60..ea2c07e1 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -816,7 +816,8 @@ namespace Nuake { ImGui::PushFont(normalFont); // If has no childrens draw tree node leaf - if (parent.Children.size() <= 0) + bool isPrefab = e.HasComponent(); + if (parent.Children.size() <= 0 || isPrefab) { base_flags |= ImGuiTreeNodeFlags_Leaf; } @@ -856,7 +857,6 @@ namespace Nuake { } bool isDragging = false; - bool isPrefab = e.HasComponent(); if (nameComponent.IsPrefab && e.HasComponent() || e.HasComponent()) { ImGui::PopStyleColor(); @@ -1019,12 +1019,15 @@ namespace Nuake { ImGui::PopStyleColor(); } - if (!isPrefab && open) + if (open) { - // Caching list to prevent deletion while iterating. - std::vector childrens = parent.Children; - for (auto& c : childrens) - DrawEntityTree(c); + if (!isPrefab) + { + // Caching list to prevent deletion while iterating. + std::vector childrens = parent.Children; + for (auto& c : childrens) + DrawEntityTree(c); + } ImGui::TreePop(); }