Merge pull request #505 from aws-lumberyard-dev/Atom/guthadam/ATOM-14065

ATOM-14065 fix problems with material editor details group property descriptions
This commit is contained in:
Guthrie Adams
2021-05-03 15:12:55 -05:00
committed by GitHub
4 changed files with 18 additions and 7 deletions
@@ -211,10 +211,7 @@ namespace AtomToolsFramework
AZStd::string DynamicProperty::GetDescription() const
{
return AZStd::string::format("%s%s(Script Name = '%s')",
m_config.m_description.c_str(),
m_config.m_description.empty() ? "" : "\n",
m_config.m_id.GetCStr());
return m_config.m_description;
}
AZ::Crc32 DynamicProperty::GetVisibility() const
@@ -91,6 +91,13 @@ namespace AtomToolsFramework
propertyConfig.m_vectorLabels = propertyDefinition.m_vectorLabels;
propertyConfig.m_visible = propertyDefinition.m_visibility != AZ::RPI::MaterialPropertyVisibility::Hidden;
propertyConfig.m_readOnly = propertyDefinition.m_visibility == AZ::RPI::MaterialPropertyVisibility::Disabled;
// Update the description for material properties to include script name assuming id is set beforehand
propertyConfig.m_description = AZStd::string::format(
"%s%s(Script Name = '%s')",
propertyConfig.m_description.c_str(),
propertyConfig.m_description.empty() ? "" : "\n",
propertyConfig.m_id.GetCStr());
}
void ConvertToPropertyConfig(AtomToolsFramework::DynamicPropertyConfig& propertyConfig, const AZ::RPI::MaterialPropertyDynamicMetadata& propertyMetaData)
@@ -762,6 +762,8 @@ namespace MaterialEditor
// in the hierarchy are applied
m_materialTypeSourceData.EnumerateProperties([this, &parentPropertyValues](const AZStd::string& groupNameId, const AZStd::string& propertyNameId, const auto& propertyDefinition) {
AtomToolsFramework::DynamicPropertyConfig propertyConfig;
// Assign id before conversion so it can be used in dynamic description
propertyConfig.m_id = MaterialPropertyId(groupNameId, propertyNameId).GetCStr();
const auto& propertyIndex = m_materialAsset->GetMaterialPropertiesLayout()->FindPropertyIndex(propertyConfig.m_id);
@@ -792,7 +794,8 @@ namespace MaterialEditor
propertyConfig.m_nameId = "materialType";
propertyConfig.m_displayName = "Material Type";
propertyConfig.m_groupName = "Details";
propertyConfig.m_description = propertyConfig.m_displayName;
propertyConfig.m_description = "The material type defines the layout, properties, default values, shader connections, and other "
"data needed to create and edit a derived material.";
propertyConfig.m_defaultValue = AZStd::any(materialTypeAsset);
propertyConfig.m_originalValue = propertyConfig.m_defaultValue;
propertyConfig.m_parentValue = propertyConfig.m_defaultValue;
@@ -806,7 +809,8 @@ namespace MaterialEditor
propertyConfig.m_nameId = "parentMaterial";
propertyConfig.m_displayName = "Parent Material";
propertyConfig.m_groupName = "Details";
propertyConfig.m_description = propertyConfig.m_displayName;
propertyConfig.m_description =
"The parent material provides an initial configuration whose properties are inherited and overriden by a derived material.";
propertyConfig.m_defaultValue = AZStd::any(parentMaterialAsset);
propertyConfig.m_originalValue = propertyConfig.m_defaultValue;
propertyConfig.m_parentValue = propertyConfig.m_defaultValue;
@@ -245,9 +245,12 @@ namespace AZ
for (const auto& propertyDefinition : propertyListItr->second)
{
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();
AtomToolsFramework::ConvertToPropertyConfig(propertyConfig, propertyDefinition);
propertyConfig.m_id = AZ::RPI::MaterialPropertyId(groupNameId, propertyDefinition.m_nameId).GetFullName();
propertyConfig.m_groupName = groupDisplayName;
const auto& propertyIndex = m_editData.m_materialAsset->GetMaterialPropertiesLayout()->FindPropertyIndex(propertyConfig.m_id);
propertyConfig.m_showThumbnail = true;