Remove all references to old CGrid system (#672)
* add overload to ActionManager to support capturing an AZStd::function * move snapping settings to new settings registry * remove unneeded reference in ViewportSettings * move viewport setting function implementations to .cpp file * add more sensible default values for snapping * fix variable name for angle snapping * remove const from function prototype value parameters * add import/export api for free functions * change from std::bind to a lambda * remove redundant const for constexpr string_view * add AZStd alias for std::abs * restore grid and angle snapping * add overload to ActionManager to support capturing an AZStd::function * remove old legacy CGrid code * fix build after merge * review feedback changes - remove 1.0f multiplies
This commit is contained in:
committed by
GitHub
parent
b5e5a3bfee
commit
b185a94519
@@ -66,7 +66,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "AssetImporter/AssetImporterManager/AssetImporterDragAndDropHandler.h"
|
||||
#include "CryEdit.h"
|
||||
#include "Controls/ConsoleSCB.h"
|
||||
#include "Grid.h"
|
||||
#include "ViewManager.h"
|
||||
#include "CryEditDoc.h"
|
||||
#include "ToolBox.h"
|
||||
@@ -97,7 +96,6 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
#include "AzAssetBrowser/AzAssetBrowserWindow.h"
|
||||
#include "AssetEditor/AssetEditorWindow.h"
|
||||
#include "GridSettingsDialog.h"
|
||||
#include "ActionManager.h"
|
||||
|
||||
// uncomment this to show thumbnail demo widget
|
||||
@@ -123,12 +121,6 @@ static const char* g_openLocationAttributeName = "OpenLocation"; //Indicates whe
|
||||
|
||||
static const char* g_assetImporterName = "AssetImporter";
|
||||
|
||||
static const char* g_snapToGridEnabled = "mainwindow/snapGridEnabled";
|
||||
static const char* g_snapToGridSize = "mainwindow/snapGridSize";
|
||||
static const char* g_snapAngleEnabled = "mainwindow/snapAngleEnabled";
|
||||
static const char* g_snapAngle = "mainwindow/snapAngle";
|
||||
static const char* g_terrainFollow = "mainwindow/terrainFollow";
|
||||
|
||||
class CEditorOpenViewCommand
|
||||
: public _i_reference_target_t
|
||||
{
|
||||
@@ -308,10 +300,8 @@ namespace
|
||||
|
||||
class SnapToWidget
|
||||
: public QWidget
|
||||
, public CGridSettingsDialog::NotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
|
||||
typedef AZStd::function<void(double)> SetValueCallback;
|
||||
typedef AZStd::function<double()> GetValueCallback;
|
||||
|
||||
@@ -335,12 +325,13 @@ public:
|
||||
m_spinBox->setEnabled(defaultAction->isChecked());
|
||||
m_spinBox->setMinimum(1e-2f);
|
||||
|
||||
OnGridValuesUpdated();
|
||||
{
|
||||
QSignalBlocker signalBlocker(m_spinBox);
|
||||
m_spinBox->setValue(m_getValueCallback());
|
||||
}
|
||||
|
||||
QObject::connect(m_spinBox, QOverload<double>::of(&AzQtComponents::DoubleSpinBox::valueChanged), this, &SnapToWidget::OnValueChanged);
|
||||
QObject::connect(defaultAction, &QAction::changed, this, &SnapToWidget::OnActionChanged);
|
||||
|
||||
CGridSettingsDialog::NotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void SetIcon(QIcon icon)
|
||||
@@ -348,14 +339,6 @@ public:
|
||||
m_toolButton->setIcon(icon);
|
||||
}
|
||||
|
||||
void OnGridValuesUpdated() override
|
||||
{
|
||||
// Blocking signals to not trigger the valueChanged callback when we set the value on the spin box.
|
||||
QSignalBlocker signalBlocker(m_spinBox);
|
||||
double value = m_getValueCallback();
|
||||
m_spinBox->setValue(value);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void OnValueChanged(double value)
|
||||
@@ -543,7 +526,6 @@ void MainWindow::Initialize()
|
||||
RegisterStdViewClasses();
|
||||
InitCentralWidget();
|
||||
|
||||
LoadConfig();
|
||||
InitActions();
|
||||
|
||||
// load toolbars ("shelves") and macros
|
||||
@@ -673,31 +655,8 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::LoadConfig()
|
||||
{
|
||||
CGrid* grid = gSettings.pGrid;
|
||||
Q_ASSERT(grid);
|
||||
bool terrainValue;
|
||||
|
||||
ReadConfigValue(g_snapAngleEnabled, grid->bAngleSnapEnabled);
|
||||
ReadConfigValue(g_snapAngle, grid->angleSnap);
|
||||
ReadConfigValue(g_snapToGridEnabled, grid->bEnabled);
|
||||
ReadConfigValue(g_snapToGridSize, grid->size);
|
||||
ReadConfigValue(g_terrainFollow, terrainValue);
|
||||
GetIEditor()->SetTerrainAxisIgnoreObjects(terrainValue);
|
||||
}
|
||||
|
||||
void MainWindow::SaveConfig()
|
||||
{
|
||||
CGrid* grid = gSettings.pGrid;
|
||||
Q_ASSERT(grid);
|
||||
|
||||
m_settings.setValue(g_snapAngleEnabled, grid->bAngleSnapEnabled);
|
||||
m_settings.setValue(g_snapAngle, grid->angleSnap);
|
||||
m_settings.setValue(g_snapToGridEnabled, grid->bEnabled);
|
||||
m_settings.setValue(g_snapToGridSize, grid->size);
|
||||
m_settings.setValue(g_terrainFollow, GetIEditor()->IsTerrainAxisIgnoreObjects());
|
||||
|
||||
m_settings.setValue("mainWindowState", saveState());
|
||||
QtViewPaneManager::instance()->SaveLayout();
|
||||
if (m_pLayoutWnd)
|
||||
@@ -941,7 +900,6 @@ void MainWindow::InitActions()
|
||||
.SetStatusTip(tr("Render in Wireframe Mode."))
|
||||
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateWireframe);
|
||||
|
||||
am->AddAction(ID_VIEW_GRIDSETTINGS, tr("Grid Settings..."));
|
||||
am->AddAction(ID_SWITCHCAMERA_DEFAULTCAMERA, tr("Default Camera")).SetCheckable(true)
|
||||
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSwitchToDefaultCamera);
|
||||
am->AddAction(ID_SWITCHCAMERA_SEQUENCECAMERA, tr("Sequence Camera")).SetCheckable(true)
|
||||
@@ -1479,15 +1437,6 @@ MainStatusBar* MainWindow::StatusBar() const
|
||||
return static_cast<MainStatusBar*>(statusBar());
|
||||
}
|
||||
|
||||
void MainWindow::OnUpdateSnapToGrid(QAction* action)
|
||||
{
|
||||
Q_ASSERT(action->isCheckable());
|
||||
bool bEnabled = gSettings.pGrid->IsEnabled();
|
||||
action->setChecked(bEnabled);
|
||||
|
||||
action->setText(QObject::tr("Snap To Grid"));
|
||||
}
|
||||
|
||||
KeyboardCustomizationSettings* MainWindow::GetShortcutManager() const
|
||||
{
|
||||
return m_keyboardCustomization;
|
||||
|
||||
Reference in New Issue
Block a user