Renamed m_groups and m_properties to have "Old" in the name for clarity.
Also fixed a potential uninitialized data bug in Conve. Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -44,8 +44,8 @@ namespace AZ
|
||||
AZStd::string m_shaderInputName;
|
||||
|
||||
// The indices of photometric units in the dropdown list
|
||||
uint32_t m_ev100Index;
|
||||
uint32_t m_nitIndex;
|
||||
uint32_t m_ev100Index = 0;
|
||||
uint32_t m_nitIndex = 1;
|
||||
|
||||
// Minimum and Maximum value for different photometric units
|
||||
AZ::Vector2 m_ev100MinMax;
|
||||
|
||||
@@ -170,11 +170,11 @@ namespace AZ
|
||||
|
||||
//! [Deprecated] Use m_propertySets instead
|
||||
//! List of groups that will contain the available properties
|
||||
AZStd::vector<GroupDefinition> m_groups;
|
||||
AZStd::vector<GroupDefinition> m_groupsOld;
|
||||
|
||||
//! [Deprecated] Use m_propertySets instead
|
||||
//! Collection of all available user-facing properties
|
||||
AZStd::map<AZStd::string /*group name*/, AZStd::vector<PropertyDefinition>> m_properties;
|
||||
AZStd::map<AZStd::string /*group name*/, AZStd::vector<PropertyDefinition>> m_propertiesOld;
|
||||
|
||||
AZStd::vector<AZStd::unique_ptr<PropertySet>> m_propertySets;
|
||||
};
|
||||
|
||||
@@ -83,8 +83,8 @@ namespace AZ
|
||||
serializeContext->Class<PropertyLayout>()
|
||||
->Version(1)
|
||||
->Field("version", &PropertyLayout::m_version)
|
||||
->Field("groups", &PropertyLayout::m_groups) //< Old, preserved for backward compatibility, replaced by propertySets
|
||||
->Field("properties", &PropertyLayout::m_properties) //< Old, preserved for backward compatibility, replaced by propertySets
|
||||
->Field("groups", &PropertyLayout::m_groupsOld) //< Deprecated, preserved for backward compatibility, replaced by propertySets
|
||||
->Field("properties", &PropertyLayout::m_propertiesOld) //< Deprecated, preserved for backward compatibility, replaced by propertySets
|
||||
->Field("propertySets", &PropertyLayout::m_propertySets)
|
||||
;
|
||||
|
||||
@@ -397,8 +397,8 @@ namespace AZ
|
||||
{
|
||||
for (const auto& group : GetOldFormatGroupDefinitionsInDisplayOrder())
|
||||
{
|
||||
auto propertyListItr = m_propertyLayout.m_properties.find(group.m_name);
|
||||
if (propertyListItr != m_propertyLayout.m_properties.end())
|
||||
auto propertyListItr = m_propertyLayout.m_propertiesOld.find(group.m_name);
|
||||
if (propertyListItr != m_propertyLayout.m_propertiesOld.end())
|
||||
{
|
||||
const auto& propertyList = propertyListItr->second;
|
||||
for (auto& propertyDefinition : propertyList)
|
||||
@@ -421,8 +421,8 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
m_propertyLayout.m_groups.clear();
|
||||
m_propertyLayout.m_properties.clear();
|
||||
m_propertyLayout.m_groupsOld.clear();
|
||||
m_propertyLayout.m_propertiesOld.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -451,11 +451,11 @@ namespace AZ
|
||||
AZStd::vector<MaterialTypeSourceData::GroupDefinition> MaterialTypeSourceData::GetOldFormatGroupDefinitionsInDisplayOrder() const
|
||||
{
|
||||
AZStd::vector<MaterialTypeSourceData::GroupDefinition> groupDefinitions;
|
||||
groupDefinitions.reserve(m_propertyLayout.m_properties.size());
|
||||
groupDefinitions.reserve(m_propertyLayout.m_propertiesOld.size());
|
||||
|
||||
// Some groups are defined explicitly in the .materialtype file's "groups" section. This is the primary way groups are sorted in the UI.
|
||||
AZStd::unordered_set<AZStd::string> foundGroups;
|
||||
for (const auto& groupDefinition : m_propertyLayout.m_groups)
|
||||
for (const auto& groupDefinition : m_propertyLayout.m_groupsOld)
|
||||
{
|
||||
if (foundGroups.insert(groupDefinition.m_name).second)
|
||||
{
|
||||
@@ -468,7 +468,7 @@ namespace AZ
|
||||
}
|
||||
|
||||
// Some groups are defined implicitly, in the "properties" section where a group name is used but not explicitly defined in the "groups" section.
|
||||
for (const auto& propertyListPair : m_propertyLayout.m_properties)
|
||||
for (const auto& propertyListPair : m_propertyLayout.m_propertiesOld)
|
||||
{
|
||||
const AZStd::string& groupName = propertyListPair.first;
|
||||
if (foundGroups.insert(groupName).second)
|
||||
|
||||
@@ -1781,15 +1781,15 @@ namespace UnitTest
|
||||
JsonTestResult loadResult = LoadTestDataFromJson(material, inputJson);
|
||||
|
||||
// Before conversion to the new format, the data is in the old place
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_groups.size(), 2);
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_properties.size(), 2);
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_groupsOld.size(), 2);
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_propertiesOld.size(), 2);
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_propertySets.size(), 0);
|
||||
|
||||
material.ConvertToNewDataFormat();
|
||||
|
||||
// After conversion to the new format, the data is in the new place
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_groups.size(), 0);
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_properties.size(), 0);
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_groupsOld.size(), 0);
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_propertiesOld.size(), 0);
|
||||
EXPECT_EQ(material.GetPropertyLayout().m_propertySets.size(), 2);
|
||||
|
||||
EXPECT_EQ(material.m_description, "This is a general description about the material");
|
||||
|
||||
Reference in New Issue
Block a user