diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/API/ToolsApplicationAPI.h b/Code/Framework/AzToolsFramework/AzToolsFramework/API/ToolsApplicationAPI.h index 72150b1b57..ab5c58c72a 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/API/ToolsApplicationAPI.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/API/ToolsApplicationAPI.h @@ -916,9 +916,6 @@ namespace AzToolsFramework eECMF_USE_VIEWPORT_CENTER = 0x2, }; - /// Populate global edit-time context menu. - virtual void PopulateEditorGlobalContextMenu(QMenu * /*menu*/, const AZ::Vector2& /*point*/, int /*flags*/) {} - /// Populate slice portion of edit-time context menu virtual void PopulateEditorGlobalContextMenu_SliceSection(QMenu * /*menu*/, const AZ::Vector2& /*point*/, int /*flags*/) {} diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Editor/EditorContextMenuBus.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Editor/EditorContextMenuBus.h index 33710e68f3..e8f37be539 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Editor/EditorContextMenuBus.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Editor/EditorContextMenuBus.h @@ -79,7 +79,7 @@ namespace AzToolsFramework * This is the menu that appears when right clicking the main editor window, * including the Entity Outliner and the Viewport. */ - virtual void PopulateEditorGlobalContextMenu(QMenu* menu) const = 0; + virtual void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) = 0; }; using EditorContextMenuBus = AZ::EBus; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp index 8293614525..d569d266ab 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -544,8 +545,7 @@ namespace AzToolsFramework QMenu* contextMenu = new QMenu(this); // Populate global context menu. - EBUS_EVENT(EditorEvents::Bus, - PopulateEditorGlobalContextMenu, + AzToolsFramework::EditorContextMenuBus::Broadcast(&AzToolsFramework::EditorContextMenuEvents::PopulateEditorGlobalContextMenu, contextMenu, AZ::Vector2::CreateZero(), EditorEvents::eECMF_HIDE_ENTITY_CREATION | EditorEvents::eECMF_USE_VIEWPORT_CENTER); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp index 9d01911532..77918565e4 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp @@ -119,7 +119,7 @@ namespace AzToolsFramework return "Prefabs"; } - void PrefabIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu) const + void PrefabIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, [[maybe_unused]] const AZ::Vector2& point, [[maybe_unused]] int flags) { AzToolsFramework::EntityIdList selectedEntities; AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.h b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.h index 69ec3013cc..a3a9bc3741 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.h @@ -65,7 +65,7 @@ namespace AzToolsFramework // EditorContextMenuBus... int GetMenuPosition() const override; AZStd::string GetMenuIdentifier() const override; - void PopulateEditorGlobalContextMenu(QMenu* menu) const override; + void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override; // EntityOutlinerSourceDropHandlingBus... void HandleSourceFileType(AZStd::string_view sourceFilePath, AZ::EntityId parentId, AZ::Vector3 position) const override; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp index 308f0f074f..4521f45783 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp @@ -13,6 +13,7 @@ #include "EditorContextMenu.h" #include "AzToolsFramework/Viewport/ViewportMessages.h" +#include "Editor/EditorContextMenuBus.h" namespace AzToolsFramework { @@ -55,8 +56,7 @@ namespace AzToolsFramework // Populate global context menu. const int contextMenuFlag = 0; - EditorEvents::Bus::BroadcastReverse( - &EditorEvents::PopulateEditorGlobalContextMenu, contextMenu.m_menu.data(), + AzToolsFramework::EditorContextMenuBus::Broadcast(&AzToolsFramework::EditorContextMenuEvents::PopulateEditorGlobalContextMenu, contextMenu.m_menu.data(), AzFramework::Vector2FromScreenPoint(mouseInteraction.m_mouseInteraction.m_mousePick.m_screenCoordinates), contextMenuFlag); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp index eadb870563..c503386ab5 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp @@ -1018,6 +1018,7 @@ namespace AzToolsFramework EditorEntityVisibilityNotificationBus::Router::BusRouterConnect(); EditorEntityLockComponentNotificationBus::Router::BusRouterConnect(); EditorManipulatorCommandUndoRedoRequestBus::Handler::BusConnect(entityContextId); + EditorContextMenuBus::Handler::BusConnect(); CreateTransformModeSelectionCluster(); CreateSpaceSelectionCluster(); @@ -1038,6 +1039,7 @@ namespace AzToolsFramework m_pivotOverrideFrame.Reset(); + EditorContextMenuBus::Handler::BusConnect(); EditorManipulatorCommandUndoRedoRequestBus::Handler::BusDisconnect(); EditorEntityLockComponentNotificationBus::Router::BusRouterDisconnect(); EditorEntityVisibilityNotificationBus::Router::BusRouterDisconnect(); @@ -3097,15 +3099,25 @@ namespace AzToolsFramework } } - void EditorTransformComponentSelection::PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& /*point*/, const int /*flags*/) + int EditorTransformComponentSelection::GetMenuPosition() const { - QAction* action = menu->addAction(QObject::tr(s_togglePivotTitleRightClick)); - QObject::connect( - action, &QAction::triggered, action, - [this]() - { - ToggleCenterPivotSelection(); - }); + return aznumeric_cast(EditorContextMenuOrdering::BOTTOM); + } + + AZStd::string EditorTransformComponentSelection::GetMenuIdentifier() const + { + return "Transform Component"; + } + + void EditorTransformComponentSelection::PopulateEditorGlobalContextMenu(QMenu* menu, [[maybe_unused]] const AZ::Vector2& point, [[maybe_unused]] int flags) + { + QAction* action = menu->addAction(QObject::tr(s_togglePivotTitleRightClick)); + QObject::connect( + action, &QAction::triggered, action, + [this]() + { + ToggleCenterPivotSelection(); + }); } void EditorTransformComponentSelection::BeforeEntitySelectionChanged() diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h index 2ec7fa2489..1b52911978 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -126,6 +127,7 @@ namespace AzToolsFramework //! Provide a suite of functionality for manipulating entities, primarily through their TransformComponent. class EditorTransformComponentSelection : public ViewportInteraction::ViewportSelectionRequests + , public EditorContextMenuBus::Handler , private EditorEventsBus::Handler , private EditorTransformComponentSelectionRequestBus::Handler , private ToolsApplicationNotificationBus::Handler @@ -238,8 +240,12 @@ namespace AzToolsFramework void UndoRedoEntityManipulatorCommand( AZ::u8 pivotOverride, const AZ::Transform& transform, AZ::EntityId entityId) override; + // EditorContextMenuBus... + void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2 & point, int flags) override; + int GetMenuPosition() const override; + AZStd::string GetMenuIdentifier() const override; + // EditorEventsBus ... - void PopulateEditorGlobalContextMenu(QMenu *menu, const AZ::Vector2& point, int flags) override; void OnEscape() override; // ToolsApplicationNotificationBus ... diff --git a/Code/Sandbox/Editor/RenderViewport.cpp b/Code/Sandbox/Editor/RenderViewport.cpp index 8cef9e802c..bd30bc7c79 100644 --- a/Code/Sandbox/Editor/RenderViewport.cpp +++ b/Code/Sandbox/Editor/RenderViewport.cpp @@ -49,6 +49,7 @@ // AzToolsFramework #include #include +#include #include #include #include @@ -112,20 +113,20 @@ static const char TextCantCreateCameraNoLevel[] = "Cannot create camera when no class EditorEntityNotifications : public AzToolsFramework::EditorEntityContextNotificationBus::Handler - , public AzToolsFramework::EditorEvents::Bus::Handler + , public AzToolsFramework::EditorContextMenuBus::Handler { public: EditorEntityNotifications(CRenderViewport& renderViewport) : m_renderViewport(renderViewport) { AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect(); - AzToolsFramework::EditorEvents::Bus::Handler::BusConnect(); + AzToolsFramework::EditorContextMenuBus::Handler::BusConnect(); } ~EditorEntityNotifications() override { AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect(); - AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect(); + AzToolsFramework::EditorContextMenuBus::Handler::BusDisconnect(); } // AzToolsFramework::EditorEntityContextNotificationBus @@ -138,7 +139,7 @@ public: m_renderViewport.OnStopPlayInEditor(); } - // AzToolsFramework::EditorEvents::Bus + // AzToolsFramework::EditorContextMenu::Bus void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override { m_renderViewport.PopulateEditorGlobalContextMenu(menu, point, flags); diff --git a/Code/Sandbox/Editor/RenderViewport.h b/Code/Sandbox/Editor/RenderViewport.h index b45c92b1c8..d7d362fe27 100644 --- a/Code/Sandbox/Editor/RenderViewport.h +++ b/Code/Sandbox/Editor/RenderViewport.h @@ -179,7 +179,7 @@ public: virtual void OnStartPlayInEditor(); virtual void OnStopPlayInEditor(); - // AzToolsFramework::EditorEvents::Bus (handler moved to cpp to resolve link issues in unity builds) + // AzToolsFramework::EditorContextMenu::Bus (handler moved to cpp to resolve link issues in unity builds) // We use this to determine when the viewport context menu is being displayed so we can exit move mode void PopulateEditorGlobalContextMenu(QMenu* /*menu*/, const AZ::Vector2& /*point*/, int /*flags*/); diff --git a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp index 694714cc6e..3b04fc70f8 100644 --- a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp +++ b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp @@ -167,7 +167,7 @@ void SandboxIntegrationManager::Setup() AzToolsFramework::ToolsApplicationEvents::Bus::Handler::BusConnect(); AzToolsFramework::EditorRequests::Bus::Handler::BusConnect(); AzToolsFramework::EditorWindowRequests::Bus::Handler::BusConnect(); - AzToolsFramework::EditorEvents::Bus::Handler::BusConnect(); + AzToolsFramework::EditorContextMenuBus::Handler::BusConnect(); AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect(); AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusConnect(); @@ -384,7 +384,7 @@ void SandboxIntegrationManager::Teardown() AzFramework::DisplayContextRequestBus::Handler::BusDisconnect(); AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect(); AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect(); - AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect(); + AzToolsFramework::EditorContextMenuBus::Handler::BusDisconnect(); AzToolsFramework::EditorWindowRequests::Bus::Handler::BusDisconnect(); AzToolsFramework::EditorRequests::Bus::Handler::BusDisconnect(); AzToolsFramework::ToolsApplicationEvents::Bus::Handler::BusDisconnect(); @@ -589,6 +589,11 @@ void SandboxIntegrationManager::OnSaveLevel() m_unsavedEntities.clear(); } +int SandboxIntegrationManager::GetMenuPosition() const +{ + return aznumeric_cast(AzToolsFramework::EditorContextMenuOrdering::TOP); +} + void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) { if (!IsLevelDocumentOpen()) @@ -662,13 +667,6 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con SetupSliceContextMenu(menu); } - else - { - menu->addSeparator(); - - // Allow handlers to append menu items to the context menu - AzToolsFramework::EditorContextMenuBus::Broadcast(&AzToolsFramework::EditorContextMenuEvents::PopulateEditorGlobalContextMenu, menu); - } action = menu->addAction(QObject::tr("Duplicate")); QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_Duplicate(); }); diff --git a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h index 6d714b67df..5cb03cc99f 100644 --- a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h +++ b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -97,7 +98,7 @@ class SandboxIntegrationManager : private AzToolsFramework::ToolsApplicationEvents::Bus::Handler , private AzToolsFramework::EditorRequests::Bus::Handler , private AzToolsFramework::EditorPickModeNotificationBus::Handler - , private AzToolsFramework::EditorEvents::Bus::Handler + , private AzToolsFramework::EditorContextMenuBus::Handler , private AzToolsFramework::EditorWindowRequests::Bus::Handler , private AzFramework::AssetCatalogEventBus::Handler , private AzFramework::DisplayContextRequestBus::Handler @@ -184,8 +185,9 @@ private: void OnEntityPickModeStopped() override; ////////////////////////////////////////////////////////////////////////// - // AzToolsFramework::EditorEvents::Bus::Handler overrides + // AzToolsFramework::EditorContextMenu::Bus::Handler overrides void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override; + int GetMenuPosition() const; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp index fb8084cb6f..33126c7f3e 100644 --- a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp +++ b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -530,8 +531,8 @@ void OutlinerWidget::contextMenuEvent(QContextMenuEvent* event) QMenu* contextMenu = new QMenu(this); // Populate global context menu. - EBUS_EVENT(AzToolsFramework::EditorEvents::Bus, - PopulateEditorGlobalContextMenu, + + AzToolsFramework::EditorContextMenuBus::Broadcast(&AzToolsFramework::EditorContextMenuEvents::PopulateEditorGlobalContextMenu, contextMenu, AZ::Vector2::CreateZero(), AzToolsFramework::EditorEvents::eECMF_HIDE_ENTITY_CREATION | AzToolsFramework::EditorEvents::eECMF_USE_VIEWPORT_CENTER); diff --git a/Gems/Camera/Code/Source/CameraEditorSystemComponent.cpp b/Gems/Camera/Code/Source/CameraEditorSystemComponent.cpp index 9b6202b6c6..33290b9cfe 100644 --- a/Gems/Camera/Code/Source/CameraEditorSystemComponent.cpp +++ b/Gems/Camera/Code/Source/CameraEditorSystemComponent.cpp @@ -61,6 +61,7 @@ namespace Camera void CameraEditorSystemComponent::Activate() { + AzToolsFramework::EditorContextMenuBus::Handler::BusConnect(); AzToolsFramework::EditorEvents::Bus::Handler::BusConnect(); Camera::EditorCameraSystemRequestBus::Handler::BusConnect(); Camera::CameraViewRegistrationRequestsBus::Handler::BusConnect(); @@ -71,6 +72,7 @@ namespace Camera Camera::CameraViewRegistrationRequestsBus::Handler::BusDisconnect(); Camera::EditorCameraSystemRequestBus::Handler::BusDisconnect(); AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect(); + AzToolsFramework::EditorContextMenuBus::Handler::BusDisconnect(); } void CameraEditorSystemComponent::PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2&, int flags) diff --git a/Gems/Camera/Code/Source/CameraEditorSystemComponent.h b/Gems/Camera/Code/Source/CameraEditorSystemComponent.h index ec361c1afd..44f23f38e6 100644 --- a/Gems/Camera/Code/Source/CameraEditorSystemComponent.h +++ b/Gems/Camera/Code/Source/CameraEditorSystemComponent.h @@ -15,6 +15,7 @@ #include #include +#include #include "CameraViewRegistrationBus.h" @@ -25,6 +26,7 @@ namespace Camera , private AzToolsFramework::EditorEvents::Bus::Handler , private EditorCameraSystemRequestBus::Handler , private CameraViewRegistrationRequestsBus::Handler + , private AzToolsFramework::EditorContextMenuBus::Handler { public: AZ_COMPONENT(CameraEditorSystemComponent, "{769802EB-722A-4F89-A475-DA396DA1FDCC}"); @@ -40,9 +42,13 @@ namespace Camera ////////////////////////////////////////////////////////////////////////// private: + ////////////////////////////////////////////////////////////////////////// + // AzToolsFramework::EditorContextMenuBus + void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override; + ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// // AzToolsFramework::EditorEvents - void PopulateEditorGlobalContextMenu(QMenu *menu, const AZ::Vector2& point, int flags) override; void NotifyRegisterViews() override; ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.cpp b/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.cpp index b28bf6ab4a..fff13d2f39 100644 --- a/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.cpp +++ b/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.cpp @@ -134,6 +134,7 @@ namespace PhysX void EditorSystemComponent::Activate() { Physics::EditorWorldBus::Handler::BusConnect(); + AzToolsFramework::EditorContextMenuBus::Handler::BusConnect(); m_onMaterialLibraryLoadErrorEventHandler = AzPhysics::SystemEvents::OnMaterialLibraryLoadErrorEvent::Handler( [this]([[maybe_unused]] AzPhysics::SystemEvents::MaterialLibraryLoadErrorType error) @@ -168,6 +169,7 @@ namespace PhysX { AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect(); AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect(); + AzToolsFramework::EditorContextMenuBus::Handler::BusDisconnect(); Physics::EditorWorldBus::Handler::BusDisconnect(); if (auto* physicsSystem = AZ::Interface::Get()) diff --git a/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.h b/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.h index 4bd11a951f..8105709244 100644 --- a/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.h +++ b/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.h @@ -15,6 +15,7 @@ #include #include #include +#include #include namespace AzPhysics @@ -32,6 +33,7 @@ namespace PhysX , public Physics::EditorWorldBus::Handler , private AzToolsFramework::EditorEntityContextNotificationBus::Handler , private AzToolsFramework::EditorEvents::Bus::Handler + , private AzToolsFramework::EditorContextMenuBus::Handler { public: AZ_COMPONENT(EditorSystemComponent, "{560F08DC-94F5-4D29-9AD4-CDFB3B57C654}"); @@ -62,8 +64,10 @@ namespace PhysX void OnStartPlayInEditorBegin() override; void OnStopPlayInEditor() override; - // AztoolsFramework::EditorEvents::Bus::Handler + // AztoolsFramework::EditorContextMenuBus::Handler void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override; + + // AztoolsFramework::EditorEvents::Bus::Handler void NotifyRegisterViews() override; AZStd::optional> RetrieveDefaultMaterialLibrary(); diff --git a/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp b/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp index 60e8e5f23a..1d4d1e8605 100644 --- a/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp +++ b/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp @@ -66,6 +66,7 @@ namespace ScriptCanvasEditor SystemComponent::~SystemComponent() { AzToolsFramework::UnregisterViewPane(LyViewPane::ScriptCanvas); + AzToolsFramework::EditorContextMenuBus::Handler::BusDisconnect(); AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect(); AzFramework::AssetCatalogEventBus::Handler::BusDisconnect(); AzToolsFramework::AssetSeedManagerRequests::Bus::Handler::BusDisconnect(); @@ -119,6 +120,7 @@ namespace ScriptCanvasEditor void SystemComponent::Init() { AzToolsFramework::EditorEvents::Bus::Handler::BusConnect(); + AzToolsFramework::EditorContextMenuBus::Handler::BusConnect(); } void SystemComponent::Activate() diff --git a/Gems/ScriptCanvas/Code/Editor/SystemComponent.h b/Gems/ScriptCanvas/Code/Editor/SystemComponent.h index f2ebad38cd..ced5a67a4c 100644 --- a/Gems/ScriptCanvas/Code/Editor/SystemComponent.h +++ b/Gems/ScriptCanvas/Code/Editor/SystemComponent.h @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -42,6 +43,7 @@ namespace ScriptCanvasEditor , private AZ::Data::AssetBus::MultiHandler , private AZ::Interface::Registrar , private AzToolsFramework::AssetSeedManagerRequests::Bus::Handler + , private AzToolsFramework::EditorContextMenuBus::Handler { public: AZ_COMPONENT(SystemComponent, "{1DE7A120-4371-4009-82B5-8140CB1D7B31}"); @@ -71,8 +73,12 @@ namespace ScriptCanvasEditor //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// - // AztoolsFramework::EditorEvents::Bus::Handler... + // AztoolsFramework::EditorContextMenuBus::Handler... void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override; + //////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////// + // AztoolsFramework::EditorEvents::Bus::Handler... void NotifyRegisterViews() override; ////////////////////////////////////////////////////////////////////////