clean up open pipeline to render graph

Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
chcurran
2021-11-03 19:15:44 -07:00
parent 6c130c7a86
commit b635e112fc
15 changed files with 616 additions and 569 deletions
@@ -283,10 +283,11 @@ namespace ScriptCanvasEditor
m_undoHelper = AZStd::make_unique<UndoHelper>(*this);
}
ScriptCanvasEditor::Widget::CanvasWidget* ScriptCanvasMemoryAsset::CreateView(QWidget* parent)
ScriptCanvasEditor::Widget::CanvasWidget* ScriptCanvasMemoryAsset::CreateView(QWidget* /*parent*/)
{
m_canvasWidget = new Widget::CanvasWidget(m_fileAssetId, parent);
return m_canvasWidget;
//m_canvasWidget = new Widget::CanvasWidget(m_fileAssetId, parent);
//return m_canvasWidget;
return nullptr;
}
void ScriptCanvasMemoryAsset::ClearView()
@@ -430,68 +431,68 @@ namespace ScriptCanvasEditor
}
}
void ScriptCanvasMemoryAsset::SourceFileFailed(AZStd::string relativePath, AZStd::string scanFolder, AZ::Uuid)
void ScriptCanvasMemoryAsset::SourceFileFailed(AZStd::string /*relativePath*/, AZStd::string /*scanFolder*/, AZ::Uuid)
{
AZStd::string fullPath;
AzFramework::StringFunc::Path::Join(scanFolder.data(), relativePath.data(), fullPath);
AzFramework::ApplicationRequests::Bus::Broadcast(&AzFramework::ApplicationRequests::NormalizePath, fullPath);
auto assetPathIdIt = AZStd::find(m_pendingSave.begin(), m_pendingSave.end(), fullPath);
if (assetPathIdIt != m_pendingSave.end())
{
if (m_onSaveCallback)
{
m_onSaveCallback(false, m_inMemoryAsset.Get(), AZ::Data::AssetId());
m_onSaveCallback = nullptr;
}
m_pendingSave.erase(assetPathIdIt);
}
// AZStd::string fullPath;
// AzFramework::StringFunc::Path::Join(scanFolder.data(), relativePath.data(), fullPath);
// AzFramework::ApplicationRequests::Bus::Broadcast(&AzFramework::ApplicationRequests::NormalizePath, fullPath);
//
// auto assetPathIdIt = AZStd::find(m_pendingSave.begin(), m_pendingSave.end(), fullPath);
//
// if (assetPathIdIt != m_pendingSave.end())
// {
// if (m_onSaveCallback)
// {
// m_onSaveCallback(false, m_inMemoryAsset.Get(), AZ::Data::AssetId());
// m_onSaveCallback = nullptr;
// }
//
// m_pendingSave.erase(assetPathIdIt);
// }
}
void ScriptCanvasMemoryAsset::SavingComplete(const AZStd::string& streamName, AZ::Uuid sourceAssetId)
void ScriptCanvasMemoryAsset::SavingComplete(const AZStd::string& /*streamName*/, AZ::Uuid /*sourceAssetId*/)
{
AZStd::string normPath = streamName;
AzFramework::ApplicationRequests::Bus::Broadcast(&AzFramework::ApplicationRequests::NormalizePath, normPath);
auto assetPathIdIt = AZStd::find(m_pendingSave.begin(), m_pendingSave.end(), normPath);
if (assetPathIdIt != m_pendingSave.end())
{
AZ::Data::AssetId previousFileAssetId;
if (sourceAssetId != m_fileAssetId.m_guid)
{
previousFileAssetId = m_fileAssetId;
// The source file has changed, store the AssetId to the canonical asset on file
SetFileAssetId(sourceAssetId);
}
else if (!m_fileAssetId.IsValid())
{
SetFileAssetId(sourceAssetId);
}
m_formerGraphIdPair = AZStd::make_pair(m_scriptCanvasId, m_graphId);
m_fileState = Tracker::ScriptCanvasFileState::UNMODIFIED;
m_pendingSave.erase(assetPathIdIt);
m_absolutePath = m_saveAsPath;
m_saveAsPath.clear();
// Connect to the source asset's bus to monitor for situations we may need to handle
AZ::Data::AssetBus::MultiHandler::BusConnect(m_inMemoryAsset.GetId());
AZ::Data::AssetBus::MultiHandler::BusConnect(m_fileAssetId);
if (m_onSaveCallback)
{
m_onSaveCallback(true, m_inMemoryAsset.Get(), previousFileAssetId);
m_onSaveCallback = nullptr;
}
}
// AZStd::string normPath = streamName;
// AzFramework::ApplicationRequests::Bus::Broadcast(&AzFramework::ApplicationRequests::NormalizePath, normPath);
//
// auto assetPathIdIt = AZStd::find(m_pendingSave.begin(), m_pendingSave.end(), normPath);
// if (assetPathIdIt != m_pendingSave.end())
// {
// AZ::Data::AssetId previousFileAssetId;
//
// if (sourceAssetId != m_fileAssetId.m_guid)
// {
// previousFileAssetId = m_fileAssetId;
//
// // The source file has changed, store the AssetId to the canonical asset on file
// SetFileAssetId(sourceAssetId);
//
// }
// else if (!m_fileAssetId.IsValid())
// {
// SetFileAssetId(sourceAssetId);
// }
//
// m_formerGraphIdPair = AZStd::make_pair(m_scriptCanvasId, m_graphId);
//
// m_fileState = Tracker::ScriptCanvasFileState::UNMODIFIED;
//
// m_pendingSave.erase(assetPathIdIt);
//
// m_absolutePath = m_saveAsPath;
// m_saveAsPath.clear();
//
// // Connect to the source asset's bus to monitor for situations we may need to handle
// AZ::Data::AssetBus::MultiHandler::BusConnect(m_inMemoryAsset.GetId());
// AZ::Data::AssetBus::MultiHandler::BusConnect(m_fileAssetId);
//
// if (m_onSaveCallback)
// {
// m_onSaveCallback(true, m_inMemoryAsset.Get(), previousFileAssetId);
// m_onSaveCallback = nullptr;
// }
// }
}
void ScriptCanvasMemoryAsset::FinalizeAssetSave(bool, const AzToolsFramework::SourceControlFileInfo& fileInfo, const AZ::Data::AssetStreamInfo& saveInfo, Callbacks::OnSave onSaveCallback)
@@ -525,14 +526,14 @@ namespace ScriptCanvasEditor
UndoNotificationBus::Broadcast(&UndoNotifications::OnCanRedoChanged, m_undoState->m_undoStack->CanRedo());
}
void ScriptCanvasMemoryAsset::SetFileAssetId(const AZ::Data::AssetId& fileAssetId)
void ScriptCanvasMemoryAsset::SetFileAssetId(const AZ::Data::AssetId& /*fileAssetId*/)
{
m_fileAssetId = fileAssetId;
if (m_canvasWidget)
{
m_canvasWidget->SetAssetId(fileAssetId);
}
// m_fileAssetId = fileAssetId;
//
// if (m_canvasWidget)
// {
// m_canvasWidget->SetAssetId(fileAssetId);
// }
}
void ScriptCanvasMemoryAsset::SignalFileStateChanged()
@@ -604,27 +605,27 @@ namespace ScriptCanvasEditor
// AssetSaveFinalizer
//////////////////////////////////////
bool AssetSaveFinalizer::ValidateStatus(const AzToolsFramework::SourceControlFileInfo& fileInfo)
bool AssetSaveFinalizer::ValidateStatus(const AzToolsFramework::SourceControlFileInfo& /*fileInfo*/)
{
auto fileIO = AZ::IO::FileIOBase::GetInstance();
if (fileInfo.IsLockedByOther())
{
AZ_Error("Script Canvas", !fileInfo.IsLockedByOther(), "The file is already exclusively opened by another user: %s", fileInfo.m_filePath.data());
AZStd::invoke(m_onSave, false, m_inMemoryAsset, m_fileAssetId);
return false;
}
else if (fileInfo.IsReadOnly() && fileIO->Exists(fileInfo.m_filePath.c_str()))
{
AZ_Error("Script Canvas", !fileInfo.IsReadOnly(), "File %s is read-only. It cannot be saved."
" If this file is in Perforce it may not have been checked out by the Source Control API.", fileInfo.m_filePath.data());
AZStd::invoke(m_onSave, false, m_inMemoryAsset, m_fileAssetId);
return false;
}
else if (m_saving)
{
AZ_Warning("Script Canvas", false, "Trying to save the same file twice. Will result in one save callback being ignored.");
return false;
}
// auto fileIO = AZ::IO::FileIOBase::GetInstance();
// if (fileInfo.IsLockedByOther())
// {
// AZ_Error("Script Canvas", !fileInfo.IsLockedByOther(), "The file is already exclusively opened by another user: %s", fileInfo.m_filePath.data());
// AZStd::invoke(m_onSave, false, m_inMemoryAsset, m_fileAssetId);
// return false;
// }
// else if (fileInfo.IsReadOnly() && fileIO->Exists(fileInfo.m_filePath.c_str()))
// {
// AZ_Error("Script Canvas", !fileInfo.IsReadOnly(), "File %s is read-only. It cannot be saved."
// " If this file is in Perforce it may not have been checked out by the Source Control API.", fileInfo.m_filePath.data());
// AZStd::invoke(m_onSave, false, m_inMemoryAsset, m_fileAssetId);
// return false;
// }
// else if (m_saving)
// {
// AZ_Warning("Script Canvas", false, "Trying to save the same file twice. Will result in one save callback being ignored.");
// return false;
// }
return true;
}