Working on making Material Editor able to open materials that have missing textures.

Made it a warning instead of an error when MaterialAssetCreator can't find a texture.
Updated the Material Editor's MaterialDocument class to not elevate warnings to errors.
Material Editor uses new features in TraceRecorder to show a message dialog when warnings are detected so the user is notified of the missing texture.

Next I will work on making MaterialAssetCreator put a "missing" texture in place of the requested one.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
santorac
2021-11-10 14:02:17 -08:00
parent 87c7023e3c
commit cd28d210ab
5 changed files with 84 additions and 6 deletions
@@ -31,6 +31,7 @@ namespace AtomToolsFramework
bool TraceRecorder::OnAssert(const char* message)
{
++m_assertCount;
if (m_messages.size() < m_maxMessageCount)
{
m_messages.push_back(AZStd::string::format("Assert: %s", message));
@@ -40,6 +41,7 @@ namespace AtomToolsFramework
bool TraceRecorder::OnException(const char* message)
{
++m_exceptionCount;
if (m_messages.size() < m_maxMessageCount)
{
m_messages.push_back(AZStd::string::format("Exception: %s", message));
@@ -49,6 +51,7 @@ namespace AtomToolsFramework
bool TraceRecorder::OnError(const char* /*window*/, const char* message)
{
++m_errorCount;
if (m_messages.size() < m_maxMessageCount)
{
m_messages.push_back(AZStd::string::format("Error: %s", message));
@@ -58,6 +61,7 @@ namespace AtomToolsFramework
bool TraceRecorder::OnWarning(const char* /*window*/, const char* message)
{
++m_warningCount;
if (m_messages.size() < m_maxMessageCount)
{
m_messages.push_back(AZStd::string::format("Warning: %s", message));
@@ -67,11 +71,58 @@ namespace AtomToolsFramework
bool TraceRecorder::OnPrintf(const char* /*window*/, const char* message)
{
++m_printfCount;
if (m_messages.size() < m_maxMessageCount)
{
m_messages.push_back(AZStd::string::format("%s", message));
}
return false;
}
size_t TraceRecorder::GetAssertCount() const
{
return m_assertCount;
}
size_t TraceRecorder::GetExceptionCount() const
{
return m_exceptionCount;
}
size_t TraceRecorder::GetErrorCount(bool includeHigher) const
{
if (includeHigher)
{
return m_errorCount + GetAssertCount() + GetExceptionCount();
}
else
{
return m_errorCount;
}
}
size_t TraceRecorder::GetWarningCount(bool includeHigher) const
{
if (includeHigher)
{
return m_warningCount + GetErrorCount(true);
}
else
{
return m_warningCount;
}
}
size_t TraceRecorder::GetPrintfCount(bool includeHigher) const
{
if (includeHigher)
{
return m_printfCount + GetWarningCount(true);
}
else
{
return m_printfCount;
}
}
} // namespace AtomToolsFramework