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:
@@ -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*/) {}
|
||||
|
||||
|
||||
@@ -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<EditorContextMenuEvents>;
|
||||
|
||||
+2
-2
@@ -26,6 +26,7 @@
|
||||
|
||||
#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>
|
||||
@@ -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);
|
||||
|
||||
+1
-1
@@ -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(
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+20
-8
@@ -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<int>(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()
|
||||
|
||||
+7
-1
@@ -22,6 +22,7 @@
|
||||
#include <AzToolsFramework/API/EditorCameraBus.h>
|
||||
#include <AzToolsFramework/Commands/EntityManipulatorCommand.h>
|
||||
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
|
||||
#include <AzToolsFramework/Editor/EditorContextMenuBus.h>
|
||||
#include <AzToolsFramework/Manipulators/BaseManipulator.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorLockComponentBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorVisibilityBus.h>
|
||||
@@ -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 ...
|
||||
|
||||
Reference in New Issue
Block a user