Merge pull request #251 from aws-lumberyard-dev/cgalvan/RemoveSetEditMode
[LYN-3160] Removed IEditor::Get/SetEditMode and some additional unused (related) content in the InfoBar.
This commit is contained in:
-18
@@ -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
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
|
||||
-16
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+30
-240
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<std::pair<EEditMode, QString>> 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<RefCoordSys>(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<int>(m_lastCoordSys[editMode.first]));
|
||||
}
|
||||
|
||||
settings.endGroup(); // CoordSys
|
||||
settings.endGroup(); // Editor
|
||||
}
|
||||
|
||||
IEditorPanelUtils* CEditorImpl::GetEditorPanelUtils()
|
||||
{
|
||||
return m_panelEditorUtils;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <memory> // for shared_ptr
|
||||
#include <QMap>
|
||||
#include <QApplication>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
#include <AzToolsFramework/Thumbnails/ThumbnailerBus.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
@@ -86,13 +85,12 @@ namespace AssetDatabase
|
||||
|
||||
class CEditorImpl
|
||||
: public IEditor
|
||||
, protected AzToolsFramework::EditorEntityContextNotificationBus::Handler
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CEditorImpl)
|
||||
|
||||
public:
|
||||
CEditorImpl();
|
||||
~CEditorImpl();
|
||||
virtual ~CEditorImpl();
|
||||
|
||||
void Initialize();
|
||||
void OnBeginShutdownSequence();
|
||||
@@ -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<IEditorNotifyListener*> 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;
|
||||
|
||||
@@ -30,6 +30,8 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <ui_InfoBar.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
#include <AzQtComponents/Components/Style.h>
|
||||
|
||||
#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<void(QComboBox::*)(const QString&)>(&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<float>(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()
|
||||
{
|
||||
|
||||
@@ -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<AZ::Uuid>& componentModeTypes) override;
|
||||
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& 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;
|
||||
|
||||
@@ -57,42 +57,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AzQtComponents::VectorInput" name="m_posCtrl" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Position</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_setVector">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>XYZ</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/XYZ-default.svg</normaloff>:/InfoBar/XYZ-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_gotoPos">
|
||||
<property name="sizePolicy">
|
||||
@@ -135,68 +99,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_lockSelection">
|
||||
<property name="toolTip">
|
||||
<string>Lock Object Selection</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lock Selection</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/LockSelection-default.svg</normaloff>:/InfoBar/LockSelection-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_vectorLock">
|
||||
<property name="toolTip">
|
||||
<string>Lock Scale Axis Vectors</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lock Scale</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/LockScale-default.svg</normaloff>:/InfoBar/LockScale-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
@@ -424,13 +326,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>AzQtComponents::VectorInput</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">AzQtComponents/Components/Widgets/VectorInput.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="InfoBar.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -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 ));
|
||||
|
||||
@@ -151,9 +151,6 @@ namespace EditorPythonBindingsUnitTests
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("get_axis_constraint") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("set_axis_constraint") != behaviorContext->m_methods.end());
|
||||
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("get_edit_mode") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("set_edit_mode") != behaviorContext->m_methods.end());
|
||||
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("get_pak_from_file") != behaviorContext->m_methods.end());
|
||||
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("log") != behaviorContext->m_methods.end());
|
||||
@@ -200,8 +197,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());
|
||||
|
||||
@@ -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 <AzTest/AzTest.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
|
||||
#include <SetVectorDlg.h>
|
||||
|
||||
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
|
||||
@@ -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<AzQtComponents::ToolBar::ToolBarIconSize>(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<void (QComboBox::*)(int)>(&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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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."));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <moc_SetVectorDlg.cpp>
|
||||
@@ -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 <QDialog>
|
||||
#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<Ui::SetVectorDlg> m_ui;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_SETVECTORDLG_H
|
||||
@@ -1,55 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SetVectorDlg</class>
|
||||
<widget class="QDialog" name="SetVectorDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>270</width>
|
||||
<height>99</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Set Vector</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>29</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLineEdit" name="edit">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="buttonCancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="buttonOk">
|
||||
<property name="text">
|
||||
<string>Set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -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())
|
||||
|
||||
@@ -484,9 +484,6 @@ set(FILES
|
||||
SelectLightAnimationDialog.h
|
||||
SelectSequenceDialog.cpp
|
||||
SelectSequenceDialog.h
|
||||
SetVectorDlg.cpp
|
||||
SetVectorDlg.h
|
||||
SetVectorDlg.ui
|
||||
ShadersDialog.cpp
|
||||
ShadersDialog.h
|
||||
ShadersDialog.ui
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user