fixed version explorer issue

Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
chcurran
2021-11-17 12:17:45 -08:00
committed by Chris Burel
parent 4484b69036
commit f8fdf4b306
6 changed files with 19 additions and 14 deletions
@@ -175,7 +175,7 @@ namespace ScriptCanvasEditor
auto saveTarget = graphData->ModGraph();
if (!saveTarget || !saveTarget->GetGraphData())
{
return AZ::Failure(AZStd::string("source save container failed to return graph data"));
return AZ::Failure(AZStd::string("source save container failed to return serializable graph data"));
}
AZ::JsonSerializerSettings settings;
@@ -194,12 +194,8 @@ namespace ScriptCanvasEditor
auto saveOutcome = JSRU::SaveObjectToStream<ScriptCanvas::ScriptCanvasData>(graphData, stream, nullptr, &settings);
if (!saveOutcome.IsSuccess())
{
Here is the allocation failure.
AZStd::string result = saveOutcome.TakeError();
return AZ::Failure(AZStd::string("JSON serialization failed to save source: %s", saveOutcome.GetError().c_str()));
AZStd::string result = saveOutcome.TakeError();
return AZ::Failure(AZStd::string("JSON serialization failed to save source: %s", result.c_str()));
}
return AZ::Success();
@@ -1409,7 +1409,7 @@ namespace ScriptCanvasEditor
AZ::Outcome<ScriptCanvasEditor::SourceHandle, AZStd::string> outcome = LoadFromFile(fullPath);
if (!outcome.IsSuccess())
{
QMessageBox::warning(this, "Invalid Source File", QString("'%1' is not a valid file path.").arg(fullPath), QMessageBox::Ok);
QMessageBox::warning(this, "Invalid Source File", QString("'%1' failed to load properly.").arg(fullPath), QMessageBox::Ok);
m_errorFilePath = fullPath;
AZ_Warning("ScriptCanvas", false, "Unable to open file as a ScriptCanvas graph: %s", fullPath);
return;
@@ -165,7 +165,7 @@ namespace ScriptCanvasEditor
{
int result = QMessageBox::No;
QMessageBox mb
(QMessageBox::Warning
( QMessageBox::Warning
, QObject::tr("Failed to Save Upgraded File")
, QObject::tr("The upgraded file could not be saved because the file is read only.\n"
"Do you want to make it writeable and overwrite it?")
@@ -221,10 +221,16 @@ namespace ScriptCanvasEditor
{
auto streamer = AZ::Interface<AZ::IO::IStreamer>::Get();
AZ::IO::FileRequestPtr flushRequest = streamer->FlushCache(source.Path().c_str());
streamer->SetRequestCompleteCallback(flushRequest, [this, source]([[maybe_unused]] AZ::IO::FileRequestHandle request)
streamer->SetRequestCompleteCallback(flushRequest, [this]([[maybe_unused]] AZ::IO::FileRequestHandle request)
{
this->OnSourceFileReleased(source);
AZStd::lock_guard<AZStd::mutex> lock(m_mutex);
if (!m_sourceFileReleased)
{
m_sourceFileReleased = true;
AZ::SystemTickBus::QueueFunction([this]() { this->OnSourceFileReleased(m_source); });
}
});
streamer->QueueRequest(flushRequest);
}
}
@@ -33,6 +33,9 @@ namespace ScriptCanvasEditor
void Save(const SourceHandle& source);
private:
AZStd::mutex m_mutex;
bool m_sourceFileReleased = false;
SourceHandle m_source;
AZStd::function<void(const FileSaveResult& result)> m_onComplete;
AZStd::function<bool()> m_onReadOnlyFile;
@@ -205,9 +205,9 @@ namespace ScriptCanvasEditor
bool SourceHandle::AnyEquals(const SourceHandle& other) const
{
return m_data == other.m_data
|| m_id == other.m_id
|| m_path == other.m_path;
return m_data && m_data == other.m_data
|| !m_id.IsNull() && m_id == other.m_id
|| !m_path.empty() && m_path == other.m_path;
}
void SourceHandle::Clear()