Prevent some slice-related commands from being enabled when the slice editor is not.

Fixes o3de/o3de#6198

Fixes an additional menu option that was visible (Resave all slices)

Signed-off-by: Andre Mitchell <andre.mitchell@bytesofpi.com>
This commit is contained in:
Andre Mitchell
2021-12-08 08:19:10 -05:00
parent 5eb058f679
commit 8b1e14cc7e
3 changed files with 9 additions and 5 deletions
+3 -3
View File
@@ -374,7 +374,6 @@ QMenu* LevelEditorMenuHandler::CreateFileMenu()
{
DisableActionWhileLevelChanges(fileOpenSlice, e);
}));
#endif
// Save Selected Slice
auto saveSelectedSlice = fileMenu.AddAction(ID_FILE_SAVE_SELECTED_SLICE);
@@ -391,7 +390,7 @@ QMenu* LevelEditorMenuHandler::CreateFileMenu()
{
HideActionWhileEntitiesDeselected(saveSliceToRoot, e);
}));
#endif
// Open Recent
m_mostRecentLevelsMenu = fileMenu.AddMenu(tr("Open Recent"));
connect(m_mostRecentLevelsMenu, &QMenu::aboutToShow, this, &LevelEditorMenuHandler::UpdateMRUFiles);
@@ -439,9 +438,10 @@ QMenu* LevelEditorMenuHandler::CreateFileMenu()
// Show Log File
fileMenu.AddAction(ID_FILE_EDITLOGFILE);
#ifdef ENABLE_SLICE_EDITOR
fileMenu.AddSeparator();
fileMenu.AddAction(ID_FILE_RESAVESLICES);
#endif
fileMenu.AddSeparator();
+3 -1
View File
@@ -380,13 +380,13 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
ON_COMMAND(ID_EDIT_LEVELDATA, OnEditLevelData)
ON_COMMAND(ID_FILE_EDITLOGFILE, OnFileEditLogFile)
ON_COMMAND(ID_FILE_RESAVESLICES, OnFileResaveSlices)
ON_COMMAND(ID_FILE_EDITEDITORINI, OnFileEditEditorini)
ON_COMMAND(ID_PREFERENCES, OnPreferences)
ON_COMMAND(ID_REDO, OnRedo)
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnRedo)
ON_COMMAND(ID_FILE_OPEN_LEVEL, OnOpenLevel)
#ifdef ENABLE_SLICE_EDITOR
ON_COMMAND(ID_FILE_RESAVESLICES, OnFileResaveSlices)
ON_COMMAND(ID_FILE_NEW_SLICE, OnCreateSlice)
ON_COMMAND(ID_FILE_OPEN_SLICE, OnOpenSlice)
#endif
@@ -2636,6 +2636,7 @@ void CCryEditApp::OnFileEditLogFile()
CFileUtil::EditTextFile(CLogFile::GetLogFileName(), 0, IFileUtil::FILE_TYPE_SCRIPT);
}
#ifdef ENABLE_SLICE_EDITOR
void CCryEditApp::OnFileResaveSlices()
{
AZStd::vector<AZ::Data::AssetInfo> sliceAssetInfos;
@@ -2766,6 +2767,7 @@ void CCryEditApp::OnFileResaveSlices()
}
}
#endif
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnFileEditEditorini()
+3 -1
View File
@@ -642,11 +642,11 @@ void MainWindow::InitActions()
.SetStatusTip(tr("Create a new slice"));
am->AddAction(ID_FILE_OPEN_SLICE, tr("Open Slice..."))
.SetStatusTip(tr("Open an existing slice"));
#endif
am->AddAction(ID_FILE_SAVE_SELECTED_SLICE, tr("Save selected slice")).SetShortcut(tr("Alt+S"))
.SetStatusTip(tr("Save the selected slice to the first level root"));
am->AddAction(ID_FILE_SAVE_SLICE_TO_ROOT, tr("Save Slice to root")).SetShortcut(tr("Ctrl+Alt+S"))
.SetStatusTip(tr("Save the selected slice to the top level root"));
#endif
am->AddAction(ID_FILE_SAVE_LEVEL, tr("&Save"))
.SetShortcut(tr("Ctrl+S"))
.SetReserved()
@@ -676,7 +676,9 @@ void MainWindow::InitActions()
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelected);
am->AddAction(ID_FILE_EXPORTOCCLUSIONMESH, tr("Export Occlusion Mesh"));
am->AddAction(ID_FILE_EDITLOGFILE, tr("Show Log File"));
#ifdef ENABLE_SLICE_EDITOR
am->AddAction(ID_FILE_RESAVESLICES, tr("Resave All Slices"));
#endif
am->AddAction(ID_FILE_PROJECT_MANAGER_SETTINGS, tr("Edit Project Settings..."));
am->AddAction(ID_FILE_PROJECT_MANAGER_NEW, tr("New Project..."));
am->AddAction(ID_FILE_PROJECT_MANAGER_OPEN, tr("Open Project..."));