diff --git a/Mods/Editor/Src/Components/EntityTree.cpp b/Mods/Editor/Src/Components/EntityTree.cpp index acc7fbd2..09d17007 100644 --- a/Mods/Editor/Src/Components/EntityTree.cpp +++ b/Mods/Editor/Src/Components/EntityTree.cpp @@ -679,21 +679,17 @@ void Editor::DrawEntityTree() { ICON_MD_SEARCH " Search by type##EntityTypesPopup", s_EntityTypeSearchInput, sizeof(s_EntityTypeSearchInput), - (*Globals::TypeRegistry)->m_types, - [](auto& p_Pair) -> std::string { - return std::string(p_Pair.first.c_str(), p_Pair.first.size()); + m_ClassNames, + [](const std::string& p_ClassName) -> const std::string& { + return p_ClassName; }, - [](auto& p_Pair) -> std::string { - return std::string(p_Pair.first.c_str(), p_Pair.first.size()); + [](const std::string& p_ClassName) -> const std::string& { + return p_ClassName; }, - [&](const std::string& typeName, const std::string&, const auto&) { + [&](const std::string&, const std::string&, const auto&) { m_EntityTypeSearchInput = s_EntityTypeSearchInput; FilterEntityTree(); - }, - nullptr, - [](auto& p_Pair) { - return p_Pair.second->GetTypeInfo() && p_Pair.second->GetTypeInfo()->IsClass(); } ); diff --git a/Mods/Editor/Src/Editor.cpp b/Mods/Editor/Src/Editor.cpp index 6bcc3cd2..b1f0d5e5 100644 --- a/Mods/Editor/Src/Editor.cpp +++ b/Mods/Editor/Src/Editor.cpp @@ -302,6 +302,25 @@ void Editor::OnEngineInitialized() { } } } + + for (const auto& [s_TypeName, s_TypeID] : (*Globals::TypeRegistry)->m_types) { + if (s_TypeID->GetTypeInfo()->IsClass()) { + m_ClassNames.push_back(std::string(s_TypeName.c_str(), s_TypeName.size())); + } + } + + std::sort( + m_ClassNames.begin(), + m_ClassNames.end(), + [](const std::string& a, const std::string& b) { + return std::lexicographical_compare( + a.begin(), a.end(), + b.begin(), b.end(), + [](char ac, char bc) { + return std::tolower(ac) < std::tolower(bc); + }); + } + ); } bool Editor::ImGuiCopyWidget(const std::string& p_Id) { diff --git a/Mods/Editor/Src/Editor.h b/Mods/Editor/Src/Editor.h index 3ced669e..d5db24e3 100644 --- a/Mods/Editor/Src/Editor.h +++ b/Mods/Editor/Src/Editor.h @@ -588,6 +588,8 @@ class Editor : public IPluginInterface { void* m_InputPinData = nullptr; STypeID* m_OutputPinTypeID = nullptr; void* m_OutputPinData = nullptr; + + std::vector m_ClassNames; }; DECLARE_ZHM_PLUGIN(Editor)