Merge pull request #441 from aws-lumberyard-dev/cgalvan/OldVIMLogicRemovalSecondPass

[LYN-3419] Removed remaining references to checking if the new viewport interaction model is enabled.
main
cgalvan 5 years ago committed by GitHub
commit ca08d78dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -675,20 +675,8 @@ namespace AzToolsFramework
// if the new viewport interaction model is enabled we do not want to
// filter out locked entities as this breaks with the logic of being
// able to select locked entities in the entity outliner
if (IsNewViewportInteractionModelEnabled())
{
selectedEntitiesFiltered.insert(
selectedEntitiesFiltered.begin(), selectedEntities.begin(), selectedEntities.end());
}
else
{
for (AZ::EntityId nowSelectedId : selectedEntities)
{
AZ_Assert(nowSelectedId.IsValid(), "Invalid entity Id being marked as selected.");
selectedEntitiesFiltered.push_back(nowSelectedId);
}
}
selectedEntitiesFiltered.insert(
selectedEntitiesFiltered.begin(), selectedEntities.begin(), selectedEntities.end());
EntityIdList newlySelectedIds;
EntityIdList newlyDeselectedIds;

@ -121,17 +121,14 @@ namespace AzToolsFramework
EditorPickModeRequestBus::Handler::BusConnect(pickModeEntityContextId);
EditorEventsBus::Handler::BusConnect();
if (IsNewViewportInteractionModelEnabled())
// replace the default input handler with one specific for dealing with
// entity selection in the viewport
EditorInteractionSystemViewportSelectionRequestBus::Event(
GetEntityContextId(), &EditorInteractionSystemViewportSelection::SetHandler,
[](const EditorVisibleEntityDataCache* entityDataCache)
{
// replace the default input handler with one specific for dealing with
// entity selection in the viewport
EditorInteractionSystemViewportSelectionRequestBus::Event(
GetEntityContextId(), &EditorInteractionSystemViewportSelection::SetHandler,
[](const EditorVisibleEntityDataCache* entityDataCache)
{
return AZStd::make_unique<EditorPickEntitySelection>(entityDataCache);
});
}
return AZStd::make_unique<EditorPickEntitySelection>(entityDataCache);
});
if (!pickModeEntityContextId.IsNull())
{
@ -162,12 +159,9 @@ namespace AzToolsFramework
EditorEventsBus::Handler::BusDisconnect();
emit OnPickComplete();
if (IsNewViewportInteractionModelEnabled())
{
// return to the default viewport editor selection
EditorInteractionSystemViewportSelectionRequestBus::Event(
GetEntityContextId(), &EditorInteractionSystemViewportSelection::SetDefaultHandler);
}
// return to the default viewport editor selection
EditorInteractionSystemViewportSelectionRequestBus::Event(
GetEntityContextId(), &EditorInteractionSystemViewportSelection::SetDefaultHandler);
EditorPickModeNotificationBus::Broadcast(&EditorPickModeNotifications::OnEntityPickModeStopped);
}

@ -126,7 +126,6 @@ namespace UnitTest
/// Base fixture for ToolsApplication editor tests.
class ToolsApplicationFixture
: public AllocatorsTestFixture
, private AzToolsFramework::NewViewportInteractionModelEnabledRequestBus::Handler
{
public:
void SetUp() override final
@ -148,8 +147,6 @@ namespace UnitTest
// in the unit tests.
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
AzToolsFramework::NewViewportInteractionModelEnabledRequestBus::Handler::BusConnect();
m_editorActions.Connect();
const auto viewportHandlerBuilder =
@ -184,7 +181,6 @@ namespace UnitTest
TearDownEditorFixtureImpl();
m_editorActions.Disconnect();
AzToolsFramework::NewViewportInteractionModelEnabledRequestBus::Handler::BusDisconnect();
// Stop & delete the Application created by this fixture, hence not using GetApplication() here
if (m_app)
@ -222,14 +218,6 @@ namespace UnitTest
private:
AZStd::unique_ptr<ToolsTestApplication> m_app;
// NewViewportInteractionModelEnabledRequestBus ...
bool IsNewViewportInteractionModelEnabled() override
{
// default to the new viewport interaction model bus being enabled so the
// manipulator manager is correctly instantiated in EditorDefaultSelection
return true;
}
};
class EditorEntityComponentChangeDetector

