Merge pull request #265 from aws-lumberyard-dev/Atom/mnaumov/ATOM-13851
[ATOM-13851] Adding custom title to PropertyAssetCtrl
This commit is contained in:
+3
@@ -49,6 +49,7 @@ namespace AtomToolsFramework
|
||||
AZ::Name m_id;
|
||||
AZStd::string m_nameId;
|
||||
AZStd::string m_displayName;
|
||||
AZStd::string m_groupName;
|
||||
AZStd::string m_description;
|
||||
AZStd::any m_defaultValue;
|
||||
AZStd::any m_parentValue;
|
||||
@@ -108,6 +109,8 @@ namespace AtomToolsFramework
|
||||
private:
|
||||
// Functions used to configure edit data attributes.
|
||||
AZStd::string GetDisplayName() const;
|
||||
AZStd::string GetGroupName() const;
|
||||
AZStd::string GetAssetPickerTitle() const;
|
||||
AZStd::string GetDescription() const;
|
||||
AZStd::vector<AZ::Edit::EnumConstant<uint32_t>> GetEnumValues() const;
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ namespace AtomToolsFramework
|
||||
m_editData.m_elementId = AZ::Edit::UIHandlers::Default;
|
||||
|
||||
AddEditDataAttributeMemberFunction(AZ::Edit::Attributes::NameLabelOverride, &DynamicProperty::GetDisplayName);
|
||||
AddEditDataAttributeMemberFunction(AZ::Edit::Attributes::AssetPickerTitle, &DynamicProperty::GetAssetPickerTitle);
|
||||
AddEditDataAttributeMemberFunction(AZ::Edit::Attributes::DescriptionTextOverride, &DynamicProperty::GetDescription);
|
||||
AddEditDataAttributeMemberFunction(AZ::Edit::Attributes::ReadOnly, &DynamicProperty::IsReadOnly);
|
||||
AddEditDataAttributeMemberFunction(AZ::Edit::Attributes::EnumValues, &DynamicProperty::GetEnumValues);
|
||||
@@ -197,6 +198,16 @@ namespace AtomToolsFramework
|
||||
return !m_config.m_displayName.empty() ? m_config.m_displayName : m_config.m_nameId;
|
||||
}
|
||||
|
||||
AZStd::string DynamicProperty::GetGroupName() const
|
||||
{
|
||||
return m_config.m_groupName;
|
||||
}
|
||||
|
||||
AZStd::string DynamicProperty::GetAssetPickerTitle() const
|
||||
{
|
||||
return GetGroupName().empty() ? GetDisplayName() : GetGroupName() + " " + GetDisplayName();
|
||||
}
|
||||
|
||||
AZStd::string DynamicProperty::GetDescription() const
|
||||
{
|
||||
return AZStd::string::format("%s%s(Script Name = '%s')",
|
||||
|
||||
@@ -773,6 +773,7 @@ namespace MaterialEditor
|
||||
AtomToolsFramework::ConvertToPropertyConfig(propertyConfig, propertyDefinition);
|
||||
propertyConfig.m_originalValue = AtomToolsFramework::ConvertToEditableType(m_materialAsset->GetPropertyValues()[propertyIndex.GetIndex()]);
|
||||
propertyConfig.m_parentValue = AtomToolsFramework::ConvertToEditableType(parentPropertyValues[propertyIndex.GetIndex()]);
|
||||
propertyConfig.m_groupName = m_materialTypeSourceData.FindGroup(groupNameId)->m_displayName;
|
||||
m_properties[propertyConfig.m_id] = AtomToolsFramework::DynamicProperty(propertyConfig);
|
||||
}
|
||||
return true;
|
||||
@@ -789,6 +790,7 @@ namespace MaterialEditor
|
||||
propertyConfig.m_id = "details.materialType";
|
||||
propertyConfig.m_nameId = "materialType";
|
||||
propertyConfig.m_displayName = "Material Type";
|
||||
propertyConfig.m_groupName = "Details";
|
||||
propertyConfig.m_description = propertyConfig.m_displayName;
|
||||
propertyConfig.m_defaultValue = AZStd::any(materialTypeAsset);
|
||||
propertyConfig.m_originalValue = propertyConfig.m_defaultValue;
|
||||
@@ -802,6 +804,7 @@ namespace MaterialEditor
|
||||
propertyConfig.m_id = "details.parentMaterial";
|
||||
propertyConfig.m_nameId = "parentMaterial";
|
||||
propertyConfig.m_displayName = "Parent Material";
|
||||
propertyConfig.m_groupName = "Details";
|
||||
propertyConfig.m_description = propertyConfig.m_displayName;
|
||||
propertyConfig.m_defaultValue = AZStd::any(parentMaterialAsset);
|
||||
propertyConfig.m_originalValue = propertyConfig.m_defaultValue;
|
||||
@@ -822,6 +825,7 @@ namespace MaterialEditor
|
||||
propertyConfig.m_id = MaterialPropertyId(UvGroupName, shaderInput).GetCStr();
|
||||
propertyConfig.m_nameId = shaderInput;
|
||||
propertyConfig.m_displayName = shaderInput;
|
||||
propertyConfig.m_groupName = "UV Names";
|
||||
propertyConfig.m_description = shaderInput;
|
||||
propertyConfig.m_defaultValue = uvName;
|
||||
propertyConfig.m_originalValue = uvName;
|
||||
|
||||
+2
@@ -203,6 +203,7 @@ namespace AZ
|
||||
propertyConfig.m_id = AZ::RPI::MaterialPropertyId(groupNameId, shaderInputStr).GetCStr();
|
||||
propertyConfig.m_nameId = shaderInputStr;
|
||||
propertyConfig.m_displayName = shaderInputStr;
|
||||
propertyConfig.m_groupName = groupDisplayName;
|
||||
propertyConfig.m_description = shaderInputStr;
|
||||
propertyConfig.m_defaultValue = uvName;
|
||||
propertyConfig.m_originalValue = uvName;
|
||||
@@ -247,6 +248,7 @@ namespace AZ
|
||||
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_defaultValue = AtomToolsFramework::ConvertToEditableType(m_editData.m_materialTypeAsset->GetDefaultPropertyValues()[propertyIndex.GetIndex()]);
|
||||
propertyConfig.m_parentValue = AtomToolsFramework::ConvertToEditableType(m_editData.m_materialTypeAsset->GetDefaultPropertyValues()[propertyIndex.GetIndex()]);
|
||||
|
||||
Reference in New Issue
Block a user