From 7bd42e1f8d7d769a35eb81648882c3d06f8bd3ef Mon Sep 17 00:00:00 2001 From: Benjamin Jillich <43751992+amzn-jillich@users.noreply.github.com> Date: Wed, 16 Jun 2021 21:55:28 -0700 Subject: [PATCH] [LYN-4410] Back buttons should preserve selected gems (#1359) --- Code/Tools/ProjectManager/Source/CreateProjectCtrl.cpp | 9 ++++++--- Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Code/Tools/ProjectManager/Source/CreateProjectCtrl.cpp b/Code/Tools/ProjectManager/Source/CreateProjectCtrl.cpp index c8ed3954ac..0e3a4ba95d 100644 --- a/Code/Tools/ProjectManager/Source/CreateProjectCtrl.cpp +++ b/Code/Tools/ProjectManager/Source/CreateProjectCtrl.cpp @@ -77,6 +77,7 @@ namespace O3DE::ProjectManager return ProjectManagerScreen::CreateProject; } + // Called when pressing "Create New Project" void CreateProjectCtrl::NotifyCurrentScreen() { ScreenWidget* currentScreen = reinterpret_cast(m_stack->currentWidget()); @@ -84,6 +85,11 @@ namespace O3DE::ProjectManager { currentScreen->NotifyCurrentScreen(); } + + // Gather the gems from the project template. When we will have multiple project templates, we need to re-gather them + // on changing the template and let the user know that any further changes on top of the template will be lost. + QString projectTemplatePath = m_newProjectSettingsScreen->GetProjectTemplatePath(); + m_gemCatalogScreen->ReinitForProject(projectTemplatePath + "/Template", /*isNewProject=*/true); } void CreateProjectCtrl::HandleBackButton() @@ -151,9 +157,6 @@ namespace O3DE::ProjectManager { m_stack->setCurrentIndex(m_stack->currentIndex() + 1); - QString projectTemplatePath = m_newProjectSettingsScreen->GetProjectTemplatePath(); - m_gemCatalogScreen->ReinitForProject(projectTemplatePath + "/Template", /*isNewProject=*/true); - Update(); } else diff --git a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp index 65f73accd1..409c51315d 100644 --- a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp +++ b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp @@ -89,17 +89,18 @@ namespace O3DE::ProjectManager return ProjectManagerScreen::UpdateProject; } + // Called when pressing "Edit Project Settings..." void UpdateProjectCtrl::NotifyCurrentScreen() { m_stack->setCurrentIndex(ScreenOrder::Settings); Update(); + + // Gather the available gems that will be shown in the gem catalog. + m_gemCatalogScreen->ReinitForProject(m_projectInfo.m_path, /*isNewProject=*/false); } void UpdateProjectCtrl::HandleGemsButton() { - // The next page is the gem catalog. Gather the available gems that will be shown in the gem catalog. - m_gemCatalogScreen->ReinitForProject(m_projectInfo.m_path, /*isNewProject=*/false); - m_stack->setCurrentWidget(m_gemCatalogScreen); Update(); }