@ -30,15 +30,9 @@ namespace AzToolsFramework
ActionOverrideRequestBus::Handler::BusConnect(GetEntityContextId());
ComponentModeFramework::ComponentModeSystemRequestBus::Handler::BusConnect();
// only create EditorTransformComponentSelection if we are using the new viewport interaction model
// note: EditorDefaultSelection is still used when the new viewport interaction model is disabled to support
// Component Mode when using legacy viewport interaction model
if (IsNewViewportInteractionModelEnabled())
{
m_manipulatorManager =
AZStd::make_shared<AzToolsFramework::ManipulatorManager>(AzToolsFramework::g_mainManipulatorManagerId);
m_transformComponentSelection = AZStd::make_unique<EditorTransformComponentSelection>(entityDataCache);
}
m_manipulatorManager =
AZStd::make_shared<AzToolsFramework::ManipulatorManager>(AzToolsFramework::g_mainManipulatorManagerId);
m_transformComponentSelection = AZStd::make_unique<EditorTransformComponentSelection>(entityDataCache);
}
EditorDefaultSelection::~EditorDefaultSelection()
@ -325,17 +319,14 @@ namespace AzToolsFramework
m_transformComponentSelection->DisplayViewportSelection(viewportInfo, debugDisplay);
}
if (IsNewViewportInteractionModelEnabled())
{
// poll and set the keyboard modifiers to ensure the mouse interaction is up to date
m_currentInteraction.m_keyboardModifiers =
AzToolsFramework::ViewportInteraction::BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers());
// draw the manipulators
const AzFramework::CameraState cameraState = GetCameraState(viewportInfo.m_viewportId);
debugDisplay.DepthTestOff();
m_manipulatorManager->DrawManipulators(debugDisplay, cameraState, m_currentInteraction);
debugDisplay.DepthTestOn();
}
// poll and set the keyboard modifiers to ensure the mouse interaction is up to date
m_currentInteraction.m_keyboardModifiers =
AzToolsFramework::ViewportInteraction::BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers());
// draw the manipulators
const AzFramework::CameraState cameraState = GetCameraState(viewportInfo.m_viewportId);
debugDisplay.DepthTestOff();
m_manipulatorManager->DrawManipulators(debugDisplay, cameraState, m_currentInteraction);
debugDisplay.DepthTestOn();
}
void EditorDefaultSelection::DisplayViewportSelection2d(

@ -458,8 +458,6 @@ QMenu* LevelEditorMenuHandler::CreateFileMenu()
void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMenu)
{
const bool newViewportInteractionModelEnabled = GetIEditor()->IsNewViewportInteractionModelEnabled();
// Undo
editMenu.AddAction(ID_UNDO);
@ -496,40 +494,21 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
// Select All
editMenu.AddAction(ID_EDIT_SELECTALL);
// Deselect All
if (!newViewportInteractionModelEnabled)
{
editMenu.AddAction(ID_EDIT_SELECTNONE);
}
// Invert Selection
editMenu.AddAction(ID_EDIT_INVERTSELECTION);
editMenu.AddSeparator();
// New Viewport Interaction Model actions/shortcuts
if (newViewportInteractionModelEnabled)
{
editMenu.AddAction(ID_EDIT_PIVOT);
editMenu.AddAction(ID_EDIT_RESET);
editMenu.AddAction(ID_EDIT_RESET_MANIPULATOR);
editMenu.AddAction(ID_EDIT_RESET_LOCAL);
editMenu.AddAction(ID_EDIT_RESET_WORLD);
}
editMenu.AddAction(ID_EDIT_PIVOT);
editMenu.AddAction(ID_EDIT_RESET);
editMenu.AddAction(ID_EDIT_RESET_MANIPULATOR);
editMenu.AddAction(ID_EDIT_RESET_LOCAL);
editMenu.AddAction(ID_EDIT_RESET_WORLD);
// Hide Selection
editMenu.AddAction(ID_EDIT_HIDE);
if (!newViewportInteractionModelEnabled)
{
// Show Selection
auto showSelectionMenu = editMenu.Get()->addAction(tr("Show Selection"));
connect(showSelectionMenu, &QAction::triggered, this, [this]() { ToggleSelection(false); });
// Show Last Hidden
editMenu.AddAction(ID_EDIT_SHOW_LAST_HIDDEN);
}
// Unhide All
editMenu.AddAction(ID_EDIT_UNHIDEALL);
@ -572,31 +551,10 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
// Modify Menu
auto modifyMenu = editMenu.AddMenu(tr("&Modify"));
if (!newViewportInteractionModelEnabled)
{
modifyMenu.AddAction(ID_MODIFY_LINK);
modifyMenu.AddAction(ID_MODIFY_UNLINK);
modifyMenu.AddSeparator();
}
auto snapMenu = modifyMenu.AddMenu(tr("Snap"));
if (!newViewportInteractionModelEnabled)
{
snapMenu.AddAction(ID_SNAP_TO_GRID);
}
snapMenu.AddAction(ID_SNAPANGLE);
if (!newViewportInteractionModelEnabled)
{
auto fastRotateMenu = modifyMenu.AddMenu(tr("Fast Rotate"));
fastRotateMenu.AddAction(ID_ROTATESELECTION_XAXIS);
fastRotateMenu.AddAction(ID_ROTATESELECTION_YAXIS);
fastRotateMenu.AddAction(ID_ROTATESELECTION_ZAXIS);
fastRotateMenu.AddAction(ID_ROTATESELECTION_ROTATEANGLE);
}
auto transformModeMenu = modifyMenu.AddMenu(tr("Transform Mode"));
transformModeMenu.AddAction(ID_EDITMODE_MOVE);
transformModeMenu.AddAction(ID_EDITMODE_ROTATE);
@ -604,14 +562,6 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
editMenu.AddSeparator();
// Lock Selection
// NEWMENUS: NEEDS IMPLEMENTATION
//// Unlock Selection
//auto unlockSelectionMenu = editMenu.Get()->addAction(tr("Unlock Selection"));
//// Unlock Last Locked
//auto unlockLastLockedMenu = editMenu.Get()->addAction(tr("Unlock Last Locked"));
// Editor Settings
auto editorSettingsMenu = editMenu.AddMenu(tr("Editor Settings"));
@ -718,12 +668,6 @@ QMenu* LevelEditorMenuHandler::CreateGameMenu()
gameMenu.AddSeparator();
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
gameMenu.AddAction(ID_TERRAIN_VEGETATION);
gameMenu.AddSeparator();
}
CreateDebuggingSubMenu(gameMenu);
return gameMenu;
@ -786,12 +730,6 @@ QMenu* LevelEditorMenuHandler::CreateViewMenu()
viewportViewsMenuWrapper.AddAction(ID_WIREFRAME);
viewportViewsMenuWrapper.AddSeparator();
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
// Ruler
viewportViewsMenuWrapper.AddAction(ID_RULER);
}
viewportViewsMenuWrapper.AddAction(ID_VIEW_GRIDSETTINGS);
viewportViewsMenuWrapper.AddSeparator();
@ -1227,22 +1165,6 @@ void LevelEditorMenuHandler::ClearAll()
UpdateMRUFiles();
}
void LevelEditorMenuHandler::ToggleSelection(bool hide)
{
CCryEditApp::instance()->OnToggleSelection(hide);
}
// Used for showing last hidden objects
void LevelEditorMenuHandler::ShowLastHidden()
{
CSelectionGroup* sel = GetIEditor()->GetSelection();
if (!sel->IsEmpty())
{
CUndo undo("Show Last Hidden");
GetIEditor()->GetObjectManager()->ShowLastHiddenObject();
}
}
// Used for disabling "Open Recent" menu option
void LevelEditorMenuHandler::OnUpdateOpenRecent()
{

@ -78,8 +78,6 @@ private:
void UpdateMRUFiles();
void ClearAll();
void ToggleSelection(bool hide);
void ShowLastHidden();
void OnUpdateOpenRecent();
void OnUpdateMacrosMenu();

@ -381,12 +381,8 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_FILE_EXPORT_SELECTEDOBJECTS, OnExportSelectedObjects)
ON_COMMAND(ID_EDIT_HOLD, OnEditHold)
ON_COMMAND(ID_EDIT_FETCH, OnEditFetch)
ON_COMMAND(ID_GENERATORS_STATICOBJECTS, OnGeneratorsStaticobjects)
ON_COMMAND(ID_FILE_EXPORTTOGAMENOSURFACETEXTURE, OnFileExportToGameNoSurfaceTexture)
ON_COMMAND(ID_VIEW_SWITCHTOGAME, OnViewSwitchToGame)
ON_COMMAND(ID_EDIT_SELECTALL, OnEditSelectAll)
ON_COMMAND(ID_EDIT_SELECTNONE, OnEditSelectNone)
ON_COMMAND(ID_EDIT_DELETE, OnEditDelete)
ON_COMMAND(ID_MOVE_OBJECT, OnMoveObject)
ON_COMMAND(ID_RENAME_OBJ, OnRenameObj)
ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove)
@ -395,7 +391,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_UNDO, OnUndo)
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnUndo) // Can't use the same ID, because for the menu we can't have a QWidgetAction, while for the toolbar we want one
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
ON_COMMAND(ID_LOCK_SELECTION, OnLockSelection)
ON_COMMAND(ID_EDIT_LEVELDATA, OnEditLevelData)
ON_COMMAND(ID_FILE_EDITLOGFILE, OnFileEditLogFile)
ON_COMMAND(ID_FILE_RESAVESLICES, OnFileResaveSlices)
@ -415,11 +410,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_GAME_SYNCPLAYER, OnSyncPlayer)
ON_COMMAND(ID_RESOURCES_REDUCEWORKINGSET, OnResourcesReduceworkingset)
// Standard file based document commands
ON_COMMAND(ID_EDIT_HIDE, OnEditHide)
ON_COMMAND(ID_EDIT_SHOW_LAST_HIDDEN, OnEditShowLastHidden)
ON_COMMAND(ID_EDIT_UNHIDEALL, OnEditUnhideall)
ON_COMMAND(ID_SNAP_TO_GRID, OnSnap)
ON_COMMAND(ID_WIREFRAME, OnWireframe)
@ -465,11 +455,6 @@ void CCryEditApp::RegisterActionHandlers()
#endif
ON_COMMAND(ID_DISPLAY_GOTOPOSITION, OnDisplayGotoPosition)
ON_COMMAND(ID_SNAPANGLE, OnSnapangle)
ON_COMMAND(ID_RULER, OnRuler)
ON_COMMAND(ID_ROTATESELECTION_XAXIS, OnRotateselectionXaxis)
ON_COMMAND(ID_ROTATESELECTION_YAXIS, OnRotateselectionYaxis)
ON_COMMAND(ID_ROTATESELECTION_ZAXIS, OnRotateselectionZaxis)
ON_COMMAND(ID_ROTATESELECTION_ROTATEANGLE, OnRotateselectionRotateangle)
ON_COMMAND(ID_EDIT_RENAMEOBJECT, OnEditRenameobject)
ON_COMMAND(ID_CHANGEMOVESPEED_INCREASE, OnChangemovespeedIncrease)
ON_COMMAND(ID_CHANGEMOVESPEED_DECREASE, OnChangemovespeedDecrease)
@ -483,7 +468,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_TOOLS_VALIDATEOBJECTPOSITIONS, OnValidateObjectPositions)
ON_COMMAND(ID_TOOLS_PREFERENCES, OnToolsPreferences)
ON_COMMAND(ID_GRAPHICS_SETTINGS, OnGraphicsSettings)
ON_COMMAND(ID_EDIT_INVERTSELECTION, OnEditInvertselection)
ON_COMMAND(ID_SWITCHCAMERA_DEFAULTCAMERA, OnSwitchToDefaultCamera)
ON_COMMAND(ID_SWITCHCAMERA_SEQUENCECAMERA, OnSwitchToSequenceCamera)
ON_COMMAND(ID_SWITCHCAMERA_SELECTEDCAMERA, OnSwitchToSelectedcamera)
@ -492,11 +476,9 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_OPEN_ASSET_BROWSER, OnOpenAssetBrowserView)
ON_COMMAND(ID_OPEN_AUDIO_CONTROLS_BROWSER, OnOpenAudioControlsEditor)
ON_COMMAND(ID_GOTO_VIEWPORTSEARCH, OnGotoViewportSearch)
ON_COMMAND(ID_DISPLAY_SHOWHELPERS, OnShowHelpers)
ON_COMMAND(ID_OPEN_TRACKVIEW, OnOpenTrackView)
ON_COMMAND(ID_OPEN_UICANVASEDITOR, OnOpenUICanvasEditor)
ON_COMMAND(ID_GOTO_VIEWPORTSEARCH, OnGotoViewportSearch)
ON_COMMAND(ID_TERRAIN_TIMEOFDAY, OnTimeOfDay)
ON_COMMAND(ID_TERRAIN_TIMEOFDAYBUTTON, OnTimeOfDay)
@ -2645,64 +2627,6 @@ void CCryEditApp::OnFileExportToGameNoSurfaceTexture()
UserExportToGame(false);
}
void CCryEditApp::OnGeneratorsStaticobjects()
{
////////////////////////////////////////////////////////////////////////
// Show the static objects dialog
////////////////////////////////////////////////////////////////////////
/*
CStaticObjects cDialog;
cDialog.DoModal();
BeginWaitCursor();
GetIEditor()->UpdateViews( eUpdateStatObj );
GetIEditor()->GetDocument()->GetStatObjMap()->PlaceObjectsOnTerrain();
EndWaitCursor();
*/
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditSelectAll()
{
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
////////////////////////////////////////////////////////////////////////
// Select all map objects
////////////////////////////////////////////////////////////////////////
AABB box(Vec3(-FLT_MAX, -FLT_MAX, -FLT_MAX), Vec3(FLT_MAX, FLT_MAX, FLT_MAX));
GetIEditor()->GetObjectManager()->SelectObjects(box);
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditSelectNone()
{
CUndo undo("Unselect All");
////////////////////////////////////////////////////////////////////////
// Remove the selection from all map objects
////////////////////////////////////////////////////////////////////////
GetIEditor()->ClearSelection();
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditInvertselection()
{
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
GetIEditor()->GetObjectManager()->InvertSelection();
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditDelete()
{
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
DeleteSelectedEntities(true);
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::DeleteSelectedEntities([[maybe_unused]] bool includeDescendants)
{
@ -2860,13 +2784,6 @@ void CCryEditApp::OnShowHelpers()
GetIEditor()->Notify(eNotify_OnDisplayRenderUpdate);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnLockSelection()
{
// Invert selection lock.
GetIEditor()->LockSelection(!GetIEditor()->IsSelectionLocked());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditLevelData()
{
@ -3628,7 +3545,6 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(LPCTSTR lpszFileName)
GetIEditor()->GetUndoManager()->Suspend();
actionManager->GetAction(ID_EDIT_SELECTALL)->trigger();
actionManager->GetAction(ID_GOTO_SELECTED)->trigger();
actionManager->GetAction(ID_EDIT_SELECTNONE)->trigger();
GetIEditor()->GetUndoManager()->Resume();
}
}
@ -3646,69 +3562,6 @@ void CCryEditApp::OnResourcesReduceworkingset()
#endif
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnToggleSelection(bool hide)
{
CSelectionGroup* sel = GetIEditor()->GetSelection();
if (!sel->IsEmpty())
{
AzToolsFramework::ScopedUndoBatch undo(hide ? "Hide Entity" : "Show Entity");
for (int i = 0; i < sel->GetCount(); i++)
{
// Duplicated object names can exist in the case of prefab objects so passing a name as a script parameter and processing it couldn't be exact.
GetIEditor()->GetObjectManager()->HideObject(sel->GetObject(i), hide);
}
}
}
void CCryEditApp::OnEditHide()
{
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
OnToggleSelection(true);
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateEditHide(QAction* action)
{
CSelectionGroup* sel = GetIEditor()->GetSelection();
if (!sel->IsEmpty())
{
action->setEnabled(true);
}
else
{
action->setEnabled(false);
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditShowLastHidden()
{
AzToolsFramework::ScopedUndoBatch undo("Show Last Hidden Entity");
GetIEditor()->GetObjectManager()->ShowLastHiddenObject();
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditUnhideall()
{
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
if (QMessageBox::question(
AzToolsFramework::GetActiveWindow(), QObject::tr("Unhide All"),
QObject::tr("Are you sure you want to unhide all the objects?"),
QMessageBox::Yes | QMessageBox::Cancel) == QMessageBox::Yes)
{
// Unhide all.
AzToolsFramework::ScopedUndoBatch undo("Unhide all Entities");
GetIEditor()->GetObjectManager()->UnhideAll();
}
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSnap()
{
@ -3978,56 +3831,6 @@ void CCryEditApp::OnUpdateSnapangle(QAction* action)
action->setChecked(gSettings.pGrid->IsAngleSnapEnabled());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnRuler()
{
CRuler* pRuler = GetIEditor()->GetRuler();
pRuler->SetActive(!pRuler->IsActive());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateRuler(QAction* action)
{
Q_ASSERT(action->isCheckable());
action->setChecked(GetIEditor()->GetRuler()->IsActive());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnRotateselectionXaxis()
{
CUndo undo("Rotate X");
CSelectionGroup* pSelection = GetIEditor()->GetSelection();
pSelection->Rotate(Ang3(m_fastRotateAngle, 0, 0), GetIEditor()->GetReferenceCoordSys());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnRotateselectionYaxis()
{
CUndo undo("Rotate Y");
CSelectionGroup* pSelection = GetIEditor()->GetSelection();
pSelection->Rotate(Ang3(0, m_fastRotateAngle, 0), GetIEditor()->GetReferenceCoordSys());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnRotateselectionZaxis()
{
CUndo undo("Rotate Z");
CSelectionGroup* pSelection = GetIEditor()->GetSelection();
pSelection->Rotate(Ang3(0, 0, m_fastRotateAngle), GetIEditor()->GetReferenceCoordSys());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnRotateselectionRotateangle()
{
bool ok = false;
int fractionalDigitCount = 5;
float angle = aznumeric_caster(QInputDialog::getDouble(AzToolsFramework::GetActiveWindow(), QObject::tr("Rotate Angle"), QStringLiteral(""), m_fastRotateAngle, std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max(), fractionalDigitCount, &ok));
if (ok)
{
m_fastRotateAngle = angle;
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditRenameobject()
{
@ -4512,18 +4315,6 @@ void CCryEditApp::OnUpdateGameSpec(QAction* action)
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnGotoViewportSearch()
{
if (MainWindow::instance())
{
CLayoutViewPane* viewPane = MainWindow::instance()->GetActiveView();
if (viewPane)
{
viewPane->SetFocusToViewportSearch();
}
}
}
RecentFileList* CCryEditApp::GetRecentFileList()
{
static RecentFileList list;

@ -116,7 +116,6 @@ public:
static CCryEditApp* instance();
bool GetRootEnginePath(QDir& rootEnginePath) const;
void OnToggleSelection(bool hide);
bool CreateLevel(bool& wasCreateLevelOperationCancelled);
void LoadFile(QString fileName);
void ForceNextIdleProcessing() { m_bForceProcessIdle = true; }
@ -210,13 +209,9 @@ public:
void OnExportSelectedObjects();
void OnEditHold();
void OnEditFetch();
void OnGeneratorsStaticobjects();
void OnFileExportToGameNoSurfaceTexture();
void OnViewSwitchToGame();
void OnViewDeploy();
void OnEditSelectAll();
void OnEditSelectNone();
void OnEditDelete();
void DeleteSelectedEntities(bool includeDescendants);
void OnMoveObject();
void OnRenameObj();
@ -229,7 +224,6 @@ public:
void OnUndo();
void OnOpenAssetImporter();
void OnUpdateSelected(QAction* action);
void OnLockSelection();
void OnEditLevelData();
void OnFileEditLogFile();
void OnFileResaveSlices();
@ -379,10 +373,6 @@ private:
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
friend struct PythonTestOutputHandler;
void OnEditHide();
void OnUpdateEditHide(QAction* action);
void OnEditShowLastHidden();
void OnEditUnhideall();
void OnSnap();
void OnWireframe();
void OnUpdateWireframe(QAction* action);
@ -423,12 +413,6 @@ private:
void OnDisplayGotoPosition();
void OnSnapangle();
void OnUpdateSnapangle(QAction* action);
void OnRuler();
void OnUpdateRuler(QAction* action);
void OnRotateselectionXaxis();
void OnRotateselectionYaxis();
void OnRotateselectionZaxis();
void OnRotateselectionRotateangle();
void OnEditRenameobject();
void OnChangemovespeedIncrease();
void OnChangemovespeedDecrease();
@ -442,7 +426,6 @@ private:
void OnValidateObjectPositions();
void OnToolsPreferences();
void OnGraphicsSettings();
void OnEditInvertselection();
void OnSwitchToDefaultCamera();
void OnUpdateSwitchToDefaultCamera(QAction* action);
void OnSwitchToSequenceCamera();
@ -455,7 +438,6 @@ private:
void OnOpenTrackView();
void OnOpenAudioControlsEditor();
void OnOpenUICanvasEditor();
void OnGotoViewportSearch();
void OnTimeOfDay();
void OnChangeGameSpec(UINT nID);
void SetGameSpecCheck(ESystemConfigSpec spec, ESystemConfigPlatform platform, int &nCheck, bool &enable);

@ -878,52 +878,6 @@ void MainWindow::InitActions()
.SetStatusTip(tr("Redo last undo operation"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateRedo);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_EDIT_SELECTALL, tr("Select &All"))
.SetShortcut(tr("Ctrl+A"))
.SetStatusTip(tr("Select all objects"))
->setShortcutContext(Qt::WidgetWithChildrenShortcut);
am->AddAction(ID_EDIT_SELECTNONE, tr("Deselect All"))
.SetShortcut(tr("Ctrl+Shift+D"))
.SetStatusTip(tr("Remove selection from all objects"));
am->AddAction(ID_EDIT_INVERTSELECTION, tr("&Invert Selection"))
.SetShortcut(tr("Ctrl+Shift+I"));
}
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_LOCK_SELECTION, tr("Lock Selection"))
.SetShortcut(tr("Ctrl+Shift+Space"))
.SetToolTip(tr("Lock Selection (Ctrl+Shift+Space)"))
.SetStatusTip(tr("Lock Current Selection."));
}
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
// implemented by EditorTransformComponentSelection when the new Viewport Interaction Model is enabled
am->AddAction(ID_EDIT_HIDE, tr("Hide Selection"))
.SetShortcut(tr("H"))
.SetToolTip(tr("Hide Selection (H)"))
.SetStatusTip(tr("Hide selected object(s)."))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditHide);
am->AddAction(ID_EDIT_UNHIDEALL, tr("Unhide All"))
.SetShortcut(tr("Ctrl+H"))
.SetToolTip(tr("Unhide All (Ctrl+H)"))
.SetStatusTip(tr("Unhide all hidden objects."));
}
am->AddAction(ID_EDIT_SHOW_LAST_HIDDEN, tr("Show Last Hidden"))
.SetShortcut(tr("Shift+H"))
.SetToolTip(tr("Show Last Hidden (Shift+H)"))
.SetStatusTip(tr("Show last hidden object."));
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_MODIFY_LINK, tr("Parent"));
am->AddAction(ID_MODIFY_UNLINK, tr("Un-Parent"));
}
am->AddAction(ID_EDIT_HOLD, tr("&Hold"))
.SetShortcut(tr("Ctrl+Alt+H"))
.SetToolTip(tr("&Hold (Ctrl+Alt+H)"))
@ -933,29 +887,6 @@ void MainWindow::InitActions()
.SetToolTip(tr("&Fetch (Ctrl+Alt+F)"))
.SetStatusTip(tr("Restore saved state (Fetch)"));
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
// implemented by EditorTransformComponentSelection when the new Viewport Interaction Model is enabled
am->AddAction(ID_EDIT_DELETE, tr("&Delete"))
.SetShortcut(QKeySequence::Delete)
.SetStatusTip(tr("Delete selected objects."))
->setShortcutContext(Qt::WidgetWithChildrenShortcut);
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
bool prefabWipFeaturesEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabWipFeaturesEnabled, &AzFramework::ApplicationRequests::ArePrefabWipFeaturesEnabled);
if (!isPrefabSystemEnabled || (isPrefabSystemEnabled && prefabWipFeaturesEnabled))
{
am->AddAction(ID_EDIT_CLONE, tr("Duplicate"))
.SetShortcut(tr("Ctrl+D"))
.SetToolTip(tr("Duplicate (Ctrl+D)"))
.SetStatusTip(tr("Duplicate selected objects."));
}
}
// Modify actions
am->AddAction(ID_EDIT_RENAMEOBJECT, tr("Rename Object(s)..."))
.SetStatusTip(tr("Rename Object"));
@ -963,24 +894,24 @@ void MainWindow::InitActions()
am->AddAction(ID_EDITMODE_MOVE, tr("Move"))
.SetIcon(Style::icon("Move"))
.SetApplyHoverEffect()
.SetShortcut(GetIEditor()->IsNewViewportInteractionModelEnabled() ? tr("1") : tr("2"))
.SetToolTip(GetIEditor()->IsNewViewportInteractionModelEnabled() ? tr("Move (1)") : tr("Move (2)"))
.SetShortcut(tr("1"))
.SetToolTip(tr("Move (1)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and move selected object(s)"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeMove);
am->AddAction(ID_EDITMODE_ROTATE, tr("Rotate"))
.SetIcon(Style::icon("Translate"))
.SetApplyHoverEffect()
.SetShortcut(GetIEditor()->IsNewViewportInteractionModelEnabled() ? tr("2") : tr("3"))
.SetToolTip(GetIEditor()->IsNewViewportInteractionModelEnabled() ? tr("Rotate (2)") : tr("Rotate (3)"))
.SetShortcut(tr("2"))
.SetToolTip(tr("Rotate (2)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and rotate selected object(s)"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeRotate);
am->AddAction(ID_EDITMODE_SCALE, tr("Scale"))
.SetIcon(Style::icon("Scale"))
.SetApplyHoverEffect()
.SetShortcut(GetIEditor()->IsNewViewportInteractionModelEnabled() ? tr("3") : tr("4"))
.SetToolTip(GetIEditor()->IsNewViewportInteractionModelEnabled() ? tr("Scale (3)") : tr("Scale (4)"))
.SetShortcut(tr("3"))
.SetToolTip(tr("Scale (3)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and scale selected object(s)"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeScale);
@ -1000,14 +931,6 @@ void MainWindow::InitActions()
.SetCheckable(true)
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSnapangle);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_ROTATESELECTION_XAXIS, tr("Rotate X Axis"));
am->AddAction(ID_ROTATESELECTION_YAXIS, tr("Rotate Y Axis"));
am->AddAction(ID_ROTATESELECTION_ZAXIS, tr("Rotate Z Axis"));
am->AddAction(ID_ROTATESELECTION_ROTATEANGLE, tr("Rotate Angle..."));
}
// Display actions
am->AddAction(ID_WIREFRAME, tr("&Wireframe"))
.SetShortcut(tr("F3"))
@ -1016,16 +939,6 @@ void MainWindow::InitActions()
.SetStatusTip(tr("Render in Wireframe Mode."))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateWireframe);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_RULER, tr("Ruler"))
.SetCheckable(true)
.SetIcon(Style::icon("Measure"))
.SetApplyHoverEffect()
.SetStatusTip(tr("Create temporary ruler to measure distance"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateRuler);
}
am->AddAction(ID_VIEW_GRIDSETTINGS, tr("Grid Settings..."));
am->AddAction(ID_SWITCHCAMERA_DEFAULTCAMERA, tr("Default Camera")).SetCheckable(true)
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSwitchToDefaultCamera);
@ -1169,12 +1082,6 @@ void MainWindow::InitActions()
am->AddAction(ID_PHYSICS_SIMULATEOBJECTS, tr("Simulate Objects"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelected);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_TERRAIN_TIMEOFDAY, tr("Time Of Day"))
.SetStatusTip(tr("Open Time of Day Editor"));
}
// Tools actions
am->AddAction(ID_RELOAD_TEXTURES, tr("Reload Textures/Shaders"))
.SetStatusTip(tr("Reload all textures."));
@ -1280,13 +1187,6 @@ void MainWindow::InitActions()
});
}
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_OPEN_TRACKVIEW, tr("TrackView"))
.SetToolTip(tr("Open Track View"))
.SetApplyHoverEffect();
}
am->AddAction(ID_OPEN_AUDIO_CONTROLS_BROWSER, tr("Audio Controls Editor"))
.SetToolTip(tr("Open Audio Controls Editor"))
.SetIcon(Style::icon("Audio"))

@ -1314,7 +1314,7 @@ void CObjectManager::ForceUpdateVisibleObjectCache(DisplayContext& dc)
FindDisplayableObjects(dc, false);
}
void CObjectManager::FindDisplayableObjects(DisplayContext& dc, bool bDisplay)
void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]] bool bDisplay)
{
// if the new IVisibilitySystem is being used, do not run this logic
if (ed_visibility_use)
@ -1341,8 +1341,6 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, bool bDisplay)
pDispayedViewObjects->ClearObjects();
pDispayedViewObjects->Reserve(m_visibleObjects.size());
const bool newViewportInteractionModelEnabled = GetIEditor()->IsNewViewportInteractionModelEnabled();
if (dc.flags & DISPLAY_2D)
{
int numVis = m_visibleObjects.size();
@ -1354,14 +1352,6 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, bool bDisplay)
if (dc.box.IsIntersectBox(bbox))
{
pDispayedViewObjects->AddObject(obj);
if (bDisplay && dc.settings->IsDisplayHelpers() && (gSettings.viewports.nShowFrozenHelpers || !obj->IsFrozen()))
{
if (!newViewportInteractionModelEnabled)
{
obj->Display(dc);
}
}
}
}
}
@ -1399,14 +1389,6 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, bool bDisplay)
if (visRatio > m_maxObjectViewDistRatio || (dc.flags & DISPLAY_SELECTION_HELPERS) || obj->IsSelected())
{
pDispayedViewObjects->AddObject(obj);
if (bDisplay && dc.settings->IsDisplayHelpers() && (gSettings.viewports.nShowFrozenHelpers || !obj->IsFrozen()) && !obj->CheckFlags(OBJFLAG_HIDE_HELPERS))
{
if (!newViewportInteractionModelEnabled)
{
obj->Display(dc);
}
}
}
}
}
@ -2356,10 +2338,7 @@ void CObjectManager::UpdateVisibilityList()
// in the view (frustum) to the visible objects list so we can draw feedback for
// entities being hidden in the viewport when selected in the entity outliner
// (EditorVisibleEntityDataCache must be populated even if entities are 'hidden')
if (visible || GetIEditor()->IsNewViewportInteractionModelEnabled())
{
m_visibleObjects.push_back(obj);
}
m_visibleObjects.push_back(obj);
}
m_isUpdateVisibilityList = false;

