Merge branch 'main' into LYN-1099

This commit is contained in:
jjjoness
2021-05-12 08:58:43 +01:00
663 changed files with 17040 additions and 78676 deletions
+4 -188
View File
@@ -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)
@@ -736,8 +695,6 @@ void MainWindow::InitActions()
am->AddAction(ID_TOOLBAR_WIDGET_REDO, QString());
am->AddAction(ID_TOOLBAR_WIDGET_SNAP_ANGLE, QString());
am->AddAction(ID_TOOLBAR_WIDGET_SNAP_GRID, QString());
am->AddAction(ID_TOOLBAR_WIDGET_ENVIRONMENT_MODE, QString());
am->AddAction(ID_TOOLBAR_WIDGET_DEBUG_MODE, QString());
am->AddAction(ID_TOOLBAR_WIDGET_SPACER_RIGHT, QString());
// File actions
@@ -941,7 +898,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)
@@ -1295,44 +1251,6 @@ QToolButton* MainWindow::CreateUndoRedoButton(int command)
return button;
}
QToolButton* MainWindow::CreateEnvironmentModeButton()
{
QToolButton* environmentModeButton = new QToolButton(this);
environmentModeButton->setAutoRaise(true);
environmentModeButton->setPopupMode(QToolButton::InstantPopup);
environmentModeButton->setIcon(Style::icon("Environment"));
environmentModeButton->setStatusTip(tr("Select from a variety of environment mode options"));
environmentModeButton->setToolTip(tr("Environment modes"));
CVarMenu* environmentModeMenu = new CVarMenu(this);
connect(environmentModeMenu, &QMenu::aboutToShow, [this, environmentModeMenu]()
{
InitEnvironmentModeMenu(environmentModeMenu);
});
environmentModeButton->setMenu(environmentModeMenu);
return environmentModeButton;
}
QToolButton* MainWindow::CreateDebugModeButton()
{
QToolButton* debugModeButton = new QToolButton(this);
debugModeButton->setAutoRaise(true);
debugModeButton->setPopupMode(QToolButton::InstantPopup);
debugModeButton->setIcon(Style::icon("Debugging"));
debugModeButton->setStatusTip(tr("Select from a variety of debug/view mode options"));
debugModeButton->setToolTip(tr("Debug modes"));
CVarMenu* debugModeMenu = new CVarMenu(this);
connect(debugModeMenu, &QMenu::aboutToShow, [this, debugModeMenu]()
{
InitDebugModeMenu(debugModeMenu);
});
debugModeButton->setMenu(debugModeMenu);
return debugModeButton;
}
QWidget* MainWindow::CreateSpacerRightWidget()
{
QWidget* spacer = new QWidget(this);
@@ -1341,93 +1259,6 @@ QWidget* MainWindow::CreateSpacerRightWidget()
return spacer;
}
void MainWindow::InitEnvironmentModeMenu(CVarMenu* environmentModeMenu)
{
environmentModeMenu->clear();
environmentModeMenu->AddCVarToggleItem({ "e_Fog", tr("Hide Global Fog"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "r_FogVolumes", tr("Hide Fog Volumes"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "e_Clouds", tr("Hide Clouds"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "e_Wind", tr("Hide Wind"), 0, 1 });
environmentModeMenu->AddSeparator();
environmentModeMenu->AddCVarToggleItem({ "e_Sun", tr("Hide Sun"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "e_Skybox", tr("Hide Skybox"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "r_SSReflections", tr("Hide Screen Space Reflection"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "e_Shadows", tr("Hide Shadows"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "r_TransparentPasses", tr("Hide Transparent Objects"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "r_ssdo", tr("Hide Screen Space Directional Occlusion"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "e_DynamicLights", tr("Hide All Dynamic Lights"), 0, 1 });
environmentModeMenu->AddSeparator();
environmentModeMenu->AddCVarToggleItem({ "e_Entities", tr("Hide Entities"), 0, 1 });
environmentModeMenu->AddSeparator();
environmentModeMenu->AddCVarToggleItem({ "e_Vegetation", tr("Hide Vegetation"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "e_Terrain", tr("Hide Terrain"), 0, 1 });
environmentModeMenu->AddSeparator();
environmentModeMenu->AddCVarToggleItem({ "e_Particles", tr("Hide Particles"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "e_Flares", tr("Hide Flares"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "e_Decals", tr("Hide Decals"), 0, 1 });
environmentModeMenu->AddSeparator();
environmentModeMenu->AddCVarToggleItem({ "e_WaterOcean", tr("Hide Ocean Water (for legacy)"), 0, 1 });
environmentModeMenu->AddCVarToggleItem({ "e_WaterVolumes", tr("Hide Water Volumes"), 0, 1 });
environmentModeMenu->AddSeparator();
environmentModeMenu->AddCVarToggleItem({ "e_BBoxes", tr("Hide BBoxes"), 0, 1 });
environmentModeMenu->AddSeparator();
environmentModeMenu->AddResetCVarsItem();
}
void MainWindow::InitDebugModeMenu(CVarMenu* debugModeMenu)
{
debugModeMenu->clear();
debugModeMenu->AddCVarValuesItem("r_DebugGBuffer", tr("GBuffers"),
{
{tr("Full Shading Mode (Default)"), 0},
{tr("Normal Visualization"), 1},
{tr("Smoothness"), 2},
{tr("Reflectance"), 3},
{tr("Albedo"), 4},
{tr("Lighting Model"), 5},
{tr("Translucency"), 6},
{tr("Sun Self Shadowing"), 7},
{tr("Subsurface Scattering"), 8},
{tr("Specular Validation Overlay"), 9}
}, 0);
debugModeMenu->AddSeparator();
debugModeMenu->AddCVarValuesItem("r_Stats", tr("Profiling"),
{
{tr("Frame Timing"), 1},
{tr("Object Timing"), 3},
{tr("Instance Draw Calls"), 6},
}, 0);
debugModeMenu->AddSeparator();
debugModeMenu->AddUniqueCVarsItem(tr("Wireframe"),
{
{"r_wireframe", tr("Wireframe Rendering Mode"), 1, 0},
{"r_showlines", tr("Wireframe Overlay"), 1, 0}
}),
debugModeMenu->AddCVarValuesItem("e_debugdraw", tr("Art Info"),
{
{tr("Texture Memory Usage"), 4},
{tr("Renderable Material Count"), 5},
{tr("LOD Vertex Count"), 22}
}, 0);
debugModeMenu->AddSeparator();
debugModeMenu->AddCVarValuesItem("e_defaultmaterial", tr("Default Material on all Objects"),
{
{tr("Gray Material with Normal Maps"), 1},
}, 0);
debugModeMenu->AddCVarValuesItem("r_DeferredShadingTiledDebugAlbedo", tr("Debug Visualization of Deferred Lighting"),
{
{tr("White Albedo"), 1},
}, 0);
debugModeMenu->AddCVarToggleItem({ "r_ShowTangents", tr("Show Tangents"), 1, 0 });
debugModeMenu->AddCVarToggleItem({ "p_draw_helpers", tr("Show Collision Shapes (Proxy)"), 1, 0 });
debugModeMenu->AddSeparator();
debugModeMenu->AddResetCVarsItem();
}
UndoRedoToolButton::UndoRedoToolButton(QWidget* parent)
: QToolButton(parent)
{
@@ -1479,15 +1310,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;
@@ -2201,12 +2023,6 @@ QWidget* MainWindow::CreateToolbarWidget(int actionId)
case ID_TOOLBAR_WIDGET_SNAP_ANGLE:
w = CreateSnapToAngleWidget();
break;
case ID_TOOLBAR_WIDGET_ENVIRONMENT_MODE:
w = CreateEnvironmentModeButton();
break;
case ID_TOOLBAR_WIDGET_DEBUG_MODE:
w = CreateDebugModeButton();
break;
case ID_TOOLBAR_WIDGET_SPACER_RIGHT:
w = CreateSpacerRightWidget();
break;