Updated unit tests to work with the new convention for property name vs property ID.

This revealed that the approach of reflecting both the old "id" and the new "name" would not work, because whenn saving it would write out both fields. So I decied to just give up on backward compatibility. This will be much cleaner than trying to continue supporting "id" as a field name, it is uncommon for users to make their own material types at this point, and if they have made some it is very easy to search and replace "id" with "name" update their files.

All .materialtype files have been updated. RPI unit tests now pass. ASV still passes.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
santorac
2021-09-17 23:12:24 -07:00
parent c2abd2d74f
commit 71c7fc0217
10 changed files with 231 additions and 238 deletions
@@ -27,7 +27,6 @@ namespace AZ
{
namespace Field
{
static constexpr const char id[] = "id"; // legacy field, replaced by "name"
static constexpr const char name[] = "name";
static constexpr const char displayName[] = "displayName";
static constexpr const char description[] = "description";
@@ -47,7 +46,6 @@ namespace AZ
static const AZStd::string_view AcceptedFields[] =
{
Field::id,
Field::name,
Field::displayName,
Field::description,
@@ -220,10 +218,7 @@ namespace AZ
}
}
// Field::id is the legacy field, replaced by Field::name. If both are present, Field::name will take priority.
result.Combine(ContinueLoadingFromJsonObjectField(&property->m_name, azrtti_typeid<AZStd::string>(), inputValue, Field::id, context));
result.Combine(ContinueLoadingFromJsonObjectField(&property->m_name, azrtti_typeid<AZStd::string>(), inputValue, Field::name, context));
result.Combine(ContinueLoadingFromJsonObjectField(&property->m_displayName, azrtti_typeid<AZStd::string>(), inputValue, Field::displayName, context));
result.Combine(ContinueLoadingFromJsonObjectField(&property->m_description, azrtti_typeid<AZStd::string>(), inputValue, Field::description, context));
result.Combine(ContinueLoadingFromJsonObjectField(&property->m_dataType, azrtti_typeid<MaterialPropertyDataType>(), inputValue, Field::type, context));