Merge commit 'a544800536a5bebda96812951befa4d43b0474d3' into amzn-tommy/gitflow_211116_o3de2

This commit is contained in:
Tommy Walton
2021-11-16 11:41:59 -08:00
6 changed files with 62 additions and 17 deletions
+8 -4
View File
@@ -370,10 +370,8 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_EDIT_FETCH, OnEditFetch)
ON_COMMAND(ID_FILE_EXPORTTOGAMENOSURFACETEXTURE, OnFileExportToGameNoSurfaceTexture)
ON_COMMAND(ID_VIEW_SWITCHTOGAME, OnViewSwitchToGame)
MainWindow::instance()->GetActionManager()->RegisterActionHandler(ID_VIEW_SWITCHTOGAME_FULLSCREEN, [this]() {
ed_previewGameInFullscreen_once = true;
OnViewSwitchToGame();
});
ON_COMMAND(ID_VIEW_SWITCHTOGAME_VIEWPORT, OnViewSwitchToGame)
ON_COMMAND(ID_VIEW_SWITCHTOGAME_FULLSCREEN, OnViewSwitchToGameFullScreen)
ON_COMMAND(ID_MOVE_OBJECT, OnMoveObject)
ON_COMMAND(ID_RENAME_OBJ, OnRenameObj)
ON_COMMAND(ID_UNDO, OnUndo)
@@ -2573,6 +2571,12 @@ void CCryEditApp::OnViewSwitchToGame()
GetIEditor()->SetInGameMode(inGame);
}
void CCryEditApp::OnViewSwitchToGameFullScreen()
{
ed_previewGameInFullscreen_once = true;
OnViewSwitchToGame();
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnExportSelectedObjects()
{
+1
View File
@@ -212,6 +212,7 @@ public:
void OnEditFetch();
void OnFileExportToGameNoSurfaceTexture();
void OnViewSwitchToGame();
void OnViewSwitchToGameFullScreen();
void OnViewDeploy();
void DeleteSelectedEntities(bool includeDescendants);
void OnMoveObject();
+11 -9
View File
@@ -939,27 +939,27 @@ void MainWindow::InitActions()
.Connect(&QAction::triggered, this, &MainWindow::OnRefreshAudioSystem);
// Game actions
am->AddAction(ID_VIEW_SWITCHTOGAME, tr("Play &Game"))
am->AddAction(ID_VIEW_SWITCHTOGAME, tr("Play Game"))
.SetIcon(QIcon(":/stylesheet/img/UI20/toolbar/Play.svg"))
.SetToolTip(tr("Play Game"))
.SetStatusTip(tr("Activate the game input mode"))
.SetCheckable(true)
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdatePlayGame);
am->AddAction(ID_VIEW_SWITCHTOGAME_VIEWPORT, tr("Play Game"))
.SetShortcut(tr("Ctrl+G"))
.SetToolTip(tr("Play Game (Ctrl+G)"))
.SetStatusTip(tr("Activate the game input mode"))
.SetApplyHoverEffect()
.SetCheckable(true)
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdatePlayGame);
am->AddAction(ID_VIEW_SWITCHTOGAME_FULLSCREEN, tr("Play &Game (Maximized)"))
am->AddAction(ID_VIEW_SWITCHTOGAME_FULLSCREEN, tr("Play Game (Maximized)"))
.SetShortcut(tr("Ctrl+Shift+G"))
.SetStatusTip(tr("Activate the game input mode (maximized)"))
.SetIcon(Style::icon("Play"))
.SetApplyHoverEffect()
.SetCheckable(true);
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdatePlayGame);
am->AddAction(ID_TOOLBAR_WIDGET_PLAYCONSOLE_LABEL, tr("Play Controls"))
.SetText(tr("Play Controls"));
am->AddAction(ID_SWITCH_PHYSICS, tr("Simulate"))
.SetIcon(QIcon(":/stylesheet/img/UI20/toolbar/Simulate_Physics.svg"))
.SetShortcut(tr("Ctrl+P"))
.SetToolTip(tr("Simulate (Ctrl+P)"))
.SetCheckable(true)
.SetStatusTip(tr("Enable processing of Physics and AI."))
.SetApplyHoverEffect()
.SetCheckable(true)
@@ -1266,7 +1266,9 @@ void MainWindow::OnGameModeChanged(bool inGameMode)
// block signals on the switch to game actions before setting the checked state, as
// setting the checked state triggers the action, which will re-enter this function
// and result in an infinite loop
AZStd::vector<QAction*> actions = { m_actionManager->GetAction(ID_VIEW_SWITCHTOGAME), m_actionManager->GetAction(ID_VIEW_SWITCHTOGAME_FULLSCREEN) };
AZStd::vector<QAction*> actions = { m_actionManager->GetAction(ID_VIEW_SWITCHTOGAME_VIEWPORT),
m_actionManager->GetAction(ID_VIEW_SWITCHTOGAME_FULLSCREEN),
m_actionManager->GetAction(ID_VIEW_SWITCHTOGAME)};
for (auto action : actions)
{
action->blockSignals(true);
+1
View File
@@ -104,6 +104,7 @@
#define ID_FILE_EXPORTTOGAMENOSURFACETEXTURE 33473
#define ID_VIEW_SWITCHTOGAME 33477
#define ID_VIEW_SWITCHTOGAME_FULLSCREEN 33478
#define ID_VIEW_SWITCHTOGAME_VIEWPORT 33479
#define ID_MOVE_OBJECT 33481
#define ID_RENAME_OBJ 33483
#define ID_FETCH 33496
+35 -4
View File
@@ -590,6 +590,16 @@ AmazonToolbar ToolbarManager::GetObjectToolbar() const
return t;
}
QMenu* ToolbarManager::CreatePlayButtonMenu() const
{
QMenu* playButtonMenu = new QMenu("Play Game");
playButtonMenu->addAction(m_actionManager->GetAction(ID_VIEW_SWITCHTOGAME_VIEWPORT));
playButtonMenu->addAction(m_actionManager->GetAction(ID_VIEW_SWITCHTOGAME_FULLSCREEN));
return playButtonMenu;
}
AmazonToolbar ToolbarManager::GetPlayConsoleToolbar() const
{
AmazonToolbar t = AmazonToolbar("PlayConsole", QObject::tr("Play Controls"));
@@ -598,8 +608,17 @@ AmazonToolbar ToolbarManager::GetPlayConsoleToolbar() const
t.AddAction(ID_TOOLBAR_WIDGET_SPACER_RIGHT, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_WIDGET_PLAYCONSOLE_LABEL, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_VIEW_SWITCHTOGAME, TOOLBARS_WITH_PLAY_GAME);
t.AddAction(ID_VIEW_SWITCHTOGAME_FULLSCREEN, TOOLBARS_WITH_PLAY_GAME);
QAction* playAction = m_actionManager->GetAction(ID_VIEW_SWITCHTOGAME);
QToolButton* playButton = new QToolButton(t.Toolbar());
QMenu* menu = CreatePlayButtonMenu();
menu->setParent(t.Toolbar());
playAction->setMenu(menu);
playButton->setDefaultAction(playAction);
t.AddWidget(playButton, ID_VIEW_SWITCHTOGAME, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_SWITCH_PHYSICS, TOOLBARS_WITH_PLAY_GAME);
return t;
@@ -728,7 +747,14 @@ void AmazonToolbar::SetActionsOnInternalToolbar(ActionManager* actionManager)
{
if (actionManager->HasAction(actionId))
{
m_toolbar->addAction(actionManager->GetAction(actionId));
if (actionData.widget != nullptr)
{
m_toolbar->addWidget(actionData.widget);
}
else
{
m_toolbar->addAction(actionManager->GetAction(actionId));
}
}
}
}
@@ -1367,7 +1393,12 @@ void AmazonToolbar::InstantiateToolbar(QMainWindow* mainWindow, ToolbarManager*
void AmazonToolbar::AddAction(int actionId, int toolbarVersionAdded)
{
m_actions.push_back({ actionId, toolbarVersionAdded });
AddWidget(nullptr, actionId, toolbarVersionAdded);
}
void AmazonToolbar::AddWidget(QWidget* widget, int actionId, int toolbarVersionAdded)
{
m_actions.push_back({ actionId, toolbarVersionAdded, widget });
}
void AmazonToolbar::Clear()
+6
View File
@@ -87,6 +87,7 @@ public:
const QString& GetTranslatedName() const { return m_translatedName; }
void AddAction(int actionId, int toolbarVersionAdded = 0);
void AddWidget(QWidget* widget, int actionId, int toolbarVersionAdded = 0);
QToolBar* Toolbar() const { return m_toolbar; }
@@ -117,6 +118,7 @@ private:
{
int actionId;
int toolbarVersionAdded;
QWidget* widget;
bool operator ==(const AmazonToolbar::ActionData& other) const
{
@@ -133,7 +135,9 @@ private:
class AmazonToolBarExpanderWatcher;
class ToolbarManager
: public QObject
{
Q_OBJECT
public:
explicit ToolbarManager(ActionManager* actionManager, MainWindow* mainWindow);
~ToolbarManager();
@@ -178,6 +182,8 @@ private:
void UpdateAllowedAreas(QToolBar* toolbar);
bool IsDirty(const AmazonToolbar& toolbar) const;
QMenu* CreatePlayButtonMenu() const;
const AmazonToolbar* FindDefaultToolbar(const QString& toolbarName) const;
AmazonToolbar* FindToolbar(const QString& toolbarName);