fixed unit tests bugs, removed commented out code, removed loading spam

Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
chcurran
2021-11-24 18:55:11 -08:00
parent 30bcddc694
commit 132d06b6da
23 changed files with 52 additions and 640 deletions
@@ -251,16 +251,6 @@ namespace ScriptCanvasEditor
{
if (index >= 0 && index < count())
{
QVariant tabdata = tabData(index);
if (tabdata.isValid())
{
// #sc_editor_asset fix tabData
auto tabAssetId = tabdata.value<GraphTabMetadata>();
//MemoryAssetNotificationBus::MultiHandler::BusDisconnect(tabAssetId);
//AssetTrackerRequestBus::Broadcast(&AssetTrackerRequests::ClearView, tabAssetId);
}
qobject_cast<AzQtComponents::TabWidget*>(parent())->removeTab(index);
}
}
@@ -271,8 +261,6 @@ namespace ScriptCanvasEditor
{
Q_EMIT TabCloseNoButton(i);
}
MemoryAssetNotificationBus::MultiHandler::BusDisconnect();
}
void GraphTabBar::OnContextMenu(const QPoint& point)
@@ -289,8 +277,6 @@ namespace ScriptCanvasEditor
auto tabAssetId = tabdata.value<GraphTabMetadata>();
Tracker::ScriptCanvasFileState fileState = Tracker::ScriptCanvasFileState::INVALID;
//AssetTrackerRequestBus::BroadcastResult(fileState , &AssetTrackerRequests::GetFileState, tabAssetId);
isModified = fileState == Tracker::ScriptCanvasFileState::NEW || fileState == Tracker::ScriptCanvasFileState::MODIFIED;
}
@@ -362,22 +348,6 @@ namespace ScriptCanvasEditor
AzQtComponents::TabBar::mouseReleaseEvent(event);
}
void GraphTabBar::OnFileStateChanged(Tracker::ScriptCanvasFileState )
{
// #sc_editor_asset
// const AZ::Data::AssetId* fileAssetId = MemoryAssetNotificationBus::GetCurrentBusId();
// if (fileAssetId)
// {
// SetFileState((*fileAssetId), fileState);
//
// if (FindTab((*fileAssetId)) == currentIndex())
// {
// Q_EMIT OnActiveFileStateChanged();
// }
// }
}
void GraphTabBar::SetTabText(int tabIndex, const QString& path, Tracker::ScriptCanvasFileState fileState)
{
if (tabIndex >= 0 && tabIndex < count())
@@ -42,7 +42,6 @@ namespace ScriptCanvasEditor
class GraphTabBar
: public AzQtComponents::TabBar
, public MemoryAssetNotificationBus::MultiHandler
{
Q_OBJECT
@@ -63,8 +62,6 @@ namespace ScriptCanvasEditor
int InsertGraphTab(int tabIndex, ScriptCanvasEditor::SourceHandle assetId, Tracker::ScriptCanvasFileState fileState);
bool SelectTab(ScriptCanvasEditor::SourceHandle assetId);
// void ConfigureTab(int tabIndex, ScriptCanvasEditor::SourceHandle fileAssetId, const AZStd::string& tabName);
int FindTab(ScriptCanvasEditor::SourceHandle assetId) const;
ScriptCanvasEditor::SourceHandle FindTabByPath(AZStd::string_view path) const;
ScriptCanvasEditor::SourceHandle FindAssetId(int tabIndex);
@@ -78,10 +75,6 @@ namespace ScriptCanvasEditor
void mouseReleaseEvent(QMouseEvent* event) override;
// MemoryAssetNotifications
void OnFileStateChanged(Tracker::ScriptCanvasFileState fileState) override;
////
// Updates the tab at the supplied index with the GraphTabMetadata
// The host widget field of the tabMetadata is not used and will not overwrite the tab data
void SetTabText(int tabIndex, const QString& path, Tracker::ScriptCanvasFileState fileState = Tracker::ScriptCanvasFileState::INVALID);
@@ -137,17 +137,6 @@ namespace ScriptCanvasEditor
m_additionTimer.start();
}
}
if (m_updatePolicy == UpdatePolicy::SingleTime)
{
// #sc_editor_asset
// treeItem = CreateChildNodeWithoutAddSignal<ExecutionLogTreeItem>(loggingDataId, nodeType, graphInfo, nodeId);
}
else
{
// #sc_editor_asset
// treeItem = CreateChildNode<ExecutionLogTreeItem>(loggingDataId, nodeType, graphInfo, nodeId);
}
return treeItem;
}
@@ -207,9 +196,6 @@ namespace ScriptCanvasEditor
AZ::NamedEntityId entityName;
// #sc_editor_asset restore this
//LoggingDataRequestBus::EventResult(entityName, m_loggingDataId, &LoggingDataRequests::FindNamedEntityId, m_graphInfo.m_runtimeEntity);
m_sourceEntityName = entityName.ToString().c_str();
m_displayName = nodeId.m_name.c_str();
@@ -514,7 +500,6 @@ namespace ScriptCanvasEditor
const ScriptCanvas::GraphIdentifier& ExecutionLogTreeItem::GetGraphIdentifier() const
{
// #sc_editor_asset
return m_graphIdentifier;
}
@@ -1665,42 +1665,6 @@ namespace ScriptCanvasEditor
return SaveAssetImpl(m_activeGraph, Save::As);
}
/*
bool MainWindow::SaveAssetImpl_OLD(const ScriptCanvasEditor::SourceHandle& assetId, const Callbacks::OnSave& saveCB)
{
if (!assetId.IsValid())
{
return false;
}
// TODO: Set graph read-only to prevent edits during save
bool saveSuccessful = false;
Tracker::ScriptCanvasFileState fileState = GetAssetFileState(assetId);
if (fileState == Tracker::ScriptCanvasFileState::NEW)
{
saveSuccessful = SaveAssetImpl(assetId, saveCB);
}
else if (fileState == Tracker::ScriptCanvasFileState::MODIFIED
|| fileState == Tracker::ScriptCanvasFileState::SOURCE_REMOVED)
{
SaveAs(assetId.Path(), assetId, saveCB);
saveSuccessful = true;
}
return saveSuccessful;
}
*/
// 1. SaveAssetImpl
// 2. SaveAs
// // 3. OnSaveCallback
// SaveAsEnd
// SaveAssetImpl end
bool MainWindow::SaveAssetImpl(const ScriptCanvasEditor::SourceHandle& inMemoryAssetId, Save save)
{
if (!inMemoryAssetId.IsGraphValid())
@@ -1768,11 +1732,6 @@ namespace ScriptCanvasEditor
AZ::IO::FileIOBase::GetInstance()->ResolvePath("@engroot@", assetRootChar.data(), assetRootChar.size());
assetRoot = assetRootChar.data();
// if (!AZ::StringFunc::StartsWith(filePath, assetRoot))
// {
// QMessageBox::information(this, "Unable to Save", AZStd::string::format("You must select a path within the current project\n\n%s", assetRoot.c_str()).c_str());
// }
// else
if (AzFramework::StringFunc::Path::GetFileName(filePath.c_str(), fileName))
{
isValidFileName = !(fileName.empty());
@@ -1924,14 +1883,6 @@ namespace ScriptCanvasEditor
{
m_tabBar->setCurrentIndex(saveTabIndex);
}
else
{
// // Something weird happens with our saving. Where we are relying on these scene changes being called.
// ScriptCanvasEditor::SourceHandle previousAssetId = m_activeGraph;
//
// OnChangeActiveGraphTab(ScriptCanvasEditor::SourceHandle());
// OnChangeActiveGraphTab(previousAssetId);
}
UpdateAssignToSelectionState();
@@ -2365,6 +2316,7 @@ namespace ScriptCanvasEditor
GraphCanvas::ViewRequestBus::Event(viewId, &GraphCanvas::ViewRequests::CenterOnEndOfChain);
}
// #sc_editor_asset
void MainWindow::UpdateWorkspaceStatus(const ScriptCanvasMemoryAsset& /*memoryAsset*/)
{
// only occurs on file open, do it there, if necessary
@@ -2656,16 +2608,6 @@ namespace ScriptCanvasEditor
void MainWindow::Clear()
{
m_tabBar->CloseAllTabs();
// #sc_editor_asset
//
// AssetTrackerRequests::AssetList assets;
// AssetTrackerRequestBus::BroadcastResult(assets, &AssetTrackerRequests::GetAssets);
//
// for (auto asset : assets)
// {
// RemoveScriptCanvasAsset(asset->GetAsset().GetId());
// }
SetActiveAsset({});
}
@@ -4093,32 +4035,6 @@ namespace ScriptCanvasEditor
void MainWindow::PrepareAssetForSave(const ScriptCanvasEditor::SourceHandle& /*assetId*/)
{
/*
ScriptCanvasMemoryAsset::pointer memoryAsset;
AssetTrackerRequestBus::BroadcastResult(memoryAsset, &AssetTrackerRequests::GetAsset, assetId);
if (memoryAsset)
{
AZ::EntityId graphId = memoryAsset->GetGraphId();
AZ::EntityId scriptCanvasId = memoryAsset->GetScriptCanvasId();
AZ::Entity* entity = nullptr;
GraphRequestBus::EventResult(entity, scriptCanvasId, &GraphRequests::GetGraphEntity);
if (entity)
{
GraphCanvas::GraphModelRequestBus::Event(graphId, &GraphCanvas::GraphModelRequests::OnSaveDataDirtied, entity->GetId());
}
GraphCanvas::GraphModelRequestBus::Event(graphId, &GraphCanvas::GraphModelRequests::OnSaveDataDirtied, graphId);
ScriptCanvasEditor::Graph* graph = AZ::EntityUtils::FindFirstDerivedComponent<ScriptCanvasEditor::Graph>(entity);
if (graph)
{
graph->MarkVersion();
}
}
*/
}
void MainWindow::RestartAutoTimerSave(bool forceTimer)
@@ -323,13 +323,7 @@ namespace ScriptCanvasEditor
m_view->tableWidget->setCellWidget(rowIndex, static_cast<int>(ColumnAction), upgradeButton);
}
char resolvedBuffer[AZ_MAX_PATH_LEN] = { 0 };
AZStd::string path = AZStd::string::format("@devroot@/%s", assetInfo.Path().c_str());
AZ::IO::FileIOBase::GetInstance()->ResolvePath(path.c_str(), resolvedBuffer, AZ_MAX_PATH_LEN);
AZ::StringFunc::Path::GetFullPath(resolvedBuffer, path);
AZ::StringFunc::Path::Normalize(path);
bool result = false;
AZ::Data::AssetInfo info;
AZStd::string watchFolder;