Removed the 'data-warnings' concept for checking before saving a material document. It's no longer necessary since we no longer replace the original data with placeholders.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
monroegm-disable-blank-issue-2
santorac 4 years ago
parent a789d7b762
commit 224e0bd20f

@ -73,9 +73,6 @@ namespace AtomToolsFramework
//! Can the document be saved
virtual bool IsSavable() const = 0;
//! Get a list of warnings about the data that would be good to know before saving
virtual AZStd::vector<AZStd::string> GetDataWarnings() const { return {}; }
//! Returns true if there are reversible modifications to the document
virtual bool CanUndo() const = 0;

@ -365,24 +365,6 @@ namespace AtomToolsFramework
return false;
}
AZStd::vector<AZStd::string> dataWarnings;
AtomToolsDocumentRequestBus::EventResult(dataWarnings, documentId, &AtomToolsDocumentRequestBus::Events::GetDataWarnings);
if (!dataWarnings.empty())
{
AZStd::string allWarnings;
AzFramework::StringFunc::Join(allWarnings, dataWarnings.begin(), dataWarnings.end(), "\n");
auto result = QMessageBox::warning(
QApplication::activeWindow(), QString("Data Warnings"),
QString("Are you sure you want to save with the following data warnings? \n\n%1").arg(allWarnings.c_str()),
QMessageBox::StandardButton::Yes, QMessageBox::StandardButton::No);
if (result == QMessageBox::StandardButton::No)
{
return false;
}
}
AtomToolsFramework::TraceRecorder traceRecorder(m_maxMessageBoxLineCount);
bool result = false;

@ -468,37 +468,6 @@ namespace MaterialEditor
{
return AzFramework::StringFunc::Path::IsExtension(m_absolutePath.c_str(), AZ::RPI::MaterialSourceData::Extension);
}
AZStd::vector<AZStd::string> MaterialDocument::GetDataWarnings() const
{
AZStd::vector<AZStd::string> warnings;
for (auto& [propertyName, dynamicProperty] : m_properties)
{
AZ::RPI::MaterialPropertyValue propertyValue = AtomToolsFramework::ConvertToRuntimeType(dynamicProperty.GetValue());
if (propertyValue.Is<AZ::Data::Asset<AZ::RPI::ImageAsset>>())
{
auto isSameAsset = [&propertyValue](const char* path)
{
AZ::Data::AssetId assetId = propertyValue.GetValue<AZ::Data::Asset<AZ::RPI::ImageAsset>>().GetId();
AZ::Data::AssetId otherAssetId;
AZ::Data::AssetCatalogRequestBus::BroadcastResult(otherAssetId, &AZ::Data::AssetCatalogRequestBus::Events::GetAssetIdByPath, path, AZ::Data::AssetType{}, false);
return assetId == otherAssetId;
};
if (isSameAsset(AZ::RPI::DefaultImageAssetPaths::DefaultFallback) ||
isSameAsset(AZ::RPI::DefaultImageAssetPaths::Missing) ||
isSameAsset(AZ::RPI::DefaultImageAssetPaths::Processing) ||
isSameAsset(AZ::RPI::DefaultImageAssetPaths::ProcessingFailed)
)
{
warnings.push_back(AZStd::string::format("%s is using a placeholder image asset.", propertyName.GetCStr()));
}
}
}
return warnings;
}
bool MaterialDocument::CanUndo() const
{

@ -55,7 +55,6 @@ namespace MaterialEditor
bool IsOpen() const override;
bool IsModified() const override;
bool IsSavable() const override;
AZStd::vector<AZStd::string> GetDataWarnings() const override;
bool CanUndo() const override;
bool CanRedo() const override;
bool Undo() override;

Loading…
Cancel
Save