Moved toggle pivot to lower in the context menu, converted all context menu additions to use a singular mechanism (#1209)
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
|
||||
#include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
|
||||
#include <AzToolsFramework/Editor/EditorContextMenuBus.h>
|
||||
#include <AzToolsFramework/Manipulators/ManipulatorManager.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemViewportSelectionRequestBus.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
@@ -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);
|
||||
|
||||
@@ -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*/);
|
||||
|
||||
|
||||
@@ -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<int>(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(); });
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <AzFramework/Viewport/DisplayContextRequestBus.h>
|
||||
#include <AzToolsFramework/API/EditorWindowRequestBus.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/Editor/EditorContextMenuBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorLayerComponentBus.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
|
||||
#include <AzToolsFramework/UI/Layer/LayerUiHandler.h>
|
||||
@@ -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;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <AzQtComponents/Utilities/QtViewPaneEffects.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/Commands/SelectionCommand.h>
|
||||
#include <AzToolsFramework/Editor/EditorContextMenuBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user