@ -470,61 +470,40 @@ void CRenderViewport::OnLButtonDown(Qt::KeyboardModifiers modifiers, const QPoin
BuildKeyboardModifiers(modifiers),
BuildMousePick(scaledPoint));
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
bool manipulatorInteraction = false;
EditorInteractionSystemViewportSelectionRequestBus::EventResult(
manipulatorInteraction, AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseManipulatorInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
bool manipulatorInteraction = false;
EditorInteractionSystemViewportSelectionRequestBus::EventResult(
manipulatorInteraction, AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseManipulatorInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
if (!manipulatorInteraction)
if (!manipulatorInteraction)
{
if (RenderViewportUtil::AllowOrbit(modifiers))
{
if (RenderViewportUtil::AllowOrbit(modifiers))
{
m_bInOrbitMode = true;
m_orbitTarget =
GetViewTM().GetTranslation() + GetViewTM().TransformVector(FORWARD_DIRECTION) * m_orbitDistance;
// mouse buttons are treated as keys as well
if (m_pressedKeyState == KeyPressedState::AllUp)
{
m_pressedKeyState = KeyPressedState::PressedThisFrame;
}
m_bInOrbitMode = true;
m_orbitTarget =
GetViewTM().GetTranslation() + GetViewTM().TransformVector(FORWARD_DIRECTION) * m_orbitDistance;
m_mousePos = scaledPoint;
m_prevMousePos = scaledPoint;
// mouse buttons are treated as keys as well
if (m_pressedKeyState == KeyPressedState::AllUp)
{
m_pressedKeyState = KeyPressedState::PressedThisFrame;
}
HideCursor();
CaptureMouse();
m_mousePos = scaledPoint;
m_prevMousePos = scaledPoint;
// no further handling of left mouse button down
return;
}
HideCursor();
CaptureMouse();
EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
}
}
else
{
// first try interaction with manipulator
if (m_manipulatorManager == nullptr || !m_manipulatorManager->ConsumeViewportMousePress(mouseInteraction))
{
if (AzToolsFramework::ComponentModeFramework::InComponentMode())
{
EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
}
else
{
QtViewport::OnLButtonDown(modifiers, scaledPoint);
}
// no further handling of left mouse button down
return;
}
EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
}
}
@ -555,39 +534,18 @@ void CRenderViewport::OnLButtonUp(Qt::KeyboardModifiers modifiers, const QPoint&
BuildKeyboardModifiers(modifiers),
BuildMousePick(scaledPoint));
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
if (m_bInOrbitMode)
{
if (m_bInOrbitMode)
{
m_bInOrbitMode = false;
ReleaseMouse();
ShowCursor();
}
m_bInOrbitMode = false;
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
}
else
{
if (m_manipulatorManager == nullptr
|| !m_manipulatorManager->ConsumeViewportMouseRelease(mouseInteraction))
{
if (AzToolsFramework::ComponentModeFramework::InComponentMode())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
}
else
{
QtViewport::OnLButtonUp(modifiers, scaledPoint);
}
}
ReleaseMouse();
ShowCursor();
}
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
}
//////////////////////////////////////////////////////////////////////////
@ -607,27 +565,10 @@ void CRenderViewport::OnLButtonDblClk(Qt::KeyboardModifiers modifiers, const QPo
BuildKeyboardModifiers(modifiers),
BuildMousePick(scaledPoint));
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::DoubleClick));
}
else
{
if (AzToolsFramework::ComponentModeFramework::InComponentMode())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::DoubleClick));
}
else
{
QtViewport::OnLButtonDblClk(modifiers, scaledPoint);
}
}
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::DoubleClick));
}
//////////////////////////////////////////////////////////////////////////
@ -649,48 +590,18 @@ void CRenderViewport::OnRButtonDown(Qt::KeyboardModifiers modifiers, const QPoin
BuildKeyboardModifiers(modifiers),
BuildMousePick(scaledPoint));
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
if (RenderViewportUtil::AllowDolly(modifiers))
{
m_bInZoomMode = true;
}
else
{
m_bInRotateMode = true;
}
if (RenderViewportUtil::AllowDolly(modifiers))
{
m_bInZoomMode = true;
}
else
{
if (m_manipulatorManager == nullptr
|| !m_manipulatorManager->ConsumeViewportMousePress(mouseInteraction))
{
if (AzToolsFramework::ComponentModeFramework::InComponentMode())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
}
else
{
QtViewport::OnRButtonDown(modifiers, scaledPoint);
}
}
if (Qt::AltModifier & QApplication::queryKeyboardModifiers())
{
m_bInZoomMode = true;
}
else
{
m_bInRotateMode = true;
}
m_bInRotateMode = true;
}
// mouse buttons are treated as keys as well
@ -725,31 +636,10 @@ void CRenderViewport::OnRButtonUp(Qt::KeyboardModifiers modifiers, const QPoint&
BuildKeyboardModifiers(modifiers),
BuildMousePick(scaledPoint));
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
}
else
{
if (m_manipulatorManager == nullptr
|| !m_manipulatorManager->ConsumeViewportMouseRelease(mouseInteraction))
{
if (AzToolsFramework::ComponentModeFramework::InComponentMode())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
}
else
{
QtViewport::OnRButtonUp(modifiers, scaledPoint);
}
}
}
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
m_bInRotateMode = false;
m_bInZoomMode = false;
@ -779,73 +669,27 @@ void CRenderViewport::OnMButtonDown(Qt::KeyboardModifiers modifiers, const QPoin
BuildKeyboardModifiers(modifiers),
BuildMousePick(scaledPoint));
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
if (RenderViewportUtil::AllowPan(modifiers))
{
if (RenderViewportUtil::AllowPan(modifiers))
{
m_bInMoveMode = true;
m_bInMoveMode = true;
// mouse buttons are treated as keys as well
if (m_pressedKeyState == KeyPressedState::AllUp)
{
m_pressedKeyState = KeyPressedState::PressedThisFrame;
}
m_mousePos = scaledPoint;
m_prevMousePos = scaledPoint;
HideCursor();
CaptureMouse();
}
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
}
else
{
if (!(modifiers & Qt::ControlModifier) && !(modifiers & Qt::ShiftModifier))
// mouse buttons are treated as keys as well
if (m_pressedKeyState == KeyPressedState::AllUp)
{
if (modifiers & Qt::AltModifier)
{
m_bInOrbitMode = true;
m_orbitTarget = GetViewTM().GetTranslation() + GetViewTM().TransformVector(FORWARD_DIRECTION) * m_orbitDistance;
}
else
{
m_bInMoveMode = true;
}
// mouse buttons are treated as keys as well
if (m_pressedKeyState == KeyPressedState::AllUp)
{
m_pressedKeyState = KeyPressedState::PressedThisFrame;
}
m_mousePos = scaledPoint;
m_prevMousePos = scaledPoint;
HideCursor();
CaptureMouse();
m_pressedKeyState = KeyPressedState::PressedThisFrame;
}
if (m_manipulatorManager == nullptr
|| !m_manipulatorManager->ConsumeViewportMousePress(mouseInteraction))
{
if (AzToolsFramework::ComponentModeFramework::InComponentMode())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
}
else
{
QtViewport::OnMButtonDown(modifiers, scaledPoint);
}
}
m_mousePos = scaledPoint;
m_prevMousePos = scaledPoint;
HideCursor();
CaptureMouse();
}
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
}
//////////////////////////////////////////////////////////////////////////
@ -873,18 +717,9 @@ void CRenderViewport::OnMButtonUp(Qt::KeyboardModifiers modifiers, const QPoint&
}
};
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
if (m_bInMoveMode)
{
m_bInMoveMode = false;
tryRestoreMouse();
}
}
else
if (m_bInMoveMode)
{
m_bInMoveMode = false;
m_bInOrbitMode = false;
tryRestoreMouse();
}
@ -893,31 +728,10 @@ void CRenderViewport::OnMButtonUp(Qt::KeyboardModifiers modifiers, const QPoint&
BuildKeyboardModifiers(modifiers),
BuildMousePick(scaledPoint));
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
}
else
{
if (m_manipulatorManager == nullptr
|| !m_manipulatorManager->ConsumeViewportMouseRelease(mouseInteraction))
{
if (AzToolsFramework::ComponentModeFramework::InComponentMode())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
}
else
{
QtViewport::OnMButtonUp(modifiers, scaledPoint);
}
}
}
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
}
void CRenderViewport::OnMouseMove(Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint& point)
@ -932,43 +746,15 @@ void CRenderViewport::OnMouseMove(Qt::KeyboardModifiers modifiers, Qt::MouseButt
const auto scaledPoint = WidgetToViewport(point);
AzToolsFramework::ManipulatorManager::ConsumeMouseMoveResult mouseMoveResult =
AzToolsFramework::ManipulatorManager::ConsumeMouseMoveResult::None;
const auto mouseInteraction = BuildMouseInteractionInternal(
BuildMouseButtons(buttons),
BuildKeyboardModifiers(modifiers),
BuildMousePick(scaledPoint));
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Move));
}
else
{
if (m_manipulatorManager)
{
mouseMoveResult = m_manipulatorManager->ConsumeViewportMouseMove(mouseInteraction);
}
if (mouseMoveResult != AzToolsFramework::ManipulatorManager::ConsumeMouseMoveResult::Interacting)
{
if (AzToolsFramework::ComponentModeFramework::InComponentMode())
{
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
MouseInteractionEvent(mouseInteraction, MouseEvent::Move));
}
else
{
QtViewport::OnMouseMove(modifiers, buttons, scaledPoint);
}
}
}
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, MouseEvent::Move));
}
void CRenderViewport::InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons)
@ -1081,22 +867,11 @@ void CRenderViewport::ProcessMouse()
Vec3 xdir = m.GetColumn0().GetNormalized();
Vec3 zdir = m.GetColumn2().GetNormalized();
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
const auto modifiers = QGuiApplication::queryKeyboardModifiers();
if (RenderViewportUtil::InvertPan(modifiers))
{
const auto modifiers = QGuiApplication::queryKeyboardModifiers();
if (RenderViewportUtil::InvertPan(modifiers))
{
xdir = -xdir;
zdir = -zdir;
}
}
else
{
if (GetCameraInvertPan())
{
xdir = -xdir;
zdir = -zdir;
}
xdir = -xdir;
zdir = -zdir;
}
Vec3 pos = m.GetTranslation();
@ -1175,20 +950,10 @@ bool CRenderViewport::event(QEvent* event)
auto keyEvent = static_cast<QKeyEvent*>(event);
bool manipulatorInteracting = false;
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::ManipulatorManagerRequestBus::EventResult(
manipulatorInteracting,
AzToolsFramework::g_mainManipulatorManagerId,
&AzToolsFramework::ManipulatorManagerRequestBus::Events::Interacting);
}
else
{
if (m_manipulatorManager != nullptr)
{
manipulatorInteracting = m_manipulatorManager->Interacting();
}
}
AzToolsFramework::ManipulatorManagerRequestBus::EventResult(
manipulatorInteracting,
AzToolsFramework::g_mainManipulatorManagerId,
&AzToolsFramework::ManipulatorManagerRequestBus::Events::Interacting);
// If a manipulator is active, stop all shortcuts from working, except for the escape key, which cancels in some cases
if ((keyEvent->key() != Qt::Key_Escape) && manipulatorInteracting)
@ -1752,12 +1517,6 @@ void CRenderViewport::OnRender()
RenderAll();
// Draw Axis arrow in lower left corner.
if (levelIsDisplayable && !GetIEditor()->IsNewViewportInteractionModelEnabled())
{
DrawAxis();
}
// Draw 2D helpers.
TransformationMatrices backupSceneMatrices;
m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
@ -1786,11 +1545,6 @@ void CRenderViewport::OnRender()
AzToolsFramework::GetEntityContextId(), &AzFramework::ViewportDebugDisplayEvents::DisplayViewport2d,
AzFramework::ViewportInfo{ GetViewportId() }, *debugDisplay);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
RenderSelectionRectangle();
}
m_renderer->Unset2DMode(backupSceneMatrices);
PostWidgetRendering();
@ -1880,11 +1634,6 @@ void CRenderViewport::InitDisplayContext()
displayContext.flags |= DISPLAY_TRACKTICKS;
}
if (m_bAdvancedSelectMode && !GetIEditor()->IsNewViewportInteractionModelEnabled())
{
displayContext.flags |= DISPLAY_SELECTION_HELPERS;
}
if (GetIEditor()->GetReferenceCoordSys() == COORDS_WORLD)
{
displayContext.flags |= DISPLAY_WORLDSPACEAXIS;
@ -2757,16 +2506,13 @@ void CRenderViewport::OnMouseWheel(Qt::KeyboardModifiers modifiers, short zDelta
BuildMousePick(scaledPoint));
bool handled = false;
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
MouseInteractionResult result = MouseInteractionResult::None;
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::EventResult(
result, AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, zDelta));
MouseInteractionResult result = MouseInteractionResult::None;
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::EventResult(
result, AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
MouseInteractionEvent(mouseInteraction, zDelta));
handled = result != MouseInteractionResult::None;
}
handled = result != MouseInteractionResult::None;
if (!handled)
{

@ -91,10 +91,6 @@
#define ID_EXPORT_INDOORS 32915
#define ID_VIEW_CYCLE2DVIEWPORT 32916
#define ID_SNAPANGLE 32917
#define ID_ROTATESELECTION_XAXIS 32918
#define ID_ROTATESELECTION_YAXIS 32919
#define ID_ROTATESELECTION_ZAXIS 32920
#define ID_ROTATESELECTION_ROTATEANGLE 32921
#define ID_EDIT_RENAMEOBJECT 32925
#define ID_CHANGEMOVESPEED_INCREASE 32928
#define ID_CHANGEMOVESPEED_DECREASE 32929
@ -108,9 +104,7 @@
#define ID_FILE_SAVELEVELRESOURCES 32942
#define ID_VALIDATELEVEL 32943
#define ID_TERRAIN_RESIZE 32944
#define ID_RULER 32945
#define ID_RELOAD_TEXTURES 32952
#define ID_LOCK_SELECTION 32956
#define ID_TERRAIN_COLLISION 32960
#define ID_TOOL_FIRST 32972
#define ID_EDIT_UNFREEZE 32973
@ -119,10 +113,8 @@
#define ID_TOOL_SHELVE_FIRST 33174
#define ID_TOOL_SHELVE_LAST 33375
#define ID_EDIT_SELECTALL 33376
#define ID_EDIT_SELECTNONE 33377
#define ID_WIREFRAME 33410
#define ID_FILE_GENERATETERRAINTEXTURE 33445
#define ID_GENERATORS_STATICOBJECTS 33447
#define ID_GENERATORS_TEXTURE 33448
#define ID_FILE_IMPORT 33457
#define ID_EDIT_HOLD 33464
@ -211,7 +203,6 @@
#define ID_EDIT_INVERTSELECTION 33692
#define ID_TOOLTERRAINMODIFY_SMOOTH 33695
#define ID_TERRAINMODIFY_SMOOTH 33696
#define ID_TERRAIN_VEGETATION 33697
#define ID_TERRAIN_PAINTLAYERS 33698
#define ID_SWITCHCAMERA_DEFAULTCAMERA 33700
#define ID_SWITCHCAMERA_SEQUENCECAMERA 33701
@ -274,7 +265,6 @@
#define ID_OPEN_ASSET_BROWSER 34077
#define ID_SNAP_TO_GRID_RANGE_BEGIN 34087
#define ID_SNAP_TO_GRID_RANGE_END 34106
#define ID_GOTO_VIEWPORTSEARCH 34137
#define ID_TOOLS_EXPORT_SHORTCUTS 34138
#define ID_TOOLS_IMPORT_SHORTCUTS 34139
#define ID_TOOLS_VALIDATEOBJECTPOSITIONS 34143
@ -308,8 +298,6 @@
#define ID_FILE_ANIMDBEDITOR 34211
#define ID_SNAP_TO_ANGLE_RANGE_BEGIN 34323
#define ID_SNAP_TO_ANGLE_RANGE_END 34330
#define ID_MODIFY_LINK 34355
#define ID_MODIFY_UNLINK 34356
#define ID_MODIFY_GOTO_SELECTION 34358
#define ID_VIEW_LAYOUT_FIRST 34363
#define ID_VIEW_LAYOUT_LAST 34377
@ -320,7 +308,6 @@
#define ID_CLEAR_REGISTRY 34470
#define ID_SOUND_STOPALLSOUNDS 34476
#define ID_AUDIO_REFRESH_AUDIO_SYSTEM 34477
#define ID_EDIT_SHOW_LAST_HIDDEN 34489
#define ID_GAME_ANDROID_ENABLELOWSPEC 34490
#define ID_GAME_ANDROID_ENABLEMEDIUMSPEC 34491
#define ID_GAME_ANDROID_ENABLEHIGHSPEC 34492

@ -254,8 +254,6 @@ SEditorSettings::SEditorSettings()
bForceSkyUpdate = true;
bIsSearchFilterActive = false;
backgroundUpdatePeriod = 0;
g_TemporaryLevelName = nullptr;

@ -477,7 +477,6 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
bool bVisualizeNavigationAccessibility;
int navigationDebugAgentType;
bool bIsSearchFilterActive;
int backgroundUpdatePeriod;
const char* g_TemporaryLevelName;

@ -595,7 +595,6 @@ AmazonToolbar ToolbarManager::GetEditModeToolbar() const
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_WIDGET_SNAP_GRID, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_WIDGET_SNAP_ANGLE, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_RULER, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_WIDGET_ENVIRONMENT_MODE, ORIGINAL_TOOLBAR_VERSION);

