Address some PR feedback

- Use AZ::IConsole instead of deprecated Cry IConsole.
- Create fullscreen preview widget on the same screen where the main window is found, instead of on the 'primary' screen
- Remove "ed_previewGameInFullscreen", which had the effect of always doing a full screen preview. If this functionality is desired, it should be re-added as a registry key instead of a cvar
This commit is contained in:
Yuriy Toporovskyy
2021-06-14 16:19:18 -04:00
parent 5becf25a79
commit 84492dee48
3 changed files with 15 additions and 25 deletions
+8 -17
View File
@@ -29,6 +29,7 @@
#include <AzCore/Component/EntityId.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Math/VectorConversions.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Console/IConsole.h>
// AzFramework
@@ -3059,6 +3060,8 @@ float EditorViewportSettings::AngleStep() const
return SandboxEditor::AngleSnappingSize();
}
AZ_CVAR_EXTERNED(bool, ed_previewGameInFullscreen_once);
bool EditorViewportWidget::ShouldPreviewFullscreen() const
{
CLayoutWnd* layout = GetIEditor()->GetViewManager()->GetLayout();
@@ -3089,23 +3092,10 @@ bool EditorViewportWidget::ShouldPreviewFullscreen() const
}
}
// Check 'ed_previewGameInFullscreen_once' and 'ed_previewGameInFullscreen' cvars
if (gEnv->pConsole)
// Check 'ed_previewGameInFullscreen_once'
if (ed_previewGameInFullscreen_once)
{
if (auto v = gEnv->pConsole->GetCVar("ed_previewGameInFullscreen_once"))
{
if (v->GetIVal() != 0)
{
v->Set(0);
return true;
}
}
{
auto v = gEnv->pConsole->GetCVar("ed_previewGameInFullscreen");
return v && v->GetIVal() != 0; // if it doesn't exist, assume its value is 0
}
ed_previewGameInFullscreen_once = true;
return true;
}
else
@@ -3119,7 +3109,8 @@ void EditorViewportWidget::StartFullscreenPreview()
AZ_Assert(!m_inFullscreenPreview, "EditorViewportWidget::StartFullscreenPreview called when already in full screen preview");
m_inFullscreenPreview = true;
const QScreen* screen = QGuiApplication::primaryScreen();
// Pick the screen on which the main window lies to use as the screen for the full screen preview
const QScreen* screen = MainWindow::instance()->screen();
const QRect screenGeometry = screen->geometry();
// Unparent this and show it, which turns it into a free floating window