diff --git a/external/entt b/external/entt index fef9211..344e03a 160000 --- a/external/entt +++ b/external/entt @@ -1 +1 @@ -Subproject commit fef921132cae7588213d0f9bcd2fb9c8ffd8b7fc +Subproject commit 344e03ac64a1f78424ab1150e2d4778e8df8431d diff --git a/framework/imgui/src/mm/imgui/imgui_entt_entity_editor.hpp b/framework/imgui/src/mm/imgui/imgui_entt_entity_editor.hpp index ac13d4f..ce07f58 100644 --- a/framework/imgui/src/mm/imgui/imgui_entt_entity_editor.hpp +++ b/framework/imgui/src/mm/imgui/imgui_entt_entity_editor.hpp @@ -134,10 +134,10 @@ public: e = registry.create(); // create a copy of an entity component by component - for (auto &&curr: registry.storage()) { - if (auto &storage = curr.second; storage.contains(old_e)) { + for(auto &&curr: registry.storage()) { + if(auto &storage = curr.second; storage.contains(old_e)) { // TODO: do something with the return value. returns false on failure. - storage.emplace(e, storage.get(old_e)); + storage.push(e, storage.value(old_e)); } } } @@ -237,11 +237,11 @@ public: if (comp_list.empty()) { ImGui::Text("Orphans:"); - registry.each([®istry](auto e){ + for (EntityType e : registry.template storage()) { if (registry.orphan(e)) { MM_IEEE_ENTITY_WIDGET(e, registry, false); } - }); + } } else { entt::runtime_view view{}; for (const auto type : comp_list) { @@ -264,17 +264,6 @@ public: } } - [[deprecated("Use renderEditor() instead. And manage the window yourself.")]] - void render(Registry& registry, EntityType& e) - { - if (show_window) { - if (ImGui::Begin("Entity Editor", &show_window)) { - renderEditor(registry, e); - } - ImGui::End(); - } - } - // displays both, editor and list // uses static internally, use only as a quick way to get going! void renderSimpleCombo(Registry& registry, EntityType& e) diff --git a/framework/imgui/src/mm/services/scene_tools.cpp b/framework/imgui/src/mm/services/scene_tools.cpp index 290dfb4..280c9ba 100644 --- a/framework/imgui/src/mm/services/scene_tools.cpp +++ b/framework/imgui/src/mm/services/scene_tools.cpp @@ -1,4 +1,5 @@ #include "./scene_tools.hpp" +#include "mm/engine_fwd.hpp" #include @@ -109,16 +110,19 @@ namespace MM::Services { if (_show_scene_metrics) { if (ImGui::Begin("Scene Metrics##ImGuiSceneToolsService", &_show_scene_metrics)) { - ImGui::Text("capacity: %lu", scene.capacity()); - ImGui::Text("size: %lu", scene.size()); - ImGui::Text("alive: %lu", scene.alive()); - size_t orphans = 0; - scene.each([&orphans, &scene](auto entity) { - if (scene.orphan(entity)) { - orphans++; + ImGui::Text("capacity: %zu", scene.storage<::MM::Entity>().capacity()); + ImGui::Text("size: %zu", scene.storage<::MM::Entity>().size()); + ImGui::Text("alive: %zu", scene.storage<::MM::Entity>().in_use()); + if (ImGui::CollapsingHeader("orphans")) { + // iterating all entities is expensive + size_t orphans = 0; + for (const auto it : scene.storage().each()) { + if (scene.orphan(std::get<0>(it))) { + orphans++; + } } - }); - ImGui::Text("orphans: %lu", orphans); + ImGui::Text("orphans: %lu", orphans); + } } ImGui::End(); }