From 08bd4ee740c995d49b995be338db36a540b50f52 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Thu, 22 Apr 2021 14:28:42 -0500 Subject: [PATCH] [LYN-3160] Removed IEditor::Get/SetEditMode and some additional unused (related) content in the InfoBar. --- .../EditorUtilityCommands_legacy_test_case.py | 18 - .../EditorUtilityCommands_test.py | 2 - .../EditorUtilityCommands_test_case.py | 16 - .../Editor/Core/LevelEditorMenuHandler.cpp | 20 - Code/Sandbox/Editor/CryEdit.cpp | 270 ++-------- Code/Sandbox/Editor/CryEdit.h | 18 - Code/Sandbox/Editor/CryEditDoc.cpp | 2 - Code/Sandbox/Editor/IEditor.h | 14 - Code/Sandbox/Editor/IEditorImpl.cpp | 113 +---- Code/Sandbox/Editor/IEditorImpl.h | 14 - Code/Sandbox/Editor/InfoBar.cpp | 467 +----------------- Code/Sandbox/Editor/InfoBar.h | 20 - Code/Sandbox/Editor/InfoBar.ui | 105 ---- Code/Sandbox/Editor/Lib/Tests/IEditorMock.h | 2 - .../Lib/Tests/test_EditorPythonBindings.cpp | 2 - .../Editor/Lib/Tests/test_SetVectorDlg.cpp | 92 ---- Code/Sandbox/Editor/MainWindow.cpp | 140 ------ Code/Sandbox/Editor/MainWindow.h | 15 - Code/Sandbox/Editor/Objects/AxisGizmo.cpp | 209 +------- Code/Sandbox/Editor/PythonEditorEventsBus.h | 10 - Code/Sandbox/Editor/PythonEditorFuncs.cpp | 77 --- Code/Sandbox/Editor/PythonEditorFuncs.h | 4 - Code/Sandbox/Editor/RenderViewport.cpp | 75 --- Code/Sandbox/Editor/Resource.h | 11 - Code/Sandbox/Editor/SetVectorDlg.cpp | 257 ---------- Code/Sandbox/Editor/SetVectorDlg.h | 61 --- Code/Sandbox/Editor/SetVectorDlg.ui | 55 --- Code/Sandbox/Editor/ToolbarManager.cpp | 14 - Code/Sandbox/Editor/editor_lib_files.cmake | 3 - .../Editor/editor_lib_test_files.cmake | 1 - 30 files changed, 34 insertions(+), 2073 deletions(-) delete mode 100644 Code/Sandbox/Editor/Lib/Tests/test_SetVectorDlg.cpp delete mode 100644 Code/Sandbox/Editor/SetVectorDlg.cpp delete mode 100644 Code/Sandbox/Editor/SetVectorDlg.h delete mode 100644 Code/Sandbox/Editor/SetVectorDlg.ui diff --git a/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_legacy_test_case.py b/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_legacy_test_case.py index 9bb9ba5337..9160530ba4 100755 --- a/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_legacy_test_case.py +++ b/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_legacy_test_case.py @@ -27,15 +27,6 @@ def testing_cvar(setMethod, methodName, label, value, compare): print('{} failed'.format(methodName)) -def testing_edit_mode(mode): - general.set_edit_mode(mode) - - if (general.get_edit_mode(mode)): - return True - - return False - - def testing_axis_constraints(constraint): general.set_axis_constraint(constraint) @@ -58,15 +49,6 @@ compare = lambda lhs, rhs: rhs == int(lhs) testing_cvar(general.set_cvar_integer, 'set_cvar_integer', 'sys_LocalMemoryGeometryLimit', 33, compare) -# ----- Test Edit Mode - -if (testing_edit_mode("SELECT") and testing_edit_mode('SELECTAREA') and - testing_edit_mode("MOVE") and testing_edit_mode("ROTATE") and - testing_edit_mode("SCALE") and testing_edit_mode("TOOL")): - - print("edit mode works") - - # ----- Test Axis Constraints if (testing_axis_constraints("X") and testing_axis_constraints("Y") and diff --git a/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_test.py b/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_test.py index 6261312814..bc258cce3f 100755 --- a/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_test.py +++ b/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_test.py @@ -33,7 +33,6 @@ class TestEditorAutomation(object): "SetCVarFromFloat worked", "SetCVarFromString worked", "SetCVarFromInteger worked", - "edit mode works", "axis constraint works", "end of editor utility tests" ] @@ -48,7 +47,6 @@ class TestEditorAutomation(object): "set_cvar_float worked", "set_cvar_string worked", "set_cvar_integer worked", - "edit mode works", "axis constraint works", "end of editor utility tests" ] diff --git a/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_test_case.py b/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_test_case.py index bae7da19b0..91dd883a10 100755 --- a/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_test_case.py +++ b/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/EditorUtilityCommands_test_case.py @@ -28,15 +28,6 @@ def testing_cvar(setMethod, methodName, label, value, compare): print('{} failed'.format(methodName)) -def testing_edit_mode(mode): - python_editor_funcs.PythonEditorBus(bus.Broadcast, 'SetEditMode', mode) - - if mode == python_editor_funcs.PythonEditorBus(bus.Broadcast, 'GetEditMode'): - return True - - return False - - def testing_axis_constraints(constraint): python_editor_funcs.PythonEditorBus(bus.Broadcast, 'SetAxisConstraint', constraint) @@ -57,13 +48,6 @@ testing_cvar('SetCVarFromString', 'SetCVarFromString', 'e_ScreenShotFileFormat', compare = lambda lhs, rhs: rhs == int(lhs) testing_cvar('SetCVarFromInteger', 'SetCVarFromInteger', 'sys_LocalMemoryGeometryLimit', 33, compare) -# ----- Test Edit Mode - -if (testing_edit_mode("SELECT") and testing_edit_mode('SELECTAREA') and - testing_edit_mode("MOVE") and testing_edit_mode("ROTATE") and - testing_edit_mode("SCALE") and testing_edit_mode("TOOL")): - print("edit mode works") - # ----- Test Axis Constraints if (testing_axis_constraints("X") and testing_axis_constraints("Y") and diff --git a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp index 0863e1627f..aed53d6e8b 100644 --- a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp +++ b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp @@ -577,16 +577,6 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe modifyMenu.AddAction(ID_MODIFY_LINK); modifyMenu.AddAction(ID_MODIFY_UNLINK); modifyMenu.AddSeparator(); - - auto alignMenu = modifyMenu.AddMenu(tr("Align")); - alignMenu.AddAction(ID_OBJECTMODIFY_ALIGNTOGRID); - - auto constrainMenu = modifyMenu.AddMenu(tr("Constrain")); - constrainMenu.AddAction(ID_SELECT_AXIS_X); - constrainMenu.AddAction(ID_SELECT_AXIS_Y); - constrainMenu.AddAction(ID_SELECT_AXIS_Z); - constrainMenu.AddAction(ID_SELECT_AXIS_XY); - constrainMenu.AddAction(ID_SELECT_AXIS_TERRAIN); } auto snapMenu = modifyMenu.AddMenu(tr("Snap")); @@ -608,20 +598,10 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe } auto transformModeMenu = modifyMenu.AddMenu(tr("Transform Mode")); - if (!newViewportInteractionModelEnabled) - { - transformModeMenu.AddAction(ID_EDITMODE_SELECT); - } - transformModeMenu.AddAction(ID_EDITMODE_MOVE); transformModeMenu.AddAction(ID_EDITMODE_ROTATE); transformModeMenu.AddAction(ID_EDITMODE_SCALE); - if (!newViewportInteractionModelEnabled) - { - transformModeMenu.AddAction(ID_EDITMODE_SELECTAREA); - } - editMenu.AddSeparator(); // Lock Selection diff --git a/Code/Sandbox/Editor/CryEdit.cpp b/Code/Sandbox/Editor/CryEdit.cpp index b373ef0009..a474706910 100644 --- a/Code/Sandbox/Editor/CryEdit.cpp +++ b/Code/Sandbox/Editor/CryEdit.cpp @@ -125,7 +125,6 @@ AZ_POP_DISABLE_WARNING #include "AnimationContext.h" #include "GotoPositionDlg.h" -#include "SetVectorDlg.h" #include "ConsoleDialog.h" #include "Controls/ConsoleSCB.h" @@ -395,29 +394,20 @@ void CCryEditApp::RegisterActionHandlers() ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove) ON_COMMAND(ID_EDITMODE_ROTATE, OnEditmodeRotate) ON_COMMAND(ID_EDITMODE_SCALE, OnEditmodeScale) - ON_COMMAND(ID_EDITMODE_SELECT, OnEditmodeSelect) ON_COMMAND(ID_OBJECTMODIFY_SETAREA, OnObjectSetArea) ON_COMMAND(ID_OBJECTMODIFY_SETHEIGHT, OnObjectSetHeight) ON_COMMAND(ID_OBJECTMODIFY_FREEZE, OnObjectmodifyFreeze) ON_COMMAND(ID_OBJECTMODIFY_UNFREEZE, OnObjectmodifyUnfreeze) - ON_COMMAND(ID_EDITMODE_SELECTAREA, OnEditmodeSelectarea) - ON_COMMAND(ID_SELECT_AXIS_X, OnSelectAxisX) - ON_COMMAND(ID_SELECT_AXIS_Y, OnSelectAxisY) - ON_COMMAND(ID_SELECT_AXIS_Z, OnSelectAxisZ) - ON_COMMAND(ID_SELECT_AXIS_XY, OnSelectAxisXy) 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_SELECTION_SAVE, OnSelectionSave) ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter) ON_COMMAND(ID_SELECTION_LOAD, OnSelectionLoad) - ON_COMMAND(ID_OBJECTMODIFY_ALIGNTOGRID, OnAlignToGrid) ON_COMMAND(ID_LOCK_SELECTION, OnLockSelection) ON_COMMAND(ID_EDIT_LEVELDATA, OnEditLevelData) ON_COMMAND(ID_FILE_EDITLOGFILE, OnFileEditLogFile) ON_COMMAND(ID_FILE_RESAVESLICES, OnFileResaveSlices) ON_COMMAND(ID_FILE_EDITEDITORINI, OnFileEditEditorini) - ON_COMMAND(ID_SELECT_AXIS_TERRAIN, OnSelectAxisTerrain) - ON_COMMAND(ID_SELECT_AXIS_SNAPTOALL, OnSelectAxisSnapToAll) ON_COMMAND(ID_PREFERENCES, OnPreferences) ON_COMMAND(ID_RELOAD_GEOMETRY, OnReloadGeometry) ON_COMMAND(ID_REDO, OnRedo) @@ -484,7 +474,6 @@ void CCryEditApp::RegisterActionHandlers() ON_COMMAND(ID_VIEW_CYCLE2DVIEWPORT, OnViewCycle2dviewport) #endif ON_COMMAND(ID_DISPLAY_GOTOPOSITION, OnDisplayGotoPosition) - ON_COMMAND(ID_DISPLAY_SETVECTOR, OnDisplaySetVector) ON_COMMAND(ID_SNAPANGLE, OnSnapangle) ON_COMMAND(ID_RULER, OnRuler) ON_COMMAND(ID_ROTATESELECTION_XAXIS, OnRotateselectionXaxis) @@ -2755,85 +2744,31 @@ void CCryEditApp::OnSetHeight() ////////////////////////////////////////////////////////////////////////// void CCryEditApp::OnEditmodeMove() { - if (GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - using namespace AzToolsFramework; - EditorTransformComponentSelectionRequestBus::Event( - GetEntityContextId(), - &EditorTransformComponentSelectionRequests::SetTransformMode, - EditorTransformComponentSelectionRequests::Mode::Translation); - } - else - { - GetIEditor()->SetEditMode(eEditModeMove); - } + using namespace AzToolsFramework; + EditorTransformComponentSelectionRequestBus::Event( + GetEntityContextId(), + &EditorTransformComponentSelectionRequests::SetTransformMode, + EditorTransformComponentSelectionRequests::Mode::Translation); } ////////////////////////////////////////////////////////////////////////// void CCryEditApp::OnEditmodeRotate() { - if (GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - using namespace AzToolsFramework; - EditorTransformComponentSelectionRequestBus::Event( - GetEntityContextId(), - &EditorTransformComponentSelectionRequests::SetTransformMode, - EditorTransformComponentSelectionRequests::Mode::Rotation); - } - else - { - GetIEditor()->SetEditMode(eEditModeRotate); - } + using namespace AzToolsFramework; + EditorTransformComponentSelectionRequestBus::Event( + GetEntityContextId(), + &EditorTransformComponentSelectionRequests::SetTransformMode, + EditorTransformComponentSelectionRequests::Mode::Rotation); } ////////////////////////////////////////////////////////////////////////// void CCryEditApp::OnEditmodeScale() { - if (GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - using namespace AzToolsFramework; - EditorTransformComponentSelectionRequestBus::Event( - GetEntityContextId(), - &EditorTransformComponentSelectionRequests::SetTransformMode, - EditorTransformComponentSelectionRequests::Mode::Scale); - } - else - { - GetIEditor()->SetEditMode(eEditModeScale); - } -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnEditmodeSelect() -{ - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - GetIEditor()->SetEditMode(eEditModeSelect); - } -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnEditmodeSelectarea() -{ - // TODO: Add your command handler code here - GetIEditor()->SetEditMode(eEditModeSelectArea); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnUpdateEditmodeSelectarea(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - action->setChecked(GetIEditor()->GetEditMode() == eEditModeSelectArea); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnUpdateEditmodeSelect(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - action->setChecked(GetIEditor()->GetEditMode() == eEditModeSelect); - } + using namespace AzToolsFramework; + EditorTransformComponentSelectionRequestBus::Event( + GetEntityContextId(), + &EditorTransformComponentSelectionRequests::SetTransformMode, + EditorTransformComponentSelectionRequests::Mode::Scale); } ////////////////////////////////////////////////////////////////////////// @@ -2841,19 +2776,12 @@ void CCryEditApp::OnUpdateEditmodeMove(QAction* action) { Q_ASSERT(action->isCheckable()); - if (GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; - AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( - mode, AzToolsFramework::GetEntityContextId(), - &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); + AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; + AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( + mode, AzToolsFramework::GetEntityContextId(), + &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); - action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation); - } - else - { - action->setChecked(GetIEditor()->GetEditMode() == eEditModeMove); - } + action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation); } ////////////////////////////////////////////////////////////////////////// @@ -2861,20 +2789,12 @@ void CCryEditApp::OnUpdateEditmodeRotate(QAction* action) { Q_ASSERT(action->isCheckable()); - if (GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; - AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( - mode, AzToolsFramework::GetEntityContextId(), - &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); + AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; + AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( + mode, AzToolsFramework::GetEntityContextId(), + &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); - action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation); - } - else - { - action->setChecked(GetIEditor()->GetEditMode() == eEditModeRotate); - action->setEnabled(true); - } + action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation); } ////////////////////////////////////////////////////////////////////////// @@ -2882,20 +2802,12 @@ void CCryEditApp::OnUpdateEditmodeScale(QAction* action) { Q_ASSERT(action->isCheckable()); - if (GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; - AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( - mode, AzToolsFramework::GetEntityContextId(), - &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); + AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; + AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( + mode, AzToolsFramework::GetEntityContextId(), + &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); - action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale); - } - else - { - action->setChecked(GetIEditor()->GetEditMode() == eEditModeScale); - action->setEnabled(true); - } + action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale); } ////////////////////////////////////////////////////////////////////////// @@ -3076,101 +2988,6 @@ void CCryEditApp::OnViewSwitchToGame() GetIEditor()->SetInGameMode(inGame); } -void CCryEditApp::OnSelectAxisX() -{ - AxisConstrains axis = (GetIEditor()->GetAxisConstrains() != AXIS_X) ? AXIS_X : AXIS_NONE; - GetIEditor()->SetAxisConstraints(axis); -} - -void CCryEditApp::OnSelectAxisY() -{ - AxisConstrains axis = (GetIEditor()->GetAxisConstrains() != AXIS_Y) ? AXIS_Y : AXIS_NONE; - GetIEditor()->SetAxisConstraints(axis); -} - -void CCryEditApp::OnSelectAxisZ() -{ - AxisConstrains axis = (GetIEditor()->GetAxisConstrains() != AXIS_Z) ? AXIS_Z : AXIS_NONE; - GetIEditor()->SetAxisConstraints(axis); -} - -void CCryEditApp::OnSelectAxisXy() -{ - AxisConstrains axis = (GetIEditor()->GetAxisConstrains() != AXIS_XY) ? AXIS_XY : AXIS_NONE; - GetIEditor()->SetAxisConstraints(axis); -} - -void CCryEditApp::OnUpdateSelectAxisX(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_X); -} - -void CCryEditApp::OnUpdateSelectAxisXy(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_XY); -} - -void CCryEditApp::OnUpdateSelectAxisY(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_Y); -} - -void CCryEditApp::OnUpdateSelectAxisZ(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_Z); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnSelectAxisTerrain() -{ - IEditor* editor = GetIEditor(); - bool isAlreadyEnabled = (editor->GetAxisConstrains() == AXIS_TERRAIN) && (editor->IsTerrainAxisIgnoreObjects()); - if (!isAlreadyEnabled) - { - editor->SetAxisConstraints(AXIS_TERRAIN); - editor->SetTerrainAxisIgnoreObjects(true); - } - else - { - // behave like a toggle button - click on the same thing again to disable. - editor->SetAxisConstraints(AXIS_NONE); - } -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnSelectAxisSnapToAll() -{ - IEditor* editor = GetIEditor(); - bool isAlreadyEnabled = (editor->GetAxisConstrains() == AXIS_TERRAIN) && (!editor->IsTerrainAxisIgnoreObjects()); - if (!isAlreadyEnabled) - { - editor->SetAxisConstraints(AXIS_TERRAIN); - editor->SetTerrainAxisIgnoreObjects(false); - } - else - { - // behave like a toggle button - click on the same thing again to disable. - editor->SetAxisConstraints(AXIS_NONE); - } -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnUpdateSelectAxisTerrain(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_TERRAIN && GetIEditor()->IsTerrainAxisIgnoreObjects()); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnUpdateSelectAxisSnapToAll(QAction* action) -{ - action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_TERRAIN && !GetIEditor()->IsTerrainAxisIgnoreObjects()); -} - ////////////////////////////////////////////////////////////////////////// void CCryEditApp::OnExportSelectedObjects() { @@ -3351,26 +3168,6 @@ void CCryEditApp::OnUpdateSelected(QAction* action) action->setEnabled(!GetIEditor()->GetSelection()->IsEmpty()); } -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnAlignToGrid() -{ - CSelectionGroup* sel = GetIEditor()->GetSelection(); - if (!sel->IsEmpty()) - { - CUndo undo("Align To Grid"); - Matrix34 tm; - for (int i = 0; i < sel->GetCount(); i++) - { - CBaseObject* obj = sel->GetObject(i); - tm = obj->GetWorldTM(); - Vec3 snaped = gSettings.pGrid->Snap(tm.GetTranslation()); - tm.SetTranslation(snaped); - obj->SetWorldTM(tm, eObjectUpdateFlags_UserInput); - obj->OnEvent(EVENT_ALIGN_TOGRID); - } - } -} - void CCryEditApp::OnShowHelpers() { GetIEditor()->GetDisplaySettings()->DisplayHelpers(!GetIEditor()->GetDisplaySettings()->IsDisplayHelpers()); @@ -4530,13 +4327,6 @@ void CCryEditApp::OnDisplayGotoPosition() dlg.exec(); } -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnDisplaySetVector() -{ - CSetVectorDlg dlg; - dlg.exec(); -} - ////////////////////////////////////////////////////////////////////////// void CCryEditApp::OnSnapangle() { diff --git a/Code/Sandbox/Editor/CryEdit.h b/Code/Sandbox/Editor/CryEdit.h index 7c77a03bb4..dc18dbcfda 100644 --- a/Code/Sandbox/Editor/CryEdit.h +++ b/Code/Sandbox/Editor/CryEdit.h @@ -224,40 +224,23 @@ public: void OnEditmodeMove(); void OnEditmodeRotate(); void OnEditmodeScale(); - void OnEditmodeSelect(); void OnObjectSetArea(); void OnObjectSetHeight(); - void OnUpdateEditmodeSelect(QAction* action); void OnUpdateEditmodeMove(QAction* action); void OnUpdateEditmodeRotate(QAction* action); void OnUpdateEditmodeScale(QAction* action); void OnObjectmodifyFreeze(); void OnObjectmodifyUnfreeze(); - void OnEditmodeSelectarea(); - void OnUpdateEditmodeSelectarea(QAction* action); - void OnSelectAxisX(); - void OnSelectAxisY(); - void OnSelectAxisZ(); - void OnSelectAxisXy(); - void OnUpdateSelectAxisX(QAction* action); - void OnUpdateSelectAxisXy(QAction* action); - void OnUpdateSelectAxisY(QAction* action); - void OnUpdateSelectAxisZ(QAction* action); void OnUndo(); void OnSelectionSave(); void OnOpenAssetImporter(); void OnSelectionLoad(); void OnUpdateSelected(QAction* action); - void OnAlignToGrid(); void OnLockSelection(); void OnEditLevelData(); void OnFileEditLogFile(); void OnFileResaveSlices(); void OnFileEditEditorini(); - void OnSelectAxisTerrain(); - void OnSelectAxisSnapToAll(); - void OnUpdateSelectAxisTerrain(QAction* action); - void OnUpdateSelectAxisSnapToAll(QAction* action); void OnPreferences(); void OnReloadTextures(); void OnReloadGeometry(); @@ -448,7 +431,6 @@ private: void OnToolsScriptHelp(); void OnViewCycle2dviewport(); void OnDisplayGotoPosition(); - void OnDisplaySetVector(); void OnSnapangle(); void OnUpdateSnapangle(QAction* action); void OnRuler(); diff --git a/Code/Sandbox/Editor/CryEditDoc.cpp b/Code/Sandbox/Editor/CryEditDoc.cpp index a94d588516..916317b6bb 100644 --- a/Code/Sandbox/Editor/CryEditDoc.cpp +++ b/Code/Sandbox/Editor/CryEditDoc.cpp @@ -279,8 +279,6 @@ void CCryEditDoc::DeleteContents() // [LY-90904] move this to the EditorVegetationManager component InstanceStatObjEventBus::Broadcast(&InstanceStatObjEventBus::Events::ReleaseData); - GetIEditor()->SetEditMode(eEditModeSelect); - ////////////////////////////////////////////////////////////////////////// // Clear all undo info. ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Sandbox/Editor/IEditor.h b/Code/Sandbox/Editor/IEditor.h index 83a0029d9f..90fb8823e7 100644 --- a/Code/Sandbox/Editor/IEditor.h +++ b/Code/Sandbox/Editor/IEditor.h @@ -318,17 +318,6 @@ enum EOperationMode eModellingMode // Geometry modeling mode }; -enum EEditMode -{ - eEditModeSelect, - eEditModeSelectArea, - eEditModeMove, - eEditModeRotate, - eEditModeScale, - eEditModeTool, - eEditModeRotateCircle, -}; - //! Mouse events that viewport can send enum EMouseEvent { @@ -619,9 +608,6 @@ struct IEditor virtual void SetOperationMode(EOperationMode mode) = 0; virtual EOperationMode GetOperationMode() = 0; - //! editMode - EEditMode - virtual void SetEditMode(int editMode) = 0; - virtual int GetEditMode() = 0; //! Shows/Hides transformation manipulator. //! if bShow is true also returns a valid ITransformManipulator pointer. virtual ITransformManipulator* ShowTransformManipulator(bool bShow) = 0; diff --git a/Code/Sandbox/Editor/IEditorImpl.cpp b/Code/Sandbox/Editor/IEditorImpl.cpp index d4fd86312e..561953d729 100644 --- a/Code/Sandbox/Editor/IEditorImpl.cpp +++ b/Code/Sandbox/Editor/IEditorImpl.cpp @@ -144,8 +144,7 @@ namespace const char* CEditorImpl::m_crashLogFileName = "SessionStatus/editor_statuses.json"; CEditorImpl::CEditorImpl() - : m_currEditMode(eEditModeSelect) - , m_operationMode(eOperationModeNone) + : m_operationMode(eOperationModeNone) , m_pSystem(nullptr) , m_pFileUtil(nullptr) , m_pClassFactory(nullptr) @@ -236,18 +235,6 @@ CEditorImpl::CEditorImpl() m_pRuler = new CRuler; m_selectedRegion.min = Vec3(0, 0, 0); m_selectedRegion.max = Vec3(0, 0, 0); - ZeroStruct(m_lastAxis); - m_lastAxis[eEditModeSelect] = AXIS_TERRAIN; - m_lastAxis[eEditModeSelectArea] = AXIS_TERRAIN; - m_lastAxis[eEditModeMove] = AXIS_TERRAIN; - m_lastAxis[eEditModeRotate] = AXIS_Z; - m_lastAxis[eEditModeScale] = AXIS_XY; - ZeroStruct(m_lastCoordSys); - m_lastCoordSys[eEditModeSelect] = COORDS_LOCAL; - m_lastCoordSys[eEditModeSelectArea] = COORDS_LOCAL; - m_lastCoordSys[eEditModeMove] = COORDS_WORLD; - m_lastCoordSys[eEditModeRotate] = COORDS_WORLD; - m_lastCoordSys[eEditModeScale] = COORDS_WORLD; DetectVersion(); RegisterTools(); @@ -257,8 +244,6 @@ CEditorImpl::CEditorImpl() m_pAssetBrowserRequestHandler = nullptr; m_assetEditorRequestsHandler = nullptr; - AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect(); - AZ::IO::SystemFile::CreateDir("SessionStatus"); QFile::setPermissions(m_crashLogFileName, QFileDevice::ReadOther | QFileDevice::WriteOther); } @@ -282,8 +267,6 @@ void CEditorImpl::Initialize() // Activate QT immediately so that its available as soon as CEditorImpl is (and thus GetIEditor()) InitializeEditorCommon(GetIEditor()); - - LoadSettings(); } //The only purpose of that function is to be called at the very begining of the shutdown sequence so that we can instrument and track @@ -298,8 +281,6 @@ void CEditorImpl::OnEarlyExitShutdownSequence() void CEditorImpl::Uninitialize() { - SaveSettings(); - if (m_pSystem) { UninitializeEditorCommonISystem(m_pSystem); @@ -360,8 +341,6 @@ void CEditorImpl::LoadPlugins() CEditorImpl::~CEditorImpl() { - AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect(); - gSettings.Save(); m_bExiting = true; // Can't save level after this point (while Crash) SAFE_RELEASE(m_pSourceControl); @@ -650,40 +629,6 @@ IMainStatusBar* CEditorImpl::GetMainStatusBar() return MainWindow::instance()->StatusBar(); } -int CEditorImpl::GetEditMode() -{ - return m_currEditMode; -} - -void CEditorImpl::SetEditMode(int editMode) -{ - bool isEditorInGameMode = false; - EBUS_EVENT_RESULT(isEditorInGameMode, AzToolsFramework::EditorEntityContextRequestBus, IsEditorRunningGame); - - if (isEditorInGameMode) - { - if (editMode != eEditModeSelect) - { - if (SelectionContainsComponentEntities()) - { - return; - } - } - } - - EEditMode newEditMode = (EEditMode)editMode; - if (m_currEditMode == newEditMode) - { - return; - } - - m_currEditMode = newEditMode; - AABB box(Vec3(0, 0, 0), Vec3(0, 0, 0)); - SetSelectedRegion(box); - - Notify(eNotify_OnEditModeChange); -} - void CEditorImpl::SetOperationMode(EOperationMode mode) { m_operationMode = mode; @@ -728,7 +673,6 @@ ITransformManipulator* CEditorImpl::GetTransformManipulator() void CEditorImpl::SetAxisConstraints(AxisConstrains axisFlags) { m_selectedAxis = axisFlags; - m_lastAxis[m_currEditMode] = m_selectedAxis; m_pViewManager->SetAxisConstrain(axisFlags); SetTerrainAxisIgnoreObjects(false); @@ -754,7 +698,6 @@ bool CEditorImpl::IsTerrainAxisIgnoreObjects() void CEditorImpl::SetReferenceCoordSys(RefCoordSys refCoords) { m_refCoordsSys = refCoords; - m_lastCoordSys[m_currEditMode] = m_refCoordsSys; // Update all views. UpdateViews(eUpdateObjects, NULL); @@ -1884,60 +1827,6 @@ bool CEditorImpl::IsNewViewportInteractionModelEnabled() const return m_isNewViewportInteractionModelEnabled; } -void CEditorImpl::OnStartPlayInEditor() -{ - if (SelectionContainsComponentEntities()) - { - SetEditMode(eEditModeSelect); - } -} - -namespace -{ - const std::vector> s_editModeNames = { - { eEditModeSelect, QStringLiteral("Select") }, - { eEditModeSelectArea, QStringLiteral("SelectArea") }, - { eEditModeMove, QStringLiteral("Move") }, - { eEditModeRotate, QStringLiteral("Rotate") }, - { eEditModeScale, QStringLiteral("Scale") } - }; -} - -void CEditorImpl::LoadSettings() -{ - QSettings settings(QStringLiteral("Amazon"), QStringLiteral("O3DE")); - - settings.beginGroup(QStringLiteral("Editor")); - settings.beginGroup(QStringLiteral("CoordSys")); - - for (const auto& editMode : s_editModeNames) - { - if (settings.contains(editMode.second)) - { - m_lastCoordSys[editMode.first] = static_cast(settings.value(editMode.second).toInt()); - } - } - - settings.endGroup(); // CoordSys - settings.endGroup(); // Editor -} - -void CEditorImpl::SaveSettings() const -{ - QSettings settings(QStringLiteral("Amazon"), QStringLiteral("O3DE")); - - settings.beginGroup(QStringLiteral("Editor")); - settings.beginGroup(QStringLiteral("CoordSys")); - - for (const auto& editMode : s_editModeNames) - { - settings.setValue(editMode.second, static_cast(m_lastCoordSys[editMode.first])); - } - - settings.endGroup(); // CoordSys - settings.endGroup(); // Editor -} - IEditorPanelUtils* CEditorImpl::GetEditorPanelUtils() { return m_panelEditorUtils; diff --git a/Code/Sandbox/Editor/IEditorImpl.h b/Code/Sandbox/Editor/IEditorImpl.h index 7bb864aaa3..db391b7678 100644 --- a/Code/Sandbox/Editor/IEditorImpl.h +++ b/Code/Sandbox/Editor/IEditorImpl.h @@ -23,7 +23,6 @@ #include // for shared_ptr #include #include -#include #include #include @@ -86,7 +85,6 @@ namespace AssetDatabase class CEditorImpl : public IEditor - , protected AzToolsFramework::EditorEntityContextNotificationBus::Handler { Q_DECLARE_TR_FUNCTIONS(CEditorImpl) @@ -226,8 +224,6 @@ public: void SetDataModified(); void SetOperationMode(EOperationMode mode); EOperationMode GetOperationMode(); - void SetEditMode(int editMode); - int GetEditMode(); ITransformManipulator* ShowTransformManipulator(bool bShow); ITransformManipulator* GetTransformManipulator(); @@ -348,23 +344,15 @@ public: protected: - ////////////////////////////////////////////////////////////////////////// - // EditorEntityContextNotificationBus implementation - void OnStartPlayInEditor() override; - ////////////////////////////////////////////////////////////////////////// AZStd::string LoadProjectIdFromProjectData(); void DetectVersion(); void RegisterTools(); void SetPrimaryCDFolder(); - void LoadSettings(); - void SaveSettings() const; - //! List of all notify listeners. std::list m_listeners; - EEditMode m_currEditMode; EOperationMode m_operationMode; ISystem* m_pSystem; IFileUtil* m_pFileUtil; @@ -378,8 +366,6 @@ protected: AABB m_selectedRegion; AxisConstrains m_selectedAxis; RefCoordSys m_refCoordsSys; - AxisConstrains m_lastAxis[16]; - RefCoordSys m_lastCoordSys[16]; bool m_bAxisVectorLock; bool m_bUpdates; bool m_bTerrainAxisIgnoreObjects; diff --git a/Code/Sandbox/Editor/InfoBar.cpp b/Code/Sandbox/Editor/InfoBar.cpp index 9e50e4ed3e..a1a1f7b055 100644 --- a/Code/Sandbox/Editor/InfoBar.cpp +++ b/Code/Sandbox/Editor/InfoBar.cpp @@ -30,6 +30,8 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING #include AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING +#include + #include #include "CryPhysicsDeprecation.h" @@ -52,10 +54,6 @@ CInfoBar::CInfoBar(QWidget* parent) { ui->setupUi(this); - m_enabledVector = false; - m_bVectorLock = false; - m_prevEditMode = 0; - m_bSelectionLocked = false; m_bSelectionChanged = false; m_bDragMode = false; m_prevMoveSpeed = 0; @@ -70,25 +68,14 @@ CInfoBar::CInfoBar(QWidget* parent) OnInitDialog(); - connect(ui->m_vectorLock, &QToolButton::clicked, this, &CInfoBar::OnVectorLock); - connect(ui->m_lockSelection, &QToolButton::clicked, this, &CInfoBar::OnLockSelection); - auto comboBoxTextChanged = static_cast(&QComboBox::currentTextChanged); connect(ui->m_moveSpeed, comboBoxTextChanged, this, &CInfoBar::OnUpdateMoveSpeedText); connect(ui->m_moveSpeed->lineEdit(), &QLineEdit::returnPressed, this, &CInfoBar::OnSpeedComboBoxEnter); - connect(ui->m_posCtrl, &AzQtComponents::VectorInput::valueChanged, this, &CInfoBar::OnVectorChanged); - // Hide some buttons from the expander menu - AzQtComponents::Style::addClass(ui->m_posCtrl, "expanderMenu_hide"); AzQtComponents::Style::addClass(ui->m_physDoStepBtn, "expanderMenu_hide"); AzQtComponents::Style::addClass(ui->m_physSingleStepBtn, "expanderMenu_hide"); - // posCtrl is a VectorInput initialized via UI; as such, we can't construct it to have only 3 elements. - // We can just hide the W element as it is unused. - ui->m_posCtrl->getElements()[3]->setVisible(false); - - connect(ui->m_setVector, &QToolButton::clicked, this, &CInfoBar::OnBnClickedSetVector); connect(ui->m_physicsBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedPhysics); connect(ui->m_physSingleStepBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedSingleStepPhys); connect(ui->m_physDoStepBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedDoStepPhys); @@ -99,12 +86,6 @@ CInfoBar::CInfoBar(QWidget* parent) connect(this, &CInfoBar::ActionTriggered, MainWindow::instance()->GetActionManager(), &ActionManager::ActionTriggered); - connect(ui->m_lockSelection, &QAbstractButton::toggled, ui->m_lockSelection, [this](bool checked) { - ui->m_lockSelection->setToolTip(checked ? tr("Unlock Object Selection") : tr("Lock Object Selection")); - }); - connect(ui->m_vectorLock, &QAbstractButton::toggled, ui->m_vectorLock, [this](bool checked) { - ui->m_vectorLock->setToolTip(checked ? tr("Unlock Axis Vectors") : tr("Lock Axis Vectors")); - }); connect(ui->m_physicsBtn, &QAbstractButton::toggled, ui->m_physicsBtn, [this](bool checked) { ui->m_physicsBtn->setToolTip(checked ? tr("Stop Simulation (Ctrl+P)") : tr("Simulate (Ctrl+P)")); }); @@ -121,27 +102,6 @@ CInfoBar::CInfoBar(QWidget* parent) ui->m_vrBtn->setToolTip(checked ? tr("Disable VR Preview") : tr("Enable VR Preview")); }); - // hide old ui elements that are not valid with the new viewport interaction model - if (GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - ui->m_lockSelection->setVisible(false); - AzQtComponents::Style::addClass(ui->m_lockSelection, "expanderMenu_hide"); - ui->m_posCtrl->setVisible(false); - AzQtComponents::Style::addClass(ui->m_posCtrl, "expanderMenu_hide"); - ui->m_setVector->setVisible(false); - AzQtComponents::Style::addClass(ui->m_setVector, "expanderMenu_hide"); - ui->m_vectorLock->setVisible(false); - AzQtComponents::Style::addClass(ui->m_vectorLock, "expanderMenu_hide"); - - // As we're hiding some of the icons, we have an extra spacer to deal with. - // We cannot set the visibility of separators, so we'll have to take it out. - int separatorIndex = layout()->indexOf(ui->verticalSpacer_2); - QLayoutItem* separator = layout()->takeAt(separatorIndex); - - // takeAt() removes the item from the layout; delete to avoid memory leaks. - delete separator; - } - ui->m_moveSpeed->setValidator(new QDoubleValidator(m_minSpeed, m_maxSpeed, m_numDecimals, ui->m_moveSpeed)); // Save off the move speed here since setting up the combo box can cause it to update values in the background. @@ -207,150 +167,6 @@ void CInfoBar::OnEditorNotifyEvent(EEditorNotifyEvent event) { m_bSelectionChanged = true; } - else if (event == eNotify_OnEditModeChange) - { - int emode = GetIEditor()->GetEditMode(); - switch (emode) - { - case eEditModeMove: - ui->m_setVector->setToolTip(tr("Set Position of Selected Objects")); - break; - case eEditModeRotate: - ui->m_setVector->setToolTip(tr("Set Rotation of Selected Objects")); - break; - case eEditModeScale: - ui->m_setVector->setToolTip(tr("Set Scale of Selected Objects")); - break; - default: - ui->m_setVector->setToolTip(tr("Set Position/Rotation/Scale of Selected Objects (None Selected)")); - break; - } - } -} - -////////////////////////////////////////////////////////////////////////// - -void CInfoBar::OnVectorChanged() -{ - SetVector(GetVector()); - OnVectorUpdate(false); -} - -void CInfoBar::OnVectorUpdate(bool followTerrain) -{ - int emode = GetIEditor()->GetEditMode(); - if (emode != eEditModeMove && emode != eEditModeRotate && emode != eEditModeScale) - { - return; - } - - Vec3 v = GetVector(); - - ITransformManipulator* pManipulator = GetIEditor()->GetTransformManipulator(); - if (pManipulator) - { - return; - } - - CSelectionGroup* selection = GetIEditor()->GetObjectManager()->GetSelection(); - if (selection->IsEmpty()) - { - return; - } - - GetIEditor()->RestoreUndo(); - - int referenceCoordSys = GetIEditor()->GetReferenceCoordSys(); - - CBaseObject* obj = GetIEditor()->GetSelectedObject(); - - Matrix34 tm; - AffineParts ap; - if (obj) - { - tm = obj->GetWorldTM(); - ap.SpectralDecompose(tm); - } - - if (emode == eEditModeMove) - { - if (obj) - { - if (referenceCoordSys == COORDS_WORLD) - { - tm.SetTranslation(v); - obj->SetWorldTM(tm); - } - else - { - obj->SetPos(v); - } - } - else - { - GetIEditor()->GetSelection()->MoveTo(v, followTerrain ? CSelectionGroup::eMS_FollowTerrain : CSelectionGroup::eMS_None, referenceCoordSys); - } - } - if (emode == eEditModeRotate) - { - if (obj) - { - AZ::Vector3 av = LYVec3ToAZVec3(v); - AZ::Transform tr = AZ::ConvertEulerDegreesToTransform(av); - Matrix34 lyTransform = AZTransformToLYTransform(tr); - - AffineParts newap; - newap.SpectralDecompose(lyTransform); - - if (referenceCoordSys == COORDS_WORLD) - { - tm = Matrix34::Create(ap.scale, newap.rot, ap.pos); - obj->SetWorldTM(tm); - } - else - { - obj->SetRotation(newap.rot); - } - } - else - { - CBaseObject *refObj; - CSelectionGroup* pGroup = GetIEditor()->GetSelection(); - if (pGroup && pGroup->GetCount() > 0) - { - refObj = pGroup->GetObject(0); - AffineParts ap2; - ap2.SpectralDecompose(refObj->GetWorldTM()); - Vec3 oldEulerRotation = AZVec3ToLYVec3(AZ::ConvertQuaternionToEulerDegrees(LYQuaternionToAZQuaternion(ap2.rot))); - Vec3 diff = v - oldEulerRotation; - GetIEditor()->GetSelection()->Rotate((Ang3)diff, referenceCoordSys); - } - } - } - if (emode == eEditModeScale) - { - if (v.x == 0 || v.y == 0 || v.z == 0) - { - return; - } - - if (obj) - { - if (referenceCoordSys == COORDS_WORLD) - { - tm = Matrix34::Create(v, ap.rot, ap.pos); - obj->SetWorldTM(tm); - } - else - { - obj->SetScale(v); - } - } - else - { - GetIEditor()->GetSelection()->SetScale(v, referenceCoordSys); - } - } } void CInfoBar::IdleUpdate() @@ -375,21 +191,6 @@ void CInfoBar::IdleUpdate() Vec3 marker = GetIEditor()->GetMarkerPosition(); - /* - // Get active viewport. - int hx = marker.x / 2; - int hy = marker.y / 2; - if (m_heightMapX != hx || m_heightMapY != hy) - { - m_heightMapX = hx; - m_heightMapY = hy; - updateUI = true; - } - */ - - RefCoordSys coordSys = GetIEditor()->GetReferenceCoordSys(); - bool bWorldSpace = GetIEditor()->GetReferenceCoordSys() == COORDS_WORLD; - CSelectionGroup* selection = GetIEditor()->GetSelection(); if (selection->GetCount() != m_numSelected) { @@ -447,198 +248,11 @@ void CInfoBar::IdleUpdate() } } - bool bSelLocked = GetIEditor()->IsSelectionLocked(); - if (bSelLocked != m_bSelectionLocked) - { - m_bSelectionLocked = bSelLocked; - ui->m_lockSelection->setChecked(m_bSelectionLocked); - } - - - if (GetIEditor()->GetSelection()->IsEmpty()) - { - if (ui->m_lockSelection->isEnabled()) - { - ui->m_lockSelection->setEnabled(false); - } - } - else - { - if (!ui->m_lockSelection->isEnabled()) - { - ui->m_lockSelection->setEnabled(true); - } - } - - ////////////////////////////////////////////////////////////////////////// - // Update vector. - ////////////////////////////////////////////////////////////////////////// - Vec3 v(0, 0, 0); - bool enable = false; - float min = 0, max = 10000; - - int emode = GetIEditor()->GetEditMode(); - ITransformManipulator* pManipulator = GetIEditor()->GetTransformManipulator(); - - if (pManipulator) - { - AffineParts ap; - ap.SpectralDecompose(pManipulator->GetTransformation(coordSys)); - - if (emode == eEditModeMove) - { - v = ap.pos; - enable = true; - - min = -64000; - max = 64000; - } - if (emode == eEditModeRotate) - { - v = Vec3(RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(ap.rot)))); - enable = true; - min = -10000; - max = 10000; - } - if (emode == eEditModeScale) - { - v = ap.scale; - enable = true; - min = -10000; - max = 10000; - } - } - else - { - if (selection->IsEmpty()) - { - // Show marker position. - EnableVector(false); - SetVector(marker); - SetVectorRange(-100000, 100000); - return; - } - - CBaseObject* obj = GetIEditor()->GetSelectedObject(); - if (!obj) - { - CSelectionGroup* pGroup = GetIEditor()->GetSelection(); - if (pGroup && pGroup->GetCount() > 0) - { - obj = pGroup->GetObject(0); - } - } - - if (obj) - { - v = obj->GetWorldPos(); - } - - if (emode == eEditModeMove) - { - if (obj) - { - if (bWorldSpace) - { - v = obj->GetWorldTM().GetTranslation(); - } - else - { - v = obj->GetPos(); - } - } - enable = true; - min = -64000; - max = 64000; - } - if (emode == eEditModeRotate) - { - if (obj) - { - Quat objRot; - if (bWorldSpace) - { - AffineParts ap; - ap.SpectralDecompose(obj->GetWorldTM()); - objRot = ap.rot; - } - else - { - objRot = obj->GetRotation(); - } - - // Always convert objRot to v in order to ensure that the inspector and info bar are always in sync - v = AZVec3ToLYVec3(AZ::ConvertQuaternionToEulerDegrees(LYQuaternionToAZQuaternion(objRot))); - } - enable = true; - min = -10000; - max = 10000; - } - if (emode == eEditModeScale) - { - if (obj) - { - if (bWorldSpace) - { - AffineParts ap; - ap.SpectralDecompose(obj->GetWorldTM()); - v = ap.scale; - } - else - { - v = obj->GetScale(); - } - } - enable = true; - min = -10000; - max = 10000; - } - } - - bool updateDisplayVector = (m_currValue != v); - - // If Edit mode changed. - if (m_prevEditMode != emode) - { - // Scale mode enables vector lock. - SetVectorLock(emode == eEditModeScale); - - // Change undo strings. - QString undoString("Modify Object(s)"); - int mode = GetIEditor()->GetEditMode(); - switch (mode) - { - case eEditModeMove: - undoString = QStringLiteral("Move Object(s)"); - break; - case eEditModeRotate: - undoString = QStringLiteral("Rotate Object(s)"); - break; - case eEditModeScale: - undoString = QStringLiteral("Scale Object(s)"); - break; - } - - // edit mode changed, we must update the number values - updateDisplayVector = true; - } - - SetVectorRange(min, max); - EnableVector(enable); - // if our selection changed, or if our display values are out of date if (m_bSelectionChanged) { - updateDisplayVector = true; m_bSelectionChanged = false; } - - if (updateDisplayVector) - { - SetVector(v); - } - - m_prevEditMode = emode; } inline double Round(double fVal, double fStep) @@ -650,71 +264,6 @@ inline double Round(double fVal, double fStep) return fVal; } -void CInfoBar::SetVector(const Vec3& v) -{ - if (!m_bDragMode) - { - m_lastValue = m_currValue; - } - - if (m_currValue != v) - { - ui->m_posCtrl->setValuebyIndex(v.x, 0); - ui->m_posCtrl->setValuebyIndex(v.y, 1); - ui->m_posCtrl->setValuebyIndex(v.z, 2); - m_currValue = v; - } -} - -Vec3 CInfoBar::GetVector() -{ - Vec3 v; - v.x = ui->m_posCtrl->getElements()[0]->getValue(); - v.y = ui->m_posCtrl->getElements()[1]->getValue(); - v.z = ui->m_posCtrl->getElements()[2]->getValue(); - m_currValue = v; - return v; -} - -void CInfoBar::EnableVector(bool enable) -{ - if (m_enabledVector != enable) - { - m_enabledVector = enable; - ui->m_posCtrl->setEnabled(enable); - ui->m_vectorLock->setEnabled(enable); - ui->m_setVector->setEnabled(enable); - } -} - -void CInfoBar::SetVectorLock(bool bVectorLock) -{ - m_bVectorLock = bVectorLock; - ui->m_vectorLock->setChecked(bVectorLock); - GetIEditor()->SetAxisVectorLock(bVectorLock); -} - -void CInfoBar::SetVectorRange(float min, float max) -{ - // Worth noting that this gets called every IdleUpdate, so it is necessary to make sure - // setting the min/max doesn't result in the Qt event queue being pumped - ui->m_posCtrl->setMinimum(min); - ui->m_posCtrl->setMaximum(max); -} - -void CInfoBar::OnVectorLock() -{ - SetVectorLock(!m_bVectorLock); -} - -void CInfoBar::OnLockSelection() -{ - bool newLockSelectionValue = !m_bSelectionLocked; - m_bSelectionLocked = newLockSelectionValue; - ui->m_lockSelection->setChecked(newLockSelectionValue); - GetIEditor()->LockSelection(newLockSelectionValue); -} - void CInfoBar::OnUpdateMoveSpeedText(const QString& text) { gSettings.cameraMoveSpeed = aznumeric_cast(Round(text.toDouble(), m_speedStep)); @@ -730,12 +279,6 @@ void CInfoBar::OnInitDialog() QFontMetrics metrics({}); int width = metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier; - ui->m_posCtrl->setEnabled(false); - ui->m_posCtrl->getElements()[0]->setFixedWidth(width); - ui->m_posCtrl->getElements()[1]->setFixedWidth(width); - ui->m_posCtrl->getElements()[2]->setFixedWidth(width); - ui->m_setVector->setEnabled(false); - ui->m_moveSpeed->setFixedWidth(width); ui->m_physicsBtn->setEnabled(false); @@ -809,12 +352,6 @@ void CInfoBar::OnBnClickedGotoPosition() emit ActionTriggered(ID_DISPLAY_GOTOPOSITION); } -////////////////////////////////////////////////////////////////////////// -void CInfoBar::OnBnClickedSetVector() -{ - emit ActionTriggered(ID_DISPLAY_SETVECTOR); -} - ////////////////////////////////////////////////////////////////////////// void CInfoBar::OnBnClickedMuteAudio() { diff --git a/Code/Sandbox/Editor/InfoBar.h b/Code/Sandbox/Editor/InfoBar.h index aa0d0628a2..6e547d46c6 100644 --- a/Code/Sandbox/Editor/InfoBar.h +++ b/Code/Sandbox/Editor/InfoBar.h @@ -59,24 +59,9 @@ protected: virtual void OnOK() {}; virtual void OnCancel() {}; - void OnVectorUpdate(bool followTerrain); - - // this gets called by stepper or text edit changes - void OnVectorChanged(); - - void SetVector(const Vec3& v); - void SetVectorRange(float min, float max); - Vec3 GetVector(); - void EnableVector(bool enable); - - void SetVectorLock(bool bVectorLock); - void OnBnClickedSyncplayer(); void OnBnClickedGotoPosition(); - void OnVectorLock(); - void OnLockSelection(); - void OnBnClickedSetVector(); void OnSpeedComboBoxEnter(); void OnUpdateMoveSpeedText(const QString&); void OnBnClickedTerrainCollision(); @@ -98,13 +83,10 @@ protected: void EnteredComponentMode(const AZStd::vector& componentModeTypes) override; void LeftComponentMode(const AZStd::vector& componentModeTypes) override; - bool m_enabledVector; - float m_width, m_height; //int m_heightMapX,m_heightMapY; double m_fieldWidthMultiplier = 1.8; - int m_prevEditMode; int m_numSelected; float m_prevMoveSpeed; @@ -117,8 +99,6 @@ protected: // Speed presets float m_speedPresetValues[3] = { 0.1f, 1.0f, 10.0f }; - bool m_bVectorLock; - bool m_bSelectionLocked; bool m_bSelectionChanged; bool m_bDragMode; diff --git a/Code/Sandbox/Editor/InfoBar.ui b/Code/Sandbox/Editor/InfoBar.ui index e6d135da4b..84207629df 100644 --- a/Code/Sandbox/Editor/InfoBar.ui +++ b/Code/Sandbox/Editor/InfoBar.ui @@ -57,42 +57,6 @@ - - - - - 0 - 0 - - - - Position - - - - - - - - 0 - 0 - - - - XYZ - - - - :/InfoBar/XYZ-default.svg:/InfoBar/XYZ-default.svg - - - - 22 - 18 - - - - @@ -135,68 +99,6 @@ - - - - Lock Object Selection - - - Lock Selection - - - - :/InfoBar/LockSelection-default.svg:/InfoBar/LockSelection-default.svg - - - - 18 - 18 - - - - true - - - - - - - Lock Scale Axis Vectors - - - Lock Scale - - - - :/InfoBar/LockScale-default.svg:/InfoBar/LockScale-default.svg - - - - 18 - 18 - - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 1 - 18 - - - - @@ -424,13 +326,6 @@ - - - AzQtComponents::VectorInput - QWidget -
AzQtComponents/Components/Widgets/VectorInput.h
-
-
diff --git a/Code/Sandbox/Editor/Lib/Tests/IEditorMock.h b/Code/Sandbox/Editor/Lib/Tests/IEditorMock.h index a309a1a5f5..c111aa836b 100644 --- a/Code/Sandbox/Editor/Lib/Tests/IEditorMock.h +++ b/Code/Sandbox/Editor/Lib/Tests/IEditorMock.h @@ -123,8 +123,6 @@ public: MOCK_METHOD0(GetRuler, CRuler* ()); MOCK_METHOD1(SetOperationMode, void(EOperationMode )); MOCK_METHOD0(GetOperationMode, EOperationMode()); - MOCK_METHOD1(SetEditMode, void(int )); - MOCK_METHOD0(GetEditMode, int()); MOCK_METHOD1(ShowTransformManipulator, ITransformManipulator* (bool)); MOCK_METHOD0(GetTransformManipulator, ITransformManipulator* ()); MOCK_METHOD1(SetAxisConstraints, void(AxisConstrains )); diff --git a/Code/Sandbox/Editor/Lib/Tests/test_EditorPythonBindings.cpp b/Code/Sandbox/Editor/Lib/Tests/test_EditorPythonBindings.cpp index 3bb33d623b..39e8266cf6 100644 --- a/Code/Sandbox/Editor/Lib/Tests/test_EditorPythonBindings.cpp +++ b/Code/Sandbox/Editor/Lib/Tests/test_EditorPythonBindings.cpp @@ -200,8 +200,6 @@ namespace EditorPythonBindingsUnitTests EXPECT_TRUE(behaviorBus->m_events.find("OpenFileBox") != behaviorBus->m_events.end()); EXPECT_TRUE(behaviorBus->m_events.find("GetAxisConstraint") != behaviorBus->m_events.end()); EXPECT_TRUE(behaviorBus->m_events.find("SetAxisConstraint") != behaviorBus->m_events.end()); - EXPECT_TRUE(behaviorBus->m_events.find("GetEditMode") != behaviorBus->m_events.end()); - EXPECT_TRUE(behaviorBus->m_events.find("SetEditMode") != behaviorBus->m_events.end()); EXPECT_TRUE(behaviorBus->m_events.find("GetPakFromFile") != behaviorBus->m_events.end()); EXPECT_TRUE(behaviorBus->m_events.find("Log") != behaviorBus->m_events.end()); EXPECT_TRUE(behaviorBus->m_events.find("Undo") != behaviorBus->m_events.end()); diff --git a/Code/Sandbox/Editor/Lib/Tests/test_SetVectorDlg.cpp b/Code/Sandbox/Editor/Lib/Tests/test_SetVectorDlg.cpp deleted file mode 100644 index 18faf6deba..0000000000 --- a/Code/Sandbox/Editor/Lib/Tests/test_SetVectorDlg.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include "EditorDefs.h" -#include -#include - -#include - -using namespace AZ; -using namespace ::testing; - -namespace UnitTest -{ - class TestSetVectorDlg - : public ::testing::Test - { - public: - - }; - - const float SetVectorDlgNearTolerance = 0.0001f; - - TEST_F(TestSetVectorDlg, GetVectorFromString_ThreeParams_Success) - { - QString testStr{ "1,2,3" }; - Vec3 result{ 0, 0, 0 }; - - result = CSetVectorDlg::GetVectorFromString(testStr); - - EXPECT_NEAR(result[0], 1.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[1], 2.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[2], 3.0f, SetVectorDlgNearTolerance); - } - - TEST_F(TestSetVectorDlg, GetVectorFromString_FourParams_ThreeParsed) - { - QString testStr{ "1,2,3,4" }; - Vec3 result{ 0, 0, 0 }; - - result = CSetVectorDlg::GetVectorFromString(testStr); - - EXPECT_NEAR(result[0], 1.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[1], 2.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[2], 3.0f, SetVectorDlgNearTolerance); - } - - TEST_F(TestSetVectorDlg, GetVectorFromString_TwoParams_ThirdZero) - { - QString testStr{ "1,2" }; - Vec3 result{ 0, 0, 0 }; - - result = CSetVectorDlg::GetVectorFromString(testStr); - - EXPECT_NEAR(result[0], 1.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[1], 2.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[2], 0.0f, SetVectorDlgNearTolerance); - } - - TEST_F(TestSetVectorDlg, GetVectorFromString_NoParams_AllZero) - { - QString testStr; - Vec3 result{ 0, 0, 0 }; - - result = CSetVectorDlg::GetVectorFromString(testStr); - - EXPECT_NEAR(result[0], 0.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[1], 0.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[2], 0.0f, SetVectorDlgNearTolerance); - } - - TEST_F(TestSetVectorDlg, GetVectorFromString_BadStrings_AllZero) - { - QString testStr{ "some,illegal,strings" }; - Vec3 resultExpected{ 0, 1, 0 }; - - auto result = CSetVectorDlg::GetVectorFromString(testStr); - - EXPECT_NEAR(result[0], 0.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[1], 0.0f, SetVectorDlgNearTolerance); - EXPECT_NEAR(result[2], 0.0f, SetVectorDlgNearTolerance); - } -} // namespace UnitTest diff --git a/Code/Sandbox/Editor/MainWindow.cpp b/Code/Sandbox/Editor/MainWindow.cpp index d7659c2512..902b04f266 100644 --- a/Code/Sandbox/Editor/MainWindow.cpp +++ b/Code/Sandbox/Editor/MainWindow.cpp @@ -750,11 +750,6 @@ void MainWindow::InitActions() am->AddAction(ID_TOOLBAR_SEPARATOR, QString()); - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - am->AddAction(ID_TOOLBAR_WIDGET_REF_COORD, QString()); - } - am->AddAction(ID_TOOLBAR_WIDGET_UNDO, QString()); am->AddAction(ID_TOOLBAR_WIDGET_REDO, QString()); am->AddAction(ID_TOOLBAR_WIDGET_SNAP_ANGLE, QString()); @@ -995,18 +990,6 @@ void MainWindow::InitActions() am->AddAction(ID_EDIT_RENAMEOBJECT, tr("Rename Object(s)...")) .SetStatusTip(tr("Rename Object")); - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - am->AddAction(ID_EDITMODE_SELECT, tr("Select mode")) - .SetIcon(Style::icon("Select")) - .SetApplyHoverEffect() - .SetShortcut(tr("1")) - .SetToolTip(tr("Select mode (1)")) - .SetCheckable(true) - .SetStatusTip(tr("Select object(s)")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeSelect); - } - am->AddAction(ID_EDITMODE_MOVE, tr("Move")) .SetIcon(Style::icon("Move")) .SetApplyHoverEffect() @@ -1032,69 +1015,6 @@ void MainWindow::InitActions() .SetStatusTip(tr("Select and scale selected object(s)")) .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeScale); - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - am->AddAction(ID_EDITMODE_SELECTAREA, tr("Select terrain")) - .SetIcon(Style::icon("Select_terrain")) - .SetApplyHoverEffect() - .SetShortcut(tr("5")) - .SetToolTip(tr("Select terrain (5)")) - .SetCheckable(true) - .SetStatusTip(tr("Switch to terrain selection mode")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeSelectarea); - am->AddAction(ID_SELECT_AXIS_X, tr("Constrain to X axis")) - .SetIcon(Style::icon("X_axis")) - .SetApplyHoverEffect() - .SetShortcut(tr("Ctrl+1")) - .SetToolTip(tr("Constrain to X axis (Ctrl+1)")) - .SetCheckable(true) - .SetStatusTip(tr("Lock movement on X axis")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisX); - am->AddAction(ID_SELECT_AXIS_Y, tr("Constrain to Y axis")) - .SetIcon(Style::icon("Y_axis")) - .SetApplyHoverEffect() - .SetShortcut(tr("Ctrl+2")) - .SetToolTip(tr("Constrain to Y axis (Ctrl+2)")) - .SetCheckable(true) - .SetStatusTip(tr("Lock movement on Y axis")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisY); - am->AddAction(ID_SELECT_AXIS_Z, tr("Constrain to Z axis")) - .SetIcon(Style::icon("Z_axis")) - .SetApplyHoverEffect() - .SetShortcut(tr("Ctrl+3")) - .SetToolTip(tr("Constrain to Z axis (Ctrl+3)")) - .SetCheckable(true) - .SetStatusTip(tr("Lock movement on Z axis")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisZ); - am->AddAction(ID_SELECT_AXIS_XY, tr("Constrain to XY plane")) - .SetIcon(Style::icon("XY2_copy")) - .SetApplyHoverEffect() - .SetShortcut(tr("Ctrl+4")) - .SetToolTip(tr("Constrain to XY plane (Ctrl+4)")) - .SetCheckable(true) - .SetStatusTip(tr("Lock movement on XY plane")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisXy); - am->AddAction(ID_SELECT_AXIS_TERRAIN, tr("Constrain to terrain/geometry")) - .SetIcon(Style::icon("Object_follow_terrain")) - .SetApplyHoverEffect() - .SetShortcut(tr("Ctrl+5")) - .SetToolTip(tr("Constrain to terrain/geometry (Ctrl+5)")) - .SetCheckable(true) - .SetStatusTip(tr("Lock object movement to follow terrain")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisTerrain); - am->AddAction(ID_SELECT_AXIS_SNAPTOALL, tr("Follow terrain and snap to objects")) - .SetIcon(Style::icon("Follow_terrain")) - .SetApplyHoverEffect() - .SetShortcut(tr("Ctrl+6")) - .SetToolTip(tr("Follow terrain and snap to objects (Ctrl+6)")) - .SetCheckable(true) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisSnapToAll); - am->AddAction(ID_OBJECTMODIFY_ALIGNTOGRID, tr("Align to grid")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelected) - .SetIcon(Style::icon("Align_to_grid")) - .SetApplyHoverEffect(); - } - am->AddAction(ID_SNAP_TO_GRID, tr("Snap to grid")) .SetIcon(Style::icon("Grid")) .SetApplyHoverEffect() @@ -1153,7 +1073,6 @@ void MainWindow::InitActions() am->AddAction(ID_CHANGEMOVESPEED_CHANGESTEP, tr("Change Step")) .SetStatusTip(tr("Change Flycam Movement Step")); am->AddAction(ID_DISPLAY_GOTOPOSITION, tr("Go to Position...")); - am->AddAction(ID_DISPLAY_SETVECTOR, tr("Display Set Vector")); am->AddAction(ID_MODIFY_GOTO_SELECTION, tr("Center on Selection")) .SetShortcut(tr("Z")) .SetToolTip(tr("Center on Selection (Z)")) @@ -1500,62 +1419,6 @@ void MainWindow::InitToolBars() AdjustToolBarIconSize(static_cast(gSettings.gui.nToolbarIconSize)); } -QComboBox* MainWindow::CreateRefCoordComboBox() -{ - // ID_REF_COORDS_SYS; - auto coordSysCombo = new RefCoordComboBox(this); - - connect(this, &MainWindow::ToggleRefCoordSys, coordSysCombo, &RefCoordComboBox::ToggleRefCoordSys); - connect(this, &MainWindow::UpdateRefCoordSys, coordSysCombo, &RefCoordComboBox::UpdateRefCoordSys); - - return coordSysCombo; -} - -RefCoordComboBox::RefCoordComboBox(QWidget* parent) - : QComboBox(parent) -{ - addItems(coordSysList()); - setCurrentIndex(0); - - connect(this, static_cast(&QComboBox::currentIndexChanged), this, [](int index) - { - if (index >= 0 && index < LAST_COORD_SYSTEM) - { - RefCoordSys coordSys = (RefCoordSys)index; - if (GetIEditor()->GetReferenceCoordSys() != index) - { - GetIEditor()->SetReferenceCoordSys(coordSys); - } - } - }); - - UpdateRefCoordSys(); -} - -QStringList RefCoordComboBox::coordSysList() const -{ - static QStringList list = { tr("View"), tr("Local"), tr("Parent"), tr("World"), tr("Custom") }; - return list; -} - -void RefCoordComboBox::UpdateRefCoordSys() -{ - RefCoordSys coordSys = GetIEditor()->GetReferenceCoordSys(); - if (coordSys >= 0 && coordSys < LAST_COORD_SYSTEM) - { - setCurrentIndex(coordSys); - } -} - -void RefCoordComboBox::ToggleRefCoordSys() -{ - QStringList coordSys = coordSysList(); - const int localIndex = coordSys.indexOf(tr("Local")); - const int worldIndex = coordSys.indexOf(tr("World")); - const int newIndex = currentIndex() == localIndex ? worldIndex : localIndex; - setCurrentIndex(newIndex); -} - QToolButton* MainWindow::CreateUndoRedoButton(int command) { // We do either undo or redo below, sort that out here @@ -2520,9 +2383,6 @@ QWidget* MainWindow::CreateToolbarWidget(int actionId) case ID_TOOLBAR_WIDGET_REDO: w = CreateUndoRedoButton(ID_REDO); break; - case ID_TOOLBAR_WIDGET_REF_COORD: - w = CreateRefCoordComboBox(); - break; case ID_TOOLBAR_WIDGET_SNAP_GRID: w = CreateSnapToGridWidget(); break; diff --git a/Code/Sandbox/Editor/MainWindow.h b/Code/Sandbox/Editor/MainWindow.h index c40d732cee..3e652888fe 100644 --- a/Code/Sandbox/Editor/MainWindow.h +++ b/Code/Sandbox/Editor/MainWindow.h @@ -77,19 +77,6 @@ namespace AzToolsFramework // Subclassing so we can add slots to our toolbar widgets // Using lambdas is crashy since the lamdba doesn't know when the widget is deleted. -class RefCoordComboBox - : public QComboBox -{ - Q_OBJECT -public: - explicit RefCoordComboBox(QWidget* parent); -public Q_SLOTS: - void ToggleRefCoordSys(); - void UpdateRefCoordSys(); -private: - QStringList coordSysList() const; -}; - class UndoRedoToolButton : public QToolButton { @@ -229,8 +216,6 @@ private: QWidget* CreateSnapToGridWidget(); QWidget* CreateSnapToAngleWidget(); - QComboBox* CreateRefCoordComboBox(); - QToolButton* CreateUndoRedoButton(int command); QToolButton* CreateEnvironmentModeButton(); diff --git a/Code/Sandbox/Editor/Objects/AxisGizmo.cpp b/Code/Sandbox/Editor/Objects/AxisGizmo.cpp index 44138b290d..40970838c1 100644 --- a/Code/Sandbox/Editor/Objects/AxisGizmo.cpp +++ b/Code/Sandbox/Editor/Objects/AxisGizmo.cpp @@ -137,36 +137,6 @@ void CAxisGizmo::GetWorldBounds(AABB& bbox) void CAxisGizmo::DrawAxis(DisplayContext& dc) { m_pAxisHelper->SetHighlightAxis(m_highlightAxis); - // Only enable axis planes when editor is in Move mode. - int nEditMode = GetIEditor()->GetEditMode(); - int nModeFlags = 0; - switch (nEditMode) - { - case eEditModeMove: - nModeFlags |= CAxisHelper::MOVE_MODE; - break; - case eEditModeRotate: - nModeFlags |= CAxisHelper::ROTATE_MODE; - nModeFlags &= ~(CAxisHelper::ROTATE_CIRCLE_MODE); - break; - case eEditModeRotateCircle: - nModeFlags |= CAxisHelper::ROTATE_CIRCLE_MODE; - nModeFlags &= ~(CAxisHelper::ROTATE_MODE); - break; - case eEditModeScale: - nModeFlags |= CAxisHelper::SCALE_MODE; - break; - case eEditModeSelect: - nModeFlags |= CAxisHelper::SELECT_MODE; - break; - case eEditModeSelectArea: - nModeFlags |= CAxisHelper::SELECT_MODE; - break; - } - - //nModeFlags |= CAxisHelper::MOVE_MODE | CAxisHelper::ROTATE_MODE | CAxisHelper::SCALE_MODE; - - m_pAxisHelper->SetMode(nModeFlags); Matrix34 tm = GetTransformation(m_bAlwaysUseLocal ? COORDS_LOCAL : GetIEditor()->GetReferenceCoordSys(), dc.view); m_pAxisHelper->DrawAxis(tm, GetIEditor()->GetGlobalGizmoParameters(), dc); @@ -177,21 +147,6 @@ void CAxisGizmo::DrawAxis(DisplayContext& dc) m_pAxisHelper->DrawDome(tm, GetIEditor()->GetGlobalGizmoParameters(), dc, objectBox); } - ////////////////////////////////////////////////////////////////////////// - // Draw extended infinite-axis gizmo - ////////////////////////////////////////////////////////////////////////// - if (!(dc.flags & DISPLAY_2D) && - (nModeFlags == CAxisHelper::MOVE_MODE || - nModeFlags == CAxisHelper::ROTATE_MODE)) - { - bool bClickedShift = CheckVirtualKey(Qt::Key_Shift); - if (bClickedShift && (m_axisGizmoCount == 1 || m_highlightAxis || (m_axisGizmoCount == 2 && m_object && m_object->IsSkipSelectionHelper()))) - { - bool bClickedAlt = CheckVirtualKey(Qt::Key_Menu); - bool bUsePhysicalProxy = !bClickedAlt; - m_pAxisHelperExtended->DrawAxes(dc, tm, bUsePhysicalProxy); - } - } } ////////////////////////////////////////////////////////////////////////// @@ -324,7 +279,7 @@ Matrix34 CAxisGizmo::GetTransformation(RefCoordSys coordSys, IDisplayViewport* v } ////////////////////////////////////////////////////////////////////////// -bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, int nFlags) +bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, [[maybe_unused]] int nFlags) { AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); @@ -364,22 +319,6 @@ bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point m_cMouseDownPos = point; m_initPos = GetTransformation(COORDS_WORLD).GetTranslation(); - switch (hc.manipulatorMode) - { - case 1: - view->SetCurrentCursor(STD_CURSOR_MOVE); - GetIEditor()->SetEditMode(eEditModeMove); - break; - case 2: - view->SetCurrentCursor(STD_CURSOR_ROTATE); - GetIEditor()->SetEditMode(eEditModeRotate); - break; - case 3: - view->SetCurrentCursor(STD_CURSOR_SCALE); - GetIEditor()->SetEditMode(eEditModeScale); - break; - } - return true; } } @@ -387,152 +326,6 @@ bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point { if (m_bDragging) { - bool bCallBack = true; - Vec3 vDragValue(0, 0, 0); - // Dragging transform manipulator. - switch (GetIEditor()->GetEditMode()) - { - case eEditModeMove: - { - view->SetCurrentCursor(STD_CURSOR_MOVE); - - if (view->GetAxisConstrain() == AXIS_TERRAIN) - { - if (nFlags & MK_CONTROL) - { - bool bCollideWithTerrain; - Vec3 posOnTerrain = view->ViewToWorld(point, &bCollideWithTerrain, true); - if (!bCollideWithTerrain) - { - return true; - } - vDragValue = posOnTerrain - m_initPos; - } - else - { - Vec3 p1 = view->SnapToGrid(view->ViewToWorld(m_cMouseDownPos)); - Vec3 p2 = view->SnapToGrid(view->ViewToWorld(point)); - vDragValue = p2 - p1; - vDragValue.z = 0; - } - } - else - { - Vec3 p1 = view->MapViewToCP(m_cMouseDownPos); - Vec3 p2 = view->MapViewToCP(point); - if (p1.IsZero() || p2.IsZero()) - { - return true; - } - vDragValue = view->GetCPVector(p1, p2); - } - } - break; - case eEditModeRotate: - { - view->SetCurrentCursor(STD_CURSOR_ROTATE); - - Ang3 ang(0, 0, 0); - float ax = (point.x() - m_cMouseDownPos.x()); - float ay = (point.y() - m_cMouseDownPos.y()); - switch (view->GetAxisConstrain()) - { - case AXIS_X: - ang.x = ay; - break; - case AXIS_Y: - ang.y = ay; - break; - case AXIS_Z: - ang.z = ay; - break; - case AXIS_XY: - ang(ax, ay, 0); - break; - case AXIS_XZ: - ang(ax, 0, ay); - break; - case AXIS_YZ: - ang(0, ay, ax); - break; - case AXIS_TERRAIN: - ang(ax, ay, 0); - break; - } - ; - ang = gSettings.pGrid->SnapAngle(ang); - vDragValue = Vec3(DEG2RAD(ang)); - } - break; - case eEditModeScale: - { - Vec3 scl(0, 0, 0); - float ay = 1.0f - 0.01f * (point.y() - m_cMouseDownPos.y()); - if (ay < 0.01f) - { - ay = 0.01f; - } - scl(ay, ay, ay); - switch (view->GetAxisConstrain()) - { - case AXIS_X: - scl(ay, 1, 1); - break; - case AXIS_Y: - scl(1, ay, 1); - break; - case AXIS_Z: - scl(1, 1, ay); - break; - case AXIS_XY: - scl(ay, ay, ay); - break; - case AXIS_XZ: - scl(ay, ay, ay); - break; - case AXIS_YZ: - scl(ay, ay, ay); - break; - case AXIS_XYZ: - scl(ay, ay, ay); - break; - case AXIS_TERRAIN: - scl(ay, ay, ay); - break; - } - ; - view->SetCurrentCursor(STD_CURSOR_SCALE); - vDragValue = scl; - } - break; - case eEditModeRotateCircle: - { - Matrix34 tm = GetTransformation(m_bAlwaysUseLocal ? COORDS_LOCAL : GetIEditor()->GetReferenceCoordSys()); - Vec3 v0, v1; - Vec3 vHitNormal; - if (m_pAxisHelper->HitTestForRotationCircle(tm, view, m_cMouseDownPos, 0.05f, &v0, &vHitNormal) && m_pAxisHelper->HitTestForRotationCircle(tm, view, point, 2.0f, &v1, &vHitNormal)) - { - Vec3 vDir0 = (v0 - tm.GetTranslation()).GetNormalized(); - Vec3 vDir1 = (v1 - tm.GetTranslation()).GetNormalized(); - - Vec3 vCurlDir = vDir0.Cross(vDir1).GetNormalized(); - if (vHitNormal.Dot(vCurlDir) > 0) - { - vDragValue = Vec3(std::acos(vDir0.Dot(vDir1)), 0, 0); - } - else - { - vDragValue = Vec3(-std::acos(vDir0.Dot(vDir1)), 0, 0); - } - } - else - { - bCallBack = false; - } - } - break; - } - return true; } else diff --git a/Code/Sandbox/Editor/PythonEditorEventsBus.h b/Code/Sandbox/Editor/PythonEditorEventsBus.h index f4b2971a17..69ef2671a1 100644 --- a/Code/Sandbox/Editor/PythonEditorEventsBus.h +++ b/Code/Sandbox/Editor/PythonEditorEventsBus.h @@ -139,16 +139,6 @@ namespace AzToolsFramework */ virtual void SetAxisConstraint(AZStd::string_view pConstrain) = 0; - /* - * Gets edit mode. - */ - virtual const char* GetEditMode() = 0; - - /* - * Sets edit mode. - */ - virtual void SetEditMode(AZStd::string_view pEditMode) = 0; - /* * Finds a pak file name for a given file. */ diff --git a/Code/Sandbox/Editor/PythonEditorFuncs.cpp b/Code/Sandbox/Editor/PythonEditorFuncs.cpp index f5de22387c..8f735706fd 100644 --- a/Code/Sandbox/Editor/PythonEditorFuncs.cpp +++ b/Code/Sandbox/Editor/PythonEditorFuncs.cpp @@ -688,68 +688,6 @@ namespace } } - ////////////////////////////////////////////////////////////////////////// - // Edit Mode - ////////////////////////////////////////////////////////////////////////// - const char* PyGetEditMode() - { - int actualEditMode = GetIEditor()->GetEditMode(); - switch (actualEditMode) - { - case eEditModeSelect: - return "SELECT"; - case eEditModeSelectArea: - return "SELECTAREA"; - case eEditModeMove: - return "MOVE"; - case eEditModeRotate: - return "ROTATE"; - case eEditModeScale: - return "SCALE"; - case eEditModeTool: - return "TOOL"; - default: - throw std::logic_error("Invalid edit mode."); - } - } - - void PySetEditMode(AZStd::string_view pEditMode) - { - if (pEditMode == "MOVE") - { - GetIEditor()->SetEditMode(eEditModeMove); - } - else if (pEditMode == "ROTATE") - { - GetIEditor()->SetEditMode(eEditModeRotate); - } - else if (pEditMode == "SCALE") - { - GetIEditor()->SetEditMode(eEditModeScale); - } - else if (pEditMode == "SELECT") - { - GetIEditor()->SetEditMode(eEditModeSelect); - } - else if (pEditMode == "SELECTAREA") - { - GetIEditor()->SetEditMode(eEditModeSelectArea); - } - else if (pEditMode == "TOOL") - { - GetIEditor()->SetEditMode(eEditModeTool); - } - else if (pEditMode == "RULER") - { - CRuler* pRuler = GetIEditor()->GetRuler(); - pRuler->SetActive(!pRuler->IsActive()); - } - else - { - throw std::logic_error("Invalid edit mode."); - } - } - ////////////////////////////////////////////////////////////////////////// const char* PyGetPakFromFile(const char* filename) { @@ -1031,8 +969,6 @@ namespace AzToolsFramework ->Event("OpenFileBox", &EditorLayerPythonRequestBus::Events::OpenFileBox) ->Event("GetAxisConstraint", &EditorLayerPythonRequestBus::Events::GetAxisConstraint) ->Event("SetAxisConstraint", &EditorLayerPythonRequestBus::Events::SetAxisConstraint) - ->Event("GetEditMode", &EditorLayerPythonRequestBus::Events::GetEditMode) - ->Event("SetEditMode", &EditorLayerPythonRequestBus::Events::SetEditMode) ->Event("GetPakFromFile", &EditorLayerPythonRequestBus::Events::GetPakFromFile) ->Event("Log", &EditorLayerPythonRequestBus::Events::Log) ->Event("Undo", &EditorLayerPythonRequestBus::Events::Undo) @@ -1168,16 +1104,6 @@ namespace AzToolsFramework return PySetAxisConstraint(pConstrain); } - const char* PythonEditorComponent::GetEditMode() - { - return PyGetEditMode(); - } - - void PythonEditorComponent::SetEditMode(AZStd::string_view pEditMode) - { - return PySetEditMode(pEditMode); - } - const char* PythonEditorComponent::GetPakFromFile(const char* filename) { return PyGetPakFromFile(filename); @@ -1252,9 +1178,6 @@ namespace AzToolsFramework addLegacyGeneral(behaviorContext->Method("get_axis_constraint", PyGetAxisConstraint, nullptr, "Gets axis.")); addLegacyGeneral(behaviorContext->Method("set_axis_constraint", PySetAxisConstraint, nullptr, "Sets axis.")); - addLegacyGeneral(behaviorContext->Method("get_edit_mode", PyGetEditMode, nullptr, "Gets edit mode.")); - addLegacyGeneral(behaviorContext->Method("set_edit_mode", PySetEditMode, nullptr, "Sets edit mode.")); - addLegacyGeneral(behaviorContext->Method("get_pak_from_file", PyGetPakFromFile, nullptr, "Finds a pak file name for a given file.")); addLegacyGeneral(behaviorContext->Method("log", PyLog, nullptr, "Prints the message to the editor console window.")); diff --git a/Code/Sandbox/Editor/PythonEditorFuncs.h b/Code/Sandbox/Editor/PythonEditorFuncs.h index 37cb6bd551..471f0d581f 100644 --- a/Code/Sandbox/Editor/PythonEditorFuncs.h +++ b/Code/Sandbox/Editor/PythonEditorFuncs.h @@ -95,10 +95,6 @@ namespace AzToolsFramework void SetAxisConstraint(AZStd::string_view pConstrain) override; - const char* GetEditMode() override; - - void SetEditMode(AZStd::string_view pEditMode) override; - const char* GetPakFromFile(const char* filename) override; void Log(const char* pMessage) override; diff --git a/Code/Sandbox/Editor/RenderViewport.cpp b/Code/Sandbox/Editor/RenderViewport.cpp index 53355f4dd9..af4cbd46bc 100644 --- a/Code/Sandbox/Editor/RenderViewport.cpp +++ b/Code/Sandbox/Editor/RenderViewport.cpp @@ -4301,11 +4301,6 @@ void CRenderViewport::RenderSnappingGrid() { return; } - if (GetIEditor()->GetEditMode() != eEditModeMove - && GetIEditor()->GetEditMode() != eEditModeRotate) - { - return; - } CGrid* pGrid = GetViewManager()->GetGrid(); if (pGrid->IsEnabled() == false && pGrid->IsAngleSnapEnabled() == false) { @@ -4317,76 +4312,6 @@ void CRenderViewport::RenderSnappingGrid() int prevState = dc.GetState(); dc.DepthWriteOff(); - Vec3 p = pSelGroup->GetObject(0)->GetWorldPos(); - - AABB bbox; - pSelGroup->GetObject(0)->GetBoundBox(bbox); - float size = 2 * bbox.GetRadius(); - float alphaMax = 1.0f, alphaMin = 0.2f; - dc.SetLineWidth(3); - - if (GetIEditor()->GetEditMode() == eEditModeMove && pGrid->IsEnabled()) - // Draw the translation grid. - { - Vec3 u = m_constructionPlaneAxisX; - Vec3 v = m_constructionPlaneAxisY; - float step = pGrid->scale * pGrid->size; - const int MIN_STEP_COUNT = 5; - const int MAX_STEP_COUNT = 300; - int nSteps = std::min(std::max(FloatToIntRet(size / step), MIN_STEP_COUNT), MAX_STEP_COUNT); - size = nSteps * step; - for (int i = -nSteps; i <= nSteps; ++i) - { - // Draw u lines. - float alphaCur = alphaMax - fabsf(float(i) / float(nSteps)) * (alphaMax - alphaMin); - dc.DrawLine(p + v * (step * i), p + u * size + v * (step * i), - ColorF(0, 0, 0, alphaCur), ColorF(0, 0, 0, alphaMin)); - dc.DrawLine(p + v * (step * i), p - u * size + v * (step * i), - ColorF(0, 0, 0, alphaCur), ColorF(0, 0, 0, alphaMin)); - // Draw v lines. - dc.DrawLine(p + u * (step * i), p + v * size + u * (step * i), - ColorF(0, 0, 0, alphaCur), ColorF(0, 0, 0, alphaMin)); - dc.DrawLine(p + u * (step * i), p - v * size + u * (step * i), - ColorF(0, 0, 0, alphaCur), ColorF(0, 0, 0, alphaMin)); - } - } - else if (GetIEditor()->GetEditMode() == eEditModeRotate && pGrid->IsAngleSnapEnabled()) - // Draw the rotation grid. - { - int nAxis(GetAxisConstrain()); - if (nAxis == AXIS_X || nAxis == AXIS_Y || nAxis == AXIS_Z) - { - RefCoordSys coordSys = GetIEditor()->GetReferenceCoordSys(); - Vec3 xAxis(1, 0, 0); - Vec3 yAxis(0, 1, 0); - Vec3 zAxis(0, 0, 1); - Vec3 rotAxis; - if (nAxis == AXIS_X) - { - rotAxis = m_constructionMatrix[coordSys].TransformVector(xAxis); - } - else if (nAxis == AXIS_Y) - { - rotAxis = m_constructionMatrix[coordSys].TransformVector(yAxis); - } - else if (nAxis == AXIS_Z) - { - rotAxis = m_constructionMatrix[coordSys].TransformVector(zAxis); - } - Vec3 anotherAxis = m_constructionPlane.n * size; - float step = pGrid->angleSnap; - int nSteps = FloatToIntRet(180.0f / step); - for (int i = 0; i < nSteps; ++i) - { - AngleAxis rot(i* step* gf_PI / 180.0, rotAxis); - Vec3 dir = rot * anotherAxis; - dc.DrawLine(p, p + dir, - ColorF(0, 0, 0, alphaMax), ColorF(0, 0, 0, alphaMin)); - dc.DrawLine(p, p - dir, - ColorF(0, 0, 0, alphaMax), ColorF(0, 0, 0, alphaMin)); - } - } - } dc.SetState(prevState); } diff --git a/Code/Sandbox/Editor/Resource.h b/Code/Sandbox/Editor/Resource.h index d72c2d76d4..8c4b09ae67 100644 --- a/Code/Sandbox/Editor/Resource.h +++ b/Code/Sandbox/Editor/Resource.h @@ -141,18 +141,12 @@ #define ID_EDITMODE_ROTATE 33506 #define ID_EDITMODE_SCALE 33507 #define ID_EDITMODE_MOVE 33508 -#define ID_EDITMODE_SELECT 33509 -#define ID_EDITMODE_SELECTAREA 33510 #define ID_SELECTION_DELETE 33512 #define ID_EDIT_ESCAPE 33513 #define ID_OBJECTMODIFY_SETAREA 33514 #define ID_OBJECTMODIFY_SETHEIGHT 33515 #define ID_OBJECTMODIFY_FREEZE 33517 #define ID_OBJECTMODIFY_UNFREEZE 33518 -#define ID_SELECT_AXIS_XY 33520 -#define ID_SELECT_AXIS_X 33521 -#define ID_SELECT_AXIS_Y 33522 -#define ID_SELECT_AXIS_Z 33523 #define ID_UNDO 33524 #define ID_EDIT_CLONE 33525 #define ID_SELECTION_SAVE 33527 @@ -161,7 +155,6 @@ #define ID_EDIT_LEVELDATA 33542 #define ID_FILE_EDITEDITORINI 33543 #define ID_FILE_EDITLOGFILE 33544 -#define ID_SELECT_AXIS_TERRAIN 33545 #define ID_PREFERENCES 33546 #define ID_RELOAD_GEOMETRY 33549 #define ID_REDO 33550 @@ -213,7 +206,6 @@ #define ID_TV_NEXTKEY 33603 #define ID_PLAY_LOOP 33607 #define ID_TERRAIN 33611 -#define ID_OBJECTMODIFY_ALIGNTOGRID 33619 #define ID_PANEL_VEG_EXPORT 33672 #define ID_PANEL_VEG_IMPORT 33673 #define ID_PANEL_VEG_DISTRIBUTE 33674 @@ -226,7 +218,6 @@ #define ID_PANEL_VEG_ADDCATEGORY 33682 #define ID_PANEL_VEG_RENAMECATEGORY 33683 #define ID_PANEL_VEG_REMOVECATEGORY 33684 -#define ID_SELECT_AXIS_SNAPTOALL 33685 #define ID_TOOLS_PREFERENCES 33691 #define ID_EDIT_INVERTSELECTION 33692 #define ID_TOOLTERRAINMODIFY_SMOOTH 33695 @@ -279,7 +270,6 @@ #define ID_DISPLAY_GOTOPOSITION 34004 #define ID_PHYSICS_SIMULATEOBJECTS 34007 #define ID_TERRAIN_TEXTURE_EXPORT 34008 -#define ID_DISPLAY_SETVECTOR 34010 #define ID_TV_SEQUENCE_NEW 34049 #define ID_TV_MODE_DOPESHEET 34052 #define ID_VIEW_LAYOUTS 34053 @@ -403,7 +393,6 @@ #define ID_TOOLBAR_WIDGET_FIRST 50003 #define ID_TOOLBAR_WIDGET_UNDO 50003 #define ID_TOOLBAR_WIDGET_REDO 50004 -#define ID_TOOLBAR_WIDGET_REF_COORD 50006 #define ID_TOOLBAR_WIDGET_SNAP_ANGLE 50007 #define ID_TOOLBAR_WIDGET_SNAP_GRID 50008 #define ID_TOOLBAR_WIDGET_ENVIRONMENT_MODE 50011 diff --git a/Code/Sandbox/Editor/SetVectorDlg.cpp b/Code/Sandbox/Editor/SetVectorDlg.cpp deleted file mode 100644 index 583f5ff4af..0000000000 --- a/Code/Sandbox/Editor/SetVectorDlg.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include "EditorDefs.h" - -#include "SetVectorDlg.h" - -// Editor -#include "MainWindow.h" -#include "MathConversion.h" -#include "ActionManager.h" -#include "Objects/BaseObject.h" -#include "Objects/SelectionGroup.h" - -AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING -#include "ui_SetVectorDlg.h" -AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING - -///////////////////////////////////////////////////////////////////////////// -// CSetVectorDlg dialog - - -CSetVectorDlg::CSetVectorDlg(QWidget* pParent /*=NULL*/) - : QDialog(pParent) - , m_ui(new Ui::SetVectorDlg) -{ - m_ui->setupUi(this); - - OnInitDialog(); - - connect(m_ui->buttonOk, &QPushButton::clicked, this, &CSetVectorDlg::accept); - connect(m_ui->buttonCancel, &QPushButton::clicked, this, &CSetVectorDlg::reject); -} - -CSetVectorDlg::~CSetVectorDlg() -{ -} - -///////////////////////////////////////////////////////////////////////////// -// CSetVectorDlg message handlers - - -void CSetVectorDlg::OnInitDialog() -{ - QString editModeString; - int emode = GetIEditor()->GetEditMode(); - - if (emode == eEditModeMove) - { - editModeString = tr("Position"); - } - else if (emode == eEditModeRotate) - { - editModeString = tr("Rotation"); - } - else if (emode == eEditModeScale) - { - editModeString = tr("Scale"); - } - - m_ui->label->setText(tr("Enter %1 here:").arg(editModeString)); - - currentVec = GetVectorFromEditor(); - m_ui->edit->setText(QStringLiteral("%1, %2, %3").arg(currentVec.x, 2, 'f', 2).arg(currentVec.y, 2, 'f', 2).arg(currentVec.z, 2, 'f', 2)); -} - -void CSetVectorDlg::accept() -{ - Vec3 newVec = GetVectorFromText(); - SetVector(newVec); - - if (GetIEditor()->GetEditMode() == eEditModeMove && currentVec.GetDistance(newVec) > 10.0f) - { - MainWindow::instance()->GetActionManager()->GetAction(ID_GOTO_SELECTED)->trigger(); - } - QDialog::accept(); -} - -Vec3 CSetVectorDlg::GetVectorFromEditor() -{ - Vec3 v; - int emode = GetIEditor()->GetEditMode(); - CBaseObject* obj = GetIEditor()->GetSelectedObject(); - bool bWorldSpace = GetIEditor()->GetReferenceCoordSys() == COORDS_WORLD; - - if (obj) - { - v = obj->GetWorldPos(); - } - - if (emode == eEditModeMove) - { - if (obj) - { - if (bWorldSpace) - { - v = obj->GetWorldTM().GetTranslation(); - } - else - { - v = obj->GetPos(); - } - } - } - if (emode == eEditModeRotate) - { - if (obj) - { - Quat qrot; - if (bWorldSpace) - { - AffineParts ap; - ap.SpectralDecompose(obj->GetWorldTM()); - qrot = ap.rot; - } - else - { - qrot = obj->GetRotation(); - } - - v = AZVec3ToLYVec3(AZ::ConvertQuaternionToEulerDegrees(LYQuaternionToAZQuaternion(qrot))); - } - } - if (emode == eEditModeScale) - { - if (obj) - { - if (bWorldSpace) - { - AffineParts ap; - ap.SpectralDecompose(obj->GetWorldTM()); - v = ap.scale; - } - else - { - v = obj->GetScale(); - } - } - } - return v; -} - -Vec3 CSetVectorDlg::GetVectorFromText() -{ - return GetVectorFromString(m_ui->edit->text()); -} - -Vec3 CSetVectorDlg::GetVectorFromString(const QString& vecString) -{ - const int maxCoordinates = 3; - float vec[maxCoordinates] = { 0, 0, 0 }; - - const QStringList parts = vecString.split(QRegularExpression("[\\s,;\\t]"), Qt::SkipEmptyParts); - const int checkCoords = AZStd::GetMin(parts.count(), maxCoordinates); - for (int k = 0; k < checkCoords; ++k) - { - vec[k] = parts[k].toDouble(); - } - - return Vec3(vec[0], vec[1], vec[2]); -} - -void CSetVectorDlg::SetVector(const Vec3& v) -{ - int emode = GetIEditor()->GetEditMode(); - if (emode != eEditModeMove && emode != eEditModeRotate && emode != eEditModeScale) - { - return; - } - - int referenceCoordSys = GetIEditor()->GetReferenceCoordSys(); - - CBaseObject* obj = GetIEditor()->GetSelectedObject(); - - Matrix34 tm; - AffineParts ap; - if (obj) - { - tm = obj->GetWorldTM(); - ap.SpectralDecompose(tm); - } - - if (emode == eEditModeMove) - { - if (obj) - { - CUndo undo("Set Position"); - if (referenceCoordSys == COORDS_WORLD) - { - tm.SetTranslation(v); - obj->SetWorldTM(tm, eObjectUpdateFlags_UserInput); - } - else - { - obj->SetPos(v, eObjectUpdateFlags_UserInput); - } - } - } - if (emode == eEditModeRotate) - { - CUndo undo("Set Rotation"); - if (obj) - { - Quat qrot = AZQuaternionToLYQuaternion(AZ::ConvertEulerDegreesToQuaternion(LYVec3ToAZVec3(v))); - if (referenceCoordSys == COORDS_WORLD) - { - tm = Matrix34::Create(ap.scale, qrot, ap.pos); - obj->SetWorldTM(tm, eObjectUpdateFlags_UserInput); - } - else - { - obj->SetRotation(qrot, eObjectUpdateFlags_UserInput); - } - } - else - { - GetIEditor()->GetSelection()->Rotate((Ang3)v, referenceCoordSys); - } - } - if (emode == eEditModeScale) - { - if (v.x == 0 || v.y == 0 || v.z == 0) - { - return; - } - - CUndo undo("Set Scale"); - if (obj) - { - if (referenceCoordSys == COORDS_WORLD) - { - tm = Matrix34::Create(v, ap.rot, ap.pos); - obj->SetWorldTM(tm, eObjectUpdateFlags_UserInput); - } - else - { - obj->SetScale(v, eObjectUpdateFlags_UserInput); - } - } - else - { - GetIEditor()->GetSelection()->Scale(v, referenceCoordSys); - } - } -} - -#include diff --git a/Code/Sandbox/Editor/SetVectorDlg.h b/Code/Sandbox/Editor/SetVectorDlg.h deleted file mode 100644 index e9fd8115e5..0000000000 --- a/Code/Sandbox/Editor/SetVectorDlg.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#ifndef CRYINCLUDE_EDITOR_SETVECTORDLG_H -#define CRYINCLUDE_EDITOR_SETVECTORDLG_H - -#pragma once -// GotoPositionDlg.h : header file -// - -#if !defined(Q_MOC_RUN) -#include -#endif - -namespace Ui -{ - class SetVectorDlg; -} - -///////////////////////////////////////////////////////////////////////////// -// CSetVectorDlg dialog - -class SANDBOX_API CSetVectorDlg - : public QDialog -{ - Q_OBJECT - // Construction -public: - CSetVectorDlg(QWidget* pParent = NULL); // standard constructor - ~CSetVectorDlg(); - - static Vec3 GetVectorFromString(const QString& vecString); - - // Implementation -protected: - void OnInitDialog(); - void accept() override; - void SetVector(const Vec3& v); - Vec3 GetVectorFromText(); - Vec3 GetVectorFromEditor(); - AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING - Vec3 currentVec; - AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING - -private: - AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING - QScopedPointer m_ui; - AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING -}; - -#endif // CRYINCLUDE_EDITOR_SETVECTORDLG_H diff --git a/Code/Sandbox/Editor/SetVectorDlg.ui b/Code/Sandbox/Editor/SetVectorDlg.ui deleted file mode 100644 index a8ed3cb282..0000000000 --- a/Code/Sandbox/Editor/SetVectorDlg.ui +++ /dev/null @@ -1,55 +0,0 @@ - - - SetVectorDlg - - - - 0 - 0 - 270 - 99 - - - - Set Vector - - - - 29 - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Cancel - - - - - - - Set - - - - - - - - diff --git a/Code/Sandbox/Editor/ToolbarManager.cpp b/Code/Sandbox/Editor/ToolbarManager.cpp index 12fd9b1a03..6977121933 100644 --- a/Code/Sandbox/Editor/ToolbarManager.cpp +++ b/Code/Sandbox/Editor/ToolbarManager.cpp @@ -587,26 +587,13 @@ AmazonToolbar ToolbarManager::GetEditModeToolbar() const t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION); - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - t.AddAction(ID_EDITMODE_SELECT, ORIGINAL_TOOLBAR_VERSION); - } - t.AddAction(ID_EDITMODE_MOVE, ORIGINAL_TOOLBAR_VERSION); t.AddAction(ID_EDITMODE_ROTATE, ORIGINAL_TOOLBAR_VERSION); t.AddAction(ID_EDITMODE_SCALE, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_EDITMODE_SELECTAREA, ORIGINAL_TOOLBAR_VERSION); t.AddAction(ID_VIEW_SWITCHTOGAME, TOOLBARS_WITH_PLAY_GAME); t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_TOOLBAR_WIDGET_REF_COORD, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_SELECT_AXIS_X, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_SELECT_AXIS_Y, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_SELECT_AXIS_Z, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_SELECT_AXIS_XY, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_SELECT_AXIS_TERRAIN, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_SELECT_AXIS_SNAPTOALL, 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); @@ -623,7 +610,6 @@ AmazonToolbar ToolbarManager::GetObjectToolbar() const AmazonToolbar t = AmazonToolbar("Object", QObject::tr("Object Toolbar")); t.SetMainToolbar(true); t.AddAction(ID_GOTO_SELECTED, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_OBJECTMODIFY_ALIGNTOGRID, ORIGINAL_TOOLBAR_VERSION); t.AddAction(ID_OBJECTMODIFY_SETHEIGHT, ORIGINAL_TOOLBAR_VERSION); if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) diff --git a/Code/Sandbox/Editor/editor_lib_files.cmake b/Code/Sandbox/Editor/editor_lib_files.cmake index da32d6d062..4adf501d45 100644 --- a/Code/Sandbox/Editor/editor_lib_files.cmake +++ b/Code/Sandbox/Editor/editor_lib_files.cmake @@ -484,9 +484,6 @@ set(FILES SelectLightAnimationDialog.h SelectSequenceDialog.cpp SelectSequenceDialog.h - SetVectorDlg.cpp - SetVectorDlg.h - SetVectorDlg.ui ShadersDialog.cpp ShadersDialog.h ShadersDialog.ui diff --git a/Code/Sandbox/Editor/editor_lib_test_files.cmake b/Code/Sandbox/Editor/editor_lib_test_files.cmake index 27713f4d30..f537169136 100644 --- a/Code/Sandbox/Editor/editor_lib_test_files.cmake +++ b/Code/Sandbox/Editor/editor_lib_test_files.cmake @@ -20,7 +20,6 @@ set(FILES Lib/Tests/test_MainWindowPythonBindings.cpp Lib/Tests/test_MaterialPythonFuncs.cpp Lib/Tests/test_ObjectManagerPythonBindings.cpp - Lib/Tests/test_SetVectorDlg.cpp Lib/Tests/test_TrackViewPythonBindings.cpp Lib/Tests/test_ViewPanePythonBindings.cpp Lib/Tests/test_ViewportTitleDlgPythonBindings.cpp