From 91fb8be5354750c8682d7f13f7988cd6048f6170 Mon Sep 17 00:00:00 2001 From: Terry Michaels Date: Thu, 10 Jun 2021 11:42:25 -0500 Subject: [PATCH] Added toolbar icons, updated viewport header UX (#1240) --- .../Images/Menu/asset_editor.svg | 7 ++++ .../Images/Menu/audio_editor.svg | 7 ++++ .../Images/Menu/emfx_editor.svg | 7 ++++ .../Images/Menu/landscape_canvas_editor.svg | 7 ++++ .../AzQtComponents/Images/Menu/lua_editor.svg | 13 ++++++++ .../Images/Menu/material_editor.svg | 10 ++++++ .../Images/Menu/script_canvas_editor.svg | 7 ++++ .../Images/Menu/trackview_editor.svg | 7 ++++ .../AzQtComponents/Images/Menu/ui_editor.svg | 7 ++++ .../AzQtComponents/Images/resources.qrc | 9 +++++ .../AzToolsFramework/Viewport/ActionBus.h | 2 +- .../Editor/AssetEditor/AssetEditorWindow.cpp | 2 ++ .../Editor/Core/LevelEditorMenuHandler.cpp | 7 +++- .../Editor/Core/LevelEditorMenuHandler.h | 2 +- .../Editor/TrackView/TrackViewDialog.cpp | 2 ++ Code/Sandbox/Editor/ViewportTitleDlg.cpp | 33 +++---------------- Code/Sandbox/Editor/ViewportTitleDlg.h | 2 -- .../EditorMaterialSystemComponent.cpp | 3 +- .../Integration/System/SystemComponent.cpp | 3 ++ .../Source/LandscapeCanvasSystemComponent.cpp | 3 ++ .../Editor/LyShineEditorSystemComponent.cpp | 2 ++ .../Code/Editor/SystemComponent.cpp | 2 ++ 22 files changed, 109 insertions(+), 35 deletions(-) create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/asset_editor.svg create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/audio_editor.svg create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/emfx_editor.svg create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/landscape_canvas_editor.svg create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/lua_editor.svg create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/material_editor.svg create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/script_canvas_editor.svg create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/trackview_editor.svg create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/ui_editor.svg diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/asset_editor.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/asset_editor.svg new file mode 100644 index 0000000000..b96f27dda7 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/asset_editor.svg @@ -0,0 +1,7 @@ + + + Asset Editor icon + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/audio_editor.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/audio_editor.svg new file mode 100644 index 0000000000..1cc863ebcd --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/audio_editor.svg @@ -0,0 +1,7 @@ + + + audio edit + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/emfx_editor.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/emfx_editor.svg new file mode 100644 index 0000000000..72e67b5170 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/emfx_editor.svg @@ -0,0 +1,7 @@ + + + EMFX header icon + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/landscape_canvas_editor.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/landscape_canvas_editor.svg new file mode 100644 index 0000000000..ebf38d15c0 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/landscape_canvas_editor.svg @@ -0,0 +1,7 @@ + + + Veg editor icon + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/lua_editor.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/lua_editor.svg new file mode 100644 index 0000000000..76b4ed3da4 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/lua_editor.svg @@ -0,0 +1,13 @@ + + + Lua icon + + + + + + + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/material_editor.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/material_editor.svg new file mode 100644 index 0000000000..ed6f477367 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/material_editor.svg @@ -0,0 +1,10 @@ + + + Material editor icon + + + + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/script_canvas_editor.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/script_canvas_editor.svg new file mode 100644 index 0000000000..b2a303d237 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/script_canvas_editor.svg @@ -0,0 +1,7 @@ + + + SC icon + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/trackview_editor.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/trackview_editor.svg new file mode 100644 index 0000000000..56da550f0e --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/trackview_editor.svg @@ -0,0 +1,7 @@ + + + trackview icon + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/ui_editor.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/ui_editor.svg new file mode 100644 index 0000000000..8d27f071da --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/ui_editor.svg @@ -0,0 +1,7 @@ + + + UI editor icon + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/resources.qrc b/Code/Framework/AzQtComponents/AzQtComponents/Images/resources.qrc index 2487917f67..cc66558367 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Images/resources.qrc +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/resources.qrc @@ -19,5 +19,14 @@ Menu/resolution.svg Menu/debug.svg Menu/camera.svg + Menu/asset_editor.svg + Menu/audio_editor.svg + Menu/emfx_editor.svg + Menu/landscape_canvas_editor.svg + Menu/lua_editor.svg + Menu/material_editor.svg + Menu/script_canvas_editor.svg + Menu/trackview_editor.svg + Menu/ui_editor.svg diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ActionBus.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ActionBus.h index 7eaf3da37c..fa43eb422d 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ActionBus.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ActionBus.h @@ -188,7 +188,7 @@ namespace AzToolsFramework virtual void AddEditMenuAction(QAction* action) = 0; /// Add an action to the Editor menu. - virtual void AddMenuAction(AZStd::string_view categoryId, QAction* action) = 0; + virtual void AddMenuAction(AZStd::string_view categoryId, QAction* action, bool addToToolsToolbar) = 0; /// (Re)populate the default EditMenu. /// Restore the EditMenu to its default state (the options available when first opening a level). diff --git a/Code/Sandbox/Editor/AssetEditor/AssetEditorWindow.cpp b/Code/Sandbox/Editor/AssetEditor/AssetEditorWindow.cpp index 53e2884943..9f14e471a3 100644 --- a/Code/Sandbox/Editor/AssetEditor/AssetEditorWindow.cpp +++ b/Code/Sandbox/Editor/AssetEditor/AssetEditorWindow.cpp @@ -117,6 +117,8 @@ void AssetEditorWindow::RegisterViewClass() { AzToolsFramework::ViewPaneOptions options; options.preferedDockingArea = Qt::LeftDockWidgetArea; + options.showOnToolsToolbar = true; + options.toolbarIcon = ":/Menu/asset_editor.svg"; AzToolsFramework::RegisterViewPane(LyViewPane::AssetEditor, LyViewPane::CategoryTools, options); } diff --git a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp index 39c7ae43fd..ebc688f9da 100644 --- a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp +++ b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp @@ -1292,7 +1292,7 @@ void LevelEditorMenuHandler::AddEditMenuAction(QAction* action) } } -void LevelEditorMenuHandler::AddMenuAction(AZStd::string_view categoryId, QAction* action) +void LevelEditorMenuHandler::AddMenuAction(AZStd::string_view categoryId, QAction* action, bool addToToolsToolbar) { auto menuWrapper = m_actionManager->FindMenu(categoryId.data()); if (menuWrapper.isNull()) @@ -1301,6 +1301,11 @@ void LevelEditorMenuHandler::AddMenuAction(AZStd::string_view categoryId, QActio return; } menuWrapper.Get()->addAction(action); + + if (addToToolsToolbar) + { + m_mainWindow->GetToolbarManager()->AddButtonToEditToolbar(action); + } } void LevelEditorMenuHandler::RestoreEditMenuToDefault() diff --git a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.h b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.h index bad689ae67..aaa2c08622 100644 --- a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.h +++ b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.h @@ -98,7 +98,7 @@ private: // EditorMenuRequestBus void AddEditMenuAction(QAction* action) override; - void AddMenuAction(AZStd::string_view categoryId, QAction* action) override; + void AddMenuAction(AZStd::string_view categoryId, QAction* action, bool addToToolsToolbar) override; void RestoreEditMenuToDefault() override; MainWindow* m_mainWindow; diff --git a/Code/Sandbox/Editor/TrackView/TrackViewDialog.cpp b/Code/Sandbox/Editor/TrackView/TrackViewDialog.cpp index 0179b779e8..9176520b15 100644 --- a/Code/Sandbox/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Sandbox/Editor/TrackView/TrackViewDialog.cpp @@ -116,6 +116,8 @@ void CTrackViewDialog::RegisterViewClass() AzToolsFramework::ViewPaneOptions opts; opts.shortcut = QKeySequence(Qt::Key_T); opts.isDisabledInSimMode = true; + opts.showOnToolsToolbar = true; + opts.toolbarIcon = ":/Menu/trackview_editor.svg"; AzToolsFramework::RegisterViewPane(LyViewPane::TrackView, LyViewPane::CategoryTools, opts); GetIEditor()->GetSettingsManager()->AddToolName(s_kTrackViewLayoutSection, LyViewPane::TrackView); diff --git a/Code/Sandbox/Editor/ViewportTitleDlg.cpp b/Code/Sandbox/Editor/ViewportTitleDlg.cpp index 716568b5c7..dc4815eb6a 100644 --- a/Code/Sandbox/Editor/ViewportTitleDlg.cpp +++ b/Code/Sandbox/Editor/ViewportTitleDlg.cpp @@ -154,11 +154,6 @@ void CViewportTitleDlg::SetupCameraDropdownMenu() QAction* gotoPositionAction = new QAction("Go to position", cameraMenu); connect(gotoPositionAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedGotoPosition); cameraMenu->addAction(gotoPositionAction); - m_syncPlayerToCameraAction = new QAction("Sync camera to player", cameraMenu); - m_syncPlayerToCameraAction->setCheckable(true); - connect(m_syncPlayerToCameraAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedSyncplayer); - cameraMenu->addAction(m_syncPlayerToCameraAction); - cameraMenu->addSeparator(); auto cameraSpeedActionWidget = new QWidgetAction(cameraMenu); @@ -238,21 +233,15 @@ void CViewportTitleDlg::SetupOverflowMenu() overFlowMenu->addAction(m_enableGridSnappingAction); m_gridSizeActionWidget = new QWidgetAction(overFlowMenu); - auto gridSizeContainer = new QWidget(overFlowMenu); - auto gridSizeLabel = new QLabel(tr("Grid Size"), overFlowMenu); - m_gridSpinBox = new AzQtComponents::DoubleSpinBox(); m_gridSpinBox->setValue(SandboxEditor::GridSnappingSize()); m_gridSpinBox->setMinimum(1e-2f); + m_gridSpinBox->setToolTip(tr("Grid size")); QObject::connect( m_gridSpinBox, QOverload::of(&AzQtComponents::DoubleSpinBox::valueChanged), this, &CViewportTitleDlg::OnGridSpinBoxChanged); - QHBoxLayout* gridSizeLayout = new QHBoxLayout; - gridSizeLayout->addWidget(gridSizeLabel); - gridSizeLayout->addWidget(m_gridSpinBox); - gridSizeContainer->setLayout(gridSizeLayout); - m_gridSizeActionWidget->setDefaultWidget(gridSizeContainer); + m_gridSizeActionWidget->setDefaultWidget(m_gridSpinBox); overFlowMenu->addAction(m_gridSizeActionWidget); overFlowMenu->addSeparator(); @@ -263,22 +252,16 @@ void CViewportTitleDlg::SetupOverflowMenu() overFlowMenu->addAction(m_enableAngleSnappingAction); m_angleSizeActionWidget = new QWidgetAction(overFlowMenu); - auto angleSizeContainer = new QWidget(overFlowMenu); - auto angleSizeLabel = new QLabel(tr("Angle Snapping"), overFlowMenu); - m_angleSpinBox = new AzQtComponents::DoubleSpinBox(); m_angleSpinBox->setValue(SandboxEditor::AngleSnappingSize()); m_angleSpinBox->setMinimum(1e-2f); + m_angleSpinBox->setToolTip(tr("Angle Snapping")); QObject::connect( m_angleSpinBox, QOverload::of(&AzQtComponents::DoubleSpinBox::valueChanged), this, &CViewportTitleDlg::OnAngleSpinBoxChanged); - QHBoxLayout* angleSizeLayout = new QHBoxLayout; - angleSizeLayout->addWidget(angleSizeLabel); - angleSizeLayout->addWidget(m_angleSpinBox); - angleSizeContainer->setLayout(angleSizeLayout); - m_angleSizeActionWidget->setDefaultWidget(angleSizeContainer); + m_angleSizeActionWidget->setDefaultWidget(m_angleSpinBox); overFlowMenu->addAction(m_angleSizeActionWidget); m_ui->m_overflowBtn->setMenu(overFlowMenu); @@ -850,14 +833,6 @@ bool CViewportTitleDlg::eventFilter(QObject* object, QEvent* event) return QWidget::eventFilter(object, event) || consumeEvent; } -void CViewportTitleDlg::OnBnClickedSyncplayer() -{ - emit ActionTriggered(ID_GAME_SYNCPLAYER); - - bool bSyncPlayer = GetIEditor()->GetGameEngine()->IsSyncPlayerPosition(); - m_syncPlayerToCameraAction->setChecked(!bSyncPlayer); -} - void CViewportTitleDlg::OnBnClickedGotoPosition() { emit ActionTriggered(ID_DISPLAY_GOTOPOSITION); diff --git a/Code/Sandbox/Editor/ViewportTitleDlg.h b/Code/Sandbox/Editor/ViewportTitleDlg.h index dd0816082a..21a54bea0a 100644 --- a/Code/Sandbox/Editor/ViewportTitleDlg.h +++ b/Code/Sandbox/Editor/ViewportTitleDlg.h @@ -143,7 +143,6 @@ protected: void SetFullViewportInfo(); void SetCompactViewportInfo(); - void OnBnClickedSyncplayer(); void OnBnClickedGotoPosition(); void OnBnClickedMuteAudio(); void OnBnClickedEnableVR(); @@ -174,7 +173,6 @@ protected: QAction* m_fullInformationAction = nullptr; QAction* m_compactInformationAction = nullptr; QAction* m_debugHelpersAction = nullptr; - QAction* m_syncPlayerToCameraAction = nullptr; QAction* m_audioMuteAction = nullptr; QAction* m_enableVRAction = nullptr; QAction* m_enableGridSnappingAction = nullptr; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp index e9a81f2e9f..06530b53b2 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp @@ -151,6 +151,7 @@ namespace AZ m_openMaterialEditorAction->setShortcut(QKeySequence(Qt::Key_M)); m_openMaterialEditorAction->setCheckable(false); m_openMaterialEditorAction->setChecked(false); + m_openMaterialEditorAction->setIcon(QIcon(":/Menu/material_editor.svg")); QObject::connect( m_openMaterialEditorAction, &QAction::triggered, m_openMaterialEditorAction, [this]() { @@ -158,7 +159,7 @@ namespace AZ } ); - AzToolsFramework::EditorMenuRequestBus::Broadcast(&AzToolsFramework::EditorMenuRequestBus::Handler::AddMenuAction, "ToolMenu", m_openMaterialEditorAction); + AzToolsFramework::EditorMenuRequestBus::Broadcast(&AzToolsFramework::EditorMenuRequestBus::Handler::AddMenuAction, "ToolMenu", m_openMaterialEditorAction, true); } } diff --git a/Gems/EMotionFX/Code/Source/Integration/System/SystemComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/System/SystemComponent.cpp index 8e68c8cb44..61a5e89d80 100644 --- a/Gems/EMotionFX/Code/Source/Integration/System/SystemComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/System/SystemComponent.cpp @@ -891,6 +891,9 @@ namespace EMotionFX emotionFXWindowOptions.detachedWindow = true; #endif emotionFXWindowOptions.optionalMenuText = "Animation Editor"; + emotionFXWindowOptions.showOnToolsToolbar = true; + emotionFXWindowOptions.toolbarIcon = ":/Menu/emfx_editor.svg"; + EditorRequests::Bus::Broadcast(&EditorRequests::RegisterViewPane, EMStudio::MainWindow::GetEMotionFXPaneName(), LyViewPane::CategoryTools, emotionFXWindowOptions, windowCreationFunc); } diff --git a/Gems/LandscapeCanvas/Code/Source/LandscapeCanvasSystemComponent.cpp b/Gems/LandscapeCanvas/Code/Source/LandscapeCanvasSystemComponent.cpp index 72f7a65966..9e0129c6fe 100644 --- a/Gems/LandscapeCanvas/Code/Source/LandscapeCanvasSystemComponent.cpp +++ b/Gems/LandscapeCanvas/Code/Source/LandscapeCanvasSystemComponent.cpp @@ -146,6 +146,9 @@ namespace LandscapeCanvas { AzToolsFramework::ViewPaneOptions options; options.paneRect = QRect(100, 100, 1280, 1024); + options.showOnToolsToolbar = true; + options.toolbarIcon = ":/Menu/landscape_canvas_editor.svg"; + AzToolsFramework::RegisterViewPane(LyViewPane::LandscapeCanvas, LyViewPane::CategoryTools, options); } diff --git a/Gems/LyShine/Code/Editor/LyShineEditorSystemComponent.cpp b/Gems/LyShine/Code/Editor/LyShineEditorSystemComponent.cpp index d1c7ce96a4..19a47efdcd 100644 --- a/Gems/LyShine/Code/Editor/LyShineEditorSystemComponent.cpp +++ b/Gems/LyShine/Code/Editor/LyShineEditorSystemComponent.cpp @@ -153,6 +153,8 @@ namespace LyShineEditor opt.isPreview = true; opt.paneRect = QRect(x, y, (int)editorWidth, (int)editorHeight); opt.isDeletable = true; // we're in a plugin; make sure we can be deleted + opt.showOnToolsToolbar = true; + opt.toolbarIcon = ":/Menu/ui_editor.svg"; // opt.canHaveMultipleInstances = true; // uncomment this when CUiAnimViewSequenceManager::CanvasUnloading supports multiple canvases AzToolsFramework::RegisterViewPane(LyViewPane::UiEditor, LyViewPane::CategoryTools, opt); diff --git a/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp b/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp index 1d4d1e8605..1ba9a64083 100644 --- a/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp +++ b/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp @@ -167,6 +167,8 @@ namespace ScriptCanvasEditor options.canHaveMultipleInstances = false; options.isPreview = true; options.showInMenu = true; + options.showOnToolsToolbar = true; + options.toolbarIcon = ":/Menu/script_canvas_editor.svg"; AzToolsFramework::RegisterViewPane(LyViewPane::ScriptCanvas, LyViewPane::CategoryTools, options); }