updated image paths to use new function
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
@@ -170,9 +170,6 @@ namespace AtomToolsFramework
|
||||
const AZ::RPI::MaterialTypeSourceData::PropertyDefinition& propertyDefinition,
|
||||
AZ::RPI::MaterialPropertyValue& propertyValue)
|
||||
{
|
||||
AZ::IO::BasicPath<AZStd::string> exportFolder(exportPath);
|
||||
exportFolder.RemoveFilename();
|
||||
|
||||
if (propertyDefinition.m_dataType == AZ::RPI::MaterialPropertyDataType::Enum && propertyValue.Is<uint32_t>())
|
||||
{
|
||||
const uint32_t index = propertyValue.GetValue<uint32_t>();
|
||||
@@ -192,16 +189,16 @@ namespace AtomToolsFramework
|
||||
if (propertyValue.Is<AZ::Data::Asset<AZ::RPI::ImageAsset>>())
|
||||
{
|
||||
const auto& imageAsset = propertyValue.GetValue<AZ::Data::Asset<AZ::RPI::ImageAsset>>();
|
||||
const auto& sourcePath = AZ::RPI::AssetUtils::GetSourcePathByAssetId(imageAsset.GetId());
|
||||
propertyValue = AZ::IO::PathView(sourcePath).LexicallyRelative(exportFolder).StringAsPosix();
|
||||
const auto& imagePath = AZ::RPI::AssetUtils::GetSourcePathByAssetId(imageAsset.GetId());
|
||||
propertyValue = GetExteralReferencePath(exportPath, imagePath);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (propertyValue.Is<AZ::Data::Instance<AZ::RPI::Image>>())
|
||||
{
|
||||
const auto& image = propertyValue.GetValue<AZ::Data::Instance<AZ::RPI::Image>>();
|
||||
const auto& sourcePath = image ? AZ::RPI::AssetUtils::GetSourcePathByAssetId(image->GetAssetId()) : "";
|
||||
propertyValue = AZ::IO::PathView(sourcePath).LexicallyRelative(exportFolder).StringAsPosix();
|
||||
const auto& imagePath = image ? AZ::RPI::AssetUtils::GetSourcePathByAssetId(image->GetAssetId()) : "";
|
||||
propertyValue = GetExteralReferencePath(exportPath, imagePath);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,12 +235,10 @@ namespace MaterialEditor
|
||||
sourceData.m_parentMaterial = AtomToolsFramework::GetExteralReferencePath(m_absolutePath, m_materialSourceData.m_parentMaterial);
|
||||
|
||||
// populate sourceData with modified or overwritten properties
|
||||
const bool savedProperties = SavePropertiesToSourceData(
|
||||
m_absolutePath, sourceData,
|
||||
[](const AtomToolsFramework::DynamicProperty& property)
|
||||
{
|
||||
return !AtomToolsFramework::ArePropertyValuesEqual(property.GetValue(), property.GetConfig().m_parentValue);
|
||||
});
|
||||
const bool savedProperties = SavePropertiesToSourceData(m_absolutePath, sourceData, [](const AtomToolsFramework::DynamicProperty& property)
|
||||
{
|
||||
return !AtomToolsFramework::ArePropertyValuesEqual(property.GetValue(), property.GetConfig().m_parentValue);
|
||||
});
|
||||
|
||||
if (!savedProperties)
|
||||
{
|
||||
@@ -303,16 +301,13 @@ namespace MaterialEditor
|
||||
MaterialSourceData sourceData;
|
||||
sourceData.m_materialTypeVersion = m_materialAsset->GetMaterialTypeAsset()->GetVersion();
|
||||
sourceData.m_materialType = AtomToolsFramework::GetExteralReferencePath(normalizedSavePath, m_materialSourceData.m_materialType);
|
||||
sourceData.m_parentMaterial =
|
||||
AtomToolsFramework::GetExteralReferencePath(normalizedSavePath, m_materialSourceData.m_parentMaterial);
|
||||
sourceData.m_parentMaterial = AtomToolsFramework::GetExteralReferencePath(normalizedSavePath, m_materialSourceData.m_parentMaterial);
|
||||
|
||||
// populate sourceData with modified or overwritten properties
|
||||
const bool savedProperties = SavePropertiesToSourceData(
|
||||
normalizedSavePath, sourceData,
|
||||
[](const AtomToolsFramework::DynamicProperty& property)
|
||||
{
|
||||
return !AtomToolsFramework::ArePropertyValuesEqual(property.GetValue(), property.GetConfig().m_parentValue);
|
||||
});
|
||||
const bool savedProperties = SavePropertiesToSourceData(normalizedSavePath, sourceData, [](const AtomToolsFramework::DynamicProperty& property)
|
||||
{
|
||||
return !AtomToolsFramework::ArePropertyValuesEqual(property.GetValue(), property.GetConfig().m_parentValue);
|
||||
});
|
||||
|
||||
if (!savedProperties)
|
||||
{
|
||||
@@ -378,17 +373,14 @@ namespace MaterialEditor
|
||||
// Only assign a parent path if the source was a .material
|
||||
if (AzFramework::StringFunc::Path::IsExtension(m_relativePath.c_str(), MaterialSourceData::Extension))
|
||||
{
|
||||
sourceData.m_parentMaterial =
|
||||
AtomToolsFramework::GetExteralReferencePath(normalizedSavePath, m_materialSourceData.m_parentMaterial);
|
||||
sourceData.m_parentMaterial = AtomToolsFramework::GetExteralReferencePath(normalizedSavePath, m_absolutePath);
|
||||
}
|
||||
|
||||
// populate sourceData with modified properties
|
||||
const bool savedProperties = SavePropertiesToSourceData(
|
||||
normalizedSavePath, sourceData,
|
||||
[](const AtomToolsFramework::DynamicProperty& property)
|
||||
{
|
||||
return !AtomToolsFramework::ArePropertyValuesEqual(property.GetValue(), property.GetConfig().m_originalValue);
|
||||
});
|
||||
const bool savedProperties = SavePropertiesToSourceData(normalizedSavePath, sourceData, [](const AtomToolsFramework::DynamicProperty& property)
|
||||
{
|
||||
return !AtomToolsFramework::ArePropertyValuesEqual(property.GetValue(), property.GetConfig().m_originalValue);
|
||||
});
|
||||
|
||||
if (!savedProperties)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user