Updated the naming convention for material property "names" vs "IDs".

A "property name" is the name of the just the property without regard to the group that it's in. A "group name" is the name of the group. And a "property ID" is the full unique name of a property in the form "groupName.propertyName". This is important preparation for upcoming changes where property sets can contain other property sets, and property IDs can be arbitrarily long like "layer1.baseColor.factor" for example.

The naming changes include variables, some code comments, and the .materialtype file format. I was able to make these changes in a backward compatible way so a property or group "id" field has been replaced with a "name" field, but "id" is still supported for compatibility. StandardPBR, EnhancedPBR, StandardMultilayerPBR, and Skin have all been updated. Note that MinimalPBR has not been updated, proving that backward compatibility works. (We can update this one too at some point though).

Testing:
Opened up materials in the material editor.
Ran AtomSampleViewer in dx12 and vulkan with no new failures.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
santorac
2021-09-17 22:19:31 -07:00
parent 22e43c9122
commit c2abd2d74f
32 changed files with 1196 additions and 1189 deletions
@@ -27,7 +27,8 @@ namespace AZ
{
namespace Field
{
static constexpr const char id[] = "id";
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";
static constexpr const char type[] = "type";
@@ -47,6 +48,7 @@ namespace AZ
static const AZStd::string_view AcceptedFields[] =
{
Field::id,
Field::name,
Field::displayName,
Field::description,
Field::type,
@@ -218,7 +220,10 @@ namespace AZ
}
}
result.Combine(ContinueLoadingFromJsonObjectField(&property->m_nameId, azrtti_typeid<AZStd::string>(), inputValue, Field::id, context));
// 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));
@@ -374,7 +379,7 @@ namespace AZ
outputValue.SetObject();
const AZStd::string emptyString;
result.Combine(ContinueStoringToJsonObjectField(outputValue, Field::id, &property->m_nameId, &emptyString, azrtti_typeid<AZStd::string>(), context));
result.Combine(ContinueStoringToJsonObjectField(outputValue, Field::name, &property->m_name, &emptyString, azrtti_typeid<AZStd::string>(), context));
result.Combine(ContinueStoringToJsonObjectField(outputValue, Field::displayName, &property->m_displayName, &emptyString, azrtti_typeid<AZStd::string>(), context));
result.Combine(ContinueStoringToJsonObjectField(outputValue, Field::description, &property->m_description, &emptyString, azrtti_typeid<AZStd::string>(), context));