From 24a83087114af6a8c4c585de6cb6a2009d0335de Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Thu, 19 Aug 2021 13:44:12 -0500 Subject: [PATCH] Include the category name when performing search in the component palette. Signed-off-by: Chris Galvan --- .../UI/ComponentPalette/ComponentPaletteWidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteWidget.cpp index 67598f9fca..3218bd402b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteWidget.cpp @@ -204,12 +204,11 @@ namespace AzToolsFramework } } - for (const auto& categoryPair : componentDataTable) + for (const auto& [categoryName, componentMap] : componentDataTable) { - auto categoryItemItr = categoryItemMap.find(categoryPair.first + "/"); + auto categoryItemItr = categoryItemMap.find(categoryName + "/"); auto parentItem = categoryItemItr != categoryItemMap.end() ? categoryItemItr->second : m_componentModel->invisibleRootItem(); - const auto& componentMap = categoryPair.second; for (const auto& componentPair : componentMap) { auto componentClass = componentPair.second; @@ -217,7 +216,8 @@ namespace AzToolsFramework const QString& componentIconName = componentIconTable[componentClass]; auto deprecatedInfo = deprecatedList.find(componentClass->m_typeId); bool componentIsDeprecated = deprecatedInfo != deprecatedList.end(); - if ((!applyRegExFilter || componentName.contains(m_searchRegExp)) && (!componentIsDeprecated || !deprecatedInfo->second.m_hideComponent)) + if ((!applyRegExFilter || categoryName.contains(m_searchRegExp) || componentName.contains(m_searchRegExp)) + && (!componentIsDeprecated || !deprecatedInfo->second.m_hideComponent)) { //count the number of components on selected entities that match this type auto componentCount = AZStd::count_if(allComponentsOnSelectedEntities.begin(), allComponentsOnSelectedEntities.end(), [componentClass](const AZ::Component* component) {