Cherry Picking (lyn1751) (#1854)
* Cherry Picking (lyn1751) Problem with DCO so we need to cherry pick this branch. Signed-off-by: aaguilea <aaguilea@amazon.com> * Cherry picking #2 Signed-off-by: aaguilea <aaguilea@amazon.com> * Cherry picking 3 Signed-off-by: aaguilea <aaguilea@amazon.com> * Changed variables reverseurls This was just changing some name variables. Signed-off-by: aaguilea <aaguilea@amazon.com> * Changes from past PR Signed-off-by: aaguilea <aaguilea@amazon.com> * changes from past PR and fixed small bug: Also removed some legacy code from Resources.h Signed-off-by: aaguilea <aaguilea@amazon.com> * couple of changes from actual PR Signed-off-by: aaguilea <aaguilea@amazon.com> * fixed copyright issues for AR Signed-off-by: aaguilea <aaguilea@amazon.com>
This commit is contained in:
committed by
GitHub
parent
a3d14e217e
commit
4f523e496f
+12
@@ -104,6 +104,18 @@ namespace UnitTest
|
||||
}
|
||||
}
|
||||
|
||||
void TestEditorActions::AddActionViaBusCrc(AZ::Crc32 id, QAction* action)
|
||||
{
|
||||
AZ_Assert(action, "Attempting to add a null action");
|
||||
|
||||
if (action)
|
||||
{
|
||||
action->setData(aznumeric_cast<AZ::u32>(id));
|
||||
action->setShortcutContext(Qt::ApplicationShortcut);
|
||||
m_defaultWidget.addAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
void TestEditorActions::RemoveActionViaBus(QAction* action)
|
||||
{
|
||||
AZ_Assert(action, "Attempting to remove a null action");
|
||||
|
||||
+1
@@ -86,6 +86,7 @@ namespace UnitTest
|
||||
{
|
||||
// EditorActionRequestBus ...
|
||||
void AddActionViaBus(int id, QAction* action) override;
|
||||
void AddActionViaBusCrc(AZ::Crc32 id, QAction* action) override;
|
||||
void RemoveActionViaBus(QAction* action) override;
|
||||
void EnableDefaultActions() override;
|
||||
void DisableDefaultActions() override;
|
||||
|
||||
@@ -150,6 +150,8 @@ namespace AzToolsFramework
|
||||
|
||||
/// Allow default actions to be added to the Action Manager via a Bus call.
|
||||
virtual void AddActionViaBus(int id, QAction* action) = 0;
|
||||
/// Allow default actions to be added to the Action Manager via a Bus call and using the CRC id method.
|
||||
virtual void AddActionViaBusCrc(AZ::Crc32 id, QAction* action) = 0;
|
||||
/// Remove default actions added to the Action Manager via a Bus Call.
|
||||
virtual void RemoveActionViaBus(QAction* action) = 0;
|
||||
/// Enable all default actions that are active during the normal Editor state.
|
||||
|
||||
+20
-39
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
@@ -2018,7 +2018,7 @@ namespace AzToolsFramework
|
||||
static void AddAction(
|
||||
AZStd::vector<AZStd::unique_ptr<QAction>>& actions,
|
||||
const QList<QKeySequence>& keySequences,
|
||||
int actionId,
|
||||
AZ::Crc32 actionId,
|
||||
const QString& name,
|
||||
const QString& statusTip,
|
||||
const T& callback)
|
||||
@@ -2033,7 +2033,7 @@ namespace AzToolsFramework
|
||||
|
||||
QObject::connect(actions.back().get(), &QAction::triggered, actions.back().get(), callback);
|
||||
|
||||
EditorActionRequestBus::Broadcast(&EditorActionRequests::AddActionViaBus, actionId, actions.back().get());
|
||||
EditorActionRequestBus::Broadcast(&EditorActionRequests::AddActionViaBusCrc, actionId, actions.back().get());
|
||||
}
|
||||
|
||||
void EditorTransformComponentSelection::OnEscape()
|
||||
@@ -2081,8 +2081,6 @@ namespace AzToolsFramework
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
// note: see Code/Editor/Resource.h for ID_EDIT_<action> ids
|
||||
|
||||
const auto lockUnlock = [this](const bool lock)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
@@ -2107,8 +2105,7 @@ namespace AzToolsFramework
|
||||
|
||||
// lock selection
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::Key_L) },
|
||||
/*ID_EDIT_FREEZE =*/32900, s_lockSelectionTitle, s_lockSelectionDesc,
|
||||
m_actions, { QKeySequence(Qt::Key_L) }, LockSelection, s_lockSelectionTitle, s_lockSelectionDesc,
|
||||
[lockUnlock]()
|
||||
{
|
||||
lockUnlock(true);
|
||||
@@ -2116,8 +2113,7 @@ namespace AzToolsFramework
|
||||
|
||||
// unlock selection
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_L) },
|
||||
/*ID_EDIT_UNFREEZE =*/32973, s_lockSelectionTitle, s_lockSelectionDesc,
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_L) }, UnlockSelection, s_lockSelectionTitle, s_lockSelectionDesc,
|
||||
[lockUnlock]()
|
||||
{
|
||||
lockUnlock(false);
|
||||
@@ -2147,8 +2143,7 @@ namespace AzToolsFramework
|
||||
|
||||
// hide selection
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::Key_H) },
|
||||
/*ID_EDIT_HIDE =*/32898, s_hideSelectionTitle, s_hideSelectionDesc,
|
||||
m_actions, { QKeySequence(Qt::Key_H) }, HideSelection, s_hideSelectionTitle, s_hideSelectionDesc,
|
||||
[showHide]()
|
||||
{
|
||||
showHide(false);
|
||||
@@ -2156,8 +2151,7 @@ namespace AzToolsFramework
|
||||
|
||||
// show selection
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_H) },
|
||||
/*ID_EDIT_UNHIDE =*/32974, s_hideSelectionTitle, s_hideSelectionDesc,
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_H) }, ShowSelection, s_hideSelectionTitle, s_hideSelectionDesc,
|
||||
[showHide]()
|
||||
{
|
||||
showHide(true);
|
||||
@@ -2165,8 +2159,7 @@ namespace AzToolsFramework
|
||||
|
||||
// unlock all entities in the level/scene
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L) },
|
||||
/*ID_EDIT_UNFREEZEALL =*/32901, s_unlockAllTitle, s_unlockAllDesc,
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L) }, UnlockAll, s_unlockAllTitle, s_unlockAllDesc,
|
||||
[]()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
@@ -2183,8 +2176,7 @@ namespace AzToolsFramework
|
||||
|
||||
// show all entities in the level/scene
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_H) },
|
||||
/*ID_EDIT_UNHIDEALL =*/32899, s_showAllTitle, s_showAllDesc,
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_H) }, ShowAll, s_showAllTitle, s_showAllDesc,
|
||||
[]()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
@@ -2201,8 +2193,7 @@ namespace AzToolsFramework
|
||||
|
||||
// select all entities in the level/scene
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_A) },
|
||||
/*ID_EDIT_SELECTALL =*/33376, s_selectAllTitle, s_selectAllDesc,
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_A) }, SelectAll, s_selectAllTitle, s_selectAllDesc,
|
||||
[this]()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
@@ -2242,8 +2233,7 @@ namespace AzToolsFramework
|
||||
|
||||
// invert current selection
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I) },
|
||||
/*ID_EDIT_INVERTSELECTION =*/33692, s_invertSelectionTitle, s_invertSelectionDesc,
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I) }, InvertSelect, s_invertSelectionTitle, s_invertSelectionDesc,
|
||||
[this]()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
@@ -2290,8 +2280,7 @@ namespace AzToolsFramework
|
||||
|
||||
// duplicate selection
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_D) },
|
||||
/*ID_EDIT_CLONE =*/33525, s_duplicateTitle, s_duplicateDesc,
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_D) }, DuplicateSelect, s_duplicateTitle, s_duplicateDesc,
|
||||
[]()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
@@ -2316,8 +2305,7 @@ namespace AzToolsFramework
|
||||
|
||||
// delete selection
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::Key_Delete) },
|
||||
/*ID_EDIT_DELETE=*/33480, s_deleteTitle, s_deleteDesc,
|
||||
m_actions, { QKeySequence(Qt::Key_Delete) }, DeleteSelect, s_deleteTitle, s_deleteDesc,
|
||||
[this]()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
@@ -2334,24 +2322,21 @@ namespace AzToolsFramework
|
||||
});
|
||||
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::Key_Space) },
|
||||
/*ID_EDIT_ESCAPE=*/33513, "", "",
|
||||
m_actions, { QKeySequence(Qt::Key_Space) }, EditEscaspe, "", "",
|
||||
[this]()
|
||||
{
|
||||
DeselectEntities();
|
||||
});
|
||||
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::Key_P) },
|
||||
/*ID_EDIT_PIVOT=*/36203, s_togglePivotTitleEditMenu, s_togglePivotDesc,
|
||||
m_actions, { QKeySequence(Qt::Key_P) }, EditPivot, s_togglePivotTitleEditMenu, s_togglePivotDesc,
|
||||
[this]()
|
||||
{
|
||||
ToggleCenterPivotSelection();
|
||||
});
|
||||
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::Key_R) },
|
||||
/*ID_EDIT_RESET=*/36204, s_resetEntityTransformTitle, s_resetEntityTransformDesc,
|
||||
m_actions, { QKeySequence(Qt::Key_R) }, EditReset, s_resetEntityTransformTitle, s_resetEntityTransformDesc,
|
||||
[this]()
|
||||
{
|
||||
switch (m_mode)
|
||||
@@ -2369,13 +2354,11 @@ namespace AzToolsFramework
|
||||
});
|
||||
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_R) },
|
||||
/*ID_EDIT_RESET_MANIPULATOR=*/36207, s_resetManipulatorTitle, s_resetManipulatorDesc,
|
||||
m_actions, { QKeySequence(Qt::CTRL + Qt::Key_R) }, EditResetManipulator, s_resetManipulatorTitle, s_resetManipulatorDesc,
|
||||
AZStd::bind(AZStd::mem_fn(&EditorTransformComponentSelection::DelegateClearManipulatorOverride), this));
|
||||
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::ALT + Qt::Key_R) },
|
||||
/*ID_EDIT_RESET_LOCAL=*/36205, s_resetTransformLocalTitle, s_resetTransformLocalDesc,
|
||||
m_actions, { QKeySequence(Qt::ALT + Qt::Key_R) }, EditResetLocal, s_resetTransformLocalTitle, s_resetTransformLocalDesc,
|
||||
[this]()
|
||||
{
|
||||
switch (m_mode)
|
||||
@@ -2393,8 +2376,7 @@ namespace AzToolsFramework
|
||||
});
|
||||
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::SHIFT + Qt::Key_R) },
|
||||
/*ID_EDIT_RESET_WORLD=*/36206, s_resetTransformWorldTitle, s_resetTransformWorldDesc,
|
||||
m_actions, { QKeySequence(Qt::SHIFT + Qt::Key_R) }, EditResetWorld, s_resetTransformWorldTitle, s_resetTransformWorldDesc,
|
||||
[this]()
|
||||
{
|
||||
switch (m_mode)
|
||||
@@ -2415,8 +2397,7 @@ namespace AzToolsFramework
|
||||
});
|
||||
|
||||
AddAction(
|
||||
m_actions, { QKeySequence(Qt::Key_U) },
|
||||
/*ID_VIEWPORTUI_VISIBLE=*/50040, "Toggle Viewport UI", "Hide/Show Viewport UI",
|
||||
m_actions, { QKeySequence(Qt::Key_U) }, ViewportUiVisible, "Toggle Viewport UI", "Hide/Show Viewport UI",
|
||||
[this]()
|
||||
{
|
||||
SetAllViewportUiVisible(!m_viewportUiVisible);
|
||||
|
||||
+22
@@ -13,6 +13,28 @@
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
//! @name Reverse URLs.
|
||||
//! Used to identify common actions and override them when necessary.
|
||||
//@{
|
||||
constexpr inline AZ::Crc32 LockSelection = AZ_CRC_CE("com.o3de.action.editortransform.lockselect");
|
||||
constexpr inline AZ::Crc32 UnlockSelection = AZ_CRC_CE("com.o3de.action.editortransform.unlockselect");
|
||||
constexpr inline AZ::Crc32 HideSelection = AZ_CRC_CE("com.o3de.action.editortransform.hideselect");
|
||||
constexpr inline AZ::Crc32 ShowSelection = AZ_CRC_CE("com.o3de.action.editortransform.showselect");
|
||||
constexpr inline AZ::Crc32 UnlockAll = AZ_CRC_CE("com.o3de.action.editortransform.unlockall");
|
||||
constexpr inline AZ::Crc32 ShowAll = AZ_CRC_CE("com.o3de.action.editortransform.unhideall");
|
||||
constexpr inline AZ::Crc32 SelectAll = AZ_CRC_CE("com.o3de.action.editortransform.selectall");
|
||||
constexpr inline AZ::Crc32 InvertSelect = AZ_CRC_CE("com.o3de.action.editortransform.invertselect");
|
||||
constexpr inline AZ::Crc32 DuplicateSelect = AZ_CRC_CE("com.o3de.action.editortransform.duplicateselect");
|
||||
constexpr inline AZ::Crc32 DeleteSelect = AZ_CRC_CE("com.o3de.action.editortransform.deleteselect");
|
||||
constexpr inline AZ::Crc32 EditEscaspe = AZ_CRC_CE("com.o3de.action.editortransform.editescape");
|
||||
constexpr inline AZ::Crc32 EditPivot = AZ_CRC_CE("com.o3de.action.editortransform.editpivot");
|
||||
constexpr inline AZ::Crc32 EditReset = AZ_CRC_CE("com.o3de.action.editortransform.editreset");
|
||||
constexpr inline AZ::Crc32 EditResetManipulator = AZ_CRC_CE("com.o3de.action.editortransform.editresetmanipulator");
|
||||
constexpr inline AZ::Crc32 EditResetLocal = AZ_CRC_CE("com.o3de.action.editortransform.editresetlocal");
|
||||
constexpr inline AZ::Crc32 EditResetWorld = AZ_CRC_CE("com.o3de.action.editortransform.editresetworld");
|
||||
constexpr inline AZ::Crc32 ViewportUiVisible = AZ_CRC_CE("com.o3de.action.editortransform.viewportuivisible");
|
||||
//@}
|
||||
|
||||
//! Provide interface for EditorTransformComponentSelection requests.
|
||||
class EditorTransformComponentSelectionRequests : public AZ::EBusTraits
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user