Got RPI unit tests building and passing again.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
santorac
2022-01-20 16:11:31 -08:00
parent 534843df0f
commit b9ba9f5ca8
4 changed files with 18 additions and 11 deletions
@@ -99,7 +99,9 @@ namespace AZ
}
}
AzFramework::StringFunc::Join(m_fullName, names.begin(), names.end(), ".");
AZStd::string fullName; // m_fullName is a Name, not a string, so we have to join into a local variable temporarily.
AzFramework::StringFunc::Join(fullName, names.begin(), names.end(), ".");
m_fullName = fullName;
}
MaterialPropertyId::operator const Name&() const
@@ -340,16 +340,16 @@ namespace AZ
if (result == MaterialUtils::GetImageAssetResult::Missing)
{
materialAssetCreator.ReportWarning(
"Material property '%s': Could not find the image '%s'", propertyId.GetFullName().GetCStr(),
"Material property '%s': Could not find the image '%s'", propertyId.GetCStr(),
property.second.m_value.GetValue<AZStd::string>().data());
}
imageAsset.SetAutoLoadBehavior(Data::AssetLoadBehavior::PreLoad);
materialAssetCreator.SetPropertyValue(propertyId.GetFullName(), imageAsset);
materialAssetCreator.SetPropertyValue(propertyId, imageAsset);
}
else
{
materialAssetCreator.SetPropertyValue(propertyId.GetFullName(), property.second.m_value);
materialAssetCreator.SetPropertyValue(propertyId, property.second.m_value);
}
}
}
@@ -140,7 +140,7 @@ namespace AZ
{
if (action.m_operation == "rename")
{
if (action.m_renameFrom == propertyId.GetFullName().GetStringView())
if (action.m_renameFrom == propertyId.GetStringView())
{
propertyId = MaterialPropertyId::Parse(action.m_renameTo);
renamed = true;
@@ -177,14 +177,19 @@ namespace AZ
// Do the search again with the new names
groupIter = m_propertyLayout.m_properties.find(propertyId.GetGroupName().GetStringView());
if (groupIter != m_propertyLayout.m_properties.end())
AZStd::vector<AZStd::string> tokens;
AZ::StringFunc::Tokenize(propertyId.GetStringView(), tokens, ".", true, true);
if (tokens.size() == 2)
{
for (const PropertyDefinition& property : groupIter->second)
groupIter = m_propertyLayout.m_properties.find(tokens[0]);
if (groupIter != m_propertyLayout.m_properties.end())
{
if (property.m_name == propertyId.GetPropertyName().GetStringView())
for (const PropertyDefinition& property : groupIter->second)
{
return &property;
if (property.m_name == tokens[1])
{
return &property;
}
}
}
}
@@ -905,7 +905,7 @@ namespace UnitTest
JsonTestResult loadResult = LoadTestDataFromJson(material, inputJson);
auto materialAssetResult = material.CreateMaterialAsset(Uuid::CreateRandom(), "test.material", AZ::RPI::MaterialAssetProcessingMode::PreBake);
EXPECT_TRUE(materialAssetResult);
MaterialPropertyIndex propertyIndex = materialAssetResult.GetValue()->GetMaterialPropertiesLayout()->FindPropertyIndex(MaterialPropertyId{groupName, propertyName}.GetFullName());
MaterialPropertyIndex propertyIndex = materialAssetResult.GetValue()->GetMaterialPropertiesLayout()->FindPropertyIndex(MaterialPropertyId{groupName, propertyName});
CheckSimilar(expectedFinalValue, materialAssetResult.GetValue()->GetPropertyValues()[propertyIndex.GetIndex()].GetValue<PropertyTypeT>());
}