Remove redundant editor mode notifications.
Signed-off-by: John <jonawals@amazon.com>
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h>
|
||||
|
||||
// AzQtComponents
|
||||
@@ -166,15 +167,14 @@ LevelEditorMenuHandler::LevelEditorMenuHandler(MainWindow* mainWindow, QtViewPan
|
||||
m_mainWindow->menuBar()->setNativeMenuBar(true);
|
||||
#endif
|
||||
|
||||
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(
|
||||
AzToolsFramework::GetEntityContextId());
|
||||
ViewportEditorModeNotificationsBus::Handler::BusConnect(GetEntityContextId());
|
||||
EditorMenuRequestBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
LevelEditorMenuHandler::~LevelEditorMenuHandler()
|
||||
{
|
||||
EditorMenuRequestBus::Handler::BusDisconnect();
|
||||
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
|
||||
ViewportEditorModeNotificationsBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void LevelEditorMenuHandler::Initialize()
|
||||
@@ -1186,30 +1186,38 @@ void LevelEditorMenuHandler::AddDisableActionInSimModeListener(QAction* action)
|
||||
}));
|
||||
}
|
||||
|
||||
void LevelEditorMenuHandler::EnteredComponentMode(const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
|
||||
void LevelEditorMenuHandler::OnEditorModeActivated(
|
||||
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
|
||||
{
|
||||
auto menuWrapper = m_actionManager->FindMenu(s_editMenuId);
|
||||
if (!menuWrapper.isNull())
|
||||
if (mode == ViewportEditorMode::Component)
|
||||
{
|
||||
// copy of menu actions
|
||||
auto actions = menuWrapper.Get()->actions();
|
||||
// remove all non-reserved edit menu options
|
||||
actions.erase(
|
||||
std::remove_if(actions.begin(), actions.end(), [](QAction* action)
|
||||
{
|
||||
return !action->property("Reserved").toBool();
|
||||
}),
|
||||
actions.end());
|
||||
auto menuWrapper = m_actionManager->FindMenu(s_editMenuId);
|
||||
if (!menuWrapper.isNull())
|
||||
{
|
||||
// copy of menu actions
|
||||
auto actions = menuWrapper.Get()->actions();
|
||||
// remove all non-reserved edit menu options
|
||||
actions.erase(
|
||||
std::remove_if(actions.begin(), actions.end(), [](QAction* action)
|
||||
{
|
||||
return !action->property("Reserved").toBool();
|
||||
}),
|
||||
actions.end());
|
||||
|
||||
// clear and update the menu with new actions
|
||||
menuWrapper.Get()->clear();
|
||||
menuWrapper.Get()->addActions(actions);
|
||||
// clear and update the menu with new actions
|
||||
menuWrapper.Get()->clear();
|
||||
menuWrapper.Get()->addActions(actions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LevelEditorMenuHandler::LeftComponentMode(const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
|
||||
void LevelEditorMenuHandler::OnEditorModeDeactivated(
|
||||
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
|
||||
{
|
||||
RestoreEditMenuToDefault();
|
||||
if (mode == ViewportEditorMode::Component)
|
||||
{
|
||||
RestoreEditMenuToDefault();
|
||||
}
|
||||
}
|
||||
|
||||
void LevelEditorMenuHandler::AddEditMenuAction(QAction* action)
|
||||
|
||||
Reference in New Issue
Block a user