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:
+17
-17
@@ -169,7 +169,7 @@ namespace AZ
|
||||
|
||||
void MaterialPropertyInspector::AddDetailsGroup()
|
||||
{
|
||||
const AZStd::string& groupNameId = "Details";
|
||||
const AZStd::string& groupName = "Details";
|
||||
const AZStd::string& groupDisplayName = "Details";
|
||||
const AZStd::string& groupDescription = "";
|
||||
|
||||
@@ -235,15 +235,15 @@ namespace AZ
|
||||
|
||||
propertyGroupContainer->layout()->addWidget(materialInfoWidget);
|
||||
|
||||
AddGroup(groupNameId, groupDisplayName, groupDescription, propertyGroupContainer);
|
||||
AddGroup(groupName, groupDisplayName, groupDescription, propertyGroupContainer);
|
||||
}
|
||||
|
||||
void MaterialPropertyInspector::AddUvNamesGroup()
|
||||
{
|
||||
const AZStd::string groupNameId = AZ::RPI::UvGroupName;
|
||||
const AZStd::string groupName = AZ::RPI::UvGroupName;
|
||||
const AZStd::string groupDisplayName = "UV Sets";
|
||||
const AZStd::string groupDescription = "UV set names in this material, which can be renamed to match those in the model.";
|
||||
auto& group = m_groups[groupNameId];
|
||||
auto& group = m_groups[groupName];
|
||||
|
||||
const RPI::MaterialUvNameMap& uvNameMap = m_editData.m_materialAsset->GetMaterialTypeAsset()->GetUvNameMap();
|
||||
group.m_properties.reserve(uvNameMap.size());
|
||||
@@ -257,8 +257,8 @@ namespace AZ
|
||||
|
||||
propertyConfig = {};
|
||||
propertyConfig.m_dataType = AtomToolsFramework::DynamicPropertyType::String;
|
||||
propertyConfig.m_id = AZ::RPI::MaterialPropertyId(groupNameId, shaderInputStr).GetCStr();
|
||||
propertyConfig.m_nameId = shaderInputStr;
|
||||
propertyConfig.m_id = AZ::RPI::MaterialPropertyId(groupName, shaderInputStr).GetCStr();
|
||||
propertyConfig.m_name = shaderInputStr;
|
||||
propertyConfig.m_displayName = shaderInputStr;
|
||||
propertyConfig.m_groupName = groupDisplayName;
|
||||
propertyConfig.m_description = shaderInputStr;
|
||||
@@ -271,8 +271,8 @@ namespace AZ
|
||||
|
||||
// Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties
|
||||
auto propertyGroupWidget = new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
&group, nullptr, group.TYPEINFO_Uuid(), this, this, GetSaveStateKeyForGroup(groupNameId));
|
||||
AddGroup(groupNameId, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
&group, nullptr, group.TYPEINFO_Uuid(), this, this, GetSaveStateKeyForGroup(groupName));
|
||||
AddGroup(groupName, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
}
|
||||
|
||||
void MaterialPropertyInspector::Populate()
|
||||
@@ -285,13 +285,13 @@ namespace AZ
|
||||
// Copy all of the properties from the material asset to the source data that will be exported
|
||||
for (const auto& groupDefinition : m_editData.m_materialTypeSourceData.GetGroupDefinitionsInDisplayOrder())
|
||||
{
|
||||
const AZStd::string& groupNameId = groupDefinition.m_nameId;
|
||||
const AZStd::string& groupDisplayName = !groupDefinition.m_displayName.empty() ? groupDefinition.m_displayName : groupNameId;
|
||||
const AZStd::string& groupName = groupDefinition.m_name;
|
||||
const AZStd::string& groupDisplayName = !groupDefinition.m_displayName.empty() ? groupDefinition.m_displayName : groupName;
|
||||
const AZStd::string& groupDescription = !groupDefinition.m_description.empty() ? groupDefinition.m_description : groupDisplayName;
|
||||
auto& group = m_groups[groupNameId];
|
||||
auto& group = m_groups[groupName];
|
||||
|
||||
const auto& propertyLayout = m_editData.m_materialTypeSourceData.m_propertyLayout;
|
||||
const auto& propertyListItr = propertyLayout.m_properties.find(groupNameId);
|
||||
const auto& propertyListItr = propertyLayout.m_properties.find(groupName);
|
||||
if (propertyListItr != propertyLayout.m_properties.end())
|
||||
{
|
||||
group.m_properties.reserve(propertyListItr->second.size());
|
||||
@@ -300,7 +300,7 @@ namespace AZ
|
||||
AtomToolsFramework::DynamicPropertyConfig propertyConfig;
|
||||
|
||||
// Assign id before conversion so it can be used in dynamic description
|
||||
propertyConfig.m_id = AZ::RPI::MaterialPropertyId(groupNameId, propertyDefinition.m_nameId).GetFullName();
|
||||
propertyConfig.m_id = AZ::RPI::MaterialPropertyId(groupName, propertyDefinition.m_name).GetFullName();
|
||||
|
||||
AtomToolsFramework::ConvertToPropertyConfig(propertyConfig, propertyDefinition);
|
||||
|
||||
@@ -316,8 +316,8 @@ namespace AZ
|
||||
|
||||
// Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties
|
||||
auto propertyGroupWidget = new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
&group, nullptr, group.TYPEINFO_Uuid(), this, this, GetSaveStateKeyForGroup(groupNameId));
|
||||
AddGroup(groupNameId, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
&group, nullptr, group.TYPEINFO_Uuid(), this, this, GetSaveStateKeyForGroup(groupName));
|
||||
AddGroup(groupName, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
}
|
||||
|
||||
AddGroupsEnd();
|
||||
@@ -496,11 +496,11 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Crc32 MaterialPropertyInspector::GetSaveStateKeyForGroup(const AZStd::string& groupNameId) const
|
||||
AZ::Crc32 MaterialPropertyInspector::GetSaveStateKeyForGroup(const AZStd::string& groupName) const
|
||||
{
|
||||
return AZ::Crc32(AZStd::string::format(
|
||||
"MaterialPropertyInspector::PropertyGroup::%s::%s", m_editData.m_materialAssetId.ToString<AZStd::string>().c_str(),
|
||||
groupNameId.c_str()));
|
||||
groupName.c_str()));
|
||||
}
|
||||
|
||||
bool MaterialPropertyInspector::AreNodePropertyValuesEqual(
|
||||
|
||||
Reference in New Issue
Block a user