- 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 d5f2305dfb..1c4e22b99e 100644
--- a/Code/Editor/CryEdit.cpp
+++ b/Code/Editor/CryEdit.cpp
@@ -380,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
@@ -445,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)
@@ -1353,8 +1352,27 @@ void CCryEditApp::CompileCriticalAssets() const
}
}
assetsInQueueNotifcation.BusDisconnect();
- CCryEditApp::OutputStartupMessage(QString("Asset Processor is now ready."));
+ // 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."));
}
bool CCryEditApp::ConnectToAssetProcessor() const
@@ -1670,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"({})");
}
@@ -2617,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()
{
@@ -2636,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;
@@ -2766,6 +2779,7 @@ void CCryEditApp::OnFileResaveSlices()
}
}
+#endif
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnFileEditEditorini()
@@ -2810,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)
{
diff --git a/Code/Editor/CryEdit.h b/Code/Editor/CryEdit.h
index 8c514170ae..97fcde8f34 100644
--- a/Code/Editor/CryEdit.h
+++ b/Code/Editor/CryEdit.h
@@ -237,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/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/EditorModularViewportCameraComposer.cpp b/Code/Editor/EditorModularViewportCameraComposer.cpp
index f145adf72f..3f66468584 100644
--- a/Code/Editor/EditorModularViewportCameraComposer.cpp
+++ b/Code/Editor/EditorModularViewportCameraComposer.cpp
@@ -356,7 +356,8 @@ namespace SandboxEditor
AZ::TransformBus::EventResult(worldFromLocal, viewEntityId, &AZ::TransformBus::Events::GetWorldTM);
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
- m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::StartTrackingTransform, worldFromLocal);
+ m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::StartTrackingTransform,
+ worldFromLocal);
}
else
{
@@ -367,8 +368,10 @@ namespace SandboxEditor
void EditorModularViewportCameraComposer::OnTick(const float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
{
- const float delta = [duration = &ed_cameraDefaultOrbitFadeDuration, deltaTime] {
- if (*duration == 0.0f) {
+ const float delta = [duration = &ed_cameraDefaultOrbitFadeDuration, deltaTime]
+ {
+ if (*duration == 0.0f)
+ {
return 1.0f;
}
return deltaTime / *duration;
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/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 ae188c7d98..e06b9696e1 100644
--- a/Code/Editor/EditorViewportSettings.cpp
+++ b/Code/Editor/EditorViewportSettings.cpp
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
namespace SandboxEditor
{
@@ -57,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
- void SetRegistry(const AZStd::string_view setting, T&& value)
- {
- if (auto* registry = AZ::SettingsRegistry::Get())
- {
- registry->Set(setting, AZStd::forward(value));
- }
- }
-
- template
- AZStd::remove_cvref_t GetRegistry(const AZStd::string_view setting, T&& defaultValue)
- {
- AZStd::remove_cvref_t value = AZStd::forward(defaultValue);
- if (const auto* registry = AZ::SettingsRegistry::Get())
- {
- T potentialValue;
- if (registry->Get(potentialValue, setting))
- {
- value = AZStd::move(potentialValue);
- }
- }
-
- return value;
- }
-
struct EditorViewportSettingsCallbacksImpl : public EditorViewportSettingsCallbacks
{
EditorViewportSettingsCallbacksImpl()
@@ -118,399 +94,409 @@ namespace SandboxEditor
AZ::Vector3 CameraDefaultEditorPosition()
{
return AZ::Vector3(
- aznumeric_cast(GetRegistry(CameraDefaultStartingPositionX, 0.0)),
- aznumeric_cast(GetRegistry(CameraDefaultStartingPositionY, -10.0)),
- aznumeric_cast(GetRegistry(CameraDefaultStartingPositionZ, 4.0)));
+ aznumeric_cast(AzToolsFramework::GetRegistry(CameraDefaultStartingPositionX, 0.0)),
+ aznumeric_cast(AzToolsFramework::GetRegistry(CameraDefaultStartingPositionY, -10.0)),
+ aznumeric_cast(AzToolsFramework::GetRegistry(CameraDefaultStartingPositionZ, 4.0)));
}
void SetCameraDefaultEditorPosition(const AZ::Vector3& defaultCameraPosition)
{
- SetRegistry(CameraDefaultStartingPositionX, defaultCameraPosition.GetX());
- SetRegistry(CameraDefaultStartingPositionY, defaultCameraPosition.GetY());
- SetRegistry(CameraDefaultStartingPositionZ, defaultCameraPosition.GetZ());
+ AzToolsFramework::SetRegistry(CameraDefaultStartingPositionX, defaultCameraPosition.GetX());
+ AzToolsFramework::SetRegistry(CameraDefaultStartingPositionY, defaultCameraPosition.GetY());
+ AzToolsFramework::SetRegistry(CameraDefaultStartingPositionZ, defaultCameraPosition.GetZ());
}
AZ::u64 MaxItemsShownInAssetBrowserSearch()
{
- return GetRegistry(AssetBrowserMaxItemsShownInSearchSetting, aznumeric_cast(50));
+ return AzToolsFramework::GetRegistry(AssetBrowserMaxItemsShownInSearchSetting, aznumeric_cast(50));
}
void SetMaxItemsShownInAssetBrowserSearch(const AZ::u64 numberOfItemsShown)
{
- SetRegistry(AssetBrowserMaxItemsShownInSearchSetting, numberOfItemsShown);
+ AzToolsFramework::SetRegistry(AssetBrowserMaxItemsShownInSearchSetting, numberOfItemsShown);
}
bool GridSnappingEnabled()
{
- return GetRegistry(GridSnappingSetting, false);
+ return AzToolsFramework::GetRegistry(GridSnappingSetting, false);
}
void SetGridSnapping(const bool enabled)
{
- SetRegistry(GridSnappingSetting, enabled);
+ AzToolsFramework::SetRegistry(GridSnappingSetting, enabled);
}
float GridSnappingSize()
{
- return aznumeric_cast(GetRegistry(GridSizeSetting, 0.1));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(GridSizeSetting, 0.1));
}
void SetGridSnappingSize(const float size)
{
- SetRegistry(GridSizeSetting, size);
+ AzToolsFramework::SetRegistry(GridSizeSetting, size);
}
bool AngleSnappingEnabled()
{
- return GetRegistry(AngleSnappingSetting, false);
+ return AzToolsFramework::GetRegistry(AngleSnappingSetting, false);
}
void SetAngleSnapping(const bool enabled)
{
- SetRegistry(AngleSnappingSetting, enabled);
+ AzToolsFramework::SetRegistry(AngleSnappingSetting, enabled);
}
float AngleSnappingSize()
{
- return aznumeric_cast(GetRegistry(AngleSizeSetting, 5.0));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(AngleSizeSetting, 5.0));
}
void SetAngleSnappingSize(const float size)
{
- SetRegistry(AngleSizeSetting, size);
+ AzToolsFramework::SetRegistry(AngleSizeSetting, size);
}
bool ShowingGrid()
{
- return GetRegistry(ShowGridSetting, false);
+ return AzToolsFramework::GetRegistry(ShowGridSetting, false);
}
void SetShowingGrid(const bool showing)
{
- SetRegistry(ShowGridSetting, showing);
+ AzToolsFramework::SetRegistry(ShowGridSetting, showing);
}
bool StickySelectEnabled()
{
- return GetRegistry(StickySelectSetting, false);
+ return AzToolsFramework::GetRegistry(StickySelectSetting, false);
}
void SetStickySelectEnabled(const bool enabled)
{
- SetRegistry(StickySelectSetting, enabled);
+ AzToolsFramework::SetRegistry(StickySelectSetting, enabled);
}
float ManipulatorLineBoundWidth()
{
- return aznumeric_cast(GetRegistry(ManipulatorLineBoundWidthSetting, 0.1));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(ManipulatorLineBoundWidthSetting, 0.1));
}
void SetManipulatorLineBoundWidth(const float lineBoundWidth)
{
- SetRegistry(ManipulatorLineBoundWidthSetting, lineBoundWidth);
+ AzToolsFramework::SetRegistry(ManipulatorLineBoundWidthSetting, lineBoundWidth);
}
float ManipulatorCircleBoundWidth()
{
- return aznumeric_cast(GetRegistry(ManipulatorCircleBoundWidthSetting, 0.1));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(ManipulatorCircleBoundWidthSetting, 0.1));
}
void SetManipulatorCircleBoundWidth(const float circleBoundWidth)
{
- SetRegistry(ManipulatorCircleBoundWidthSetting, circleBoundWidth);
+ AzToolsFramework::SetRegistry(ManipulatorCircleBoundWidthSetting, circleBoundWidth);
}
float CameraTranslateSpeed()
{
- return aznumeric_cast(GetRegistry(CameraTranslateSpeedSetting, 10.0));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(CameraTranslateSpeedSetting, 10.0));
}
void SetCameraTranslateSpeed(const float speed)
{
- SetRegistry(CameraTranslateSpeedSetting, speed);
+ AzToolsFramework::SetRegistry(CameraTranslateSpeedSetting, speed);
}
float CameraBoostMultiplier()
{
- return aznumeric_cast(GetRegistry(CameraBoostMultiplierSetting, 3.0));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(CameraBoostMultiplierSetting, 3.0));
}
void SetCameraBoostMultiplier(const float multiplier)
{
- SetRegistry(CameraBoostMultiplierSetting, multiplier);
+ AzToolsFramework::SetRegistry(CameraBoostMultiplierSetting, multiplier);
}
float CameraRotateSpeed()
{
- return aznumeric_cast(GetRegistry(CameraRotateSpeedSetting, 0.005));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(CameraRotateSpeedSetting, 0.005));
}
void SetCameraRotateSpeed(const float speed)
{
- SetRegistry(CameraRotateSpeedSetting, speed);
+ AzToolsFramework::SetRegistry(CameraRotateSpeedSetting, speed);
}
float CameraScrollSpeed()
{
- return aznumeric_cast(GetRegistry(CameraScrollSpeedSetting, 0.02));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(CameraScrollSpeedSetting, 0.02));
}
void SetCameraScrollSpeed(const float speed)
{
- SetRegistry(CameraScrollSpeedSetting, speed);
+ AzToolsFramework::SetRegistry(CameraScrollSpeedSetting, speed);
}
float CameraDollyMotionSpeed()
{
- return aznumeric_cast(GetRegistry(CameraDollyMotionSpeedSetting, 0.01));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(CameraDollyMotionSpeedSetting, 0.01));
}
void SetCameraDollyMotionSpeed(const float speed)
{
- SetRegistry(CameraDollyMotionSpeedSetting, speed);
+ AzToolsFramework::SetRegistry(CameraDollyMotionSpeedSetting, speed);
}
bool CameraOrbitYawRotationInverted()
{
- return GetRegistry(CameraOrbitYawRotationInvertedSetting, false);
+ return AzToolsFramework::GetRegistry(CameraOrbitYawRotationInvertedSetting, false);
}
void SetCameraOrbitYawRotationInverted(const bool inverted)
{
- SetRegistry(CameraOrbitYawRotationInvertedSetting, inverted);
+ AzToolsFramework::SetRegistry(CameraOrbitYawRotationInvertedSetting, inverted);
}
bool CameraPanInvertedX()
{
- return GetRegistry(CameraPanInvertedXSetting, true);
+ return AzToolsFramework::GetRegistry(CameraPanInvertedXSetting, true);
}
void SetCameraPanInvertedX(const bool inverted)
{
- SetRegistry(CameraPanInvertedXSetting, inverted);
+ AzToolsFramework::SetRegistry(CameraPanInvertedXSetting, inverted);
}
bool CameraPanInvertedY()
{
- return GetRegistry(CameraPanInvertedYSetting, true);
+ return AzToolsFramework::GetRegistry(CameraPanInvertedYSetting, true);
}
void SetCameraPanInvertedY(const bool inverted)
{
- SetRegistry(CameraPanInvertedYSetting, inverted);
+ AzToolsFramework::SetRegistry(CameraPanInvertedYSetting, inverted);
}
float CameraPanSpeed()
{
- return aznumeric_cast(GetRegistry(CameraPanSpeedSetting, 0.01));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(CameraPanSpeedSetting, 0.01));
}
void SetCameraPanSpeed(float speed)
{
- SetRegistry(CameraPanSpeedSetting, speed);
+ AzToolsFramework::SetRegistry(CameraPanSpeedSetting, speed);
}
float CameraRotateSmoothness()
{
- return aznumeric_cast(GetRegistry(CameraRotateSmoothnessSetting, 5.0));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(CameraRotateSmoothnessSetting, 5.0));
}
void SetCameraRotateSmoothness(const float smoothness)
{
- SetRegistry(CameraRotateSmoothnessSetting, smoothness);
+ AzToolsFramework::SetRegistry(CameraRotateSmoothnessSetting, smoothness);
}
float CameraTranslateSmoothness()
{
- return aznumeric_cast(GetRegistry(CameraTranslateSmoothnessSetting, 5.0));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(CameraTranslateSmoothnessSetting, 5.0));
}
void SetCameraTranslateSmoothness(const float smoothness)
{
- SetRegistry(CameraTranslateSmoothnessSetting, smoothness);
+ AzToolsFramework::SetRegistry(CameraTranslateSmoothnessSetting, smoothness);
}
bool CameraRotateSmoothingEnabled()
{
- return GetRegistry(CameraRotateSmoothingSetting, true);
+ return AzToolsFramework::GetRegistry(CameraRotateSmoothingSetting, true);
}
void SetCameraRotateSmoothingEnabled(const bool enabled)
{
- SetRegistry(CameraRotateSmoothingSetting, enabled);
+ AzToolsFramework::SetRegistry(CameraRotateSmoothingSetting, enabled);
}
bool CameraTranslateSmoothingEnabled()
{
- return GetRegistry(CameraTranslateSmoothingSetting, true);
+ return AzToolsFramework::GetRegistry(CameraTranslateSmoothingSetting, true);
}
void SetCameraTranslateSmoothingEnabled(const bool enabled)
{
- SetRegistry(CameraTranslateSmoothingSetting, enabled);
+ AzToolsFramework::SetRegistry(CameraTranslateSmoothingSetting, enabled);
}
bool CameraCaptureCursorForLook()
{
- return GetRegistry(CameraCaptureCursorLookSetting, true);
+ return AzToolsFramework::GetRegistry(CameraCaptureCursorLookSetting, true);
}
void SetCameraCaptureCursorForLook(const bool capture)
{
- SetRegistry(CameraCaptureCursorLookSetting, capture);
+ AzToolsFramework::SetRegistry(CameraCaptureCursorLookSetting, capture);
}
float CameraDefaultOrbitDistance()
{
- return aznumeric_cast(GetRegistry(CameraDefaultOrbitDistanceSetting, 20.0));
+ return aznumeric_cast(AzToolsFramework::GetRegistry(CameraDefaultOrbitDistanceSetting, 20.0));
}
void SetCameraDefaultOrbitDistance(const float distance)
{
- SetRegistry(CameraDefaultOrbitDistanceSetting, distance);
+ AzToolsFramework::SetRegistry(CameraDefaultOrbitDistanceSetting, distance);
}
AzFramework::InputChannelId CameraTranslateForwardChannelId()
{
return AzFramework::InputChannelId(
- GetRegistry(CameraTranslateForwardIdSetting, AZStd::string("keyboard_key_alphanumeric_W")).c_str());
+ AzToolsFramework::GetRegistry(CameraTranslateForwardIdSetting, AZStd::string("keyboard_key_alphanumeric_W")).c_str());
}
void SetCameraTranslateForwardChannelId(AZStd::string_view cameraTranslateForwardId)
{
- SetRegistry(CameraTranslateForwardIdSetting, cameraTranslateForwardId);
+ AzToolsFramework::SetRegistry(CameraTranslateForwardIdSetting, cameraTranslateForwardId);
}
AzFramework::InputChannelId CameraTranslateBackwardChannelId()
{
return AzFramework::InputChannelId(
- GetRegistry(CameraTranslateBackwardIdSetting, AZStd::string("keyboard_key_alphanumeric_S")).c_str());
+ AzToolsFramework::GetRegistry(CameraTranslateBackwardIdSetting, AZStd::string("keyboard_key_alphanumeric_S")).c_str());
}
void SetCameraTranslateBackwardChannelId(AZStd::string_view cameraTranslateBackwardId)
{
- SetRegistry(CameraTranslateBackwardIdSetting, cameraTranslateBackwardId);
+ AzToolsFramework::SetRegistry(CameraTranslateBackwardIdSetting, cameraTranslateBackwardId);
}
AzFramework::InputChannelId CameraTranslateLeftChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraTranslateLeftIdSetting, AZStd::string("keyboard_key_alphanumeric_A")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraTranslateLeftIdSetting, AZStd::string("keyboard_key_alphanumeric_A")).c_str());
}
void SetCameraTranslateLeftChannelId(AZStd::string_view cameraTranslateLeftId)
{
- SetRegistry(CameraTranslateLeftIdSetting, cameraTranslateLeftId);
+ AzToolsFramework::SetRegistry(CameraTranslateLeftIdSetting, cameraTranslateLeftId);
}
AzFramework::InputChannelId CameraTranslateRightChannelId()
{
return AzFramework::InputChannelId(
- GetRegistry(CameraTranslateRightIdSetting, AZStd::string("keyboard_key_alphanumeric_D")).c_str());
+ AzToolsFramework::GetRegistry(CameraTranslateRightIdSetting, AZStd::string("keyboard_key_alphanumeric_D")).c_str());
}
void SetCameraTranslateRightChannelId(AZStd::string_view cameraTranslateRightId)
{
- SetRegistry(CameraTranslateRightIdSetting, cameraTranslateRightId);
+ AzToolsFramework::SetRegistry(CameraTranslateRightIdSetting, cameraTranslateRightId);
}
AzFramework::InputChannelId CameraTranslateUpChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraTranslateUpIdSetting, AZStd::string("keyboard_key_alphanumeric_E")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraTranslateUpIdSetting, AZStd::string("keyboard_key_alphanumeric_E")).c_str());
}
void SetCameraTranslateUpChannelId(AZStd::string_view cameraTranslateUpId)
{
- SetRegistry(CameraTranslateUpIdSetting, cameraTranslateUpId);
+ AzToolsFramework::SetRegistry(CameraTranslateUpIdSetting, cameraTranslateUpId);
}
AzFramework::InputChannelId CameraTranslateDownChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraTranslateDownIdSetting, AZStd::string("keyboard_key_alphanumeric_Q")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraTranslateDownIdSetting, AZStd::string("keyboard_key_alphanumeric_Q")).c_str());
}
void SetCameraTranslateDownChannelId(AZStd::string_view cameraTranslateDownId)
{
- SetRegistry(CameraTranslateDownIdSetting, cameraTranslateDownId);
+ AzToolsFramework::SetRegistry(CameraTranslateDownIdSetting, cameraTranslateDownId);
}
AzFramework::InputChannelId CameraTranslateBoostChannelId()
{
return AzFramework::InputChannelId(
- GetRegistry(CameraTranslateBoostIdSetting, AZStd::string("keyboard_key_modifier_shift_l")).c_str());
+ AzToolsFramework::GetRegistry(CameraTranslateBoostIdSetting, AZStd::string("keyboard_key_modifier_shift_l")).c_str());
}
void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId)
{
- SetRegistry(CameraTranslateBoostIdSetting, cameraTranslateBoostId);
+ AzToolsFramework::SetRegistry(CameraTranslateBoostIdSetting, cameraTranslateBoostId);
}
AzFramework::InputChannelId CameraOrbitChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraOrbitIdSetting, AZStd::string("keyboard_key_modifier_alt_l")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraOrbitIdSetting, AZStd::string("keyboard_key_modifier_alt_l")).c_str());
}
void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId)
{
- SetRegistry(CameraOrbitIdSetting, cameraOrbitId);
+ AzToolsFramework::SetRegistry(CameraOrbitIdSetting, cameraOrbitId);
}
AzFramework::InputChannelId CameraFreeLookChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraFreeLookIdSetting, AZStd::string("mouse_button_right")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraFreeLookIdSetting, AZStd::string("mouse_button_right")).c_str());
}
void SetCameraFreeLookChannelId(AZStd::string_view cameraFreeLookId)
{
- SetRegistry(CameraFreeLookIdSetting, cameraFreeLookId);
+ AzToolsFramework::SetRegistry(CameraFreeLookIdSetting, cameraFreeLookId);
}
AzFramework::InputChannelId CameraFreePanChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraFreePanIdSetting, AZStd::string("mouse_button_middle")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraFreePanIdSetting, AZStd::string("mouse_button_middle")).c_str());
}
void SetCameraFreePanChannelId(AZStd::string_view cameraFreePanId)
{
- SetRegistry(CameraFreePanIdSetting, cameraFreePanId);
+ AzToolsFramework::SetRegistry(CameraFreePanIdSetting, cameraFreePanId);
}
AzFramework::InputChannelId CameraOrbitLookChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraOrbitLookIdSetting, AZStd::string("mouse_button_left")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraOrbitLookIdSetting, AZStd::string("mouse_button_left")).c_str());
}
void SetCameraOrbitLookChannelId(AZStd::string_view cameraOrbitLookId)
{
- SetRegistry(CameraOrbitLookIdSetting, cameraOrbitLookId);
+ AzToolsFramework::SetRegistry(CameraOrbitLookIdSetting, cameraOrbitLookId);
}
AzFramework::InputChannelId CameraOrbitDollyChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraOrbitDollyIdSetting, AZStd::string("mouse_button_right")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraOrbitDollyIdSetting, AZStd::string("mouse_button_right")).c_str());
}
void SetCameraOrbitDollyChannelId(AZStd::string_view cameraOrbitDollyId)
{
- SetRegistry(CameraOrbitDollyIdSetting, cameraOrbitDollyId);
+ AzToolsFramework::SetRegistry(CameraOrbitDollyIdSetting, cameraOrbitDollyId);
}
AzFramework::InputChannelId CameraOrbitPanChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraOrbitPanIdSetting, AZStd::string("mouse_button_middle")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraOrbitPanIdSetting, AZStd::string("mouse_button_middle")).c_str());
}
void SetCameraOrbitPanChannelId(AZStd::string_view cameraOrbitPanId)
{
- SetRegistry(CameraOrbitPanIdSetting, cameraOrbitPanId);
+ AzToolsFramework::SetRegistry(CameraOrbitPanIdSetting, cameraOrbitPanId);
}
AzFramework::InputChannelId CameraFocusChannelId()
{
- return AzFramework::InputChannelId(GetRegistry(CameraFocusIdSetting, AZStd::string("keyboard_key_alphanumeric_X")).c_str());
+ return AzFramework::InputChannelId(
+ AzToolsFramework::GetRegistry(CameraFocusIdSetting, AZStd::string("keyboard_key_alphanumeric_X")).c_str());
}
void SetCameraFocusChannelId(AZStd::string_view cameraFocusId)
{
- SetRegistry(CameraFocusIdSetting, cameraFocusId);
+ AzToolsFramework::SetRegistry(CameraFocusIdSetting, cameraFocusId);
}
} // namespace SandboxEditor
diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp
index 7323da9e95..828812fb7e 100644
--- a/Code/Editor/EditorViewportWidget.cpp
+++ b/Code/Editor/EditorViewportWidget.cpp
@@ -46,6 +46,7 @@
#include
#include
#include
+#include
#include
#include
@@ -453,9 +454,6 @@ void EditorViewportWidget::Update()
// Render
{
- // TODO: Move out this logic to a controller and refactor to work with Atom
- ProcessRenderLisneters(m_displayContext);
-
m_displayContext.Flush2D();
// Post Render Callback
@@ -665,13 +663,7 @@ void EditorViewportWidget::OnBeginPrepareRender()
RenderAll();
// Draw 2D helpers.
-#ifdef LYSHINE_ATOM_TODO
- TransformationMatrices backupSceneMatrices;
-#endif
m_debugDisplay->DepthTestOff();
-#ifdef LYSHINE_ATOM_TODO
- m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
-#endif
auto prevState = m_debugDisplay->GetState();
m_debugDisplay->SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
@@ -1627,14 +1619,14 @@ Vec3 EditorViewportWidget::ViewToWorld(
auto ray = m_renderViewport->ViewportScreenToWorldRay(AzToolsFramework::ViewportInteraction::ScreenPointFromQPoint(vp));
const float maxDistance = 10000.f;
- Vec3 v = AZVec3ToLYVec3(ray.direction) * maxDistance;
+ Vec3 v = AZVec3ToLYVec3(ray.m_direction) * maxDistance;
if (!_finite(v.x) || !_finite(v.y) || !_finite(v.z))
{
return Vec3(0, 0, 0);
}
- Vec3 colp = AZVec3ToLYVec3(ray.origin) + 0.002f * v;
+ Vec3 colp = AZVec3ToLYVec3(ray.m_origin) + 0.002f * v;
return colp;
}
@@ -2426,6 +2418,16 @@ AZ::Vector3 EditorViewportSettings::DefaultEditorCameraPosition() const
return SandboxEditor::CameraDefaultEditorPosition();
}
+bool EditorViewportSettings::IconsVisible() const
+{
+ return AzToolsFramework::IconsVisible();
+}
+
+bool EditorViewportSettings::HelpersVisible() const
+{
+ return AzToolsFramework::HelpersVisible();
+}
+
AZ_CVAR_EXTERNED(bool, ed_previewGameInFullscreen_once);
bool EditorViewportWidget::ShouldPreviewFullscreen() const
diff --git a/Code/Editor/EditorViewportWidget.h b/Code/Editor/EditorViewportWidget.h
index 3d52b2416d..83ca655326 100644
--- a/Code/Editor/EditorViewportWidget.h
+++ b/Code/Editor/EditorViewportWidget.h
@@ -79,6 +79,8 @@ struct EditorViewportSettings : public AzToolsFramework::ViewportInteraction::Vi
float ManipulatorCircleBoundWidth() const override;
bool StickySelectEnabled() const override;
AZ::Vector3 DefaultEditorCameraPosition() const override;
+ bool IconsVisible() const override;
+ bool HelpersVisible() const override;
};
// EditorViewportWidget window
diff --git a/Code/Editor/ErrorRecorder.cpp b/Code/Editor/ErrorRecorder.cpp
index 999dab323c..253e103527 100644
--- a/Code/Editor/ErrorRecorder.cpp
+++ b/Code/Editor/ErrorRecorder.cpp
@@ -7,7 +7,6 @@
*/
#include "EditorDefs.h"
#include "ErrorRecorder.h"
-#include "BaseLibraryItem.h"
#include "Include/IErrorReport.h"
diff --git a/Code/Editor/ErrorRecorder.h b/Code/Editor/ErrorRecorder.h
index e4b3706a16..beacc3f0e5 100644
--- a/Code/Editor/ErrorRecorder.h
+++ b/Code/Editor/ErrorRecorder.h
@@ -14,6 +14,8 @@
#define CRYINCLUDE_EDITOR_CORE_ERRORRECORDER_H
#pragma once
+#include "Include/EditorCoreAPI.h"
+
//////////////////////////////////////////////////////////////////////////
//! Automatic class to record and display error.
class EDITOR_CORE_API CErrorsRecorder
diff --git a/Code/Editor/ErrorReport.cpp b/Code/Editor/ErrorReport.cpp
index 4fd7d41a96..f93ea7606d 100644
--- a/Code/Editor/ErrorReport.cpp
+++ b/Code/Editor/ErrorReport.cpp
@@ -67,24 +67,6 @@ QString CErrorRecord::GetErrorText() const
{
str += QString("\t ");
}
- if (pItem)
- {
- switch (pItem->GetType())
- {
- case EDB_TYPE_MATERIAL:
- str += QString("\t Material=\"");
- break;
- case EDB_TYPE_PARTICLE:
- str += QString("\t Particle=\"");
- break;
- case EDB_TYPE_MUSIC:
- str += QString("\t Music=\"");
- break;
- default:
- str += QString("\t Item=\"");
- }
- str += pItem->GetFullName() + "\"";
- }
if (pObject)
{
str += QString("\t Object=\"") + pObject->GetName() + "\"";
@@ -101,7 +83,6 @@ CErrorReport::CErrorReport()
m_bImmediateMode = true;
m_bShowErrors = true;
m_pObject = nullptr;
- m_pItem = nullptr;
m_pParticle = nullptr;
}
@@ -140,10 +121,6 @@ void CErrorReport::ReportError(CErrorRecord& err)
{
err.pObject = m_pObject;
}
- else if (err.pItem == nullptr && m_pItem != nullptr)
- {
- err.pItem = m_pItem;
- }
m_errors.push_back(err);
}
bNoRecurse = false;
@@ -255,12 +232,6 @@ void CErrorReport::SetCurrentValidatorObject(CBaseObject* pObject)
m_pObject = pObject;
}
-//////////////////////////////////////////////////////////////////////////
-void CErrorReport::SetCurrentValidatorItem(CBaseLibraryItem* pItem)
-{
- m_pItem = pItem;
-}
-
//////////////////////////////////////////////////////////////////////////
void CErrorReport::SetCurrentFile(const QString& file)
{
diff --git a/Code/Editor/ErrorReport.h b/Code/Editor/ErrorReport.h
index 3b9a860301..98d230e383 100644
--- a/Code/Editor/ErrorReport.h
+++ b/Code/Editor/ErrorReport.h
@@ -17,8 +17,11 @@
// forward declarations.
class CParticleItem;
-#include "BaseLibraryItem.h"
+#include
+#include
+
#include "Objects/BaseObject.h"
+#include "Include/EditorCoreAPI.h"
#include "Include/IErrorReport.h"
#include "ErrorRecorder.h"
@@ -56,16 +59,13 @@ public:
int count;
//! Object that caused this error.
_smart_ptr pObject;
- //! Library Item that caused this error.
- _smart_ptr pItem;
int flags;
CErrorRecord(CBaseObject* object, ESeverity _severity, const QString& _error, int _flags = 0, int _count = 0,
- CBaseLibraryItem* item = 0, EValidatorModule _module = VALIDATOR_MODULE_EDITOR)
+ EValidatorModule _module = VALIDATOR_MODULE_EDITOR)
: severity(_severity)
, module(_module)
, pObject(object)
- , pItem(item)
, flags(_flags)
, count(_count)
, error(_error)
@@ -77,7 +77,6 @@ public:
severity = ESEVERITY_WARNING;
module = VALIDATOR_MODULE_EDITOR;
pObject = 0;
- pItem = 0;
flags = 0;
count = 0;
}
@@ -116,8 +115,6 @@ public:
//! Assign current Object to which new reported warnings are assigned.
void SetCurrentValidatorObject(CBaseObject* pObject);
- //! Assign current Item to which new reported warnings are assigned.
- void SetCurrentValidatorItem(CBaseLibraryItem* pItem);
//! Assign current filename.
void SetCurrentFile(const QString& file);
@@ -127,7 +124,6 @@ private:
bool m_bImmediateMode;
bool m_bShowErrors;
_smart_ptr m_pObject;
- _smart_ptr m_pItem;
CParticleItem* m_pParticle;
QString m_currentFilename;
};
diff --git a/Code/Editor/ErrorReportDialog.cpp b/Code/Editor/ErrorReportDialog.cpp
index 2d551d6c8b..bbeede79ef 100644
--- a/Code/Editor/ErrorReportDialog.cpp
+++ b/Code/Editor/ErrorReportDialog.cpp
@@ -362,10 +362,6 @@ void CErrorReportDialog::CopyToClipboard()
{
str += QString::fromLatin1(" [Object: %1]").arg(pRecord->pObject->GetName());
}
- if (pRecord->pItem)
- {
- str += QString::fromLatin1(" [Material: %1]").arg(pRecord->pItem->GetName());
- }
str += QString::fromLatin1("\r\n");
}
}
diff --git a/Code/Editor/ErrorReportTableModel.cpp b/Code/Editor/ErrorReportTableModel.cpp
index f5dce1a86d..923991bb62 100644
--- a/Code/Editor/ErrorReportTableModel.cpp
+++ b/Code/Editor/ErrorReportTableModel.cpp
@@ -149,11 +149,7 @@ QVariant CErrorReportTableModel::data(const CErrorRecord& record, int column, in
case ColumnFile:
return record.file;
case ColumnObject:
- if (record.pItem)
- {
- return record.pItem->GetFullName();
- }
- else if (record.pObject)
+ if (record.pObject)
{
return record.pObject->GetName();
}
diff --git a/Code/Editor/GameEngine.cpp b/Code/Editor/GameEngine.cpp
index e82832fc21..db4c587f54 100644
--- a/Code/Editor/GameEngine.cpp
+++ b/Code/Editor/GameEngine.cpp
@@ -442,7 +442,7 @@ AZ::Outcome CGameEngine::Init(
REGISTER_COMMAND("quit", CGameEngine::HandleQuitRequest, VF_RESTRICTEDMODE, "Quit/Shutdown the engine");
EBUS_EVENT(CrySystemEventBus, OnCryEditorInitialized);
-
+
return AZ::Success();
}
@@ -465,7 +465,7 @@ void CGameEngine::SetLevelPath(const QString& path)
const char* oldExtension = EditorUtils::LevelFile::GetOldCryFileExtension();
const char* defaultExtension = EditorUtils::LevelFile::GetDefaultFileExtension();
- // Store off if
+ // Store off if
if (QFileInfo(path + oldExtension).exists())
{
m_levelExtension = oldExtension;
diff --git a/Code/Editor/Geometry/TriMesh.cpp b/Code/Editor/Geometry/TriMesh.cpp
deleted file mode 100644
index efc201095d..0000000000
--- a/Code/Editor/Geometry/TriMesh.cpp
+++ /dev/null
@@ -1,587 +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 "TriMesh.h"
-
-// Editor
-#include "Util/fastlib.h"
-#include "Objects/SubObjSelection.h"
-
-
-//////////////////////////////////////////////////////////////////////////
-CTriMesh::CTriMesh()
-{
- pFaces = nullptr;
- pVertices = nullptr;
- pWSVertices = nullptr;
- pUV = nullptr;
- pColors = nullptr;
- pEdges = nullptr;
- pWeights = nullptr;
-
- nFacesCount = 0;
- nVertCount = 0;
- nUVCount = 0;
- nEdgeCount = 0;
-
- selectionType = SO_ELEM_NONE;
-
- memset(m_streamSize, 0, sizeof(m_streamSize));
- memset(m_streamSel, 0, sizeof(m_streamSel));
- streamSelMask = 0;
-
- m_streamSel[VERTICES] = &vertSel;
- m_streamSel[EDGES] = &edgeSel;
- m_streamSel[FACES] = &faceSel;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CTriMesh::~CTriMesh()
-{
- free(pFaces);
- free(pEdges);
- free(pVertices);
- free(pUV);
- free(pColors);
- free(pWSVertices);
- free(pWeights);
-}
-
-// Set stream size.
-void CTriMesh::ReallocStream(int stream, int nNewCount)
-{
- assert(stream >= 0 && stream < LAST_STREAM);
- if (stream < 0 || stream >= LAST_STREAM)
- {
- return;
- }
- if (m_streamSize[stream] == nNewCount)
- {
- return; // Stream already have required size.
- }
- void* pStream = nullptr;
- int nElementSize = 0;
- GetStreamInfo(stream, pStream, nElementSize);
- pStream = ReAllocElements(pStream, nNewCount, nElementSize);
- m_streamSize[stream] = nNewCount;
-
- switch (stream)
- {
- case VERTICES:
- pVertices = (CTriVertex*)pStream;
- nVertCount = nNewCount;
- vertSel.resize(nNewCount);
- break;
- case FACES:
- pFaces = (CTriFace*)pStream;
- nFacesCount = nNewCount;
- faceSel.resize(nNewCount);
- break;
- case EDGES:
- pEdges = (CTriEdge*)pStream;
- nEdgeCount = nNewCount;
- edgeSel.resize(nNewCount);
- break;
- case TEXCOORDS:
- pUV = (SMeshTexCoord*)pStream;
- nUVCount = nNewCount;
- break;
- case COLORS:
- pColors = (SMeshColor*)pStream;
- break;
- case WEIGHTS:
- pWeights = (float*)pStream;
- break;
- case LINES:
- pLines = (CTriLine*)pStream;
- break;
- case WS_POSITIONS:
- pWSVertices = (Vec3*)pStream;
- break;
- default:
- assert(0); // unknown stream.
- }
- m_streamSize[stream] = nNewCount;
-}
-
-// Set stream size.
-void CTriMesh::GetStreamInfo(int stream, void*& pStream, int& nElementSize) const
-{
- assert(stream >= 0 && stream < LAST_STREAM);
- switch (stream)
- {
- case VERTICES:
- pStream = pVertices;
- nElementSize = sizeof(CTriVertex);
- break;
- case FACES:
- pStream = pFaces;
- nElementSize = sizeof(CTriFace);
- break;
- case EDGES:
- pStream = pEdges;
- nElementSize = sizeof(CTriEdge);
- break;
- case TEXCOORDS:
- pStream = pUV;
- nElementSize = sizeof(SMeshTexCoord);
- break;
- case COLORS:
- pStream = pColors;
- nElementSize = sizeof(SMeshColor);
- break;
- case WEIGHTS:
- pStream = pWeights;
- nElementSize = sizeof(float);
- break;
- case LINES:
- pStream = pLines;
- nElementSize = sizeof(CTriLine);
- break;
- case WS_POSITIONS:
- pStream = pWSVertices;
- nElementSize = sizeof(Vec3);
- break;
- default:
- assert(0); // unknown stream.
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void* CTriMesh::ReAllocElements(void* old_ptr, int new_elem_num, int size_of_element)
-{
- return realloc(old_ptr, new_elem_num * size_of_element);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////
-inline int FindVertexInHash(const Vec3& vPosToFind, const CTriVertex* pVectors, std::vector& hash, float fEpsilon)
-{
- for (uint32 i = 0; i < hash.size(); i++)
- {
- const Vec3& v0 = pVectors[hash[i]].pos;
- const Vec3& v1 = vPosToFind;
- if (fabsf(v0.y - v1.y) < fEpsilon && fabsf(v0.x - v1.x) < fEpsilon && fabsf(v0.z - v1.z) < fEpsilon)
- {
- return hash[i];
- }
- }
- return -1;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////
-inline int FindTexCoordInHash(const SMeshTexCoord& coordToFind, const SMeshTexCoord* pCoords, std::vector& hash, float fEpsilon)
-{
- for (uint32 i = 0; i < hash.size(); i++)
- {
- const SMeshTexCoord& t0 = pCoords[hash[i]];
- const SMeshTexCoord& t1 = coordToFind;
-
- if (t0.IsEquivalent(t1, fEpsilon))
- {
- return hash[i];
- }
- }
- return -1;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-void CTriMesh::SharePositions()
-{
- float fEpsilon = 0.0001f;
- float fHashScale = 256.0f / MAX(bbox.GetSize().GetLength(), fEpsilon);
- std::vector arrHashTable[256];
-
- CTriVertex* pNewVerts = new CTriVertex[GetVertexCount()];
- SMeshColor* pNewColors = nullptr;
- if (pColors)
- {
- pNewColors = new SMeshColor[GetVertexCount()];
- }
-
- int nLastIndex = 0;
- for (int f = 0; f < GetFacesCount(); f++)
- {
- CTriFace& face = pFaces[f];
- for (int i = 0; i < 3; i++)
- {
- const Vec3& v = pVertices[face.v[i]].pos;
- uint8 nHash = static_cast(RoundFloatToInt((v.x + v.y + v.z) * fHashScale));
-
- int find = FindVertexInHash(v, pNewVerts, arrHashTable[nHash], fEpsilon);
- if (find < 0)
- {
- pNewVerts[nLastIndex] = pVertices[face.v[i]];
- if (pColors)
- {
- pNewColors[nLastIndex] = pColors[face.v[i]];
- }
- face.v[i] = nLastIndex;
- // Reserve some space already.
- arrHashTable[nHash].reserve(100);
- arrHashTable[nHash].push_back(nLastIndex);
- nLastIndex++;
- }
- else
- {
- face.v[i] = find;
- }
- }
- }
-
- SetVertexCount(nLastIndex);
- memcpy(pVertices, pNewVerts, nLastIndex * sizeof(CTriVertex));
- delete []pNewVerts;
-
- if (pColors)
- {
- SetColorsCount(nLastIndex);
- memcpy(pColors, pNewColors, nLastIndex * sizeof(SMeshColor));
- delete []pNewColors;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CTriMesh::ShareUV()
-{
- float fEpsilon = 0.0001f;
- float fHashScale = 256.0f;
- std::vector arrHashTable[256];
-
- SMeshTexCoord* pNewUV = new SMeshTexCoord[GetUVCount()];
-
- int nLastIndex = 0;
- for (int f = 0; f < GetFacesCount(); f++)
- {
- CTriFace& face = pFaces[f];
- for (int i = 0; i < 3; i++)
- {
- const Vec2 uv = pUV[face.uv[i]].GetUV();
- uint8 nHash = static_cast(RoundFloatToInt((uv.x + uv.y) * fHashScale));
-
- int find = FindTexCoordInHash(pUV[face.uv[i]], pNewUV, arrHashTable[nHash], fEpsilon);
- if (find < 0)
- {
- pNewUV[nLastIndex] = pUV[face.uv[i]];
- face.uv[i] = nLastIndex;
- arrHashTable[nHash].reserve(100);
- arrHashTable[nHash].push_back(nLastIndex);
- nLastIndex++;
- }
- else
- {
- face.uv[i] = find;
- }
- }
- }
-
- SetUVCount(nLastIndex);
- memcpy(pUV, pNewUV, nLastIndex * sizeof(SMeshTexCoord));
- delete []pNewUV;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CTriMesh::CalcFaceNormals()
-{
- for (int i = 0; i < nFacesCount; i++)
- {
- CTriFace& face = pFaces[i];
- Vec3 p1 = pVertices[face.v[0]].pos;
- Vec3 p2 = pVertices[face.v[1]].pos;
- Vec3 p3 = pVertices[face.v[2]].pos;
- face.normal = (p2 - p1).Cross(p3 - p1);
- face.normal.Normalize();
- }
-}
-
-#define TEX_EPS 0.001f
-#define VER_EPS 0.001f
-
-//////////////////////////////////////////////////////////////////////////
-void CTriMesh::CopyStream(CTriMesh& fromMesh, int stream)
-{
- void* pTrgStream = nullptr;
- void* pSrcStream = nullptr;
- int nElemSize = 0;
- fromMesh.GetStreamInfo(stream, pSrcStream, nElemSize);
- if (pSrcStream)
- {
- ReallocStream(stream, fromMesh.GetStreamSize(stream));
- GetStreamInfo(stream, pTrgStream, nElemSize);
- memcpy(pTrgStream, pSrcStream, nElemSize * fromMesh.GetStreamSize(stream));
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CTriMesh::Copy(CTriMesh& fromMesh, int nCopyFlags)
-{
- streamSelMask = fromMesh.streamSelMask;
-
- if (nCopyFlags & COPY_VERTICES)
- {
- CopyStream(fromMesh, VERTICES);
- }
- if (nCopyFlags & COPY_FACES)
- {
- CopyStream(fromMesh, FACES);
- }
- if (nCopyFlags & COPY_EDGES)
- {
- CopyStream(fromMesh, EDGES);
- }
- if (nCopyFlags & COPY_TEXCOORDS)
- {
- CopyStream(fromMesh, TEXCOORDS);
- }
- if (nCopyFlags & COPY_COLORS)
- {
- CopyStream(fromMesh, COLORS);
- }
- if (nCopyFlags & COPY_WEIGHTS)
- {
- CopyStream(fromMesh, WEIGHTS);
- }
- if (nCopyFlags & COPY_LINES)
- {
- CopyStream(fromMesh, LINES);
- }
-
- if (nCopyFlags & COPY_VERT_SEL)
- {
- vertSel = fromMesh.vertSel;
- }
- if (nCopyFlags & COPY_EDGE_SEL)
- {
- edgeSel = fromMesh.edgeSel;
- }
- if (nCopyFlags & COPY_FACE_SEL)
- {
- faceSel = fromMesh.faceSel;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CTriMesh::UpdateEdges()
-{
- SetEdgeCount(GetFacesCount() * 3);
-
- std::map edgemap;
-
- int nEdges = 0;
- for (int i = 0; i < GetFacesCount(); i++)
- {
- CTriFace& face = pFaces[i];
- for (int j = 0; j < 3; j++)
- {
- int v0 = j;
- int v1 = (j != 2) ? j + 1 : 0;
- CTriEdge edge;
- edge.flags = 0;
-
- // First vertex index must always be smaller.
- if (face.v[v0] < face.v[v1])
- {
- edge.v[0] = face.v[v0];
- edge.v[1] = face.v[v1];
- }
- else
- {
- edge.v[0] = face.v[v1];
- edge.v[1] = face.v[v0];
- }
- edge.face[0] = i;
- edge.face[1] = -1;
- int nedge = stl::find_in_map(edgemap, edge, -1);
- if (nedge >= 0)
- {
- // Assign this face as a second member of the edge.
- if (pEdges[nedge].face[1] < 0)
- {
- pEdges[nedge].face[1] = i;
- }
-
- face.edge[j] = nedge;
- }
- else
- {
- edgemap[edge] = nEdges;
- pEdges[nEdges] = edge;
- face.edge[j] = nEdges;
- nEdges++;
- }
- }
- }
-
- SetEdgeCount(nEdges);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CTriMesh::SoftSelection(const SSubObjSelOptions& options)
-{
- int i;
- int nVerts = GetVertexCount();
- CTriVertex* pVerts = pVertices;
-
- for (i = 0; i < nVerts; i++)
- {
- if (pWeights[i] == 1.0f)
- {
- const Vec3& vp = pVerts[i].pos;
- for (int j = 0; j < nVerts; j++)
- {
- if (pWeights[j] != 1.0f)
- {
- if (vp.IsEquivalent(pVerts[j].pos, options.fSoftSelFalloff))
- {
- float fDist = vp.GetDistance(pVerts[j].pos);
- if (fDist < options.fSoftSelFalloff)
- {
- float fWeight = 1.0f - (fDist / options.fSoftSelFalloff);
- if (fWeight > pWeights[j])
- {
- pWeights[j] = fWeight;
- }
- }
- }
- }
- }
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CTriMesh::UpdateSelection()
-{
- bool bAnySelected = false;
- if (selectionType == SO_ELEM_VERTEX)
- {
- for (int i = 0; i < GetVertexCount(); i++)
- {
- if (vertSel[i])
- {
- bAnySelected = true;
- pWeights[i] = 1.0f;
- }
- else
- {
- pWeights[i] = 0;
- }
- }
- }
- if (selectionType == SO_ELEM_EDGE)
- {
- // Clear weights.
- for (int i = 0; i < GetVertexCount(); i++)
- {
- pWeights[i] = 0;
- }
-
- for (int i = 0; i < GetEdgeCount(); i++)
- {
- if (edgeSel[i])
- {
- bAnySelected = true;
- CTriEdge& edge = pEdges[i];
- for (int j = 0; j < 2; j++)
- {
- pWeights[edge.v[j]] = 1.0f;
- }
- }
- }
- }
- else if (selectionType == SO_ELEM_FACE)
- {
- // Clear weights.
- for (int i = 0; i < GetVertexCount(); i++)
- {
- pWeights[i] = 0;
- }
-
- for (int i = 0; i < GetFacesCount(); i++)
- {
- if (faceSel[i])
- {
- bAnySelected = true;
- CTriFace& face = pFaces[i];
- for (int j = 0; j < 3; j++)
- {
- pWeights[face.v[j]] = 1.0f;
- }
- }
- }
- }
- return bAnySelected;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool CTriMesh::ClearSelection()
-{
- bool bWasSelected = false;
- // Remove all selections.
- int i;
- for (i = 0; i < GetVertexCount(); i++)
- {
- pWeights[i] = 0;
- }
- streamSelMask = 0;
- for (int ii = 0; ii < LAST_STREAM; ii++)
- {
- if (m_streamSel[ii] && !m_streamSel[ii]->is_zero())
- {
- bWasSelected = true;
- m_streamSel[ii]->clear();
- }
- }
- return bWasSelected;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CTriMesh::GetEdgesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outEdges)
-{
- // Brute force algorithm using binary search.
- // for every edge check if edge vertex is inside inVertices array.
- std::sort(inVertices.begin(), inVertices.end());
- for (int i = 0; i < GetEdgeCount(); i++)
- {
- if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pEdges[i].v[0])) != inVertices.end())
- {
- outEdges.push_back(i);
- }
- else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pEdges[i].v[1])) != inVertices.end())
- {
- outEdges.push_back(i);
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CTriMesh::GetFacesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outFaces)
-{
- // Brute force algorithm using binary search.
- // for every face check if face vertex is inside inVertices array.
- std::sort(inVertices.begin(), inVertices.end());
- for (int i = 0; i < GetFacesCount(); i++)
- {
- if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pFaces[i].v[0])) != inVertices.end())
- {
- outFaces.push_back(i);
- }
- else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pFaces[i].v[1])) != inVertices.end())
- {
- outFaces.push_back(i);
- }
- else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pFaces[i].v[2])) != inVertices.end())
- {
- outFaces.push_back(i);
- }
- }
-}
diff --git a/Code/Editor/Geometry/TriMesh.h b/Code/Editor/Geometry/TriMesh.h
deleted file mode 100644
index a6c58b8f9d..0000000000
--- a/Code/Editor/Geometry/TriMesh.h
+++ /dev/null
@@ -1,238 +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
- *
- */
-
-
-#ifndef CRYINCLUDE_EDITOR_GEOMETRY_TRIMESH_H
-#define CRYINCLUDE_EDITOR_GEOMETRY_TRIMESH_H
-#pragma once
-
-#include
-#include "Util/bitarray.h"
-
-struct SSubObjSelOptions;
-
-typedef std::vector MeshElementsArray;
-
-//////////////////////////////////////////////////////////////////////////
-// Vertex used in the TriMesh.
-//////////////////////////////////////////////////////////////////////////
-struct CTriVertex
-{
- Vec3 pos;
- //float weight; // Selection weight in 0-1 range.
-};
-
-//////////////////////////////////////////////////////////////////////////
-// Triangle face used by the Triangle mesh.
-//////////////////////////////////////////////////////////////////////////
-struct CTriFace
-{
- uint32 v[3]; // Indices to vertices array.
- uint32 uv[3]; // Indices to texture coordinates array.
- Vec3 n[3]; // Vertex normals at face vertices.
- Vec3 normal; // Face normal.
- uint32 edge[3]; // Indices to the face edges.
- unsigned char MatID; // Index of face sub material.
- unsigned char flags; // see ETriMeshFlags
-};
-
-//////////////////////////////////////////////////////////////////////////
-// Mesh edge.
-//////////////////////////////////////////////////////////////////////////
-struct CTriEdge
-{
- uint32 v[2]; // Indices to edge vertices.
- int face[2]; // Indices to edge faces (-1 if no face).
- uint32 flags; // see ETriMeshFlags
-
- CTriEdge() {}
- bool operator==(const CTriEdge& edge) const
- {
- if ((v[0] == edge.v[0] && v[1] == edge.v[1]) ||
- (v[0] == edge.v[1] && v[1] == edge.v[0]))
- {
- return true;
- }
- return false;
- }
- bool operator!=(const CTriEdge& edge) const { return !(*this == edge); }
- bool operator<(const CTriEdge& edge) const { return (*(uint64*)v < *(uint64*)edge.v); }
- bool operator>(const CTriEdge& edge) const { return (*(uint64*)v > *(uint64*)edge.v); }
-};
-
-//////////////////////////////////////////////////////////////////////////
-// Mesh line.
-//////////////////////////////////////////////////////////////////////////
-struct CTriLine
-{
- uint32 v[2]; // Indices to edge vertices.
-
- CTriLine() {}
- bool operator==(const CTriLine& edge) const
- {
- if ((v[0] == edge.v[0] && v[1] == edge.v[1]) ||
- (v[0] == edge.v[1] && v[1] == edge.v[0]))
- {
- return true;
- }
- return false;
- }
- bool operator!=(const CTriLine& edge) const { return !(*this == edge); }
- bool operator<(const CTriLine& edge) const { return (*(uint64*)v < *(uint64*)edge.v); }
- bool operator>(const CTriLine& edge) const { return (*(uint64*)v > *(uint64*)edge.v); }
-};
-
-//////////////////////////////////////////////////////////////////////////
-struct CTriMeshPoly
-{
- std::vector v; // Indices to vertices array.
- std::vector uv; // Indices to texture coordinates array.
- std::vector n; // Vertex normals at face vertices.
- Vec3 normal; // Polygon normal.
- uint32 edge[3]; // Indices to the face edges.
- unsigned char MatID; // Index of face sub material.
- unsigned char flags; // optional flags.
-};
-
-//////////////////////////////////////////////////////////////////////////
-// CTriMesh is used in the Editor as a general purpose editable triangle mesh.
-//////////////////////////////////////////////////////////////////////////
-class CTriMesh
-{
-public:
- enum EStream
- {
- VERTICES,
- FACES,
- EDGES,
- TEXCOORDS,
- COLORS,
- WEIGHTS,
- LINES,
- WS_POSITIONS,
- LAST_STREAM,
- };
- enum ECopyFlags
- {
- COPY_VERTICES = BIT(1),
- COPY_FACES = BIT(2),
- COPY_EDGES = BIT(3),
- COPY_TEXCOORDS = BIT(4),
- COPY_COLORS = BIT(5),
- COPY_VERT_SEL = BIT(6),
- COPY_EDGE_SEL = BIT(7),
- COPY_FACE_SEL = BIT(8),
- COPY_WEIGHTS = BIT(9),
- COPY_LINES = BIT(10),
- COPY_ALL = 0xFFFF,
- };
- // geometry data
- CTriFace* pFaces;
- CTriEdge* pEdges;
- CTriVertex* pVertices;
- SMeshTexCoord* pUV;
- SMeshColor* pColors; // If allocated same size as pVerts array.
- Vec3* pWSVertices; // World space vertices.
- float* pWeights;
- CTriLine* pLines;
-
- int nFacesCount;
- int nVertCount;
- int nUVCount;
- int nEdgeCount;
- int nLinesCount;
-
- AABB bbox;
-
- //////////////////////////////////////////////////////////////////////////
- // Selections.
- //////////////////////////////////////////////////////////////////////////
- CBitArray vertSel;
- CBitArray edgeSel;
- CBitArray faceSel;
- // Every bit of the selection mask correspond to a stream, if bit is set this stream have some elements selected
- int streamSelMask;
-
- // Selection element type.
- // see ESubObjElementType
- int selectionType;
-
- //////////////////////////////////////////////////////////////////////////
- // Vertices of the front facing triangles.
- CBitArray frontFacingVerts;
-
- //////////////////////////////////////////////////////////////////////////
- // Functions.
- //////////////////////////////////////////////////////////////////////////
- CTriMesh();
- ~CTriMesh();
-
- int GetFacesCount() const { return nFacesCount; }
- int GetVertexCount() const { return nVertCount; }
- int GetUVCount() const { return nUVCount; }
- int GetEdgeCount() const { return nEdgeCount; }
- int GetLinesCount() const { return nLinesCount; }
-
- //////////////////////////////////////////////////////////////////////////
- void SetFacesCount(int nNewCount) { ReallocStream(FACES, nNewCount); }
- void SetVertexCount(int nNewCount)
- {
- ReallocStream(VERTICES, nNewCount);
- if (pColors)
- {
- ReallocStream(COLORS, nNewCount);
- }
- ReallocStream(WEIGHTS, nNewCount);
- }
- void SetColorsCount(int nNewCount) { ReallocStream(COLORS, nNewCount); }
- void SetUVCount(int nNewCount) { ReallocStream(TEXCOORDS, nNewCount); }
- void SetEdgeCount(int nNewCount) { ReallocStream(EDGES, nNewCount); }
- void SetLinesCount(int nNewCount) { ReallocStream(LINES, nNewCount); }
-
- void ReallocStream(int stream, int nNewCount);
- void GetStreamInfo(int stream, void*& pStream, int& nElementSize) const;
- int GetStreamSize(int stream) const { return m_streamSize[stream]; };
-
- // Calculate per face normal.
- void CalcFaceNormals();
-
- //////////////////////////////////////////////////////////////////////////
- // Welding functions.
- //////////////////////////////////////////////////////////////////////////
- void SharePositions();
- void ShareUV();
- //////////////////////////////////////////////////////////////////////////
- // Recreate edges of the mesh.
- void UpdateEdges();
-
- void Copy(CTriMesh& fromMesh, int nCopyFlags = COPY_ALL);
-
- //////////////////////////////////////////////////////////////////////////
- // Sub-object selection specific methods.
- //////////////////////////////////////////////////////////////////////////
- // Return true if something is selected.
- bool UpdateSelection();
- // Clear all selections, return true if something was selected.
- bool ClearSelection();
- void SoftSelection(const SSubObjSelOptions& options);
- CBitArray* GetStreamSelection(int nStream) { return m_streamSel[nStream]; };
- // Returns true if specified stream have any selected elements.
- bool StreamHaveSelection(int nStream) { return streamSelMask & (1 << nStream); }
- void GetEdgesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outEdges);
- void GetFacesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outFaces);
-
-private:
- void* ReAllocElements(void* old_ptr, int new_elem_num, int size_of_element);
- void CopyStream(CTriMesh& fromMesh, int stream);
-
- // For internal use.
- int m_streamSize[LAST_STREAM];
- CBitArray* m_streamSel[LAST_STREAM];
-};
-
-#endif // CRYINCLUDE_EDITOR_GEOMETRY_TRIMESH_H
diff --git a/Code/Editor/GotoPositionDlg.cpp b/Code/Editor/GotoPositionDlg.cpp
index 84d149de58..37f55f19ea 100644
--- a/Code/Editor/GotoPositionDlg.cpp
+++ b/Code/Editor/GotoPositionDlg.cpp
@@ -6,7 +6,6 @@
*
*/
-
#include "GotoPositionDlg.h"
#include "EditorDefs.h"
@@ -25,6 +24,17 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
+void GotoPositionPitchConstraints::DeterminePitchRange(const AngleRangeConfigureFn& configurePitchRangeFn) const
+{
+ const auto [pitchMinRadians, pitchMaxRadians] = AzFramework::CameraPitchMinMaxRadians();
+ configurePitchRangeFn(AZ::RadToDeg(pitchMinRadians), AZ::RadToDeg(pitchMaxRadians));
+}
+
+float GotoPositionPitchConstraints::PitchClampedRadians(float pitchDegrees) const
+{
+ return AzFramework::ClampPitchRotation(AZ::DegToRad(pitchDegrees));
+}
+
GotoPositionDialog::GotoPositionDialog(QWidget* parent)
: QDialog(parent)
, m_ui(new Ui::GotoPositionDialog)
@@ -55,20 +65,23 @@ void GotoPositionDialog::OnInitDialog()
const auto yawDegrees = AZ::RadToDeg(cameraRotation.GetZ());
// position
- m_ui->m_dymX->setRange(-64000.0, 64000.0);
+ const double CameraPositionExtent = 64000.0;
+ m_ui->m_dymX->setRange(-CameraPositionExtent, CameraPositionExtent);
m_ui->m_dymX->setValue(cameraTranslation.GetX());
-
- m_ui->m_dymY->setRange(-64000.0, 64000.0);
+ m_ui->m_dymY->setRange(-CameraPositionExtent, CameraPositionExtent);
m_ui->m_dymY->setValue(cameraTranslation.GetY());
-
- m_ui->m_dymZ->setRange(-64000.0, 64000.0);
+ m_ui->m_dymZ->setRange(-CameraPositionExtent, CameraPositionExtent);
m_ui->m_dymZ->setValue(cameraTranslation.GetZ());
// rotation
- m_ui->m_dymAnglePitch->setRange(-180.0, 180.0);
+ m_gotoPositionPitchConstraints.DeterminePitchRange(
+ [this](const float minPitchDegrees, const float maxPitchDegrees)
+ {
+ m_ui->m_dymAnglePitch->setRange(minPitchDegrees, maxPitchDegrees);
+ });
m_ui->m_dymAnglePitch->setValue(pitchDegrees);
- m_ui->m_dymAngleYaw->setRange(-180.0, 180.0);
+ m_ui->m_dymAngleYaw->setRange(-360, 360);
m_ui->m_dymAngleYaw->setValue(yawDegrees);
// ensure the goto button is highlighted correctly.
@@ -108,12 +121,13 @@ void GotoPositionDialog::OnUpdateNumbers()
void GotoPositionDialog::accept()
{
- SandboxEditor::InterpolateDefaultViewportCameraToTransform(
- AZ::Vector3(
- aznumeric_cast(m_ui->m_dymX->value()), aznumeric_cast(m_ui->m_dymY->value()),
- aznumeric_cast(m_ui->m_dymZ->value())),
- AZ::DegToRad(aznumeric_cast(m_ui->m_dymAnglePitch->value())),
- AZ::DegToRad(aznumeric_cast(m_ui->m_dymAngleYaw->value())));
+ const auto position = AZ::Vector3(
+ aznumeric_cast(m_ui->m_dymX->value()), aznumeric_cast