Review changes, new icons

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
This commit is contained in:
sphrose
2021-11-30 15:36:58 +00:00
parent 7a0c866586
commit a414f87894
9 changed files with 44 additions and 91 deletions
@@ -203,14 +203,29 @@ namespace LandscapeCanvasEditor
{
using namespace AzToolsFramework;
static const QStringList preferredCategories = { "Vegetation", "Atom" };
// Check whether the first category has a preferred component and return that if it does.
const AZStd::unordered_map<AZStd::string, QString> preferredComponentByCategory = { { "Shape", "Shape Reference" } };
static const AZStd::unordered_map<AZStd::string, QString> preferredComponentByCategory = { { "Shape", "Shape Reference" } };
const AZStd::string firstCategoryName(componentDataTable.begin()->first.toUtf8());
const auto& preferredComponentPair = preferredComponentByCategory.find(firstCategoryName);
if (preferredComponentPair != preferredComponentByCategory.end())
{
const auto& componentPair = componentDataTable.begin()->second.find(preferredComponentPair->second);
if (componentPair != componentDataTable.begin()->second.end())
{
return componentPair->second->m_typeId;
}
}
// There are a couple of cases where we prefer certain categories of Components
// to be added over others,
// so if those there are components in those categories, then choose them first.
// Otherwise, just pick the first one in the list.
static const QStringList preferredCategories = { "Vegetation", "Atom" };
ComponentPaletteUtil::ComponentDataTable::const_iterator categoryIt;
for (const auto& categoryName : preferredCategories)
{
@@ -227,22 +242,6 @@ namespace LandscapeCanvasEditor
AZ_Assert(categoryIt->second.size(), "No components found that satisfy the missing required service(s).");
const AZStd::string categoryName(categoryIt->first.toUtf8());
// Check whether the selected category has a preferred component and return that if it does.
for (const auto& preferredComponentPair : preferredComponentByCategory)
{
if (categoryName == preferredComponentPair.first)
{
const auto& componentPair = categoryIt->second.find(preferredComponentPair.second);
if (componentPair != categoryIt->second.end())
{
return componentPair->second->m_typeId;
}
}
}
const auto& componentPair = categoryIt->second.begin();
return componentPair->second->m_typeId;
}