- class TreeItemDataIterator
- {
- public:
- typedef T Type;
- typedef TreeItemIterator InternalIterator;
-
- //iterator traits, required by STL
- typedef ptrdiff_t difference_type;
- typedef Type* value_type;
- typedef Type** pointer;
- typedef Type*& reference;
- typedef std::forward_iterator_tag iterator_category;
-
- TreeItemDataIterator() {}
- TreeItemDataIterator(const TreeItemDataIterator& other)
- : iterator(other.iterator) {AdvanceToValidIterator(); }
- explicit TreeItemDataIterator(const InternalIterator& iterator)
- : iterator(iterator) {AdvanceToValidIterator(); }
-
- Type* operator*() {return reinterpret_cast(iterator.pCtrl->GetItemData(iterator.hItem)); }
- bool operator==(const TreeItemDataIterator& other) const {return iterator == other.iterator; }
- bool operator!=(const TreeItemDataIterator& other) const {return iterator != other.iterator; }
-
- HTREEITEM GetTreeItem() {return iterator.hItem; }
-
- TreeItemDataIterator& operator++()
- {
- ++iterator;
- AdvanceToValidIterator();
- return *this;
- }
-
- TreeItemDataIterator operator++(int) {TreeItemDataIterator old = *this; ++(*this); return old; }
-
- private:
- void AdvanceToValidIterator()
- {
- while (iterator.pCtrl && iterator.hItem && !iterator.pCtrl->GetItemData(iterator.hItem))
- {
- ++iterator;
- }
- }
-
- InternalIterator iterator;
- };
-
- template
- class RecursiveItemDataIteratorType
- {
- public: typedef TreeItemDataIterator type;
- };
- template
- inline TreeItemDataIterator BeginTreeItemDataRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
- {
- return TreeItemDataIterator(BeginTreeItemsRecursive(pCtrl, hItem));
- }
-
- template
- inline TreeItemDataIterator EndTreeItemDataRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
- {
- return TreeItemDataIterator(EndTreeItemsRecursive(pCtrl, hItem));
- }
-
- template
- class NonRecursiveItemDataIteratorType
- {
- typedef TreeItemDataIterator type;
- };
- template
- inline TreeItemDataIterator BeginTreeItemDataNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
- {
- return TreeItemDataIterator(BeginTreeItemsNonRecursive(pCtrl, hItem));
- }
-
- template
- inline TreeItemDataIterator EndTreeItemDataNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
- {
- return TreeItemDataIterator(EndTreeItemsNonRecursive(pCtrl, hItem));
- }
-
- class SelectedTreeItemIterator
- {
- public:
- SelectedTreeItemIterator()
- : pCtrl(0)
- , hItem(0) {}
- SelectedTreeItemIterator(const SelectedTreeItemIterator& other)
- : pCtrl(other.pCtrl)
- , hItem(other.hItem) {}
- SelectedTreeItemIterator(CXTTreeCtrl* pCtrl, HTREEITEM hItem)
- : pCtrl(pCtrl)
- , hItem(hItem) {}
-
- HTREEITEM operator*() {return hItem; }
- bool operator==(const SelectedTreeItemIterator& other) const {return pCtrl == other.pCtrl && hItem == other.hItem; }
- bool operator!=(const SelectedTreeItemIterator& other) const {return pCtrl != other.pCtrl || hItem != other.hItem; }
-
- SelectedTreeItemIterator& operator++()
- {
- hItem = (pCtrl ? pCtrl->GetNextSelectedItem(hItem) : 0);
-
- return *this;
- }
-
- SelectedTreeItemIterator operator++(int) {SelectedTreeItemIterator old = *this; ++(*this); return old; }
-
- CXTTreeCtrl* pCtrl;
- HTREEITEM hItem;
- };
-
- SelectedTreeItemIterator BeginSelectedTreeItems(CXTTreeCtrl* pCtrl)
- {
- return SelectedTreeItemIterator(pCtrl, (pCtrl ? pCtrl->GetFirstSelectedItem() : 0));
- }
-
- SelectedTreeItemIterator EndSelectedTreeItems(CXTTreeCtrl* pCtrl)
- {
- return SelectedTreeItemIterator(pCtrl, 0);
- }
-
- template
- class SelectedTreeItemDataIterator
- {
- public:
- typedef T Type;
- typedef SelectedTreeItemIterator InternalIterator;
-
- SelectedTreeItemDataIterator() {}
- SelectedTreeItemDataIterator(const SelectedTreeItemDataIterator& other)
- : iterator(other.iterator) {AdvanceToValidIterator(); }
- explicit SelectedTreeItemDataIterator(const InternalIterator& iterator)
- : iterator(iterator) {AdvanceToValidIterator(); }
-
- Type* operator*() {return reinterpret_cast(iterator.pCtrl->GetItemData(iterator.hItem)); }
- bool operator==(const SelectedTreeItemDataIterator& other) const {return iterator == other.iterator; }
- bool operator!=(const SelectedTreeItemDataIterator& other) const {return iterator != other.iterator; }
-
- HTREEITEM GetTreeItem() {return iterator.hItem; }
-
- SelectedTreeItemDataIterator& operator++()
- {
- ++iterator;
- AdvanceToValidIterator();
- return *this;
- }
-
- SelectedTreeItemDataIterator operator++(int) {SelectedTreeItemDataIterator old = *this; ++(*this); return old; }
-
- private:
- void AdvanceToValidIterator()
- {
- while (iterator.pCtrl && iterator.hItem && !iterator.pCtrl->GetItemData(iterator.hItem))
- {
- ++iterator;
- }
- }
-
- InternalIterator iterator;
- };
-
- template
- SelectedTreeItemDataIterator BeginSelectedTreeItemData(CXTTreeCtrl* pCtrl)
- {
- return SelectedTreeItemDataIterator(BeginSelectedTreeItems(pCtrl));
- }
-
- template
- SelectedTreeItemDataIterator EndSelectedTreeItemData(CXTTreeCtrl* pCtrl)
- {
- return SelectedTreeItemDataIterator(EndSelectedTreeItems(pCtrl));
- }
-}
-
-#endif // CRYINCLUDE_EDITOR_CONTROLS_TREECTRLUTILS_H
diff --git a/Code/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Editor/Core/LevelEditorMenuHandler.cpp
index 70aff10f87..05f06c87aa 100644
--- a/Code/Editor/Core/LevelEditorMenuHandler.cpp
+++ b/Code/Editor/Core/LevelEditorMenuHandler.cpp
@@ -104,6 +104,11 @@ namespace
}
}
+ // Currently (December 13, 2021), this function is only used by slice editor code.
+ // When the slice editor is not enabled, there are no references to the
+ // HideActionWhileEntitiesDeselected function, causing a compiler warning and
+ // subsequently a build error.
+#ifdef ENABLE_SLICE_EDITOR
void HideActionWhileEntitiesDeselected(QAction* action, EEditorNotifyEvent editorNotifyEvent)
{
if (action == nullptr)
@@ -127,6 +132,7 @@ namespace
break;
}
}
+#endif
void DisableActionWhileInSimMode(QAction* action, EEditorNotifyEvent editorNotifyEvent)
{
@@ -374,7 +380,6 @@ QMenu* LevelEditorMenuHandler::CreateFileMenu()
{
DisableActionWhileLevelChanges(fileOpenSlice, e);
}));
-#endif
// Save Selected Slice
auto saveSelectedSlice = fileMenu.AddAction(ID_FILE_SAVE_SELECTED_SLICE);
@@ -391,7 +396,7 @@ QMenu* LevelEditorMenuHandler::CreateFileMenu()
{
HideActionWhileEntitiesDeselected(saveSliceToRoot, e);
}));
-
+#endif
// Open Recent
m_mostRecentLevelsMenu = fileMenu.AddMenu(tr("Open Recent"));
connect(m_mostRecentLevelsMenu, &QMenu::aboutToShow, this, &LevelEditorMenuHandler::UpdateMRUFiles);
@@ -439,9 +444,10 @@ QMenu* LevelEditorMenuHandler::CreateFileMenu()
// Show Log File
fileMenu.AddAction(ID_FILE_EDITLOGFILE);
+#ifdef ENABLE_SLICE_EDITOR
fileMenu.AddSeparator();
-
fileMenu.AddAction(ID_FILE_RESAVESLICES);
+#endif
fileMenu.AddSeparator();
@@ -538,6 +544,7 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
auto snapMenu = modifyMenu.AddMenu(tr("Snap"));
snapMenu.AddAction(AzToolsFramework::SnapAngle);
+ snapMenu.AddAction(AzToolsFramework::SnapToGrid);
auto transformModeMenu = modifyMenu.AddMenu(tr("Transform Mode"));
transformModeMenu.AddAction(AzToolsFramework::EditModeMove);
@@ -723,7 +730,8 @@ QMenu* LevelEditorMenuHandler::CreateViewMenu()
// MISSING AVIRECORDER
viewportViewsMenuWrapper.AddSeparator();
- viewportViewsMenuWrapper.AddAction(ID_DISPLAY_SHOWHELPERS);
+ viewportViewsMenuWrapper.AddAction(AzToolsFramework::Helpers);
+ viewportViewsMenuWrapper.AddAction(AzToolsFramework::Icons);
// Refresh Style
viewMenu.AddAction(ID_SKINS_REFRESH);
diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp
index c5c3acd2f6..1c4e22b99e 100644
--- a/Code/Editor/CryEdit.cpp
+++ b/Code/Editor/CryEdit.cpp
@@ -33,6 +33,7 @@ AZ_POP_DISABLE_WARNING
#include
#include
#include
+#include
#include
// Aws Native SDK
@@ -80,7 +81,6 @@ AZ_POP_DISABLE_WARNING
#include
// CryCommon
-#include
#include
// Editor
@@ -371,10 +371,8 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_EDIT_FETCH, OnEditFetch)
ON_COMMAND(ID_FILE_EXPORTTOGAMENOSURFACETEXTURE, OnFileExportToGameNoSurfaceTexture)
ON_COMMAND(ID_VIEW_SWITCHTOGAME, OnViewSwitchToGame)
- MainWindow::instance()->GetActionManager()->RegisterActionHandler(ID_VIEW_SWITCHTOGAME_FULLSCREEN, [this]() {
- ed_previewGameInFullscreen_once = true;
- OnViewSwitchToGame();
- });
+ ON_COMMAND(ID_VIEW_SWITCHTOGAME_VIEWPORT, OnViewSwitchToGame)
+ ON_COMMAND(ID_VIEW_SWITCHTOGAME_FULLSCREEN, OnViewSwitchToGameFullScreen)
ON_COMMAND(ID_MOVE_OBJECT, OnMoveObject)
ON_COMMAND(ID_RENAME_OBJ, OnRenameObj)
ON_COMMAND(ID_UNDO, OnUndo)
@@ -382,13 +380,13 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
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_PREFERENCES, OnPreferences)
ON_COMMAND(ID_REDO, OnRedo)
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnRedo)
ON_COMMAND(ID_FILE_OPEN_LEVEL, OnOpenLevel)
#ifdef ENABLE_SLICE_EDITOR
+ ON_COMMAND(ID_FILE_RESAVESLICES, OnFileResaveSlices)
ON_COMMAND(ID_FILE_NEW_SLICE, OnCreateSlice)
ON_COMMAND(ID_FILE_OPEN_SLICE, OnOpenSlice)
#endif
@@ -447,7 +445,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_OPEN_ASSET_BROWSER, OnOpenAssetBrowserView)
ON_COMMAND(ID_OPEN_AUDIO_CONTROLS_BROWSER, OnOpenAudioControlsEditor)
- ON_COMMAND(ID_DISPLAY_SHOWHELPERS, OnShowHelpers)
ON_COMMAND(ID_OPEN_TRACKVIEW, OnOpenTrackView)
ON_COMMAND(ID_OPEN_UICANVASEDITOR, OnOpenUICanvasEditor)
@@ -548,7 +545,6 @@ public:
{ "BatchMode", m_bConsoleMode },
{ "NullRenderer", m_bNullRenderer },
{ "devmode", m_bDeveloperMode },
- { "VTUNE", dummy },
{ "runpython", m_bRunPythonScript },
{ "runpythontest", m_bRunPythonTestScript },
{ "version", m_bShowVersionInfo },
@@ -915,13 +911,9 @@ namespace
QWidget* g_splashScreen = nullptr;
}
-QString FormatVersion(const SFileVersion& v)
+QString FormatVersion([[maybe_unused]] const SFileVersion& v)
{
-#if defined(LY_BUILD)
- return QObject::tr("Version %1.%2.%3.%4 - Build %5").arg(v[3]).arg(v[2]).arg(v[1]).arg(v[0]).arg(LY_BUILD);
-#else
- return QObject::tr("Version %1.%2.%3.%4").arg(v[3]).arg(v[2]).arg(v[1]).arg(v[0]);
-#endif
+ return QObject::tr("Version %1").arg(LY_VERSION_BUILD_NUMBER);
}
QString FormatRichTextCopyrightNotice()
@@ -1360,18 +1352,27 @@ void CCryEditApp::CompileCriticalAssets() const
}
}
assetsInQueueNotifcation.BusDisconnect();
+
+ // Signal the "CriticalAssetsCompiled" lifecycle event
+ // Also reload the "assetcatalog.xml" if it exists
+ if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
+ {
+ AZ::ComponentApplicationLifecycle::SignalEvent(*settingsRegistry, "CriticalAssetsCompiled", R"({})");
+ // Reload the assetcatalog.xml at this point again
+ // Start Monitoring Asset changes over the network and load the AssetCatalog
+ auto LoadCatalog = [settingsRegistry](AZ::Data::AssetCatalogRequests* assetCatalogRequests)
+ {
+ if (AZ::IO::FixedMaxPath assetCatalogPath;
+ settingsRegistry->Get(assetCatalogPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_CacheRootFolder))
+ {
+ assetCatalogPath /= "assetcatalog.xml";
+ assetCatalogRequests->LoadCatalog(assetCatalogPath.c_str());
+ }
+ };
+ AZ::Data::AssetCatalogRequestBus::Broadcast(AZStd::move(LoadCatalog));
+ }
+
CCryEditApp::OutputStartupMessage(QString("Asset Processor is now ready."));
-
- // VERY early on, as soon as we can, request that the asset system make sure the following assets take priority over others,
- // so that by the time we ask for them there is a greater likelihood that they're already good to go.
- // these can be loaded later but are still important:
- AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::EscalateAssetBySearchTerm, "/texturemsg/");
- AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::EscalateAssetBySearchTerm, "engineassets/materials");
- AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::EscalateAssetBySearchTerm, "engineassets/geomcaches");
- AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::EscalateAssetBySearchTerm, "engineassets/objects");
-
- // some are specifically extra important and will cause issues if missing completely:
- AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::CompileAssetSync, "engineassets/objects/default.cgf");
}
bool CCryEditApp::ConnectToAssetProcessor() const
@@ -1687,7 +1688,7 @@ bool CCryEditApp::InitInstance()
return false;
}
- if (AZ::SettingsRegistryInterface* settingsRegistry = AZ::SettingsRegistry::Get())
+ if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
{
AZ::ComponentApplicationLifecycle::SignalEvent(*settingsRegistry, "LegacySystemInterfaceCreated", R"({})");
}
@@ -2585,6 +2586,12 @@ void CCryEditApp::OnViewSwitchToGame()
GetIEditor()->SetInGameMode(inGame);
}
+void CCryEditApp::OnViewSwitchToGameFullScreen()
+{
+ ed_previewGameInFullscreen_once = true;
+ OnViewSwitchToGame();
+}
+
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnExportSelectedObjects()
{
@@ -2628,12 +2635,6 @@ void CCryEditApp::OnUpdateSelected(QAction* action)
action->setEnabled(!GetIEditor()->GetSelection()->IsEmpty());
}
-void CCryEditApp::OnShowHelpers()
-{
- GetIEditor()->GetDisplaySettings()->DisplayHelpers(!GetIEditor()->GetDisplaySettings()->IsDisplayHelpers());
- GetIEditor()->Notify(eNotify_OnDisplayRenderUpdate);
-}
-
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditLevelData()
{
@@ -2647,6 +2648,7 @@ void CCryEditApp::OnFileEditLogFile()
CFileUtil::EditTextFile(CLogFile::GetLogFileName(), 0, IFileUtil::FILE_TYPE_SCRIPT);
}
+#ifdef ENABLE_SLICE_EDITOR
void CCryEditApp::OnFileResaveSlices()
{
AZStd::vector sliceAssetInfos;
@@ -2777,6 +2779,7 @@ void CCryEditApp::OnFileResaveSlices()
}
}
+#endif
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnFileEditEditorini()
@@ -2821,14 +2824,11 @@ void CCryEditApp::OpenProjectManager(const AZStd::string& screen)
{
// provide the current project path for in case we want to update the project
AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath();
-#if !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
- const char* argumentQuoteString = R"(")";
-#else
- const char* argumentQuoteString = R"(\")";
-#endif
- const AZStd::string commandLineOptions = AZStd::string::format(R"( --screen %s --project-path %s%s%s)",
- screen.c_str(),
- argumentQuoteString, projectPath.c_str(), argumentQuoteString);
+
+ const AZStd::vector commandLineOptions {
+ "--screen", screen,
+ "--project-path", AZStd::string::format(R"("%s")", projectPath.c_str()) };
+
bool launchSuccess = AzFramework::ProjectManager::LaunchProjectManager(commandLineOptions);
if (!launchSuccess)
{
@@ -3828,7 +3828,8 @@ void CCryEditApp::OnOpenQuickAccessBar()
}
QRect geo = m_pQuickAccessBar->geometry();
- geo.moveCenter(MainWindow::instance()->geometry().center());
+ auto mainWindow = MainWindow::instance();
+ geo.moveCenter(mainWindow->mapToGlobal(mainWindow->geometry().center()));
m_pQuickAccessBar->setGeometry(geo);
m_pQuickAccessBar->setVisible(true);
m_pQuickAccessBar->setFocus();
@@ -3974,9 +3975,8 @@ void CCryEditApp::OpenLUAEditor(const char* files)
}
}
- const char* engineRoot = nullptr;
- AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
- AZ_Assert(engineRoot != nullptr, "Unable to communicate to AzFramework::ApplicationRequests::Bus");
+ AZ::IO::FixedMaxPathString engineRoot = AZ::Utils::GetEnginePath();
+ AZ_Assert(!engineRoot.empty(), "Unable to query Engine Path");
AZStd::string_view exePath;
AZ::ComponentApplicationBus::BroadcastResult(exePath, &AZ::ComponentApplicationRequests::GetExecutableFolder);
@@ -3995,7 +3995,7 @@ void CCryEditApp::OpenLUAEditor(const char* files)
#endif
"%s", argumentQuoteString, aznumeric_cast(exePath.size()), exePath.data(), argumentQuoteString);
- AZStd::string processArgs = AZStd::string::format("%s -engine-path \"%s\"", args.c_str(), engineRoot);
+ AZStd::string processArgs = AZStd::string::format("%s -engine-path \"%s\"", args.c_str(), engineRoot.c_str());
StartProcessDetached(process.c_str(), processArgs.c_str());
}
@@ -4028,7 +4028,7 @@ void CCryEditApp::OnError(AzFramework::AssetSystem::AssetSystemErrors error)
break;
}
- CryMessageBox(errorMessage.c_str(), "Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
+ QMessageBox::critical(nullptr,"Error",errorMessage.c_str());
}
void CCryEditApp::OnOpenProceduralMaterialEditor()
@@ -4196,6 +4196,8 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[])
"\nThis could be because of incorrectly configured components, or missing required gems."
"\nSee other errors for more details.");
+ AzToolsFramework::EditorEventsBus::Broadcast(&AzToolsFramework::EditorEvents::NotifyEditorInitialized);
+
if (didCryEditStart)
{
app->EnableOnIdle();
diff --git a/Code/Editor/CryEdit.h b/Code/Editor/CryEdit.h
index 53ee8f1905..97fcde8f34 100644
--- a/Code/Editor/CryEdit.h
+++ b/Code/Editor/CryEdit.h
@@ -212,6 +212,7 @@ public:
void OnEditFetch();
void OnFileExportToGameNoSurfaceTexture();
void OnViewSwitchToGame();
+ void OnViewSwitchToGameFullScreen();
void OnViewDeploy();
void DeleteSelectedEntities(bool includeDescendants);
void OnMoveObject();
@@ -236,7 +237,6 @@ public:
void OnSyncPlayerUpdate(QAction* action);
void OnResourcesReduceworkingset();
void OnDummyCommand() {};
- void OnShowHelpers();
void OnFileSave();
void OnUpdateDocumentReady(QAction* action);
void OnUpdateFileOpen(QAction* action);
diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp
index 4944c3bff5..3bcba4d5e0 100644
--- a/Code/Editor/CryEditDoc.cpp
+++ b/Code/Editor/CryEditDoc.cpp
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
#include
#include
@@ -50,7 +51,6 @@
#include "GameExporter.h"
#include "MainWindow.h"
#include "LevelFileDialog.h"
-#include "StatObjBus.h"
#include "Undo/Undo.h"
#include
@@ -60,15 +60,6 @@
#include
#include // for LmbrCentral::EditorLightComponentRequestBus
-//#define PROFILE_LOADING_WITH_VTUNE
-
-// profilers api.
-//#include "pure.h"
-#ifdef PROFILE_LOADING_WITH_VTUNE
-#include "C:\Program Files\Intel\Vtune\Analyzer\Include\VTuneApi.h"
-#pragma comment(lib,"C:\\Program Files\\Intel\\Vtune\\Analyzer\\Lib\\VTuneApi.lib")
-#endif
-
static const char* kAutoBackupFolder = "_autobackup";
static const char* kHoldFolder = "$tmp_hold"; // conform to the ignored file types $tmp[0-9]*_ regex
static const char* kSaveBackupFolder = "_savebackup";
@@ -254,9 +245,6 @@ void CCryEditDoc::DeleteContents()
EBUS_EVENT(AzToolsFramework::EditorEntityContextRequestBus, ResetEditorContext);
- // [LY-90904] move this to the EditorVegetationManager component
- InstanceStatObjEventBus::Broadcast(&InstanceStatObjEventBus::Events::ReleaseData);
-
//////////////////////////////////////////////////////////////////////////
// Clear all undo info.
//////////////////////////////////////////////////////////////////////////
@@ -316,8 +304,6 @@ void CCryEditDoc::Save(TDocMultiArchive& arrXmlAr)
// Fog settings ///////////////////////////////////////////////////////
SerializeFogSettings((*arrXmlAr[DMAS_GENERAL]));
-
- SerializeNameSelection((*arrXmlAr[DMAS_GENERAL]));
}
}
AfterSave();
@@ -408,9 +394,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
int t0 = GetTickCount();
-#ifdef PROFILE_LOADING_WITH_VTUNE
- VTResume();
-#endif
// Load level-specific audio data.
AZStd::string levelFileName{ fileName.toUtf8().constData() };
AZStd::to_lower(levelFileName.begin(), levelFileName.end());
@@ -466,12 +449,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
}
}
- if (!isPrefabEnabled)
- {
- // Name Selection groups
- SerializeNameSelection((*arrXmlAr[DMAS_GENERAL]));
- }
-
{
CAutoLogTime logtime("Post Load");
@@ -484,10 +461,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
CSurfaceTypeValidator().Validate();
-#ifdef PROFILE_LOADING_WITH_VTUNE
- VTPause();
-#endif
-
LogLoadTime(GetTickCount() - t0);
// Loaded with success, remove event from log file
GetIEditor()->GetSettingsManager()->UnregisterEvent(loadEvent);
@@ -610,16 +583,6 @@ void CCryEditDoc::SerializeFogSettings(CXmlArchive& xmlAr)
}
}
-void CCryEditDoc::SerializeNameSelection(CXmlArchive& xmlAr)
-{
- IObjectManager* pObjManager = GetIEditor()->GetObjectManager();
-
- if (pObjManager)
- {
- pObjManager->SerializeNameSelection(xmlAr.root, xmlAr.bLoading);
- }
-}
-
void CCryEditDoc::SetModifiedModules(EModifiedModule eModifiedModule, bool boSet)
{
if (!boSet)
@@ -765,7 +728,9 @@ bool CCryEditDoc::OnOpenDocument(const QString& lpszPathName)
bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContext& context)
{
- CTimeValue loading_start_time = gEnv->pTimer->GetAsyncTime();
+ const AZ::TimeMs timeMs = AZ::GetRealElapsedTimeMs();
+ const double timeSec = AZ::TimeMsToSecondsDouble(timeMs);
+ const CTimeValue loading_start_time(timeSec);
bool usePrefabSystemForLevels = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
@@ -806,7 +771,7 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
{
- CTimeValue& loading_start_time = context.loading_start_time;
+ const CTimeValue& loading_start_time = context.loading_start_time;
bool isPrefabEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
@@ -876,7 +841,9 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
StartStreamingLoad();
- CTimeValue loading_end_time = gEnv->pTimer->GetAsyncTime();
+ const AZ::TimeMs timeMs = AZ::GetRealElapsedTimeMs();
+ const double timeSec = AZ::TimeMsToSecondsDouble(timeMs);
+ const CTimeValue loading_end_time(timeSec);
CLogFile::FormatLine("-----------------------------------------------------------");
CLogFile::FormatLine("Successfully opened document %s", context.absoluteLevelPath.toUtf8().data());
@@ -1139,7 +1106,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
const QString oldLevelPattern = QDir(oldLevelFolder).absoluteFilePath("*.*");
const QString oldLevelName = Path::GetFile(GetLevelPathName());
const QString oldLevelXml = Path::ReplaceExtension(oldLevelName, "xml");
- AZ::IO::ArchiveFileIterator findHandle = pIPak->FindFirst(oldLevelPattern.toUtf8().data(), AZ::IO::IArchive::eFileSearchType_AllowOnDiskAndInZips);
+ AZ::IO::ArchiveFileIterator findHandle = pIPak->FindFirst(oldLevelPattern.toUtf8().data(), AZ::IO::FileSearchLocation::Any);
if (findHandle)
{
do
diff --git a/Code/Editor/CryEditDoc.h b/Code/Editor/CryEditDoc.h
index e64bdb1308..f7e97d308e 100644
--- a/Code/Editor/CryEditDoc.h
+++ b/Code/Editor/CryEditDoc.h
@@ -24,7 +24,6 @@
#include
#endif
-class CClouds;
struct LightingSettings;
struct IVariable;
struct ICVar;
@@ -124,7 +123,6 @@ public: // Create from serialization only
const char* GetTemporaryLevelName() const;
void DeleteTemporaryLevel();
- CClouds* GetClouds() { return m_pClouds; }
void SetWaterColor(const QColor& col) { m_waterColor = col; }
QColor GetWaterColor() const { return m_waterColor; }
XmlNodeRef& GetFogTemplate() { return m_fogTemplate; }
@@ -163,7 +161,6 @@ protected:
bool LoadEntitiesFromSlice(const QString& sliceFile);
void SerializeFogSettings(CXmlArchive& xmlAr);
virtual void SerializeViewSettings(CXmlArchive& xmlAr);
- void SerializeNameSelection(CXmlArchive& xmlAr);
void LogLoadTime(int time) const;
struct TSaveDocContext
@@ -195,7 +192,6 @@ protected:
QColor m_waterColor = QColor(0, 0, 255);
XmlNodeRef m_fogTemplate;
XmlNodeRef m_environmentTemplate;
- CClouds* m_pClouds;
std::list m_listeners;
bool m_bDocumentReady = false;
ICVar* doc_validate_surface_types = nullptr;
diff --git a/Code/Editor/Dialogs/PythonScriptsDialog.cpp b/Code/Editor/Dialogs/PythonScriptsDialog.cpp
index 35047947ac..06b1acdbc8 100644
--- a/Code/Editor/Dialogs/PythonScriptsDialog.cpp
+++ b/Code/Editor/Dialogs/PythonScriptsDialog.cpp
@@ -40,10 +40,10 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
namespace
{
// File name extension for python files
- const QString s_kPythonFileNameSpec = "*.py";
+ const QString s_kPythonFileNameSpec("*.py");
// Tree root element name
- const QString s_kRootElementName = "Python Scripts";
+ const QString s_kRootElementName("Python Scripts");
}
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/DisplaySettings.cpp b/Code/Editor/DisplaySettings.cpp
index ed4ca180b4..bfeac3e37f 100644
--- a/Code/Editor/DisplaySettings.cpp
+++ b/Code/Editor/DisplaySettings.cpp
@@ -68,8 +68,6 @@ void CDisplaySettings::SetObjectHideMask(int hideMask)
m_objectHideMask = hideMask;
gSettings.objectHideMask = m_objectHideMask;
-
- GetIEditor()->Notify(eNotify_OnDisplayRenderUpdate);
};
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/EditMode/DeepSelection.cpp b/Code/Editor/EditMode/DeepSelection.cpp
deleted file mode 100644
index 3e232a230c..0000000000
--- a/Code/Editor/EditMode/DeepSelection.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-#include "EditorDefs.h"
-
-#include "DeepSelection.h"
-
-// Editor
-#include "Objects/BaseObject.h"
-
-
-//! Functor for sorting selected objects on deep selection mode.
-struct NearDistance
-{
- NearDistance(){}
- bool operator()(const CDeepSelection::RayHitObject& lhs, const CDeepSelection::RayHitObject& rhs) const
- {
- return lhs.distance < rhs.distance;
- }
-};
-
-//-----------------------------------------------------------------------------
-CDeepSelection::CDeepSelection()
- : m_Mode(DSM_NONE)
- , m_previousMode(DSM_NONE)
- , m_CandidateObjectCount(0)
- , m_CurrentSelectedPos(-1)
-{
- m_LastPickPoint = QPoint(-1, -1);
-}
-
-//-----------------------------------------------------------------------------
-CDeepSelection::~CDeepSelection()
-{
-}
-
-//-----------------------------------------------------------------------------
-void CDeepSelection::Reset(bool bResetLastPick)
-{
- for (int i = 0; i < m_CandidateObjectCount; ++i)
- {
- m_RayHitObjects[i].object->ClearFlags(OBJFLAG_NO_HITTEST);
- }
-
- m_CandidateObjectCount = 0;
- m_CurrentSelectedPos = -1;
-
- m_RayHitObjects.clear();
-
- if (bResetLastPick)
- {
- m_LastPickPoint = QPoint(-1, -1);
- }
-}
-
-//-----------------------------------------------------------------------------
-void CDeepSelection::AddObject(float distance, CBaseObject* pObj)
-{
- m_RayHitObjects.push_back(RayHitObject(distance, pObj));
-}
-
-//-----------------------------------------------------------------------------
-bool CDeepSelection::OnCycling (const QPoint& pt)
-{
- QPoint diff = m_LastPickPoint - pt;
- LONG epsilon = 2;
- m_LastPickPoint = pt;
-
- if (abs(diff.x()) < epsilon && abs(diff.y()) < epsilon)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
-//-----------------------------------------------------------------------------
-void CDeepSelection::ExcludeHitTest(int except)
-{
- int nExcept = except % m_CandidateObjectCount;
-
- for (int i = 0; i < m_CandidateObjectCount; ++i)
- {
- m_RayHitObjects[i].object->SetFlags(OBJFLAG_NO_HITTEST);
- }
-
- m_RayHitObjects[nExcept].object->ClearFlags(OBJFLAG_NO_HITTEST);
-}
-
-//-----------------------------------------------------------------------------
-int CDeepSelection::CollectCandidate(float fMinDistance, float fRange)
-{
- m_CandidateObjectCount = 0;
-
- if (!m_RayHitObjects.empty())
- {
- std::sort(m_RayHitObjects.begin(), m_RayHitObjects.end(), NearDistance());
-
- for (std::vector::iterator itr = m_RayHitObjects.begin();
- itr != m_RayHitObjects.end(); ++itr)
- {
- if (itr->distance - fMinDistance < fRange)
- {
- ++m_CandidateObjectCount;
- }
- else
- {
- break;
- }
- }
- }
-
- return m_CandidateObjectCount;
-}
-
-//-----------------------------------------------------------------------------
-CBaseObject* CDeepSelection::GetCandidateObject(int index)
-{
- m_CurrentSelectedPos = index % m_CandidateObjectCount;
-
- return m_RayHitObjects[m_CurrentSelectedPos].object;
-}
-
-//-----------------------------------------------------------------------------
-//!
-void CDeepSelection::SetMode(EDeepSelectionMode mode)
-{
- m_previousMode = m_Mode;
- m_Mode = mode;
-}
diff --git a/Code/Editor/EditMode/DeepSelection.h b/Code/Editor/EditMode/DeepSelection.h
deleted file mode 100644
index b6f652abc5..0000000000
--- a/Code/Editor/EditMode/DeepSelection.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : Deep Selection Header
-
-
-#ifndef CRYINCLUDE_EDITOR_EDITMODE_DEEPSELECTION_H
-#define CRYINCLUDE_EDITOR_EDITMODE_DEEPSELECTION_H
-#pragma once
-
-class CBaseObject;
-
-//! Deep Selection
-//! Additional output information of HitContext on using "deep selection mode".
-//! At the deep selection mode, it supports second selection pass for easy
-//! selection on crowded area with two different method.
-//! One is to show pop menu of candidate objects list. Another is the cyclic
-//! selection on pick clicking.
-class CDeepSelection
- : public _i_reference_target_t
-{
-public:
- //! Deep Selection Mode Definition
- enum EDeepSelectionMode
- {
- DSM_NONE = 0, // Not using deep selection.
- DSM_POP = 1, // Deep selection mode with pop context menu.
- DSM_CYCLE = 2 // Deep selection mode with cyclic selection on each clinking same point.
- };
-
- //! Subclass for container of the selected object with hit distance.
- struct RayHitObject
- {
- RayHitObject(float dist, CBaseObject* pObj)
- : distance(dist)
- , object(pObj)
- {
- }
-
- float distance;
- CBaseObject* object;
- };
-
- //! Constructor
- CDeepSelection();
- virtual ~CDeepSelection();
-
- void Reset(bool bResetLastPick = false);
- void AddObject(float distance, CBaseObject* pObj);
- //! Check if clicking point is same position with last position,
- //! to decide whether to continue cycling mode.
- bool OnCycling (const QPoint& pt);
- //! All objects in list are excluded for hitting test except one, current selection.
- void ExcludeHitTest(int except);
- void SetMode(EDeepSelectionMode mode);
- inline EDeepSelectionMode GetMode() const { return m_Mode; }
- inline EDeepSelectionMode GetPreviousMode() const { return m_previousMode; }
- //! Collect object in the deep selection range. The distance from the minimum
- //! distance is less than deep selection range.
- int CollectCandidate(float fMinDistance, float fRange);
- //! Return the candidate object in index position, then it is to be current
- //! selection position.
- CBaseObject* GetCandidateObject(int index);
- //! Return the current selection position that is update in "GetCandidateObject"
- //! function call.
- inline int GetCurrentSelectPos() const { return m_CurrentSelectedPos; }
- //! Return the number of objects in the deep selection range.
- inline int GetCandidateObjectCount() const { return m_CandidateObjectCount; }
-
-private:
- //! Current mode
- EDeepSelectionMode m_Mode;
- EDeepSelectionMode m_previousMode;
- //! Last picking point to check whether cyclic selection continue.
- QPoint m_LastPickPoint;
- //! List of the selected objects with ray hitting
- std::vector m_RayHitObjects;
- int m_CandidateObjectCount;
- int m_CurrentSelectedPos;
-};
-#endif // CRYINCLUDE_EDITOR_EDITMODE_DEEPSELECTION_H
diff --git a/Code/Editor/EditorDefs.h b/Code/Editor/EditorDefs.h
index 4115e8433a..97c03b2b45 100644
--- a/Code/Editor/EditorDefs.h
+++ b/Code/Editor/EditorDefs.h
@@ -105,7 +105,6 @@
#include
#include
#include
-#include
#include
#include
diff --git a/Code/Editor/EditorEnvironment.cpp b/Code/Editor/EditorEnvironment.cpp
index 463fec8d08..2d675275ec 100644
--- a/Code/Editor/EditorEnvironment.cpp
+++ b/Code/Editor/EditorEnvironment.cpp
@@ -17,7 +17,7 @@ void SetEditorEnvironment(SSystemGlobalEnvironment* pEnv)
void AttachEditorAZEnvironment(AZ::EnvironmentInstance azEnv)
{
- AZ::Environment::Attach(azEnv, true);
+ AZ::Environment::Attach(azEnv);
}
void DetachEditorAZEnvironment()
diff --git a/Code/Editor/EditorModularViewportCameraComposer.cpp b/Code/Editor/EditorModularViewportCameraComposer.cpp
index ce4a0a2e33..3f66468584 100644
--- a/Code/Editor/EditorModularViewportCameraComposer.cpp
+++ b/Code/Editor/EditorModularViewportCameraComposer.cpp
@@ -13,9 +13,32 @@
#include
#include
#include
+#include
#include
#include
+AZ_CVAR(
+ bool,
+ ed_cameraPinDefaultOrbit,
+ true,
+ nullptr,
+ AZ::ConsoleFunctorFlags::Null,
+ "Sets whether the default orbit point moves with the camera or not");
+AZ_CVAR(
+ bool,
+ ed_cameraDefaultOrbitAxesOrtho,
+ true,
+ nullptr,
+ AZ::ConsoleFunctorFlags::Null,
+ "Sets whether to draw the default orbit point as orthographic or not");
+AZ_CVAR(
+ float,
+ ed_cameraDefaultOrbitFadeDuration,
+ 0.5f,
+ nullptr,
+ AZ::ConsoleFunctorFlags::Null,
+ "Sets how long the default orbit point should take to appear and disappear");
+
namespace SandboxEditor
{
static AzFramework::TranslateCameraInputChannelIds BuildTranslateCameraInputChannelIds()
@@ -122,6 +145,15 @@ namespace SandboxEditor
}
};
+ const auto trackingTransform = [viewportId = m_viewportId]
+ {
+ bool tracking = false;
+ AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult(
+ tracking, viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::IsTrackingTransform);
+
+ return tracking;
+ };
+
m_firstPersonRotateCamera = AZStd::make_shared(SandboxEditor::CameraFreeLookChannelId());
m_firstPersonRotateCamera->m_rotateSpeedFn = []
@@ -129,6 +161,11 @@ namespace SandboxEditor
return SandboxEditor::CameraRotateSpeed();
};
+ m_firstPersonRotateCamera->m_constrainPitch = [trackingTransform]
+ {
+ return !trackingTransform();
+ };
+
// default behavior is to hide the cursor but this can be disabled (useful for remote desktop)
// note: See CaptureCursorLook in the Settings Registry
m_firstPersonRotateCamera->SetActivationBeganFn(hideCursor);
@@ -174,7 +211,7 @@ namespace SandboxEditor
return SandboxEditor::CameraScrollSpeed();
};
- const auto pivotFn = []
+ const auto pivotFn = []() -> AZStd::optional
{
// use the manipulator transform as the pivot point
AZStd::optional entityPivot;
@@ -187,8 +224,7 @@ namespace SandboxEditor
return entityPivot->GetTranslation();
}
- // otherwise just use the identity
- return AZ::Vector3::CreateZero();
+ return AZStd::nullopt;
};
m_firstPersonFocusCamera =
@@ -199,9 +235,26 @@ namespace SandboxEditor
m_orbitCamera = AZStd::make_shared(SandboxEditor::CameraOrbitChannelId());
m_orbitCamera->SetPivotFn(
- [pivotFn]([[maybe_unused]] const AZ::Vector3& position, [[maybe_unused]] const AZ::Vector3& direction)
+ [this, pivotFn](const AZ::Vector3& position, const AZ::Vector3& direction)
{
- return pivotFn();
+ // return the pivot
+ if (auto pivot = pivotFn())
+ {
+ return pivot.value();
+ }
+
+ // start ticking and drawing (for the default pivot)
+ AZ::TickBus::Handler::BusConnect();
+ AzFramework::ViewportDebugDisplayEventBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
+
+ m_defaultOrbiting = true;
+ // calculate the default orbit point
+ if (!ed_cameraPinDefaultOrbit || m_orbitCamera->Beginning())
+ {
+ m_defaultOrbitPoint = position + direction * SandboxEditor::CameraDefaultOrbitDistance();
+ }
+
+ return m_defaultOrbitPoint;
});
m_orbitRotateCamera = AZStd::make_shared(SandboxEditor::CameraOrbitLookChannelId());
@@ -216,6 +269,11 @@ namespace SandboxEditor
return SandboxEditor::CameraOrbitYawRotationInverted();
};
+ m_orbitRotateCamera->m_constrainPitch = [trackingTransform]
+ {
+ return !trackingTransform();
+ };
+
m_orbitTranslateCamera = AZStd::make_shared(
translateCameraInputChannelIds, AzFramework::LookTranslation, AzFramework::TranslateOffsetOrbit);
@@ -298,12 +356,78 @@ namespace SandboxEditor
AZ::TransformBus::EventResult(worldFromLocal, viewEntityId, &AZ::TransformBus::Events::GetWorldTM);
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
- m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::SetReferenceFrame, worldFromLocal);
+ m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::StartTrackingTransform,
+ worldFromLocal);
}
else
{
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
- m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::ClearReferenceFrame);
+ m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::StopTrackingTransform);
}
}
+
+ void EditorModularViewportCameraComposer::OnTick(const float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
+ {
+ const float delta = [duration = &ed_cameraDefaultOrbitFadeDuration, deltaTime]
+ {
+ if (*duration == 0.0f)
+ {
+ return 1.0f;
+ }
+ return deltaTime / *duration;
+ }();
+
+ if (m_defaultOrbiting)
+ {
+ m_defaultOrbitOpacity = AZStd::min(m_defaultOrbitOpacity + delta, 1.0f);
+ }
+ else
+ {
+ m_defaultOrbitOpacity = AZStd::max(m_defaultOrbitOpacity - delta, 0.0f);
+ if (m_defaultOrbitOpacity == 0.0f)
+ {
+ AZ::TickBus::Handler::BusDisconnect();
+ AzFramework::ViewportDebugDisplayEventBus::Handler::BusDisconnect();
+ }
+ }
+
+ m_defaultOrbiting = false;
+ }
+
+ static void DrawTransformAxis(
+ AzFramework::DebugDisplayRequests& display,
+ const AzFramework::CameraState& cameraState,
+ const AZ::Vector3& pivot,
+ const float axisLength,
+ const float alpha)
+ {
+ const int prevState = display.GetState();
+
+ display.DepthWriteOff();
+ display.DepthTestOff();
+ display.CullOff();
+
+ const float orthoScale =
+ ed_cameraDefaultOrbitAxesOrtho ? AzToolsFramework::CalculateScreenToWorldMultiplier(pivot, cameraState) : 1.0f;
+
+ display.SetColor(AZ::Color::CreateFromVector3AndFloat(AZ::Colors::Red.GetAsVector3(), alpha));
+ display.DrawLine(pivot, pivot + AZ::Vector3::CreateAxisX() * axisLength * orthoScale);
+ display.SetColor(AZ::Color::CreateFromVector3AndFloat(AZ::Colors::LawnGreen.GetAsVector3(), alpha));
+ display.DrawLine(pivot, pivot + AZ::Vector3::CreateAxisY() * axisLength * orthoScale);
+ display.SetColor(AZ::Color::CreateFromVector3AndFloat(AZ::Colors::Blue.GetAsVector3(), alpha));
+ display.DrawLine(pivot, pivot + AZ::Vector3::CreateAxisZ() * axisLength * orthoScale);
+
+ display.DepthWriteOn();
+ display.DepthTestOn();
+ display.CullOn();
+
+ display.SetState(prevState);
+ }
+
+ void EditorModularViewportCameraComposer::DisplayViewport(
+ [[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay)
+ {
+ DrawTransformAxis(
+ debugDisplay, AzToolsFramework::GetCameraState(viewportInfo.m_viewportId), m_defaultOrbitPoint, 1.0f, m_defaultOrbitOpacity);
+ }
} // namespace SandboxEditor
diff --git a/Code/Editor/EditorModularViewportCameraComposer.h b/Code/Editor/EditorModularViewportCameraComposer.h
index 9cfd6f3554..6cd5df533c 100644
--- a/Code/Editor/EditorModularViewportCameraComposer.h
+++ b/Code/Editor/EditorModularViewportCameraComposer.h
@@ -9,6 +9,8 @@
#pragma once
#include
+#include
+#include
#include
#include
#include
@@ -20,6 +22,8 @@ namespace SandboxEditor
class EditorModularViewportCameraComposer
: private EditorModularViewportCameraComposerNotificationBus::Handler
, private Camera::EditorCameraNotificationBus::Handler
+ , private AzFramework::ViewportDebugDisplayEventBus::Handler
+ , private AZ::TickBus::Handler
{
public:
SANDBOX_API explicit EditorModularViewportCameraComposer(AzFramework::ViewportId viewportId);
@@ -29,6 +33,12 @@ namespace SandboxEditor
SANDBOX_API AZStd::shared_ptr CreateModularViewportCameraController();
private:
+ // AzFramework::ViewportDebugDisplayEventBus overrides ...
+ void DisplayViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
+
+ // AZ::TickBus overrides ...
+ void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
+
//! Setup all internal camera inputs.
void SetupCameras();
@@ -52,5 +62,9 @@ namespace SandboxEditor
AZStd::shared_ptr m_orbitFocusCamera;
AzFramework::ViewportId m_viewportId;
+
+ float m_defaultOrbitOpacity = 0.0f; //!< The default orbit axes opacity (to fade in and out).
+ AZ::Vector3 m_defaultOrbitPoint = AZ::Vector3::CreateZero(); //!< The orbit point to use when no entity is selected.
+ bool m_defaultOrbiting = false; //!< Is the camera default orbiting (orbiting when there's no selected entity).
};
} // namespace SandboxEditor
diff --git a/Code/Editor/EditorPanelUtils.cpp b/Code/Editor/EditorPanelUtils.cpp
deleted file mode 100644
index a270de5978..0000000000
--- a/Code/Editor/EditorPanelUtils.cpp
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-
-#include "EditorDefs.h"
-
-#include "EditorPanelUtils.h"
-
-#include
-
-// Qt
-#include
-#include
-#include
-
-// Editor
-#include "IEditorPanelUtils.h"
-#include "Objects/EntityObject.h"
-#include "CryEditDoc.h"
-#include "ViewManager.h"
-#include "Controls/QToolTipWidget.h"
-#include "Objects/SelectionGroup.h"
-
-
-
-#ifndef PI
-#define PI 3.14159265358979323f
-#endif
-
-
-struct ToolTip
-{
- bool isValid;
- QString title;
- QString content;
- QString specialContent;
- QString disabledContent;
-};
-
-// internal implementation for better compile times - should also never be used externally, use IParticleEditorUtils interface for that.
-class CEditorPanelUtils_Impl
- : public IEditorPanelUtils
-{
-public:
- void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
- {
- for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); i++)
- {
- GetIEditor()->GetViewManager()->GetView(i)->SetGlobalDropCallback(dropCallback, custom);
- }
- }
-
-public:
-
- int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) override
- {
- CRY_ASSERT(settings);
- return settings->GetDebugFlags();
- }
-
- void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags) override
- {
- CRY_ASSERT(settings);
- settings->SetDebugFlags(flags);
- }
-
-protected:
- QVector hotkeys;
- bool m_hotkeysAreEnabled;
-public:
-
- bool HotKey_Import() override
- {
- QVector > keys;
- QString filepath = QFileDialog::getOpenFileName(nullptr, "Select shortcut configuration to load",
- QString(), "HotKey Config Files (*.hkxml)");
- QFile file(filepath);
- if (!file.open(QIODevice::ReadOnly))
- {
- return false;
- }
- QXmlStreamReader stream(&file);
- bool result = true;
-
- while (!stream.isEndDocument())
- {
- if (stream.isStartElement())
- {
- if (stream.name() == "HotKey")
- {
- QPair key;
- QXmlStreamAttributes att = stream.attributes();
- for (QXmlStreamAttribute attr : att)
- {
- if (attr.name().compare(QLatin1String("path"), Qt::CaseInsensitive) == 0)
- {
- key.first = attr.value().toString();
- }
- if (attr.name().compare(QLatin1String("sequence"), Qt::CaseInsensitive) == 0)
- {
- key.second = attr.value().toString();
- }
- }
- if (!key.first.isEmpty())
- {
- keys.push_back(key); // we allow blank key sequences for unassigned shortcuts
- }
- else
- {
- result = false; //but not blank paths!
- }
- }
- }
- stream.readNext();
- }
- file.close();
-
- if (result)
- {
- HotKey_BuildDefaults();
- for (QPair key : keys)
- {
- for (int j = 0; j < hotkeys.count(); j++)
- {
- if (hotkeys[j].path.compare(key.first, Qt::CaseInsensitive) == 0)
- {
- hotkeys[j].SetPath(key.first.toStdString().c_str());
- hotkeys[j].SetSequenceFromString(key.second.toStdString().c_str());
- }
- }
- }
- }
- return result;
- }
-
- void HotKey_Export() override
- {
- auto settingDir = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Editor" / "Plugins" / "ParticleEditorPlugin" / "settings";
- QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", settingDir.c_str(), "HotKey Config Files (*.hkxml)");
- QFile file(filepath);
- if (!file.open(QIODevice::WriteOnly))
- {
- return;
- }
-
- QXmlStreamWriter stream(&file);
- stream.setAutoFormatting(true);
- stream.writeStartDocument();
- stream.writeStartElement("HotKeys");
-
- for (HotKey key : hotkeys)
- {
- stream.writeStartElement("HotKey");
- stream.writeAttribute("path", key.path);
- stream.writeAttribute("sequence", key.sequence.toString());
- stream.writeEndElement();
- }
- stream.writeEndElement();
- stream.writeEndDocument();
- file.close();
- }
-
- QKeySequence HotKey_GetShortcut(const char* path) override
- {
- for (HotKey combo : hotkeys)
- {
- if (combo.IsMatch(path))
- {
- return combo.sequence;
- }
- }
- return QKeySequence();
- }
-
- bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
- {
- if (!m_hotkeysAreEnabled)
- {
- return false;
- }
- unsigned int keyInt = 0;
- //Capture any modifiers
- Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
- if (modifiers & Qt::ShiftModifier)
- {
- keyInt += Qt::SHIFT;
- }
- if (modifiers & Qt::ControlModifier)
- {
- keyInt += Qt::CTRL;
- }
- if (modifiers & Qt::AltModifier)
- {
- keyInt += Qt::ALT;
- }
- if (modifiers & Qt::MetaModifier)
- {
- keyInt += Qt::META;
- }
- //Capture any key
- keyInt += event->key();
-
- QString t0 = QKeySequence(keyInt).toString();
- QString t1 = HotKey_GetShortcut(path).toString();
-
- //if strings match then shortcut is pressed
- if (t1.compare(t0, Qt::CaseInsensitive) == 0)
- {
- return true;
- }
- return false;
- }
-
- bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
- {
- if (!m_hotkeysAreEnabled)
- {
- return false;
- }
-
- QString t0 = event->key().toString();
- QString t1 = HotKey_GetShortcut(path).toString();
-
- //if strings match then shortcut is pressed
- if (t1.compare(t0, Qt::CaseInsensitive) == 0)
- {
- return true;
- }
- return false;
- }
-
- bool HotKey_LoadExisting() override
- {
- QSettings settings("O3DE", "O3DE");
- QString group = "Hotkeys/";
-
- HotKey_BuildDefaults();
-
- int size = settings.beginReadArray(group);
-
- for (int i = 0; i < size; i++)
- {
- settings.setArrayIndex(i);
- QPair hotkey;
- hotkey.first = settings.value("name").toString();
- hotkey.second = settings.value("keySequence").toString();
- if (!hotkey.first.isEmpty())
- {
- for (int j = 0; j < hotkeys.count(); j++)
- {
- if (hotkeys[j].path.compare(hotkey.first, Qt::CaseInsensitive) == 0)
- {
- hotkeys[j].SetPath(hotkey.first.toStdString().c_str());
- hotkeys[j].SetSequenceFromString(hotkey.second.toStdString().c_str());
- }
- }
- }
- }
-
- settings.endArray();
- if (hotkeys.isEmpty())
- {
- return false;
- }
- return true;
- }
-
- void HotKey_SaveCurrent() override
- {
- QSettings settings("O3DE", "O3DE");
- QString group = "Hotkeys/";
- settings.remove("Hotkeys/");
- settings.sync();
- settings.beginWriteArray(group);
- int saveIndex = 0;
- for (HotKey key : hotkeys)
- {
- if (!key.path.isEmpty())
- {
- settings.setArrayIndex(saveIndex++);
- settings.setValue("name", key.path);
- settings.setValue("keySequence", key.sequence.toString());
- }
- }
- settings.endArray();
- settings.sync();
- }
-
- void HotKey_BuildDefaults() override
- {
- m_hotkeysAreEnabled = true;
- QVector > keys;
- while (hotkeys.count() > 0)
- {
- hotkeys.takeAt(0);
- }
-
- //MENU SELECTION SHORTCUTS////////////////////////////////////////////////
- keys.push_back(QPair("Menus.File Menu", "Alt+F"));
- keys.push_back(QPair("Menus.Edit Menu", "Alt+E"));
- keys.push_back(QPair("Menus.View Menu", "Alt+V"));
- //FILE MENU SHORTCUTS/////////////////////////////////////////////////////
- keys.push_back(QPair("File Menu.Create new emitter", "Ctrl+N"));
- keys.push_back(QPair("File Menu.Create new library", "Ctrl+Shift+N"));
- keys.push_back(QPair("File Menu.Create new folder", ""));
- keys.push_back(QPair("File Menu.Import", "Ctrl+I"));
- keys.push_back(QPair("File Menu.Import level library", "Ctrl+Shift+I"));
- keys.push_back(QPair("File Menu.Save", "Ctrl+S"));
- keys.push_back(QPair("File Menu.Close", "Ctrl+Q"));
- //EDIT MENU SHORTCUTS/////////////////////////////////////////////////////
- keys.push_back(QPair("Edit Menu.Copy", "Ctrl+C"));
- keys.push_back(QPair("Edit Menu.Paste", "Ctrl+V"));
- keys.push_back(QPair("Edit Menu.Duplicate", "Ctrl+D"));
- keys.push_back(QPair("Edit Menu.Undo", "Ctrl+Z"));
- keys.push_back(QPair("Edit Menu.Redo", "Ctrl+Shift+Z"));
- keys.push_back(QPair("Edit Menu.Group", "Ctrl+G"));
- keys.push_back(QPair("Edit Menu.Ungroup", "Ctrl+Shift+G"));
- keys.push_back(QPair("Edit Menu.Rename", "Ctrl+R"));
- keys.push_back(QPair("Edit Menu.Reset", ""));
- keys.push_back(QPair("Edit Menu.Edit Hotkeys", ""));
- keys.push_back(QPair("Edit Menu.Assign to selected", "Ctrl+Space"));
- keys.push_back(QPair("Edit Menu.Insert Comment", "Ctrl+Alt+M"));
- keys.push_back(QPair("Edit Menu.Enable/Disable Emitter", "Ctrl+E"));
- keys.push_back(QPair("File Menu.Enable All", ""));
- keys.push_back(QPair("File Menu.Disable All", ""));
- keys.push_back(QPair("Edit Menu.Delete", "Del"));
- //VIEW MENU SHORTCUTS/////////////////////////////////////////////////////
- keys.push_back(QPair("View Menu.Reset Layout", ""));
- //PLAYBACK CONTROL////////////////////////////////////////////////////////
- keys.push_back(QPair("Previewer.Play/Pause Toggle", "Space"));
- keys.push_back(QPair("Previewer.Step forward through time", "c"));
- keys.push_back(QPair("Previewer.Loop Toggle", "z"));
- keys.push_back(QPair("Previewer.Reset Playback", "x"));
- keys.push_back(QPair("Previewer.Focus", "Ctrl+F"));
- keys.push_back(QPair("Previewer.Zoom In", "w"));
- keys.push_back(QPair("Previewer.Zoom Out", "s"));
- keys.push_back(QPair("Previewer.Pan Left", "a"));
- keys.push_back(QPair("Previewer.Pan Right", "d"));
-
- for (QPair key : keys)
- {
- unsigned int index = hotkeys.count();
- hotkeys.push_back(HotKey());
- hotkeys[index].SetPath(key.first.toStdString().c_str());
- hotkeys[index].SetSequenceFromString(key.second.toStdString().c_str());
- }
- }
-
- void HotKey_SetKeys(QVector keys) override
- {
- hotkeys = keys;
- }
-
- QVector HotKey_GetKeys() override
- {
- return hotkeys;
- }
-
- QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
- {
- if (!m_hotkeysAreEnabled)
- {
- return "";
- }
- for (HotKey key : hotkeys)
- {
- if (HotKey_IsPressed(event, key.path.toUtf8()))
- {
- return key.path;
- }
- }
- return "";
- }
- QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
- {
- if (!m_hotkeysAreEnabled)
- {
- return "";
- }
- for (HotKey key : hotkeys)
- {
- if (HotKey_IsPressed(event, key.path.toUtf8()))
- {
- return key.path;
- }
- }
- return "";
- }
- //building the default hotkey list re-enables hotkeys
- //do not use this when rebuilding the default list is a possibility.
- void HotKey_SetEnabled(bool val) override
- {
- m_hotkeysAreEnabled = val;
- }
-
- bool HotKey_IsEnabled() const override
- {
- return m_hotkeysAreEnabled;
- }
-
-protected:
- QMap m_tooltips;
-
- void ToolTip_ParseNode(XmlNodeRef node)
- {
- if (QString(node->getTag()).compare("tooltip", Qt::CaseInsensitive) != 0)
- {
- unsigned int childCount = node->getChildCount();
-
- for (unsigned int i = 0; i < childCount; i++)
- {
- ToolTip_ParseNode(node->getChild(i));
- }
- }
-
- QString title = node->getAttr("title");
- QString content = node->getAttr("content");
- QString specialContent = node->getAttr("special_content");
- QString disabledContent = node->getAttr("disabled_content");
-
- QMap::iterator itr = m_tooltips.insert(node->getAttr("path"), ToolTip());
- itr->isValid = true;
- itr->title = title;
- itr->content = content;
- itr->specialContent = specialContent;
- itr->disabledContent = disabledContent;
-
- unsigned int childCount = node->getChildCount();
-
- for (unsigned int i = 0; i < childCount; i++)
- {
- ToolTip_ParseNode(node->getChild(i));
- }
- }
-
- ToolTip GetToolTip(QString path)
- {
- if (m_tooltips.contains(path))
- {
- return m_tooltips[path];
- }
- ToolTip temp;
- temp.isValid = false;
- return temp;
- }
-
-public:
- void ToolTip_LoadConfigXML(QString filepath) override
- {
- XmlNodeRef node = GetIEditor()->GetSystem()->LoadXmlFromFile(filepath.toStdString().c_str());
- ToolTip_ParseNode(node);
- }
-
- void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true) override
- {
- AZ_Assert(tooltip, "tooltip cannot be null");
-
- QString title = ToolTip_GetTitle(path, option);
- QString content = ToolTip_GetContent(path, option);
- QString specialContent = ToolTip_GetSpecialContentType(path, option);
- QString disabledContent = ToolTip_GetDisabledContent(path, option);
-
- // Even if these items are empty, we set them anyway to clear out any data that was left over from when the tooltip was used for a different object.
- tooltip->SetTitle(title);
- tooltip->SetContent(content);
-
- //this only handles simple creation...if you need complex call this then add specials separate
- if (!specialContent.contains("::"))
- {
- tooltip->AddSpecialContent(specialContent, optionalData);
- }
-
- if (!isEnabled) // If disabled, add disabled value
- {
- tooltip->AppendContent(disabledContent);
- }
- }
-
- QString ToolTip_GetTitle(QString path, QString option) override
- {
- if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
- {
- return GetToolTip(path + "." + option).title;
- }
- if (!option.isEmpty() && GetToolTip("Options." + option).isValid)
- {
- return GetToolTip("Options." + option).title;
- }
- return GetToolTip(path).title;
- }
-
- QString ToolTip_GetContent(QString path, QString option) override
- {
- if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
- {
- return GetToolTip(path + "." + option).content;
- }
- if (!option.isEmpty() && GetToolTip("Options." + option).isValid)
- {
- return GetToolTip("Options." + option).content;
- }
- return GetToolTip(path).content;
- }
-
- QString ToolTip_GetSpecialContentType(QString path, QString option) override
- {
- if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
- {
- return GetToolTip(path + "." + option).specialContent;
- }
- if (!option.isEmpty() && GetToolTip("Options." + option).isValid)
- {
- return GetToolTip("Options." + option).specialContent;
- }
- return GetToolTip(path).specialContent;
- }
-
- QString ToolTip_GetDisabledContent(QString path, QString option) override
- {
- if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
- {
- return GetToolTip(path + "." + option).disabledContent;
- }
- if (!option.isEmpty() && GetToolTip("Options." + option).isValid)
- {
- return GetToolTip("Options." + option).disabledContent;
- }
- return GetToolTip(path).disabledContent;
- }
-};
-
-IEditorPanelUtils* CreateEditorPanelUtils()
-{
- return new CEditorPanelUtils_Impl();
-}
-
diff --git a/Code/Editor/EditorPanelUtils.h b/Code/Editor/EditorPanelUtils.h
deleted file mode 100644
index 6ac15ebfc9..0000000000
--- a/Code/Editor/EditorPanelUtils.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-// Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#ifndef CRYINCLUDE_CRYEDITOR_EDITORPANELUTILS_H
-#define CRYINCLUDE_CRYEDITOR_EDITORPANELUTILS_H
-#pragma once
-
-struct IEditorPanelUtils;
-IEditorPanelUtils* CreateEditorPanelUtils();
-
-#endif
diff --git a/Code/Editor/EditorPreferencesDialog.cpp b/Code/Editor/EditorPreferencesDialog.cpp
index a1859b0f14..665daf52a8 100644
--- a/Code/Editor/EditorPreferencesDialog.cpp
+++ b/Code/Editor/EditorPreferencesDialog.cpp
@@ -112,6 +112,31 @@ void EditorPreferencesDialog::showEvent(QShowEvent* event)
QDialog::showEvent(event);
}
+void WidgetHandleKeyPressEvent(QWidget* widget, QKeyEvent* event)
+{
+ // If the enter key is pressed during any text input, the dialog box will close
+ // making it inconvenient to do multiple edits. This routine captures the
+ // Key_Enter or Key_Return and clears the focus to give a visible cue that
+ // editing of that field has finished and then doesn't propogate it.
+ if (event->key() != Qt::Key::Key_Enter && event->key() != Qt::Key::Key_Return)
+ {
+ QApplication::sendEvent(widget, event);
+ }
+ else
+ {
+ if (QWidget* editWidget = QApplication::focusWidget())
+ {
+ editWidget->clearFocus();
+ }
+ }
+}
+
+
+void EditorPreferencesDialog::keyPressEvent(QKeyEvent* event)
+{
+ WidgetHandleKeyPressEvent(this, event);
+}
+
void EditorPreferencesDialog::OnTreeCurrentItemChanged()
{
QTreeWidgetItem* currentItem = ui->pageTree->currentItem();
diff --git a/Code/Editor/EditorPreferencesDialog.h b/Code/Editor/EditorPreferencesDialog.h
index 64f44d7ab5..a3f05ad00d 100644
--- a/Code/Editor/EditorPreferencesDialog.h
+++ b/Code/Editor/EditorPreferencesDialog.h
@@ -19,6 +19,8 @@ namespace Ui
class EditorPreferencesTreeWidgetItem;
+void WidgetHandleKeyPressEvent(QWidget* widget, QKeyEvent* event);
+
class EditorPreferencesDialog
: public QDialog
, public AzToolsFramework::IPropertyEditorNotify
@@ -36,6 +38,7 @@ public:
protected:
void showEvent(QShowEvent* event) override;
+ void keyPressEvent(QKeyEvent* event) override;
private:
void CreateImages();
diff --git a/Code/Editor/EditorPreferencesPageAWS.cpp b/Code/Editor/EditorPreferencesPageAWS.cpp
index 68a9d6889f..9279dce7bc 100644
--- a/Code/Editor/EditorPreferencesPageAWS.cpp
+++ b/Code/Editor/EditorPreferencesPageAWS.cpp
@@ -28,7 +28,7 @@ void CEditorPreferencesPage_AWS::Reflect(AZ::SerializeContext& serialize)
if (editContext)
{
editContext->Class("Options", "")
- ->DataElement(AZ::Edit::UIHandlers::CheckBox, &UsageOptions::m_awsAttributionEnabled, "Allow O3DE to send information about your use of AWS Core Gem to AWS",
+ ->DataElement(AZ::Edit::UIHandlers::CheckBox, &UsageOptions::m_awsAttributionEnabled, "Allow O3DE to send information about your use of AWS Core Gem to AWS",
"");
editContext->Class("AWS Preferences", "AWS Preferences")
diff --git a/Code/Editor/EditorPreferencesPageViewportCamera.cpp b/Code/Editor/EditorPreferencesPageViewportCamera.cpp
index 2f6e6b1b9d..c81eac0414 100644
--- a/Code/Editor/EditorPreferencesPageViewportCamera.cpp
+++ b/Code/Editor/EditorPreferencesPageViewportCamera.cpp
@@ -61,7 +61,7 @@ static AZStd::vector GetEditorInputNames()
void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serialize)
{
serialize.Class()
- ->Version(3)
+ ->Version(4)
->Field("TranslateSpeed", &CameraMovementSettings::m_translateSpeed)
->Field("RotateSpeed", &CameraMovementSettings::m_rotateSpeed)
->Field("BoostMultiplier", &CameraMovementSettings::m_boostMultiplier)
@@ -76,9 +76,8 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
->Field("OrbitYawRotationInverted", &CameraMovementSettings::m_orbitYawRotationInverted)
->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX)
->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY)
- ->Field("DefaultPositionX", &CameraMovementSettings::m_defaultCameraPositionX)
- ->Field("DefaultPositionY", &CameraMovementSettings::m_defaultCameraPositionY)
- ->Field("DefaultPositionZ", &CameraMovementSettings::m_defaultCameraPositionZ);
+ ->Field("DefaultPosition", &CameraMovementSettings::m_defaultPosition)
+ ->Field("DefaultOrbitDistance", &CameraMovementSettings::m_defaultOrbitDistance);
serialize.Class()
->Version(2)
@@ -159,14 +158,12 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_captureCursorLook, "Camera Capture Look Cursor",
"Should the cursor be captured (hidden) while performing free look")
->DataElement(
- AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultCameraPositionX, "Default X Camera Position",
- "Default X Camera Position when a level is opened")
+ AZ::Edit::UIHandlers::Vector3, &CameraMovementSettings::m_defaultPosition, "Default Camera Position",
+ "Default Camera Position when a level is first opened")
->DataElement(
- AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultCameraPositionY, "Default Y Camera Position",
- "Default Y Camera Position when a level is opened")
- ->DataElement(
- AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultCameraPositionZ, "Default Z Camera Position",
- "Default Z Camera Position when a level is opened");
+ AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultOrbitDistance, "Default Orbit Distance",
+ "The default distance to orbit about when there is no entity selected")
+ ->Attribute(AZ::Edit::Attributes::Min, minValue);
editContext->Class("Camera Input Settings", "")
->DataElement(
@@ -283,12 +280,8 @@ void CEditorPreferencesPage_ViewportCamera::OnApply()
SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_orbitYawRotationInverted);
SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_panInvertedX);
SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY);
- SandboxEditor::SetDefaultCameraEditorPosition(
- AZ::Vector3(
- m_cameraMovementSettings.m_defaultCameraPositionX,
- m_cameraMovementSettings.m_defaultCameraPositionY,
- m_cameraMovementSettings.m_defaultCameraPositionZ
- ));
+ SandboxEditor::SetCameraDefaultEditorPosition(m_cameraMovementSettings.m_defaultPosition);
+ SandboxEditor::SetCameraDefaultOrbitDistance(m_cameraMovementSettings.m_defaultOrbitDistance);
SandboxEditor::SetCameraTranslateForwardChannelId(m_cameraInputSettings.m_translateForwardChannelId);
SandboxEditor::SetCameraTranslateBackwardChannelId(m_cameraInputSettings.m_translateBackwardChannelId);
@@ -325,11 +318,8 @@ void CEditorPreferencesPage_ViewportCamera::InitializeSettings()
m_cameraMovementSettings.m_orbitYawRotationInverted = SandboxEditor::CameraOrbitYawRotationInverted();
m_cameraMovementSettings.m_panInvertedX = SandboxEditor::CameraPanInvertedX();
m_cameraMovementSettings.m_panInvertedY = SandboxEditor::CameraPanInvertedY();
-
- AZ::Vector3 defaultCameraPosition = SandboxEditor::DefaultEditorCameraPosition();
- m_cameraMovementSettings.m_defaultCameraPositionX = defaultCameraPosition.GetX();
- m_cameraMovementSettings.m_defaultCameraPositionY = defaultCameraPosition.GetY();
- m_cameraMovementSettings.m_defaultCameraPositionZ = defaultCameraPosition.GetZ();
+ m_cameraMovementSettings.m_defaultPosition = SandboxEditor::CameraDefaultEditorPosition();
+ m_cameraMovementSettings.m_defaultOrbitDistance = SandboxEditor::CameraDefaultOrbitDistance();
m_cameraInputSettings.m_translateForwardChannelId = SandboxEditor::CameraTranslateForwardChannelId().GetName();
m_cameraInputSettings.m_translateBackwardChannelId = SandboxEditor::CameraTranslateBackwardChannelId().GetName();
diff --git a/Code/Editor/EditorPreferencesPageViewportCamera.h b/Code/Editor/EditorPreferencesPageViewportCamera.h
index a2705bfd24..41816de51c 100644
--- a/Code/Editor/EditorPreferencesPageViewportCamera.h
+++ b/Code/Editor/EditorPreferencesPageViewportCamera.h
@@ -9,9 +9,12 @@
#pragma once
#include "Include/IPreferencesPage.h"
+
+#include
#include
#include
#include
+
#include
inline AZ::Crc32 EditorPropertyVisibility(const bool enabled)
@@ -43,6 +46,7 @@ private:
{
AZ_TYPE_INFO(CameraMovementSettings, "{60B8C07E-5F48-4171-A50B-F45558B5CCA1}")
+ AZ::Vector3 m_defaultPosition;
float m_translateSpeed;
float m_rotateSpeed;
float m_scrollSpeed;
@@ -50,16 +54,14 @@ private:
float m_panSpeed;
float m_boostMultiplier;
float m_rotateSmoothness;
- bool m_rotateSmoothing;
float m_translateSmoothness;
- bool m_translateSmoothing;
+ float m_defaultOrbitDistance;
bool m_captureCursorLook;
bool m_orbitYawRotationInverted;
bool m_panInvertedX;
bool m_panInvertedY;
- float m_defaultCameraPositionX;
- float m_defaultCameraPositionY;
- float m_defaultCameraPositionZ;
+ bool m_rotateSmoothing;
+ bool m_translateSmoothing;
AZ::Crc32 RotateSmoothingVisibility() const
{
diff --git a/Code/Editor/EditorPreferencesPageViewportManipulator.cpp b/Code/Editor/EditorPreferencesPageViewportManipulator.cpp
index ea00d6a7f0..32e0e5b573 100644
--- a/Code/Editor/EditorPreferencesPageViewportManipulator.cpp
+++ b/Code/Editor/EditorPreferencesPageViewportManipulator.cpp
@@ -10,6 +10,8 @@
#include "EditorPreferencesPageViewportManipulator.h"
+#include
+
// Editor
#include "EditorViewportSettings.h"
#include "Settings.h"
@@ -19,7 +21,17 @@ void CEditorPreferencesPage_ViewportManipulator::Reflect(AZ::SerializeContext& s
serialize.Class()
->Version(1)
->Field("LineBoundWidth", &Manipulators::m_manipulatorLineBoundWidth)
- ->Field("CircleBoundWidth", &Manipulators::m_manipulatorCircleBoundWidth);
+ ->Field("CircleBoundWidth", &Manipulators::m_manipulatorCircleBoundWidth)
+ ->Field("LinearManipulatorAxisLength", &Manipulators::m_linearManipulatorAxisLength)
+ ->Field("PlanarManipulatorAxisLength", &Manipulators::m_planarManipulatorAxisLength)
+ ->Field("SurfaceManipulatorRadius", &Manipulators::m_surfaceManipulatorRadius)
+ ->Field("SurfaceManipulatorOpacity", &Manipulators::m_surfaceManipulatorOpacity)
+ ->Field("LinearManipulatorConeLength", &Manipulators::m_linearManipulatorConeLength)
+ ->Field("LinearManipulatorConeRadius", &Manipulators::m_linearManipulatorConeRadius)
+ ->Field("ScaleManipulatorBoxHalfExtent", &Manipulators::m_scaleManipulatorBoxHalfExtent)
+ ->Field("RotationManipulatorRadius", &Manipulators::m_rotationManipulatorRadius)
+ ->Field("ManipulatorViewBaseScale", &Manipulators::m_manipulatorViewBaseScale)
+ ->Field("FlipManipulatorAxesTowardsView", &Manipulators::m_flipManipulatorAxesTowardsView);
serialize.Class()->Version(2)->Field(
"Manipulators", &CEditorPreferencesPage_ViewportManipulator::m_manipulators);
@@ -36,7 +48,55 @@ void CEditorPreferencesPage_ViewportManipulator::Reflect(AZ::SerializeContext& s
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_manipulatorCircleBoundWidth, "Circle Bound Width",
"Manipulator Circle Bound Width")
->Attribute(AZ::Edit::Attributes::Min, 0.001f)
- ->Attribute(AZ::Edit::Attributes::Max, 2.0f);
+ ->Attribute(AZ::Edit::Attributes::Max, 2.0f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_linearManipulatorAxisLength, "Linear Manipulator Axis Length",
+ "Length of default Linear Manipulator (for Translation and Scale Manipulators)")
+ ->Attribute(AZ::Edit::Attributes::Min, 0.1f)
+ ->Attribute(AZ::Edit::Attributes::Max, 5.0f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_planarManipulatorAxisLength, "Planar Manipulator Axis Length",
+ "Length of default Planar Manipulator (for Translation Manipulators)")
+ ->Attribute(AZ::Edit::Attributes::Min, 0.1f)
+ ->Attribute(AZ::Edit::Attributes::Max, 5.0f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_surfaceManipulatorRadius, "Surface Manipulator Radius",
+ "Radius of default Surface Manipulator (for Translation Manipulators)")
+ ->Attribute(AZ::Edit::Attributes::Min, 0.05f)
+ ->Attribute(AZ::Edit::Attributes::Max, 1.0f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_surfaceManipulatorOpacity, "Surface Manipulator Opacity",
+ "Opacity of default Surface Manipulator (for Translation Manipulators)")
+ ->Attribute(AZ::Edit::Attributes::Min, 0.01f)
+ ->Attribute(AZ::Edit::Attributes::Max, 1.0f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_linearManipulatorConeLength, "Linear Manipulator Cone Length",
+ "Length of cone for default Linear Manipulator (for Translation Manipulators)")
+ ->Attribute(AZ::Edit::Attributes::Min, 0.05f)
+ ->Attribute(AZ::Edit::Attributes::Max, 1.0f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_linearManipulatorConeRadius, "Linear Manipulator Cone Radius",
+ "Radius of cone for default Linear Manipulator (for Translation Manipulators)")
+ ->Attribute(AZ::Edit::Attributes::Min, 0.05f)
+ ->Attribute(AZ::Edit::Attributes::Max, 0.5f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_scaleManipulatorBoxHalfExtent, "Scale Manipulator Box Half Extent",
+ "Half extent of box for default Scale Manipulator")
+ ->Attribute(AZ::Edit::Attributes::Min, 0.05f)
+ ->Attribute(AZ::Edit::Attributes::Max, 1.0f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_rotationManipulatorRadius, "Rotation Manipulator Radius",
+ "Radius of default Angular Manipulators (for Rotation Manipulators)")
+ ->Attribute(AZ::Edit::Attributes::Min, 0.5f)
+ ->Attribute(AZ::Edit::Attributes::Max, 5.0f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_manipulatorViewBaseScale, "Manipulator View Base Scale",
+ "The base scale to apply to all Manipulator Views (default is 1.0)")
+ ->Attribute(AZ::Edit::Attributes::Min, 0.5f)
+ ->Attribute(AZ::Edit::Attributes::Max, 2.0f)
+ ->DataElement(
+ AZ::Edit::UIHandlers::CheckBox, &Manipulators::m_flipManipulatorAxesTowardsView, "Flip Manipulator Axes Towards View",
+ "Determines whether Planar and Linear Manipulators should switch to face the view (camera) in the Editor");
editContext
->Class("Manipulator Viewport Preferences", "Manipulator Viewport Preferences")
@@ -82,10 +142,32 @@ void CEditorPreferencesPage_ViewportManipulator::OnApply()
{
SandboxEditor::SetManipulatorLineBoundWidth(m_manipulators.m_manipulatorLineBoundWidth);
SandboxEditor::SetManipulatorCircleBoundWidth(m_manipulators.m_manipulatorCircleBoundWidth);
+
+ AzToolsFramework::SetLinearManipulatorAxisLength(m_manipulators.m_linearManipulatorAxisLength);
+ AzToolsFramework::SetPlanarManipulatorAxisLength(m_manipulators.m_planarManipulatorAxisLength);
+ AzToolsFramework::SetSurfaceManipulatorRadius(m_manipulators.m_surfaceManipulatorRadius);
+ AzToolsFramework::SetSurfaceManipulatorOpacity(m_manipulators.m_surfaceManipulatorOpacity);
+ AzToolsFramework::SetLinearManipulatorConeLength(m_manipulators.m_linearManipulatorConeLength);
+ AzToolsFramework::SetLinearManipulatorConeRadius(m_manipulators.m_linearManipulatorConeRadius);
+ AzToolsFramework::SetScaleManipulatorBoxHalfExtent(m_manipulators.m_scaleManipulatorBoxHalfExtent);
+ AzToolsFramework::SetRotationManipulatorRadius(m_manipulators.m_rotationManipulatorRadius);
+ AzToolsFramework::SetFlipManipulatorAxesTowardsView(m_manipulators.m_flipManipulatorAxesTowardsView);
+ AzToolsFramework::SetManipulatorViewBaseScale(m_manipulators.m_manipulatorViewBaseScale);
}
void CEditorPreferencesPage_ViewportManipulator::InitializeSettings()
{
m_manipulators.m_manipulatorLineBoundWidth = SandboxEditor::ManipulatorLineBoundWidth();
m_manipulators.m_manipulatorCircleBoundWidth = SandboxEditor::ManipulatorCircleBoundWidth();
+
+ m_manipulators.m_linearManipulatorAxisLength = AzToolsFramework::LinearManipulatorAxisLength();
+ m_manipulators.m_planarManipulatorAxisLength = AzToolsFramework::PlanarManipulatorAxisLength();
+ m_manipulators.m_surfaceManipulatorRadius = AzToolsFramework::SurfaceManipulatorRadius();
+ m_manipulators.m_surfaceManipulatorOpacity = AzToolsFramework::SurfaceManipulatorOpacity();
+ m_manipulators.m_linearManipulatorConeLength = AzToolsFramework::LinearManipulatorConeLength();
+ m_manipulators.m_linearManipulatorConeRadius = AzToolsFramework::LinearManipulatorConeRadius();
+ m_manipulators.m_scaleManipulatorBoxHalfExtent = AzToolsFramework::ScaleManipulatorBoxHalfExtent();
+ m_manipulators.m_rotationManipulatorRadius = AzToolsFramework::RotationManipulatorRadius();
+ m_manipulators.m_flipManipulatorAxesTowardsView = AzToolsFramework::FlipManipulatorAxesTowardsView();
+ m_manipulators.m_manipulatorViewBaseScale = AzToolsFramework::ManipulatorViewBaseScale();
}
diff --git a/Code/Editor/EditorPreferencesPageViewportManipulator.h b/Code/Editor/EditorPreferencesPageViewportManipulator.h
index 93db6a7035..eb76cec2c5 100644
--- a/Code/Editor/EditorPreferencesPageViewportManipulator.h
+++ b/Code/Editor/EditorPreferencesPageViewportManipulator.h
@@ -41,6 +41,16 @@ private:
float m_manipulatorLineBoundWidth = 0.0f;
float m_manipulatorCircleBoundWidth = 0.0f;
+ float m_linearManipulatorAxisLength = 0.0f;
+ float m_planarManipulatorAxisLength = 0.0f;
+ float m_surfaceManipulatorRadius = 0.0f;
+ float m_surfaceManipulatorOpacity = 0.0f;
+ float m_linearManipulatorConeLength = 0.0f;
+ float m_linearManipulatorConeRadius = 0.0f;
+ float m_scaleManipulatorBoxHalfExtent = 0.0f;
+ float m_rotationManipulatorRadius = 0.0f;
+ float m_manipulatorViewBaseScale = 0.0f;
+ bool m_flipManipulatorAxesTowardsView = false;
};
Manipulators m_manipulators;
diff --git a/Code/Editor/EditorViewportSettings.cpp b/Code/Editor/EditorViewportSettings.cpp
index 8f2be1de6c..e06b9696e1 100644
--- a/Code/Editor/EditorViewportSettings.cpp
+++ b/Code/Editor/EditorViewportSettings.cpp
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
namespace SandboxEditor
{
@@ -38,6 +39,7 @@ namespace SandboxEditor
constexpr AZStd::string_view CameraTranslateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothing";
constexpr AZStd::string_view CameraRotateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothing";
constexpr AZStd::string_view CameraCaptureCursorLookSetting = "/Amazon/Preferences/Editor/Camera/CaptureCursorLook";
+ constexpr AZStd::string_view CameraDefaultOrbitDistanceSetting = "/Amazon/Preferences/Editor/Camera/DefaultOrbitDistance";
constexpr AZStd::string_view CameraTranslateForwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateForwardId";
constexpr AZStd::string_view CameraTranslateBackwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateBackwardId";
constexpr AZStd::string_view CameraTranslateLeftIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateLeftId";
@@ -56,31 +58,6 @@ namespace SandboxEditor
constexpr AZStd::string_view CameraDefaultStartingPositionY = "/Amazon/Preferences/Editor/Camera/DefaultStartingPosition/y";
constexpr AZStd::string_view CameraDefaultStartingPositionZ = "/Amazon/Preferences/Editor/Camera/DefaultStartingPosition/z";
- template