Removed the GetLabelByAssetId function since now we can use the display name that comes with the ModelMaterialSlot.

Updated OpenMaterialExporter() to account for the fact that multiple material slots can have the same default material asset.
Updated the material inspector to sort material slots by name to match the order in the Material Component.
Updated ExportItem to protect its data members, which makes it more clear that assetId and materialSlotName are readonly inputs.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
Chris Santora
2021-07-17 18:18:28 -07:00
committed by santorac
parent e3ceaa477e
commit 670dd6c5bc
4 changed files with 88 additions and 92 deletions
@@ -189,8 +189,7 @@ namespace AZ
// But we still need to allow the user to reconfigure it using the dialog
EditorMaterialComponentExporter::ExportItemsContainer exportItems;
{
EditorMaterialComponentExporter::ExportItem exportItem;
exportItem.m_originalAssetId = m_defaultMaterialAsset.GetId();
EditorMaterialComponentExporter::ExportItem exportItem{m_defaultMaterialAsset.GetId(), m_label};
exportItems.push_back(exportItem);
}
@@ -205,7 +204,7 @@ namespace AZ
}
// Generate a new asset ID utilizing the export file path so that we can update this material slot to reference the new asset
const auto& assetIdOutcome = AZ::RPI::AssetUtils::MakeAssetId(exportItem.m_exportPath, 0);
const auto& assetIdOutcome = AZ::RPI::AssetUtils::MakeAssetId(exportItem.GetExportPath(), 0);
if (assetIdOutcome)
{
m_materialAsset.Create(assetIdOutcome.GetValue());