@ -94,13 +94,6 @@ CViewManager::CViewManager()
RegisterQtViewPane<QTopRendererWnd>(GetIEditor(), "Map", LyViewPane::CategoryViewport, viewportOptions);
GetIEditor()->RegisterNotifyListener(this);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
// if the legacy interaction model is used, this manager will be the main manager
m_manipulatorManager =
AZStd::make_shared<AzToolsFramework::ManipulatorManager>(AzToolsFramework::g_mainManipulatorManagerId);
}
}
//////////////////////////////////////////////////////////////////////////

@ -665,12 +665,6 @@ void CLayoutViewPane::SetFullscreenViewport(bool b)
}
}
//////////////////////////////////////////////////////////////////////////
void CLayoutViewPane::SetFocusToViewportSearch()
{
m_viewportTitleDlg.SetFocusToSearchField();
}
//////////////////////////////////////////////////////////////////////////
void CLayoutViewPane::SetFocusToViewport()
{

@ -73,7 +73,6 @@ public:
void ShowTitleMenu();
void ToggleMaximize();
void SetFocusToViewportSearch();
void SetFocusToViewport();
void ResizeViewport(int width, int height);

@ -63,33 +63,9 @@ inline namespace Helpers
}
}
const int SEARCH_BY_NAME = 1;
const int SEARCH_BY_TYPE = 2;
const int SEARCH_BY_ASSET = 3;
const int HIDE_OTHERS = 4;
const int FREEZE_OTHERS = 5;
const int JUST_SELLECT = 6;
const int LOGICAL_AND = 7;
const int LOGICAL_OR = 8;
const int INPUT_NAMES_FROM_SELECTION = 9;
CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent)
: QWidget(pParent)
, m_searchMode(ESM_BY_NAME)
, m_searchResultHandling(ESRH_HIDE_OTHERS)
, m_bOR(false)
, m_ui(new Ui::ViewportTitleDlg)
, m_searchModeActionGroup(nullptr)
, m_searchByNameAction(nullptr)
, m_searchByTypeAction(nullptr)
, m_searchByAssetAction(nullptr)
, m_searchResultHandlingActionGroup(nullptr)
, m_searchHideOthersAction(nullptr)
, m_searchFreezeOthersAction(nullptr)
, m_searchJustSelectAction(nullptr)
, m_searchMatchTypeActionGroup(nullptr)
, m_searchAndAction(nullptr)
, m_searchOrAction(nullptr)
{
auto container = new QWidget(this);
m_ui->setupUi(container);
@ -106,29 +82,8 @@ CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent)
LoadCustomPresets("AspectRatioPresets", "AspectRatioPreset", m_customAspectRatioPresets);
LoadCustomPresets("ResPresets", "ResPreset", m_customResPresets);
const bool newViewportInteractionModelEnabled =
GetIEditor()->IsNewViewportInteractionModelEnabled();
m_ui->m_viewportSearch->setEnabled(!newViewportInteractionModelEnabled);
m_ui->m_viewportSearch->setVisible(!newViewportInteractionModelEnabled);
OnInitDialog();
if (!newViewportInteractionModelEnabled)
{
m_ui->m_viewportSearch->setClearButtonEnabled(true);
connect(m_ui->m_viewportSearch, &AzQtComponents::SearchLineEdit::menuEntryClicked, this, &CViewportTitleDlg::OnViewportSearchButtonClicked);
connect(m_ui->m_viewportSearch, &AzQtComponents::SearchLineEdit::returnPressed, this, &CViewportTitleDlg::OnSearchTermChange);
connect(m_ui->m_viewportSearch, &QLineEdit::textChanged, this, [this] (const QString& text){
if(text.isEmpty())
{
this->OnViewportSearchClear();
}
});
m_ui->m_viewportSearch->setFixedWidth(190);
}
connect(m_ui->m_fovLabel, &QWidget::customContextMenuRequested, this, &CViewportTitleDlg::PopUpFOVMenu);
connect(m_ui->m_fovStaticCtrl, &QWidget::customContextMenuRequested, this, &CViewportTitleDlg::PopUpFOVMenu);
connect(m_ui->m_ratioStaticCtrl, &QWidget::customContextMenuRequested, this, &CViewportTitleDlg::PopUpAspectMenu);
@ -160,8 +115,6 @@ void CViewportTitleDlg::OnInitDialog()
m_ui->m_titleBtn->setText(m_title);
m_ui->m_sizeStaticCtrl->setText(QString());
UpdateSearchOptionsText();
m_ui->m_toggleHelpersBtn->setChecked(GetIEditor()->GetDisplaySettings()->IsDisplayHelpers());
ICVar* pDisplayInfo(gEnv->pConsole->GetCVar("r_displayInfo"));
@ -178,77 +131,6 @@ void CViewportTitleDlg::OnInitDialog()
m_ui->m_toggleHelpersBtn->setProperty("class", "big");
m_ui->m_toggleDisplayInfoBtn->setProperty("class", "big");
// ON_EN_CHANGE(IDC_VIEWPORT_SEARCH, OnSearchTermChange)
}
//////////////////////////////////////////////////////////////////////////
QMenu * CViewportTitleDlg::InitializeViewportSearchMenu()
{
QMenu* menu = new QMenu(this);
m_searchByNameAction = menu->addAction(tr("By Name"));
m_searchByNameAction->setData(SEARCH_BY_NAME);
m_searchByNameAction->setCheckable(true);
m_searchByNameAction->setChecked(m_searchMode == ESM_BY_NAME);
m_searchByTypeAction = menu->addAction(tr("By Type"));
m_searchByTypeAction->setData(SEARCH_BY_TYPE);
m_searchByTypeAction->setCheckable(true);
m_searchByTypeAction->setChecked(m_searchMode == ESM_BY_TYPE);
m_searchByAssetAction = menu->addAction(tr("By Asset"));
m_searchByAssetAction->setData(SEARCH_BY_ASSET);
m_searchByAssetAction->setCheckable(true);
m_searchByAssetAction->setChecked(m_searchMode == ESM_BY_ASSET);
menu->addSeparator();
m_searchHideOthersAction = menu->addAction(tr("Hide others"));
m_searchHideOthersAction->setData(HIDE_OTHERS);
m_searchHideOthersAction->setCheckable(true);
m_searchHideOthersAction->setChecked(m_searchResultHandling == ESRH_HIDE_OTHERS);
m_searchFreezeOthersAction = menu->addAction(tr("Freeze others"));
m_searchFreezeOthersAction->setData(FREEZE_OTHERS);
m_searchFreezeOthersAction->setCheckable(true);
m_searchFreezeOthersAction->setChecked(m_searchResultHandling == ESRH_FREEZE_OTHERS);
m_searchJustSelectAction = menu->addAction(tr("Just Select"));
m_searchJustSelectAction->setData(JUST_SELLECT);
m_searchJustSelectAction->setCheckable(true);
m_searchJustSelectAction->setChecked(m_searchResultHandling == ESRH_JUST_SELECT);
menu->addSeparator();
m_searchAndAction = menu->addAction(tr("AND"));
m_searchAndAction->setData(LOGICAL_AND);
m_searchAndAction->setCheckable(true);
m_searchAndAction->setChecked(!m_bOR);
m_searchOrAction = menu->addAction(tr("OR"));
m_searchOrAction->setData(LOGICAL_OR);
m_searchOrAction->setCheckable(true);
m_searchOrAction->setChecked(m_bOR);
menu->addSeparator();
menu->addAction(tr("Input names from selection"))->setData(INPUT_NAMES_FROM_SELECTION);
// Add the search mode, search result handling, and match type actions to
// exclusive action groups so that only one can be checked at a time, and
// you can't un-check the active action
m_searchModeActionGroup = new QActionGroup(this);
m_searchModeActionGroup->setExclusive(true);
m_searchModeActionGroup->addAction(m_searchByNameAction);
m_searchModeActionGroup->addAction(m_searchByTypeAction);
m_searchModeActionGroup->addAction(m_searchByAssetAction);
m_searchResultHandlingActionGroup = new QActionGroup(this);
m_searchResultHandlingActionGroup->setExclusive(true);
m_searchResultHandlingActionGroup->addAction(m_searchHideOthersAction);
m_searchResultHandlingActionGroup->addAction(m_searchFreezeOthersAction);
m_searchResultHandlingActionGroup->addAction(m_searchJustSelectAction);
m_searchMatchTypeActionGroup = new QActionGroup(this);
m_searchMatchTypeActionGroup->setExclusive(true);
m_searchMatchTypeActionGroup->addAction(m_searchAndAction);
m_searchMatchTypeActionGroup->addAction(m_searchOrAction);
return menu;
}
//////////////////////////////////////////////////////////////////////////
@ -256,11 +138,6 @@ void CViewportTitleDlg::SetTitle(const QString& title)
{
m_title = title;
m_ui->m_titleBtn->setText(m_title);
const bool searchVisible =
title == QLatin1String("Perspective") && !GetIEditor()->IsNewViewportInteractionModelEnabled();
m_ui->m_viewportSearch->setVisible(searchVisible);
}
//////////////////////////////////////////////////////////////////////////
@ -645,339 +522,6 @@ void CViewportTitleDlg::OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::InputNamesToSearchFromSelection()
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
CSelectionGroup* pSelected = pObjMgr->GetSelection();
QString names;
for (int i = 0; i < pSelected->GetCount(); ++i)
{
names += pSelected->GetObject(i)->GetName();
names += QStringLiteral(" ");
}
m_ui->m_viewportSearch->setText(names);
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::OnViewportSearchButtonClicked(const QAction* clickedAction)
{
int cmd = clickedAction ? clickedAction->data().toInt() : 0;
#define ASSIGN(dst, src) do { if ((dst) != (src)) { (dst) = (src); OnSearchTermChange(); } \
} \
while (0)
if (cmd == SEARCH_BY_NAME)
{
ASSIGN(m_searchMode, ESM_BY_NAME);
}
else if (cmd == SEARCH_BY_TYPE)
{
ASSIGN(m_searchMode, ESM_BY_TYPE);
}
else if (cmd == SEARCH_BY_ASSET)
{
ASSIGN(m_searchMode, ESM_BY_ASSET);
}
else if (cmd == HIDE_OTHERS)
{
ASSIGN(m_searchResultHandling, ESRH_HIDE_OTHERS);
}
else if (cmd == FREEZE_OTHERS)
{
ASSIGN(m_searchResultHandling, ESRH_FREEZE_OTHERS);
}
else if (cmd == JUST_SELLECT)
{
ASSIGN(m_searchResultHandling, ESRH_JUST_SELECT);
}
else if (cmd == LOGICAL_AND)
{
ASSIGN(m_bOR, false);
}
else if (cmd == LOGICAL_OR)
{
ASSIGN(m_bOR, true);
}
else if (cmd == INPUT_NAMES_FROM_SELECTION)
{
InputNamesToSearchFromSelection();
m_bOR = true;
m_searchOrAction->setChecked(true);
OnSearchTermChange();
}
UpdateSearchOptionsText();
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::OnViewportSearchClear()
{
UnhideUnfreezeAll();
//clear edit control
gSettings.bIsSearchFilterActive = false;
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::SetFocusToSearchField()
{
if (m_ui->m_viewportSearch->isVisible())
{
m_ui->m_viewportSearch->setFocus();
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::OnSearchTermChange()
{
// Get individual search terms.
const QString searchTerm = m_ui->m_viewportSearch->text();
if (!searchTerm.isEmpty())
{
gSettings.bIsSearchFilterActive = true;
}
else
{
gSettings.bIsSearchFilterActive = false;
}
const int MIN_CHARS_AS_A_SEARCH_TERM = 3;
QStringList terms;
QStringList splitTerms = searchTerm.split(QStringLiteral(" "));
for (const QString& term : splitTerms)
{
if (term.length() >= MIN_CHARS_AS_A_SEARCH_TERM)
{
terms.append(term);
}
}
if (terms.isEmpty())
{
UnhideUnfreezeAll();
return;
}
// Make sure to lower case all terms because later we lower case all inputs to compare against
for (QString& term : terms)
{
term = term.toLower();
}
// Perform a search.
if (m_searchMode == ESM_BY_NAME)
{
SearchByName(terms);
}
else if (m_searchMode == ESM_BY_TYPE)
{
SearchByType(terms);
}
else if (m_searchMode == ESM_BY_ASSET)
{
SearchByAsset(terms);
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::UnhideUnfreezeAll()
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
int objCount = pObjMgr->GetObjectCount();
CBaseObjectsArray objects;
pObjMgr->GetObjects(objects);
for (int i = 0; i < objCount; ++i)
{
CBaseObject* pObject = objects[i];
pObjMgr->FreezeObject(pObject, false);
pObjMgr->HideObject(pObject, false);
}
}
//////////////////////////////////////////////////////////////////////////
static bool DoesTextSatisfyTerms(const QString& text, const QStringList& terms, bool bOR)
{
if (bOR) // OR
{
for (const QString& term : terms)
{
if (text.contains(term))
{
return true;
}
}
return false;
}
else // AND
{
for (const QString& term : terms)
{
if (!text.contains(term))
{
return false;
}
}
return true;
}
}
//////////////////////////////////////////////////////////////////////////
static void HandleMatched(CBaseObject* pObject)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
pObjMgr->FreezeObject(pObject, false);
pObjMgr->HideObject(pObject, false);
pObjMgr->SelectObject(pObject);
}
//////////////////////////////////////////////////////////////////////////
static void HandleFiltered(CBaseObject* pObject, CViewportTitleDlg::ESearchResultHandling searchResultHandling)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
pObjMgr->UnselectObject(pObject);
if (searchResultHandling == CViewportTitleDlg::ESRH_HIDE_OTHERS)
{
pObjMgr->FreezeObject(pObject, false);
pObjMgr->HideObject(pObject, true);
}
else if (searchResultHandling == CViewportTitleDlg::ESRH_FREEZE_OTHERS)
{
pObjMgr->HideObject(pObject, false);
pObjMgr->FreezeObject(pObject, true);
}
else if (searchResultHandling == CViewportTitleDlg::ESRH_JUST_SELECT)
{
pObjMgr->FreezeObject(pObject, false);
pObjMgr->HideObject(pObject, false);
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::SearchByType(const QStringList& terms)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
int objCount = pObjMgr->GetObjectCount();
CBaseObjectsArray objects;
pObjMgr->GetObjects(objects);
for (int i = 0; i < objCount; ++i)
{
CBaseObject* pObject = objects[i];
QString type = pObject->GetTypeDescription();
if (DoesTextSatisfyTerms(type.toLower(), terms, m_bOR))
{
HandleMatched(pObject);
}
else
{
HandleFiltered(pObject, m_searchResultHandling);
}
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::SearchByName(const QStringList& terms)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
int objCount = pObjMgr->GetObjectCount();
CBaseObjectsArray objects;
pObjMgr->GetObjects(objects);
for (int i = 0; i < objCount; ++i)
{
CBaseObject* pObject = objects[i];
QString name = pObject->GetName();
if (DoesTextSatisfyTerms(name.toLower(), terms, m_bOR))
{
HandleMatched(pObject);
}
else
{
HandleFiltered(pObject, m_searchResultHandling);
}
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::SearchByAsset(const QStringList& terms)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
int objCount = pObjMgr->GetObjectCount();
CBaseObjectsArray objects;
pObjMgr->GetObjects(objects);
for (int i = 0; i < objCount; ++i)
{
CBaseObject* pObject = objects[i];
CUsedResources usedAssets;
pObject->GatherUsedResources(usedAssets);
CUsedResources::TResourceFiles::const_iterator itr = usedAssets.files.begin(),
end = usedAssets.files.end();
bool bMatch = false;
for (; itr != end; ++itr)
{
QString filename = *itr;
if (DoesTextSatisfyTerms(filename.toLower(), terms, m_bOR))
{
bMatch = true;
break;
}
}
if (bMatch)
{
HandleMatched(pObject);
}
else
{
HandleFiltered(pObject, m_searchResultHandling);
}
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::UpdateSearchOptionsText()
{
QString str = "";
if (m_searchMode == ESM_BY_NAME)
{
str += tr("By Name");
}
else if (m_searchMode == ESM_BY_TYPE)
{
str += tr("By Type");
}
else //if(m_searchMode == ESM_BY_ASSET)
{
str += tr("By Asset");
}
if (m_searchResultHandling == ESRH_HIDE_OTHERS)
{
str += tr(", Hide filtered");
}
else if (m_searchResultHandling == ESRH_FREEZE_OTHERS)
{
str += tr(", Freeze filtered");
}
else if (m_searchResultHandling == ESRH_JUST_SELECT)
{
str += tr(", Just Select");
}
if (m_bOR)
{
str += tr(", OR");
}
else
{
str += tr(", AND");
}
m_ui->m_viewportSearch->setPlaceholderText(str);
}
void CViewportTitleDlg::LoadCustomPresets(const QString& section, const QString& keyName, QStringList& outCustompresets)
{
QSettings settings("Amazon", "O3DE"); // Temporary solution until we have the global Settings class.

@ -28,7 +28,6 @@ class CLayoutViewPane;
class CPopupMenuItem;
class QAbstractButton;
class QActionGroup;
class QMenu;
struct ICVar;
@ -53,22 +52,6 @@ public:
void SetTitle(const QString& title);
void OnViewportSizeChanged(int width, int height);
void OnViewportFOVChanged(float fov);
void SetFocusToSearchField();
// Dialog Data
enum ESearchResultHandling
{
ESRH_HIDE_OTHERS = 0,
ESRH_FREEZE_OTHERS,
ESRH_JUST_SELECT,
};
enum ESearchMode
{
ESM_BY_NAME = 0,
ESM_BY_TYPE,
ESM_BY_ASSET,
};
static void AddFOVMenus(QMenu* menu, std::function<void(float)> callback, const QStringList& customPresets);
static void AddAspectRatioMenus(QMenu* menu, std::function<void(int, int)> callback, const QStringList& customPresets);
@ -87,7 +70,6 @@ public:
protected:
virtual void OnInitDialog();
QMenu *InitializeViewportSearchMenu();
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) override;
@ -95,18 +77,11 @@ protected:
void OnMaximize();
void OnToggleHelpers();
void OnToggleDisplayInfo();
void OnSearchTermChange();
void OnViewportSearchButtonClicked(const QAction* clickedAction);
void OnViewportSearchClear();
QString m_title;
CLayoutViewPane* m_pViewPane;
ESearchMode m_searchMode;
ESearchResultHandling m_searchResultHandling;
bool m_bOR;
static const int MAX_NUM_CUSTOM_PRESETS = 10;
QStringList m_customResPresets;
QStringList m_customFOVPresets;
@ -114,13 +89,6 @@ protected:
uint64 m_displayInfoCallbackIndex;
void UnhideUnfreezeAll();
void SearchByType(const QStringList& terms);
void SearchByName(const QStringList& terms);
void SearchByAsset(const QStringList& terms);
void UpdateSearchOptionsText();
void InputNamesToSearchFromSelection();
void OnMenuFOVCustom();
void CreateFOVMenu();
@ -139,18 +107,6 @@ protected:
QMenu* m_resolutionMenu = nullptr;
QScopedPointer<Ui::ViewportTitleDlg> m_ui;
QActionGroup* m_searchModeActionGroup;
QAction* m_searchByNameAction;
QAction* m_searchByTypeAction;
QAction* m_searchByAssetAction;
QActionGroup* m_searchResultHandlingActionGroup;
QAction* m_searchHideOthersAction;
QAction* m_searchFreezeOthersAction;
QAction* m_searchJustSelectAction;
QActionGroup* m_searchMatchTypeActionGroup;
QAction* m_searchAndAction;
QAction* m_searchOrAction;
};
namespace AzToolsFramework

@ -28,7 +28,7 @@
<height>29</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,2,0,0,0,0,0,0,0,0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,0,0,0,0,0,0,0">
<property name="leftMargin">
<number>10</number>
</property>
@ -60,28 +60,6 @@
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::SearchLineEdit" name="m_viewportSearch">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>147</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>147</width>
<height>22</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_fovLabel">
<property name="contextMenuPolicy">
@ -208,11 +186,6 @@
<header>AzQtComponents/Components/ButtonDivider.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>AzQtComponents::SearchLineEdit</class>
<extends>QLineEdit</extends>
<header>AzQtComponents/Components/SearchLineEdit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

@ -110,7 +110,6 @@ void CComponentEntityObject::AssignEntity(AZ::Entity* entity, bool destroyOld)
if (m_entityId.IsValid())
{
AzToolsFramework::EntitySelectionEvents::Bus::Handler::BusDisconnect();
AZ::TransformNotificationBus::Handler::BusDisconnect();
LmbrCentral::RenderBoundsNotificationBus::Handler::BusDisconnect();
LmbrCentral::MeshComponentNotificationBus::Handler::BusDisconnect();
@ -157,7 +156,6 @@ void CComponentEntityObject::AssignEntity(AZ::Entity* entity, bool destroyOld)
EBUS_EVENT(AzToolsFramework::EditorEntityContextRequestBus, AddRequiredComponents, *entity);
AzToolsFramework::EntitySelectionEvents::Bus::Handler::BusConnect(m_entityId);
AZ::TransformNotificationBus::Handler::BusConnect(m_entityId);
LmbrCentral::RenderBoundsNotificationBus::Handler::BusConnect(m_entityId);
LmbrCentral::MeshComponentNotificationBus::Handler::BusConnect(m_entityId);
@ -306,39 +304,6 @@ void CComponentEntityObject::OnEntityNameChanged(const AZStd::string& name)
}
}
void CComponentEntityObject::OnSelected()
{
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
return;
}
if (m_selectionReentryGuard)
{
EditorActionScope selectionChange(m_selectionReentryGuard);
// Invoked when selected via tools application, so we notify sandbox.
const bool wasSelected = IsSelected();
GetIEditor()->GetObjectManager()->SelectObject(this);
}
}
void CComponentEntityObject::OnDeselected()
{
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
return;
}
if (m_selectionReentryGuard)
{
EditorActionScope selectionChange(m_selectionReentryGuard);
// Invoked when selected via tools application, so we notify sandbox.
GetIEditor()->GetObjectManager()->UnselectObject(this);
}
}
void CComponentEntityObject::AttachChild(CBaseObject* child, bool /*bKeepPos*/)
{
if (child->GetType() == OBJTYPE_AZENTITY)
@ -997,24 +962,12 @@ bool CComponentEntityObject::IsIsolated() const
bool CComponentEntityObject::IsSelected() const
{
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
return AzToolsFramework::IsSelected(m_entityId);
}
// legacy is selected call
return CBaseObject::IsSelected();
return AzToolsFramework::IsSelected(m_entityId);
}
bool CComponentEntityObject::IsSelectable() const
{
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
return AzToolsFramework::IsSelectableInViewport(m_entityId);
}
// legacy is selectable call
return CBaseObject::IsSelectable();
return AzToolsFramework::IsSelectableInViewport(m_entityId);
}
void CComponentEntityObject::SetWorldPos(const Vec3& pos, int flags)

@ -38,7 +38,6 @@ class QMenu;
*/
class CComponentEntityObject
: public CEntityObject
, private AzToolsFramework::EntitySelectionEvents::Bus::Handler
, private AzToolsFramework::EditorLockComponentNotificationBus::Handler
, private AzToolsFramework::EditorVisibilityNotificationBus::Handler
, private AzToolsFramework::EditorEntityIconComponentNotificationBus::Handler
@ -111,12 +110,6 @@ public:
void OnEntityNameChanged(const AZStd::string& name) override;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//! AzToolsFramework::EntitySelectionEvents::Bus::Handler
void OnSelected() override;
void OnDeselected() override;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// AzToolsFramework::EditorLockComponentNotificationBus::Handler
void OnEntityLockChanged(bool locked) override;

@ -159,18 +159,6 @@ void SandboxIntegrationManager::Setup()
AzToolsFramework::ToolsApplicationEvents::Bus::Handler::BusConnect();
AzToolsFramework::EditorRequests::Bus::Handler::BusConnect();
AzToolsFramework::EditorWindowRequests::Bus::Handler::BusConnect();
// if the new viewport interaction model is enabled, then object picking is handled via
// EditorPickEntitySelection and SandboxIntegrationManager is not required
if (!IsNewViewportInteractionModelEnabled())
{
AzFramework::EntityContextId pickModeEntityContextId = GetEntityContextId();
if (!pickModeEntityContextId.IsNull())
{
AzToolsFramework::EditorPickModeNotificationBus::Handler::BusConnect(pickModeEntityContextId);
}
}
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusConnect();
@ -398,12 +386,6 @@ void SandboxIntegrationManager::Teardown()
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect();
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
if (!IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EditorPickModeNotificationBus::Handler::BusDisconnect();
}
AzToolsFramework::EditorWindowRequests::Bus::Handler::BusDisconnect();
AzToolsFramework::EditorRequests::Bus::Handler::BusDisconnect();
AzToolsFramework::ToolsApplicationEvents::Bus::Handler::BusDisconnect();
@ -1243,21 +1225,14 @@ void SandboxIntegrationManager::CloneSelection(bool& handled)
}
}
void SandboxIntegrationManager::DeleteSelectedEntities(const bool includeDescendants)
void SandboxIntegrationManager::DeleteSelectedEntities([[maybe_unused]] const bool includeDescendants)
{
if (IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EntityIdList selectedEntityIds;
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
selectedEntityIds, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
AzToolsFramework::EntityIdList selectedEntityIds;
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
selectedEntityIds, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
&AzToolsFramework::ToolsApplicationRequests::DeleteEntitiesAndAllDescendants, selectedEntityIds);
}
else
{
CCryEditApp::instance()->DeleteSelectedEntities(includeDescendants);
}
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
&AzToolsFramework::ToolsApplicationRequests::DeleteEntitiesAndAllDescendants, selectedEntityIds);
}
AZ::EntityId SandboxIntegrationManager::CreateNewEntity(AZ::EntityId parentId)

Loading…
Cancel
Save