From 17a79daad89afe48b8d03df852c99eedcc887e9d Mon Sep 17 00:00:00 2001 From: sphrose <82213493+sphrose@users.noreply.github.com> Date: Mon, 12 Jul 2021 16:07:52 +0100 Subject: [PATCH 01/75] Add clear console when starting gamemode setting. Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com> --- Code/Editor/Controls/ConsoleSCB.cpp | 4 ++++ Code/Editor/Controls/ConsoleSCB.h | 2 ++ Code/Editor/EditorPreferencesPageGeneral.cpp | 5 +++++ Code/Editor/EditorPreferencesPageGeneral.h | 1 + Code/Editor/GameEngine.cpp | 6 ++++++ Code/Editor/Settings.cpp | 5 +++++ Code/Editor/Settings.h | 1 + 7 files changed, 24 insertions(+) diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp index 32ec6506b1..32731b7317 100644 --- a/Code/Editor/Controls/ConsoleSCB.cpp +++ b/Code/Editor/Controls/ConsoleSCB.cpp @@ -537,6 +537,10 @@ void CConsoleSCB::AddToPendingLines(const QString& text, bool bNewLine) s_pendingLines.push_back({ text, bNewLine }); } +void CConsoleSCB::ClearText() +{ + ui->textEdit->clear(); +} /** * When a CVar variable is updated, we need to tell alert our console variables * pane so it can update the corresponding row diff --git a/Code/Editor/Controls/ConsoleSCB.h b/Code/Editor/Controls/ConsoleSCB.h index faa8c06124..d561e5f5a6 100644 --- a/Code/Editor/Controls/ConsoleSCB.h +++ b/Code/Editor/Controls/ConsoleSCB.h @@ -174,6 +174,8 @@ public: static void AddToPendingLines(const QString& text, bool bNewLine); // call this function instead of AddToConsole() until an instance of CConsoleSCB exists to prevent messages from getting lost + void ClearText(); + // EditorPreferencesNotificationBus... void OnEditorPreferencesChanged() override; diff --git a/Code/Editor/EditorPreferencesPageGeneral.cpp b/Code/Editor/EditorPreferencesPageGeneral.cpp index 861ef10c23..cf4a430c7e 100644 --- a/Code/Editor/EditorPreferencesPageGeneral.cpp +++ b/Code/Editor/EditorPreferencesPageGeneral.cpp @@ -31,6 +31,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize) ->Field("PreviewPanel", &GeneralSettings::m_previewPanel) ->Field("ApplyConfigSpec", &GeneralSettings::m_applyConfigSpec) ->Field("EnableSourceControl", &GeneralSettings::m_enableSourceControl) + ->Field("ClearConsole", &GeneralSettings::m_clearConsoleOnGameModeStart) ->Field("ConsoleBackgroundColorTheme", &GeneralSettings::m_consoleBackgroundColorTheme) ->Field("AutoloadLastLevel", &GeneralSettings::m_autoLoadLastLevel) ->Field("ShowTimeInConsole", &GeneralSettings::m_bShowTimeInConsole) @@ -76,6 +77,8 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize) ->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_previewPanel, "Show Geometry Preview Panel", "Show Geometry Preview Panel") ->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_applyConfigSpec, "Hide objects by config spec", "Hide objects by config spec") ->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_enableSourceControl, "Enable Source Control", "Enable Source Control") + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_clearConsoleOnGameModeStart, "Clear Console at Game Startup", "Clear Console when Game Mode Starts") ->DataElement(AZ::Edit::UIHandlers::ComboBox, &GeneralSettings::m_consoleBackgroundColorTheme, "Console Background", "Console Background") ->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Light, "Light") ->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Dark, "Dark") @@ -141,6 +144,7 @@ void CEditorPreferencesPage_General::OnApply() gSettings.bPreviewGeometryWindow = m_generalSettings.m_previewPanel; gSettings.bApplyConfigSpecInEditor = m_generalSettings.m_applyConfigSpec; gSettings.enableSourceControl = m_generalSettings.m_enableSourceControl; + gSettings.clearConsoleOnGameModeStart = m_generalSettings.m_clearConsoleOnGameModeStart; gSettings.consoleBackgroundColorTheme = m_generalSettings.m_consoleBackgroundColorTheme; gSettings.bShowTimeInConsole = m_generalSettings.m_bShowTimeInConsole; gSettings.bShowDashboardAtStartup = m_messaging.m_showDashboard; @@ -175,6 +179,7 @@ void CEditorPreferencesPage_General::InitializeSettings() m_generalSettings.m_previewPanel = gSettings.bPreviewGeometryWindow; m_generalSettings.m_applyConfigSpec = gSettings.bApplyConfigSpecInEditor; m_generalSettings.m_enableSourceControl = gSettings.enableSourceControl; + m_generalSettings.m_clearConsoleOnGameModeStart = gSettings.clearConsoleOnGameModeStart; m_generalSettings.m_consoleBackgroundColorTheme = gSettings.consoleBackgroundColorTheme; m_generalSettings.m_bShowTimeInConsole = gSettings.bShowTimeInConsole; m_generalSettings.m_autoLoadLastLevel = gSettings.bAutoloadLastLevelAtStartup; diff --git a/Code/Editor/EditorPreferencesPageGeneral.h b/Code/Editor/EditorPreferencesPageGeneral.h index ca315c2d01..557a9d5bce 100644 --- a/Code/Editor/EditorPreferencesPageGeneral.h +++ b/Code/Editor/EditorPreferencesPageGeneral.h @@ -45,6 +45,7 @@ private: bool m_previewPanel; bool m_applyConfigSpec; bool m_enableSourceControl; + bool m_clearConsoleOnGameModeStart; AzToolsFramework::ConsoleColorTheme m_consoleBackgroundColorTheme; bool m_autoLoadLastLevel; bool m_bShowTimeInConsole; diff --git a/Code/Editor/GameEngine.cpp b/Code/Editor/GameEngine.cpp index a729be9175..e77d44d98e 100644 --- a/Code/Editor/GameEngine.cpp +++ b/Code/Editor/GameEngine.cpp @@ -29,6 +29,7 @@ // Editor #include "IEditorImpl.h" +#include "Controls/ConsoleSCB.h" #include "CryEditDoc.h" #include "Settings.h" @@ -565,6 +566,11 @@ void CGameEngine::SwitchToInGame() streamer->QueueRequest(flush); wait.acquire(); } + + if (gSettings.clearConsoleOnGameModeStart) + { + CConsoleSCB::GetCreatedInstance()->ClearText(); + } GetIEditor()->Notify(eNotify_OnBeginGameMode); diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp index cdd44b5fff..f675116e56 100644 --- a/Code/Editor/Settings.cpp +++ b/Code/Editor/Settings.cpp @@ -188,6 +188,7 @@ SEditorSettings::SEditorSettings() consoleBackgroundColorTheme = AzToolsFramework::ConsoleColorTheme::Dark; bShowTimeInConsole = false; + clearConsoleOnGameModeStart = false; enableSceneInspector = false; @@ -526,6 +527,8 @@ void SEditorSettings::Save() SaveValue("Settings", "ConsoleBackgroundColorThemeV2", (int)consoleBackgroundColorTheme); + SaveValue("Settings", "ClearConsoleOnGameModeStart", clearConsoleOnGameModeStart); + SaveValue("Settings", "ShowTimeInConsole", bShowTimeInConsole); SaveValue("Settings", "EnableSceneInspector", enableSceneInspector); @@ -744,6 +747,8 @@ void SEditorSettings::Load() consoleBackgroundColorTheme = AzToolsFramework::ConsoleColorTheme::Dark; } + LoadValue("Settings", "ClearConsoleOnGameModeStart", clearConsoleOnGameModeStart); + LoadValue("Settings", "ShowTimeInConsole", bShowTimeInConsole); LoadValue("Settings", "EnableSceneInspector", enableSceneInspector); diff --git a/Code/Editor/Settings.h b/Code/Editor/Settings.h index cef77de6a7..ff4252f8d8 100644 --- a/Code/Editor/Settings.h +++ b/Code/Editor/Settings.h @@ -379,6 +379,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING //! Source Control Enabling. bool enableSourceControl; + bool clearConsoleOnGameModeStart; //! Text editor. QString textEditorForScript; From 93cbb7c98186c15427826f639edf8e5abf30499b Mon Sep 17 00:00:00 2001 From: sphrose <82213493+sphrose@users.noreply.github.com> Date: Wed, 14 Jul 2021 10:14:25 +0100 Subject: [PATCH 02/75] Review changes Changed text case, removed ClearText API and added GameStartup motify listening. Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com> --- Code/Editor/Controls/ConsoleSCB.cpp | 23 ++++++++++++++++---- Code/Editor/Controls/ConsoleSCB.h | 5 +++-- Code/Editor/EditorPreferencesPageGeneral.cpp | 2 +- Code/Editor/GameEngine.cpp | 6 ----- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp index 32731b7317..3498476797 100644 --- a/Code/Editor/Controls/ConsoleSCB.cpp +++ b/Code/Editor/Controls/ConsoleSCB.cpp @@ -337,6 +337,8 @@ CConsoleSCB::CConsoleSCB(QWidget* parent) connect(findPreviousAction, &QAction::triggered, this, &CConsoleSCB::findPrevious); ui->findPrevButton->addAction(findPreviousAction); + GetIEditor()->RegisterNotifyListener(this); + connect(ui->button, &QPushButton::clicked, this, &CConsoleSCB::showVariableEditor); connect(ui->findButton, &QPushButton::clicked, this, &CConsoleSCB::toggleConsoleSearch); connect(ui->textEdit, &ConsoleTextEdit::searchBarRequested, this, [this] @@ -375,6 +377,8 @@ CConsoleSCB::~CConsoleSCB() { AzToolsFramework::EditorPreferencesNotificationBus::Handler::BusDisconnect(); + GetIEditor()->UnregisterNotifyListener(this); + s_consoleSCB = nullptr; CLogFile::AttachEditBox(nullptr); } @@ -537,10 +541,6 @@ void CConsoleSCB::AddToPendingLines(const QString& text, bool bNewLine) s_pendingLines.push_back({ text, bNewLine }); } -void CConsoleSCB::ClearText() -{ - ui->textEdit->clear(); -} /** * When a CVar variable is updated, we need to tell alert our console variables * pane so it can update the corresponding row @@ -1355,4 +1355,19 @@ CConsoleSCB* CConsoleSCB::GetCreatedInstance() return s_consoleSCB; } +void CConsoleSCB::OnEditorNotifyEvent(EEditorNotifyEvent event) +{ + switch (event) + { + case eNotify_OnBeginGameMode: + if (gSettings.clearConsoleOnGameModeStart) + { + ui->textEdit->clear(); + } + break; + default: + break; + } +} + #include diff --git a/Code/Editor/Controls/ConsoleSCB.h b/Code/Editor/Controls/ConsoleSCB.h index d561e5f5a6..a62c1009b0 100644 --- a/Code/Editor/Controls/ConsoleSCB.h +++ b/Code/Editor/Controls/ConsoleSCB.h @@ -158,6 +158,7 @@ private: class CConsoleSCB : public QWidget , private AzToolsFramework::EditorPreferencesNotificationBus::Handler + , public IEditorNotifyListener { Q_OBJECT public: @@ -174,8 +175,6 @@ public: static void AddToPendingLines(const QString& text, bool bNewLine); // call this function instead of AddToConsole() until an instance of CConsoleSCB exists to prevent messages from getting lost - void ClearText(); - // EditorPreferencesNotificationBus... void OnEditorPreferencesChanged() override; @@ -188,6 +187,8 @@ private Q_SLOTS: void findNext(); private: + void OnEditorNotifyEvent(EEditorNotifyEvent event) override; + QScopedPointer ui; int m_richEditTextLength; diff --git a/Code/Editor/EditorPreferencesPageGeneral.cpp b/Code/Editor/EditorPreferencesPageGeneral.cpp index cf4a430c7e..046a546f59 100644 --- a/Code/Editor/EditorPreferencesPageGeneral.cpp +++ b/Code/Editor/EditorPreferencesPageGeneral.cpp @@ -78,7 +78,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize) ->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_applyConfigSpec, "Hide objects by config spec", "Hide objects by config spec") ->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_enableSourceControl, "Enable Source Control", "Enable Source Control") ->DataElement( - AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_clearConsoleOnGameModeStart, "Clear Console at Game Startup", "Clear Console when Game Mode Starts") + AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_clearConsoleOnGameModeStart, "Clear Console at game startup", "Clear Console when game mode starts") ->DataElement(AZ::Edit::UIHandlers::ComboBox, &GeneralSettings::m_consoleBackgroundColorTheme, "Console Background", "Console Background") ->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Light, "Light") ->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Dark, "Dark") diff --git a/Code/Editor/GameEngine.cpp b/Code/Editor/GameEngine.cpp index e77d44d98e..c4fd38afc9 100644 --- a/Code/Editor/GameEngine.cpp +++ b/Code/Editor/GameEngine.cpp @@ -29,7 +29,6 @@ // Editor #include "IEditorImpl.h" -#include "Controls/ConsoleSCB.h" #include "CryEditDoc.h" #include "Settings.h" @@ -567,11 +566,6 @@ void CGameEngine::SwitchToInGame() wait.acquire(); } - if (gSettings.clearConsoleOnGameModeStart) - { - CConsoleSCB::GetCreatedInstance()->ClearText(); - } - GetIEditor()->Notify(eNotify_OnBeginGameMode); m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true); From 2560e2392f5911e46b66ceceb973435d032129c7 Mon Sep 17 00:00:00 2001 From: pappeste Date: Tue, 8 Jun 2021 18:48:37 -0700 Subject: [PATCH 03/75] enable the warning Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 41de1bd6a0..4024e45bad 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -41,7 +41,6 @@ ly_append_configurations_options( /wd4018 # signed/unsigned mismatch /wd4244 # conversion, possible loss of data /wd4245 # conversion, signed/unsigned mismatch - /wd4267 # conversion, possible loss of data /wd4389 # comparison, signed/unsigned mismatch # Enabling warnings that are disabled by default from /W4 From 8eef0e219ad0d055b691490f9eb2d04d6beb53dc Mon Sep 17 00:00:00 2001 From: pappeste Date: Tue, 8 Jun 2021 18:49:00 -0700 Subject: [PATCH 04/75] CryLegacyAllocator cleanup Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Legacy/CryCommon/CryLegacyAllocator.h | 127 --------------------- 1 file changed, 127 deletions(-) diff --git a/Code/Legacy/CryCommon/CryLegacyAllocator.h b/Code/Legacy/CryCommon/CryLegacyAllocator.h index 81e3f90026..b0e1e29657 100644 --- a/Code/Legacy/CryCommon/CryLegacyAllocator.h +++ b/Code/Legacy/CryCommon/CryLegacyAllocator.h @@ -10,8 +10,6 @@ #include "LegacyAllocator.h" -#include - //----------------------------------------------------------------------------- // CryModule allocation API //----------------------------------------------------------------------------- @@ -95,128 +93,3 @@ inline void* CryModuleReallocAlignImpl(void* prev, size_t size, size_t alignment return ptr; } - -//----------------------------------------------------------------------------- -// CryCrt alloc API -//----------------------------------------------------------------------------- -inline size_t CryCrtSize(void* p) -{ - return AZ::AllocatorInstance::Get().AllocationSize(p); -} - -inline void* CryCrtMalloc(size_t size) -{ - return CryModuleMalloc(size); -} - -inline size_t CryCrtFree(void* p) -{ - size_t size = CryCrtSize(p); - CryModuleFree(p); - return size; -}; - -//----------------------------------------------------------------------------- -// CrySystemCrt alloc API -//----------------------------------------------------------------------------- -inline size_t CrySystemCrtSize(void* p) -{ - return AZ::AllocatorInstance::Get().AllocationSize(p); -} - -inline void* CrySystemCrtMalloc(size_t size) -{ - return AZ::AllocatorInstance::Get().Allocate(size, 0, 0, "AZ::LegacyAllocator"); -} - -inline void* CrySystemCrtRealloc(void* p, size_t size) -{ - // Use LegacyAllocator's special ReAllocate - return AZ::AllocatorInstance::Get().ReAllocate(p, size, 0); -} - -inline size_t CrySystemCrtFree(void* p) -{ - size_t size = CrySystemCrtSize(p); - CryModuleFree(p); - return size; -} - -inline size_t CrySystemCrtGetUsedSpace() -{ - return AZ::AllocatorInstance::Get().NumAllocatedBytes(); -} - -//----------------------------------------------------------------------------- -// CryMalloc API -//----------------------------------------------------------------------------- -inline void* CryMalloc(size_t size, size_t& allocated, size_t alignment) -{ - if (!size) - { - allocated = 0; - return nullptr; - } - - // The original implementation guaranteed 16 byte min alignment - alignment = AZStd::GetMax(alignment, 16); - void* ptr = AZ::AllocatorInstance::Get().Allocate(size, alignment, 0, "CryMalloc", __FILE__, __LINE__); - allocated = AZ::AllocatorInstance::Get().AllocationSize(ptr); - return ptr; -} - -inline void* CryRealloc(void* memblock, size_t size, size_t& allocated, size_t& oldsize, size_t alignment) -{ - oldsize = AZ::AllocatorInstance::Get().AllocationSize(memblock); - void* ptr = AZ::AllocatorInstance::Get().ReAllocate(memblock, size, alignment); - allocated = AZ::AllocatorInstance::Get().AllocationSize(ptr); - return ptr; -} - -inline size_t CryFree(void* p, size_t /*alignment*/) -{ - size_t size = AZ::AllocatorInstance::Get().AllocationSize(p); - AZ::AllocatorInstance::Get().DeAllocate(p, size); - return size; -} - -inline size_t CryGetMemSize(void* memblock, size_t /*sourceSize*/) -{ - return AZ::AllocatorInstance::Get().AllocationSize(memblock); -} - -inline int CryMemoryGetAllocatedSize() -{ - return AZ::AllocatorInstance::Get().NumAllocatedBytes(); -} - -////////////////////////////////////////////////////////////////////////// -inline int CryMemoryGetPoolSize() -{ - return 0; -} - -////////////////////////////////////////////////////////////////////////// -inline int CryStats([[maybe_unused]] char* buf) -{ - return 0; -} - -inline int CryGetUsedHeapSize() -{ - return AZ::AllocatorInstance::Get().NumAllocatedBytes(); -} - -inline int CryGetWastedHeapSize() -{ - return 0; -} - -inline void CryCleanup() -{ - AZ::AllocatorInstance::Get().GarbageCollect(); -} - -inline void CryResetStats(void) -{ -} From ceab4a794cca5a9a4815dd9ad28395977b0fd73e Mon Sep 17 00:00:00 2001 From: pappeste Date: Tue, 8 Jun 2021 18:49:32 -0700 Subject: [PATCH 05/75] CryEngine compiles Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzCore/AzCore/IO/Streamer/BlockCache.cpp | 2 +- .../AzCore/IO/Streamer/DedicatedCache.cpp | 2 +- Code/Framework/AzCore/AzCore/Math/Aabb.h | 2 +- Code/Framework/AzCore/AzCore/Math/Aabb.inl | 4 ++-- .../Json/ByteStreamSerializer.cpp | 2 +- Code/Legacy/CryCommon/CryArray.h | 6 +++--- Code/Legacy/CryCommon/CryName.h | 14 +++++++------- Code/Legacy/CryCommon/CryPodArray.h | 4 ++-- Code/Legacy/CryCommon/CryString.h | 18 +++++++++--------- Code/Legacy/CryCommon/IIndexedMesh.h | 2 +- Code/Legacy/CryCommon/IShader.h | 16 ++++++++-------- Code/Legacy/CryCommon/VectorMap.h | 6 ++---- Code/Legacy/CryCommon/platform.h | 2 -- Code/Legacy/CrySystem/ConsoleBatchFile.cpp | 2 +- .../CrySystem/LevelSystem/LevelSystem.cpp | 2 +- .../CrySystem/LocalizedStringManager.cpp | 18 +++++++++--------- Code/Legacy/CrySystem/Log.cpp | 2 +- Code/Legacy/CrySystem/SimpleStringPool.h | 4 ++-- Code/Legacy/CrySystem/SystemCFG.cpp | 6 +++--- Code/Legacy/CrySystem/ViewSystem/View.cpp | 6 +++--- Code/Legacy/CrySystem/XConsole.cpp | 8 ++++---- Code/Legacy/CrySystem/XConsole.h | 2 +- Code/Legacy/CrySystem/XML/WriteXMLSource.cpp | 3 ++- Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp | 12 ++++++------ Code/Legacy/CrySystem/XML/XmlUtils.cpp | 4 ++-- Code/Legacy/CrySystem/XML/xml.cpp | 10 +++++----- .../RemoteConsole/Core/RemoteConsoleCore.cpp | 4 ++-- 27 files changed, 80 insertions(+), 83 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp index 6e46b930b6..f358370be5 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp @@ -47,7 +47,7 @@ namespace AZ } auto stackEntry = AZStd::make_shared( - cacheSize, blockSize, aznumeric_caster(hardware.m_maxPhysicalSectorSize), false); + cacheSize, aznumeric_cast(blockSize), aznumeric_cast(hardware.m_maxPhysicalSectorSize), false); stackEntry->SetNext(AZStd::move(parent)); return stackEntry; } diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp index 5b67c8c255..6ec3fb295c 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp @@ -45,7 +45,7 @@ namespace AZ } auto stackEntry = AZStd::make_shared( - cacheSize, blockSize, aznumeric_caster(hardware.m_maxPhysicalSectorSize), m_writeOnlyEpilog); + cacheSize, aznumeric_cast(blockSize), aznumeric_cast(hardware.m_maxPhysicalSectorSize), m_writeOnlyEpilog); stackEntry->SetNext(AZStd::move(parent)); return stackEntry; } diff --git a/Code/Framework/AzCore/AzCore/Math/Aabb.h b/Code/Framework/AzCore/AzCore/Math/Aabb.h index 8d8ded7b2d..488808bc4c 100644 --- a/Code/Framework/AzCore/AzCore/Math/Aabb.h +++ b/Code/Framework/AzCore/AzCore/Math/Aabb.h @@ -43,7 +43,7 @@ namespace AZ static Aabb CreateCenterRadius(const Vector3& center, float radius); //! Creates an AABB which contains the specified points. - static Aabb CreatePoints(const Vector3* pts, int numPts); + static Aabb CreatePoints(const Vector3* pts, size_t numPts); //! Creates an AABB which contains the specified OBB. static Aabb CreateFromObb(const Obb& obb); diff --git a/Code/Framework/AzCore/AzCore/Math/Aabb.inl b/Code/Framework/AzCore/AzCore/Math/Aabb.inl index 5806857bb1..3ce7b99792 100644 --- a/Code/Framework/AzCore/AzCore/Math/Aabb.inl +++ b/Code/Framework/AzCore/AzCore/Math/Aabb.inl @@ -60,10 +60,10 @@ namespace AZ } - AZ_MATH_INLINE Aabb Aabb::CreatePoints(const Vector3* pts, int numPts) + AZ_MATH_INLINE Aabb Aabb::CreatePoints(const Vector3* pts, size_t numPts) { Aabb aabb = Aabb::CreateFromPoint(pts[0]); - for (int i = 1; i < numPts; ++i) + for (size_t i = 1; i < numPts; ++i) { aabb.AddPoint(pts[i]); } diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp index c6fe112c6f..1c472ef901 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp @@ -71,7 +71,7 @@ namespace AZ if (context.ShouldKeepDefaults() || !defaultValue || (valAsByteStream != *static_cast(defaultValue))) { const auto base64ByteStream = AZ::StringFunc::Base64::Encode(valAsByteStream.data(), valAsByteStream.size()); - outputValue.SetString(base64ByteStream.c_str(), base64ByteStream.size(), context.GetJsonAllocator()); + outputValue.SetString(base64ByteStream.c_str(), static_cast(base64ByteStream.size()), context.GetJsonAllocator()); return context.Report(Tasks::WriteValue, Outcomes::Success, "ByteStream successfully stored."); } diff --git a/Code/Legacy/CryCommon/CryArray.h b/Code/Legacy/CryCommon/CryArray.h index 167f1cfb57..b304df28af 100644 --- a/Code/Legacy/CryCommon/CryArray.h +++ b/Code/Legacy/CryCommon/CryArray.h @@ -11,7 +11,7 @@ #define CRYINCLUDE_CRYCOMMON_CRYARRAY_H #pragma once -#include "CryLegacyAllocator.h" +#include //--------------------------------------------------------------------------- // Convenient iteration macros @@ -675,7 +675,7 @@ namespace NArray I capacity() const { - I aligned_bytes = Align(size() * sizeof(T), sizeof(I)); + I aligned_bytes = static_cast(Align(size() * sizeof(T), sizeof(I))); if (m_nSizeCap & nCAP_BIT) { // Capacity stored in word following data @@ -693,7 +693,7 @@ namespace NArray // Store size, and assert against overflow. assert(s <= c); m_nSizeCap = s; - I aligned_bytes = Align(s * sizeof(T), sizeof(I)); + I aligned_bytes = static_cast(Align(s * sizeof(T), sizeof(I))); if (c * sizeof(T) >= aligned_bytes + sizeof(I)) { // Has extra capacity, more than word-alignment diff --git a/Code/Legacy/CryCommon/CryName.h b/Code/Legacy/CryCommon/CryName.h index 0495ad78f1..ce17d1f540 100644 --- a/Code/Legacy/CryCommon/CryName.h +++ b/Code/Legacy/CryCommon/CryName.h @@ -45,7 +45,7 @@ struct INameTable const char* GetStr() { return (char*)(this + 1); } void AddRef() { nRefCount++; /*InterlockedIncrement(&_header()->nRefCount);*/}; int Release() { return --nRefCount; }; - int GetMemoryUsage() { return sizeof(SNameEntry) + strlen(GetStr()); } + int GetMemoryUsage() { return static_cast(sizeof(SNameEntry) + strlen(GetStr())); } int GetLength(){return nLength; } }; @@ -102,14 +102,14 @@ public: if (!pEntry) { // Create a new entry. - unsigned int nLen = strlen(str); - unsigned int allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char); + size_t nLen = strlen(str); + size_t allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char); pEntry = (SNameEntry*)CryModuleMalloc(allocLen); assert(pEntry != NULL); pEntry->nTag = SNameEntry::TAG; pEntry->nRefCount = 0; - pEntry->nLength = nLen; - pEntry->nAllocSize = allocLen; + pEntry->nLength = static_cast(nLen); + pEntry->nAllocSize = static_cast(allocLen); // Copy string to the end of name entry. char* pEntryStr = const_cast(pEntry->GetStr()); memcpy(pEntryStr, str, nLen + 1); @@ -134,7 +134,7 @@ public: int n = 0; for (it = m_nameMap.begin(); it != m_nameMap.end(); it++) { - nSize += strlen(it->first); + nSize += static_cast(strlen(it->first)); nSize += it->second->GetMemoryUsage(); n++; } @@ -149,7 +149,7 @@ public: } virtual int GetNumberOfEntries() { - return m_nameMap.size(); + return static_cast(m_nameMap.size()); } // Log all names inside CryName table. diff --git a/Code/Legacy/CryCommon/CryPodArray.h b/Code/Legacy/CryCommon/CryPodArray.h index ee36750f7f..20693b29ac 100644 --- a/Code/Legacy/CryCommon/CryPodArray.h +++ b/Code/Legacy/CryCommon/CryPodArray.h @@ -159,8 +159,8 @@ public: return numElements != m_elements.size(); } - ILINE int Count() const { return m_elements.size(); } - ILINE unsigned int Size() const { return m_elements.size(); } + ILINE size_t Count() const { return m_elements.size(); } + ILINE size_t Size() const { return m_elements.size(); } ILINE int IsEmpty() const { return m_elements.empty(); } diff --git a/Code/Legacy/CryCommon/CryString.h b/Code/Legacy/CryCommon/CryString.h index 72469e3dca..459e25b63c 100644 --- a/Code/Legacy/CryCommon/CryString.h +++ b/Code/Legacy/CryCommon/CryString.h @@ -1266,7 +1266,7 @@ inline void CryStringT::resize(size_type nCount, value_type _Ch) } else if (nCount < length()) { - _header()->nLength = nCount; + _header()->nLength = static_cast(nCount); m_str[length()] = 0; // Make null terminated string. } } @@ -1971,7 +1971,7 @@ inline CryStringT& CryStringT::erase(size_type nIndex, size_type nCount) _MakeUnique(); size_type nNumToCopy = length() - (nIndex + nCount) + 1; _move(m_str + nIndex, m_str + nIndex + nCount, nNumToCopy); - _header()->nLength = length() - nCount; + _header()->nLength = static_cast(length() - nCount); } return *this; @@ -2013,7 +2013,7 @@ inline CryStringT& CryStringT::insert(size_type nIndex, size_type nCount, _move(m_str + nIndex + nCount, m_str + nIndex, (nNewLength - nIndex - nCount) + 1); _set(m_str + nIndex, ch, nCount); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); CRY_STRING_DEBUG(m_str) return *this; @@ -2050,7 +2050,7 @@ inline CryStringT& CryStringT::insert(size_type nIndex, const_str pstr, si _move(m_str + nIndex + nInsertLength, m_str + nIndex, (nNewLength - nIndex - nInsertLength + 1)); _copy(m_str + nIndex, pstr, nInsertLength); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[length()] = 0; } CRY_STRING_DEBUG(m_str) @@ -2164,7 +2164,7 @@ inline CryStringT& CryStringT::replace(const_str strOld, const_str strNew) } strStart += _strlen(strStart) + 1; } - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); } CRY_STRING_DEBUG(m_str) @@ -2289,7 +2289,7 @@ inline CryStringT& CryStringT::TrimRight(const value_type* sCharSet) // Just shrink length of the string. size_type nNewLength = (size_type)(str - m_str) + 1; // m_str can change in _MakeUnique _MakeUnique(); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[nNewLength] = 0; } @@ -2317,7 +2317,7 @@ inline CryStringT& CryStringT::TrimRight() // Just shrink length of the string. size_type nNewLength = (size_type)(str - m_str) + 1; // m_str can change in _MakeUnique _MakeUnique(); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[nNewLength] = 0; } @@ -2353,7 +2353,7 @@ inline CryStringT& CryStringT::TrimLeft(const value_type* sCharSet) _MakeUnique(); size_type nNewLength = length() - nOff; _move(m_str, m_str + nOff, nNewLength + 1); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[nNewLength] = 0; } @@ -2376,7 +2376,7 @@ inline CryStringT& CryStringT::TrimLeft() _MakeUnique(); size_type nNewLength = length() - nOff; _move(m_str, m_str + nOff, nNewLength + 1); - _header()->nLength = nNewLength; + _header()->nLength = static_cast(nNewLength); m_str[nNewLength] = 0; } diff --git a/Code/Legacy/CryCommon/IIndexedMesh.h b/Code/Legacy/CryCommon/IIndexedMesh.h index cb19656e35..87c3df98bd 100644 --- a/Code/Legacy/CryCommon/IIndexedMesh.h +++ b/Code/Legacy/CryCommon/IIndexedMesh.h @@ -2094,7 +2094,7 @@ public: { if (activeStreams & (1U << i)) { - nMeshSize += ((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount(); + nMeshSize += static_cast(((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount()); nMeshSize += TARGET_DEFAULT_ALIGN - (nMeshSize & (TARGET_DEFAULT_ALIGN - 1)); } } diff --git a/Code/Legacy/CryCommon/IShader.h b/Code/Legacy/CryCommon/IShader.h index 3a49e4d1ac..d445c21b1d 100644 --- a/Code/Legacy/CryCommon/IShader.h +++ b/Code/Legacy/CryCommon/IShader.h @@ -1426,9 +1426,9 @@ struct STexSamplerFX SAFE_RELEASE(m_pITarget); } - int Size() + size_t Size() { - int nSize = sizeof(*this); + size_t nSize = sizeof(*this); nSize += m_szName.capacity(); nSize += m_szTexture.capacity(); #if SHADER_REFLECT_TEXTURE_SLOTS @@ -1805,9 +1805,9 @@ struct SEfResTexture return m_Ext.m_pTexModifier; } - int Size() const + size_t Size() const { - int nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt); + size_t nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt); nSize += m_Name.size(); nSize += m_Sampler.Size(); nSize += m_Ext.Size(); @@ -1900,9 +1900,9 @@ struct SBaseShaderResources uint8 m_VoxelCoverage; - int Size() const + size_t Size() const { - int nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam); + size_t nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam); return nSize; } @@ -2032,9 +2032,9 @@ struct SInputShaderResources TexturesResourcesMap m_TexturesResourcesMap; // a map of all textures resources used by the shader by name SDeformInfo m_DeformInfo; - int Size() const + size_t Size() const { - int nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size(); + size_t nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size(); nSize += m_TexturePath.size(); nSize += sizeof(SDeformInfo); diff --git a/Code/Legacy/CryCommon/VectorMap.h b/Code/Legacy/CryCommon/VectorMap.h index 0f2b7e57e4..1a42f0e48f 100644 --- a/Code/Legacy/CryCommon/VectorMap.h +++ b/Code/Legacy/CryCommon/VectorMap.h @@ -408,8 +408,7 @@ typename VectorMap::key_compare VectorMap::key_comp() co template typename VectorMap::iterator VectorMap::lower_bound(const key_type& key) { - int count = 0; - count = m_entries.size(); + int count = static_cast(m_entries.size()); iterator first = m_entries.begin(); iterator last = m_entries.end(); for (; 0 < count; ) @@ -432,8 +431,7 @@ typename VectorMap::iterator VectorMap::lower_bound(cons template typename VectorMap::const_iterator VectorMap::lower_bound(const key_type& key) const { - int count = 0; - count = m_entries.size(); + int count = static_cast(m_entries.size()); const_iterator first = m_entries.begin(); const_iterator last = m_entries.end(); for (; 0 < count; ) diff --git a/Code/Legacy/CryCommon/platform.h b/Code/Legacy/CryCommon/platform.h index b3846b88dd..6aad8dd043 100644 --- a/Code/Legacy/CryCommon/platform.h +++ b/Code/Legacy/CryCommon/platform.h @@ -475,8 +475,6 @@ ILINE DestinationType alias_cast(SourceType pPtr) return conv_union.pDst; } -#include "CryLegacyAllocator.h" - ////////////////////////////////////////////////////////////////////////// #ifndef DEPRECATED #define DEPRECATED diff --git a/Code/Legacy/CrySystem/ConsoleBatchFile.cpp b/Code/Legacy/CrySystem/ConsoleBatchFile.cpp index 6e36780ac0..69bbfc281d 100644 --- a/Code/Legacy/CrySystem/ConsoleBatchFile.cpp +++ b/Code/Legacy/CrySystem/ConsoleBatchFile.cpp @@ -112,7 +112,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename) CryLog("%s \"%s\" found in %s ...", szLog, PathUtil::GetFile(filenameLog.c_str()), PathUtil::GetPath(filenameLog).c_str()); } - int nLen = file.GetLength(); + size_t nLen = file.GetLength(); char* sAllText = new char [nLen + 16]; file.ReadRaw(sAllText, nLen); sAllText[nLen] = '\0'; diff --git a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp index e8cc4d484c..ffaf0e7210 100644 --- a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp +++ b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp @@ -161,7 +161,7 @@ struct SLevelNameAutoComplete : public IConsoleArgumentAutoComplete { AZStd::vector levels; - virtual int GetCount() const { return levels.size(); }; + virtual int GetCount() const { return static_cast(levels.size()); }; virtual const char* GetValue(int nIndex) const { return levels[nIndex].c_str(); }; }; // definition and declaration must be separated for devirtualization diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index ce39f08480..38f8ffc5b6 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -479,7 +479,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, if (i == ELOCALIZED_COLUMN_SOUNDMOOD) { const char* pSoundMoodName = pFind + strlen(sLocalizedColumnNames[i]) + 1; - int nSoundMoodNameLength = sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1; + int nSoundMoodNameLength = static_cast(sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1); if (nSoundMoodNameLength > 0) { SoundMoodIndex[nCellIndex] = pSoundMoodName; @@ -490,7 +490,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, if (i == ELOCALIZED_COLUMN_EVENTPARAMETER) { const char* pParameterName = pFind + strlen(sLocalizedColumnNames[i]) + 1; - int nParameterNameLength = sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1; + int nParameterNameLength = static_cast(sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1); if (nParameterNameLength > 0) { EventParameterIndex[nCellIndex] = pParameterName; @@ -622,7 +622,7 @@ bool CLocalizedStringsManager::InitLocalizationData( CRY_ASSERT(m_tagFileNames.size() < 255); - uint8 curNumTags = m_tagFileNames.size(); + uint8 curNumTags = static_cast(m_tagFileNames.size()); m_tagFileNames[sType].filenames = vEntries; m_tagFileNames[sType].id = curNumTags + 1; @@ -757,7 +757,7 @@ bool CLocalizedStringsManager::ReleaseLocalizationDataByTag( bool bVecEntryErased = false; //Then remove the entries in the storage vector - const uint32 numEntries = m_pLanguage->m_vLocalizedStrings.size(); + const int32 numEntries = static_cast(m_pLanguage->m_vLocalizedStrings.size()); for (int32 i = numEntries - 1; i >= 0; i--) { SLocalizedStringEntry* entry = m_pLanguage->m_vLocalizedStrings[i]; @@ -1405,7 +1405,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName, // SoundMood Entries { - pEntry->SoundMoods.resize(SoundMoodValues.size()); + pEntry->SoundMoods.resize(static_cast(SoundMoodValues.size())); if (SoundMoodValues.size() > 0) { std::map::const_iterator itEnd = SoundMoodValues.end(); @@ -1421,7 +1421,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName, // EventParameter Entries { - pEntry->EventParameters.resize(EventParameterValues.size()); + pEntry->EventParameters.resize(static_cast(EventParameterValues.size())); if (EventParameterValues.size() > 0) { std::map::const_iterator itEnd = EventParameterValues.end(); @@ -2196,7 +2196,7 @@ int CLocalizedStringsManager::GetLocalizedStringCount() { return 0; } - return m_pLanguage->m_vLocalizedStrings.size(); + return static_cast(m_pLanguage->m_vLocalizedStrings.size()); } ////////////////////////////////////////////////////////////////////////// @@ -2310,10 +2310,10 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr int maxArgUsed = 0; int lastPos = 0; int curPos = 0; - const int sourceLen = sString.length(); + const int sourceLen = static_cast(sString.length()); while (true) { - int foundPos = sString.find(token, curPos); + int foundPos = static_cast(sString.find(token, curPos)); if (foundPos != string::npos) { if (foundPos + 1 < sourceLen) diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index d2d8495063..96bc29b58a 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -484,7 +484,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo break; } - int bufferlen = sizeof(szBuffer) - prefixSize; + int bufferlen = static_cast(sizeof(szBuffer) - prefixSize); if (bufferlen > 0) { #if defined(AZ_RESTRICTED_PLATFORM) diff --git a/Code/Legacy/CrySystem/SimpleStringPool.h b/Code/Legacy/CrySystem/SimpleStringPool.h index ddeca0f44c..d1a618425c 100644 --- a/Code/Legacy/CrySystem/SimpleStringPool.h +++ b/Code/Legacy/CrySystem/SimpleStringPool.h @@ -216,8 +216,8 @@ public: CryFatalError("Can't replace strings in an xml node that reuses strings"); } - int nStrLen1 = strlen(str1); - int nStrLen2 = strlen(str2); + int nStrLen1 = static_cast(strlen(str1)); + int nStrLen2 = static_cast(strlen(str2)); // undo ptr1 add. if (m_ptr != m_start) diff --git a/Code/Legacy/CrySystem/SystemCFG.cpp b/Code/Legacy/CrySystem/SystemCFG.cpp index 719928384b..4ab203ded1 100644 --- a/Code/Legacy/CrySystem/SystemCFG.cpp +++ b/Code/Legacy/CrySystem/SystemCFG.cpp @@ -285,7 +285,7 @@ public: pos = 1; for (;; ) { - pos = szValue.find_first_of("\\", pos); + pos = static_cast(szValue.find_first_of("\\", pos)); if (pos == string::npos) { @@ -300,7 +300,7 @@ public: pos = 1; for (;; ) { - pos = szValue.find_first_of("\"", pos); + pos = static_cast(szValue.find_first_of("\"", pos)); if (pos == string::npos) { @@ -414,7 +414,7 @@ bool CSystemConfiguration::ParseSystemConfig() INDENT_LOG_DURING_SCOPE(); - int nLen = file.GetLength(); + int nLen = static_cast(file.GetLength()); if (nLen == 0) { CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "Couldn't get length for Config file %s", filename.c_str()); diff --git a/Code/Legacy/CrySystem/ViewSystem/View.cpp b/Code/Legacy/CrySystem/ViewSystem/View.cpp index ef9f2591c4..e6e9f7a984 100644 --- a/Code/Legacy/CrySystem/ViewSystem/View.cpp +++ b/Code/Legacy/CrySystem/ViewSystem/View.cpp @@ -173,7 +173,7 @@ void CView::SetViewShakeEx(const SShakeParams& params) return; } - int shakes(m_shakes.size()); + int shakes = static_cast(m_shakes.size()); SShake* pSetShake(NULL); for (int i = 0; i < shakes; ++i) @@ -250,7 +250,7 @@ void CView::ProcessShaking(float frameTime) m_viewParams.shakingRatio = 0; m_viewParams.groundOnly = false; - int shakes(m_shakes.size()); + int shakes = static_cast(m_shakes.size()); for (int i = 0; i < shakes; ++i) { ProcessShake(&m_shakes[i], frameTime); @@ -556,7 +556,7 @@ void CView::ProcessShakeNormal_DoShaking(SShake* pShake, float frameTime) //------------------------------------------------------------------------ void CView::StopShake(int shakeID) { - uint32 num = m_shakes.size(); + uint32 num = static_cast(m_shakes.size()); for (uint32 i = 0; i < num; ++i) { if (m_shakes[i].ID == shakeID && m_shakes[i].updating) diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index 09b3182c04..a2f3426d5c 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -1341,7 +1341,7 @@ bool CXConsole::ProcessInput(const AzFramework::InputChannel& inputChannel) { if (isCtrlModifierActive) { - m_nScrollLine = m_dqConsoleBuffer.size() - 1; + m_nScrollLine = static_cast(m_dqConsoleBuffer.size() - 1); } else { @@ -1454,7 +1454,7 @@ bool CXConsole::GetLineNo(const int indwLineNo, char* outszBuffer, const int ind ////////////////////////////////////////////////////////////////////////// int CXConsole::GetLineCount() const { - return m_dqConsoleBuffer.size(); + return static_cast(m_dqConsoleBuffer.size()); } ////////////////////////////////////////////////////////////////////////// @@ -2675,7 +2675,7 @@ void CXConsole::RemoveOutputPrintSink(IOutputPrintSink* inpSink) { assert(inpSink); - int nCount = m_OutputSinks.size(); + int nCount = static_cast(m_OutputSinks.size()); for (int i = 0; i < nCount; i++) { @@ -2965,7 +2965,7 @@ bool CXConsole::IsHashCalculated() ////////////////////////////////////////////////////////////////////////// int CXConsole::GetNumCheatVars() { - return m_randomCheckedVariables.size(); + return static_cast(m_randomCheckedVariables.size()); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Legacy/CrySystem/XConsole.h b/Code/Legacy/CrySystem/XConsole.h index eca52771dd..1fee015f22 100644 --- a/Code/Legacy/CrySystem/XConsole.h +++ b/Code/Legacy/CrySystem/XConsole.h @@ -70,7 +70,7 @@ struct CConsoleCommandArgs CConsoleCommandArgs(string& line, std::vector& args) : m_line(line) , m_args(args) {}; - virtual int GetArgCount() const { return m_args.size(); }; + virtual int GetArgCount() const { return static_cast(m_args.size()); }; // Get argument by index, nIndex must be in 0 <= nIndex < GetArgCount() virtual const char* GetArg(int nIndex) const { diff --git a/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp b/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp index 2a532befd3..def45f27de 100644 --- a/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp +++ b/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp @@ -190,8 +190,9 @@ bool SaveArray(const IdTable& idTable, XmlNodeRef& definition, XmlNodeRef& data, } bool needIndex = false; - for (size_t i = 1; i <= numElems; i++) + for (size_t sizei = 1; sizei <= numElems; sizei++) { + const int i = static_cast(sizei); if (!childSource->HaveElemAt(i)) { needIndex = true; diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp index 60e0d2e4f1..1500717ddc 100644 --- a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp +++ b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp @@ -114,26 +114,26 @@ bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node, nTheoreticalPosition += sizeof(header); align(nTheoreticalPosition, nAlignment); - header.nNodeTablePosition = nTheoreticalPosition; + header.nNodeTablePosition = static_cast(nTheoreticalPosition); header.nNodeCount = int(m_nodes.size()); nTheoreticalPosition += header.nNodeCount * sizeof(Node); align(nTheoreticalPosition, nAlignment); - header.nChildTablePosition = nTheoreticalPosition; + header.nChildTablePosition = static_cast(nTheoreticalPosition); header.nChildCount = int(m_childs.size()); nTheoreticalPosition += header.nChildCount * sizeof(NodeIndex); align(nTheoreticalPosition, nAlignment); - header.nAttributeTablePosition = nTheoreticalPosition; + header.nAttributeTablePosition = static_cast(nTheoreticalPosition); header.nAttributeCount = int(m_attributes.size()); nTheoreticalPosition += header.nAttributeCount * sizeof(Attribute); align(nTheoreticalPosition, nAlignment); - header.nStringDataPosition = nTheoreticalPosition; + header.nStringDataPosition = static_cast(nTheoreticalPosition); header.nStringDataSize = m_nStringDataSize; nTheoreticalPosition += header.nStringDataSize; - header.nXMLSize = nTheoreticalPosition; + header.nXMLSize = static_cast(nTheoreticalPosition); // Swap endianness of the data structures if (bNeedSwapEndian) @@ -328,7 +328,7 @@ int XMLBinary::CXMLBinaryWriter::AddString(const XmlString& sString) // We don't have such string yet, so we should add it to the tables. m_strings.push_back(sString); itStringEntry = m_stringMap.insert(StringMap::value_type(sString, m_nStringDataSize)).first; - m_nStringDataSize += sString.length() + 1; + m_nStringDataSize += static_cast(sString.length() + 1); } // Return offset of the string in the string data buffer. diff --git a/Code/Legacy/CrySystem/XML/XmlUtils.cpp b/Code/Legacy/CrySystem/XML/XmlUtils.cpp index 1b341ee99e..16ddc6c992 100644 --- a/Code/Legacy/CrySystem/XML/XmlUtils.cpp +++ b/Code/Legacy/CrySystem/XML/XmlUtils.cpp @@ -91,7 +91,7 @@ XmlNodeRef CXmlUtils::LoadXmlFromFile(const char* sFilename, bool bReuseStrings, XmlNodeRef CXmlUtils::LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings, bool bSuppressWarnings) { XmlParser parser(bReuseStrings); - XmlNodeRef node = parser.ParseBuffer(buffer, size, true, bSuppressWarnings); + XmlNodeRef node = parser.ParseBuffer(buffer, static_cast(size), true, bSuppressWarnings); return node; } @@ -111,7 +111,7 @@ const char* CXmlUtils::HashXml(XmlNodeRef node) static char temp[16]; static const char* hex = "0123456789abcdef"; XmlString str = node->getXML(); - GetMD5(str.data(), str.length(), temp); + GetMD5(str.data(), static_cast(str.length()), temp); for (int i = 0; i < 16; i++) { signature[2 * i + 0] = hex[((uint8)temp[i]) >> 4]; diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index 5761d8a963..0493a64ca8 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -655,7 +655,7 @@ XmlNodeRef CXmlNode::findChild(const char* tag) const if (m_pChilds) { XmlNodes& childs = *m_pChilds; - for (int i = 0, num = childs.size(); i < num; ++i) + for (int i = 0, num = static_cast(childs.size()); i < num; ++i) { if (childs[i]->isTag(tag)) { @@ -690,7 +690,7 @@ void CXmlNode::deleteChild(const char* tag) if (m_pChilds) { XmlNodes& childs = *m_pChilds; - for (int i = 0, num = childs.size(); i < num; ++i) + for (int i = 0, num = static_cast(childs.size()); i < num; ++i) { if (childs[i]->isTag(tag)) { @@ -913,7 +913,7 @@ XmlNodeRef CXmlNode::clone() node->m_pChilds = new XmlNodes; node->m_pChilds->reserve(childs.size()); - for (int i = 0, num = childs.size(); i < num; ++i) + for (int i = 0, num = static_cast(childs.size()); i < num; ++i) { node->addChild(childs[i]->clone()); } @@ -956,7 +956,7 @@ static void AddTabsToString(XmlString& xml, int level) ////////////////////////////////////////////////////////////////////////// bool CXmlNode::IsValidXmlString(const char* str) const { - int len = strlen(str); + int len = static_cast(strlen(str)); { // Prevents invalid characters not from standard ASCII set to propagate to xml. @@ -1432,7 +1432,7 @@ protected: void XmlParserImp::CleanStack() { m_nNodeStackTop = 0; - for (int i = 0, num = m_nodeStack.size(); i < num; i++) + for (int i = 0, num = static_cast(m_nodeStack.size()); i < num; i++) { m_nodeStack[i].node = 0; m_nodeStack[i].childs.resize(0); diff --git a/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp b/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp index 24faf2ccaa..d4ef5b3ba8 100644 --- a/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp +++ b/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp @@ -323,7 +323,7 @@ bool SRemoteServer::ReadBuffer(const char* buffer, int data) } // Advance to the next null terminated string in the buffer - const int currentSize = strnlen(curBuffer, bytesRemaining); + const int currentSize = static_cast(strnlen(curBuffer, bytesRemaining)); bytesRemaining -= currentSize + 1; curBuffer += currentSize + 1; } @@ -466,7 +466,7 @@ void SRemoteClient::FillAutoCompleteList(AZStd::vector& list) AZStd::string item = "map "; const char* levelName = pLevel->GetName(); int start = 0; - for (int k = 0, kend = strlen(levelName); k < kend; ++k) + for (int k = 0, kend = static_cast(strlen(levelName)); k < kend; ++k) { if ((levelName[k] == '\\' || levelName[k] == '/') && k + 1 < kend) { From 909384bd3464842cfca4df152b01bce2cf69319f Mon Sep 17 00:00:00 2001 From: pappeste Date: Wed, 16 Jun 2021 18:08:23 -0700 Subject: [PATCH 06/75] Code/Framework compiling Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzFramework/Tests/OctreeTests.cpp | 6 +++--- .../AzNetworking/TcpTransport/TcpConnection.cpp | 8 ++++---- .../AzNetworking/TcpTransport/TcpRingBuffer.inl | 2 +- .../AzNetworking/UdpTransport/DtlsEndpoint.cpp | 4 ++-- .../AzNetworking/UdpTransport/UdpFragmentQueue.cpp | 6 +++--- .../UdpTransport/UdpNetworkInterface.cpp | 12 ++++++------ .../AzNetworking/UdpTransport/UdpReaderThread.cpp | 2 +- .../AzNetworking/UdpTransport/UdpSocket.cpp | 2 +- .../AzToolsFramework/Application/ToolsApplication.h | 2 +- .../AzToolsFramework/Asset/AssetUtils.cpp | 2 -- .../Prefab/Instance/InstanceToTemplatePropagator.cpp | 2 +- .../Prefab/Instance/InstanceUpdateExecutor.cpp | 2 +- .../AzToolsFramework/Prefab/PrefabPublicHandler.cpp | 6 +++--- .../PythonTerminal/ScriptHelpDialog.cpp | 2 +- .../UI/Outliner/EntityOutlinerListModel.cpp | 2 +- .../UI/PropertyEditor/EntityPropertyEditor.cpp | 12 ++++++------ .../Prefab/Benchmark/PrefabBenchmarkFixture.cpp | 4 ++-- .../Tests/Prefab/PrefabTestDomUtils.h | 4 ++-- 18 files changed, 39 insertions(+), 41 deletions(-) diff --git a/Code/Framework/AzFramework/Tests/OctreeTests.cpp b/Code/Framework/AzFramework/Tests/OctreeTests.cpp index 3faf98adfb..f248dbfa66 100644 --- a/Code/Framework/AzFramework/Tests/OctreeTests.cpp +++ b/Code/Framework/AzFramework/Tests/OctreeTests.cpp @@ -98,7 +98,7 @@ namespace UnitTest // If an entry is removed from the octree as an unintended side effect of updating an existing entry, // GetEntryCount can't be relied upon to report the actual entry count. // So manually count the entries when using the entry count for validation. - uint32_t manualEntryCount = 0; + size_t manualEntryCount = 0; visScene->EnumerateNoCull([&manualEntryCount](const AzFramework::IVisibilityScene::NodeData& nodeData) { manualEntryCount += nodeData.m_entries.size(); }); EXPECT_EQ(manualEntryCount, expectedEntryCount); @@ -409,7 +409,7 @@ namespace UnitTest } // Expect all the entries to be in the scene - ValidateEntryCountEqualsExpectedCount(m_octreeScene, visEntries.size()); + ValidateEntryCountEqualsExpectedCount(m_octreeScene, static_cast(visEntries.size())); // Update them, without making any actual changes for (AzFramework::VisibilityEntry& entry : visEntries) @@ -418,6 +418,6 @@ namespace UnitTest } // Expect all the entries to be in the scene - ValidateEntryCountEqualsExpectedCount(m_octreeScene, visEntries.size()); + ValidateEntryCountEqualsExpectedCount(m_octreeScene, static_cast(visEntries.size())); } } diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpConnection.cpp b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpConnection.cpp index 1beb83e19f..6d7358a425 100644 --- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpConnection.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpConnection.cpp @@ -170,7 +170,7 @@ namespace AzNetworking } timeoutItem->UpdateTimeoutTime(startTimeMs); - NetworkOutputSerializer serializer(buffer.GetBuffer(), buffer.GetSize()); + NetworkOutputSerializer serializer(buffer.GetBuffer(), static_cast(buffer.GetSize())); if (m_state == ConnectionState::Connecting) { const ConnectResult connectResult = m_networkInterface.GetConnectionListener().ValidateConnect(GetRemoteAddress(), header, serializer); @@ -198,7 +198,7 @@ namespace AzNetworking { TcpPacketEncodingBuffer buffer; { - NetworkInputSerializer serializer(buffer.GetBuffer(), buffer.GetCapacity()); + NetworkInputSerializer serializer(buffer.GetBuffer(), static_cast(buffer.GetCapacity())); if (!const_cast(packet).Serialize(serializer)) { AZ_Assert(false, "SendReliablePacket: Unable to serialize packet [Type: %d]", packet.GetPacketType()); @@ -272,7 +272,7 @@ namespace AzNetworking { TcpPacketHeader header(packetType, aznumeric_cast(payloadBuffer.GetSize())); header.SetPacketFlag(PacketFlag::Compressed, shouldCompress); - NetworkInputSerializer serializer(headerBuffer.GetBuffer(), headerBuffer.GetCapacity()); + NetworkInputSerializer serializer(headerBuffer.GetBuffer(), static_cast(headerBuffer.GetCapacity())); if (!header.Serialize(serializer)) { return false; @@ -313,7 +313,7 @@ namespace AzNetworking m_networkInterface.GetMetrics().m_sendBytesCompressedDelta += (payloadSize - compressionMemBytesUsed); writeBuffer.Resize(aznumeric_cast(compressionMemBytesUsed)); - payloadSize = writeBuffer.GetSize(); + payloadSize = static_cast(writeBuffer.GetSize()); srcData = writeBuffer.GetBuffer(); } diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpRingBuffer.inl b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpRingBuffer.inl index 322a4e6abf..9c4b2f1a17 100644 --- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpRingBuffer.inl +++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpRingBuffer.inl @@ -12,7 +12,7 @@ namespace AzNetworking { template inline TcpRingBuffer::TcpRingBuffer() - : m_impl(m_buffer.data(), m_buffer.size()) + : m_impl(m_buffer.data(), static_cast(m_buffer.size())) { ; } diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsEndpoint.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsEndpoint.cpp index 37c952cf30..bd5e62983f 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsEndpoint.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsEndpoint.cpp @@ -84,7 +84,7 @@ namespace AzNetworking if (dtlsData.GetSize() > 0) { const uint8_t* encryptedData = dtlsData.GetBuffer(); - const uint32_t encryptedSize = dtlsData.GetSize(); + const uint32_t encryptedSize = static_cast(dtlsData.GetSize()); BIO_write(m_readBio, encryptedData, encryptedSize); } DtlsEndpoint::HandshakeState prevState = m_state; @@ -196,7 +196,7 @@ namespace AzNetworking // Need to do this... connection negotiation may have left data in the write bio that we need to send out if (BIO_ctrl_pending(m_writeBio) > 0) { - const uint32_t maxBufferSize = outHandshakeData.GetCapacity(); + const uint32_t maxBufferSize = static_cast(outHandshakeData.GetCapacity()); outHandshakeData.Resize(maxBufferSize); const int32_t dataSize = BIO_read(m_writeBio, outHandshakeData.GetBuffer(), maxBufferSize); outHandshakeData.Resize(dataSize); diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp index 831c35552c..66fe6f30eb 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp @@ -108,7 +108,7 @@ namespace AzNetworking return true; } - totalPacketSize += packetFragments[index]->GetChunkBuffer().GetSize(); + totalPacketSize += static_cast(packetFragments[index]->GetChunkBuffer().GetSize()); } // We now mark this sequence as delivered, so if by some chance all the individual chunks get redelivered again we don't double deliver the reconstructed packet @@ -125,7 +125,7 @@ namespace AzNetworking uint8_t* bufferPointer = buffer.GetBuffer(); for (uint32_t index = 0; index < packetFragments.size(); ++index) { - const uint32_t chunkSize = packetFragments[index]->GetChunkBuffer().GetSize(); + const uint32_t chunkSize = static_cast(packetFragments[index]->GetChunkBuffer().GetSize()); memcpy(bufferPointer, packetFragments[index]->GetChunkBuffer().GetBuffer(), chunkSize); bufferPointer += chunkSize; } @@ -133,7 +133,7 @@ namespace AzNetworking // We can erase all the chunks now, packet is completed m_packetFragments.erase(fragmentSequence); - NetworkOutputSerializer networkSerializer(buffer.GetBuffer(), buffer.GetSize()); + NetworkOutputSerializer networkSerializer(buffer.GetBuffer(), static_cast(buffer.GetSize())); { ISerializer& networkISerializer = networkSerializer; // To get the default typeinfo parameters in ISerializer diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp index a3ddb856d2..e3ab11c117 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp @@ -249,7 +249,7 @@ namespace AzNetworking continue; } decodedPacketData = m_decompressBuffer.GetBuffer(); - decodedPacketSize = m_decompressBuffer.GetSize(); + decodedPacketSize = static_cast(m_decompressBuffer.GetSize()); } GetMetrics().m_recvBytesUncompressed += decodedPacketSize; @@ -494,7 +494,7 @@ namespace AzNetworking { buffer.Resize(buffer.GetCapacity()); - NetworkInputSerializer networkSerializer(buffer.GetBuffer(), buffer.GetCapacity()); + NetworkInputSerializer networkSerializer(buffer.GetBuffer(), static_cast(buffer.GetCapacity())); ISerializer& serializer = networkSerializer; // To get the default typeinfo parameters in ISerializer if (!header.SerializePacketFlags(serializer)) @@ -517,7 +517,7 @@ namespace AzNetworking buffer.Resize(serializer.GetSize()); } - uint32_t packetSize = buffer.GetSize(); + uint32_t packetSize = static_cast(buffer.GetSize()); uint8_t* packetData = buffer.GetBuffer(); // If the packet doesn't fit within our MTU (minus potential SSL encryption overhead), break it up @@ -549,7 +549,7 @@ namespace AzNetworking UdpPacketEncodingBuffer writeBuffer; if (m_compressor && shouldCompress) { - NetworkInputSerializer flagSerializer(writeBuffer.GetBuffer(), writeBuffer.GetCapacity()); + NetworkInputSerializer flagSerializer(writeBuffer.GetBuffer(), static_cast(writeBuffer.GetCapacity())); ISerializer& serializer = flagSerializer; // To get the default typeinfo parameters in ISerializer header.SetPacketFlag(PacketFlag::Compressed, true); @@ -562,7 +562,7 @@ namespace AzNetworking AZ_Assert(flagSize == 1, "Flag bitfield should serialize to one byte"); // Compress the packet, make sure to offset by the size of the flag which is now serialized - const uint32_t payloadSize = buffer.GetSize() - flagSize; + const uint32_t payloadSize = static_cast(buffer.GetSize() - flagSize); uint8_t* payload = buffer.GetBuffer() + flagSize; const AZStd::size_t maxSizeNeeded = m_compressor->GetMaxCompressedBufferSize(payloadSize); AZStd::size_t compressionMemBytesUsed = 0; @@ -578,7 +578,7 @@ namespace AzNetworking if (compressionMemBytesUsed < payloadSize) { writeBuffer.Resize(aznumeric_cast(flagSize + compressionMemBytesUsed)); - packetSize = writeBuffer.GetSize(); + packetSize = static_cast(writeBuffer.GetSize()); packetData = writeBuffer.GetBuffer(); // Track byte delta caused by compression GetMetrics().m_sendBytesCompressedDelta += (packetSize - compressionMemBytesUsed); diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpReaderThread.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpReaderThread.cpp index 8b535e01aa..b1474bc10f 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpReaderThread.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpReaderThread.cpp @@ -177,7 +177,7 @@ namespace AzNetworking } IpAddress address; - const uint32_t bufferHead = receiveBuffer.GetSize(); + const uint32_t bufferHead = static_cast(receiveBuffer.GetSize()); if (bufferHead + MaxUdpTransmissionUnit >= receiveBuffer.GetCapacity()) { AZLOG_INFO("Receive buffer full, leaving data on the socket. Size exceeded by %d", diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp index 29a99f96a1..997fc323a9 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp @@ -241,7 +241,7 @@ namespace AzNetworking #ifdef ENABLE_LATENCY_DEBUG int32_t UdpSocket::SendInternalDeferred(const DeferredData& data) const { - return SendInternal(data.m_address, data.m_dataBuffer.GetBuffer(), data.m_dataBuffer.GetSize(), data.m_encrypt, *data.m_dtlsEndpoint); + return SendInternal(data.m_address, data.m_dataBuffer.GetBuffer(), static_cast(data.m_dataBuffer.GetSize()), data.m_encrypt, *data.m_dtlsEndpoint); } #endif } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.h index e95b306d43..e7fa543faf 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.h @@ -98,7 +98,7 @@ namespace AzToolsFramework SourceControlFileInfo GetSceneSourceControlInfo() override; bool AreAnyEntitiesSelected() override { return !m_selectedEntities.empty(); } - int GetSelectedEntitiesCount() override { return m_selectedEntities.size(); } + int GetSelectedEntitiesCount() override { return static_cast(m_selectedEntities.size()); } const EntityIdList& GetSelectedEntities() override { return m_selectedEntities; } const EntityIdList& GetHighlightedEntities() override { return m_highlightedEntities; } void SetSelectedEntities(const EntityIdList& selectedEntities) override; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp index 69ee4e6188..92c8d37540 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp @@ -34,8 +34,6 @@ namespace AzToolsFramework::AssetUtils::Internal return {}; } - const int pathLen = sourceFolder.length() + 1; - AZ::IO::Path sourceWildcard{ sourceFolder }; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp index c7bf72ff7b..d51630cd86 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp @@ -164,7 +164,7 @@ namespace AzToolsFramework AZStd::string path = prefix + pathIter->value.GetString(); - pathIter->value.SetString(path.c_str(), path.length(), providedPatch.GetAllocator()); + pathIter->value.SetString(path.c_str(), static_cast(path.length()), providedPatch.GetAllocator()); } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp index 1c389f6b97..9ef74167a6 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp @@ -97,7 +97,7 @@ namespace AzToolsFramework m_updatingTemplateInstancesInQueue = true; const int instanceCountToUpdateInBatch = - m_instanceCountToUpdateInBatch == 0 ? m_instancesUpdateQueue.size() : m_instanceCountToUpdateInBatch; + m_instanceCountToUpdateInBatch == 0 ? static_cast(m_instancesUpdateQueue.size()) : m_instanceCountToUpdateInBatch; TemplateId currentTemplateId = InvalidTemplateId; TemplateReference currentTemplateReference = AZStd::nullopt; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index 16db933192..fdefe5900a 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -1445,7 +1445,7 @@ namespace AzToolsFramework if (&owningInstance->get() == &commonRootEntityOwningInstance) { // If it's the same instance, we can add this entity to the new instance entities. - int priorEntitiesSize = entities.size(); + size_t priorEntitiesSize = entities.size(); entities.insert(entity); @@ -1624,7 +1624,7 @@ namespace AzToolsFramework entityDomAfter.Parse(newEntityDomString.toUtf8().constData()); // Add the new Entity DOM to the Entities member of the instance - rapidjson::Value aliasName(newEntityAlias.c_str(), newEntityAlias.length(), domToAddDuplicatedEntitiesUnder.GetAllocator()); + rapidjson::Value aliasName(newEntityAlias.c_str(), static_cast(newEntityAlias.length()), domToAddDuplicatedEntitiesUnder.GetAllocator()); entitiesIter->value.AddMember(AZStd::move(aliasName), entityDomAfter, domToAddDuplicatedEntitiesUnder.GetAllocator()); } @@ -1696,7 +1696,7 @@ namespace AzToolsFramework nestedInstanceDomAfter.Parse(newInstanceDomString.toUtf8().constData()); // Add the new Instance DOM to the Instances member of the instance - rapidjson::Value aliasName(newInstanceAlias.c_str(), newInstanceAlias.length(), domToAddDuplicatedInstancesUnder.GetAllocator()); + rapidjson::Value aliasName(newInstanceAlias.c_str(), static_cast(newInstanceAlias.length()), domToAddDuplicatedInstancesUnder.GetAllocator()); instancesIter->value.AddMember(AZStd::move(aliasName), nestedInstanceDomAfter, domToAddDuplicatedInstancesUnder.GetAllocator()); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/PythonTerminal/ScriptHelpDialog.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/PythonTerminal/ScriptHelpDialog.cpp index 0a2fbb14f6..ea13d368cd 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/PythonTerminal/ScriptHelpDialog.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/PythonTerminal/ScriptHelpDialog.cpp @@ -251,7 +251,7 @@ namespace AzToolsFramework { EditorPythonConsoleInterface::GlobalFunctionCollection globalFunctionCollection; editorPythonConsoleInterface->GetGlobalFunctionList(globalFunctionCollection); - m_items.reserve(globalFunctionCollection.size()); + m_items.reserve(static_cast(globalFunctionCollection.size())); for (const EditorPythonConsoleInterface::GlobalFunction& globalFunction : globalFunctionCollection) { Item item; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp index 30b3f8915b..4115fe409e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp @@ -247,7 +247,7 @@ namespace AzToolsFramework if (highlightTextIndex >= 0) { const QString BACKGROUND_COLOR{ "#707070" }; - label.insert(highlightTextIndex + m_filterString.length(), ""); + label.insert(highlightTextIndex + static_cast(m_filterString.length()), ""); label.insert(highlightTextIndex, ""); } } while(highlightTextIndex > 0); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp index 17155076ec..f166e85ff9 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp @@ -2643,22 +2643,22 @@ namespace AzToolsFramework m_gui->m_statusComboBox->setItalic(false); if (allActive) { - m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[StatusTypeToIndex(StatusType::StatusStartActive)]); - m_gui->m_statusComboBox->setCurrentIndex(StatusTypeToIndex(StatusType::StatusStartActive)); + m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[static_cast(StatusTypeToIndex(StatusType::StatusStartActive))]); + m_gui->m_statusComboBox->setCurrentIndex(static_cast(StatusTypeToIndex(StatusType::StatusStartActive))); m_comboItems[StatusTypeToIndex(StatusType::StatusStartActive)]->setCheckState(Qt::Checked); } else if (allInactive) { - m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[StatusTypeToIndex(StatusType::StatusStartInactive)]); - m_gui->m_statusComboBox->setCurrentIndex(StatusTypeToIndex(StatusType::StatusStartInactive)); + m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[static_cast(StatusTypeToIndex(StatusType::StatusStartInactive))]); + m_gui->m_statusComboBox->setCurrentIndex(static_cast(StatusTypeToIndex(StatusType::StatusStartInactive))); m_comboItems[StatusTypeToIndex(StatusType::StatusStartInactive)]->setCheckState(Qt::Checked); } else if (allEditorOnly) { - m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[StatusTypeToIndex(StatusType::StatusEditorOnly)]); - m_gui->m_statusComboBox->setCurrentIndex(StatusTypeToIndex(StatusType::StatusEditorOnly)); + m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[static_cast(StatusTypeToIndex(StatusType::StatusEditorOnly))]); + m_gui->m_statusComboBox->setCurrentIndex(static_cast(StatusTypeToIndex(StatusType::StatusEditorOnly))); m_comboItems[StatusTypeToIndex(StatusType::StatusEditorOnly)]->setCheckState(Qt::Checked); } else // Some marked active, some not diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabBenchmarkFixture.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabBenchmarkFixture.cpp index 51a044e9c1..7e47fa9569 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabBenchmarkFixture.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabBenchmarkFixture.cpp @@ -110,8 +110,8 @@ namespace Benchmark void BM_Prefab::SetUpMockValidatorForReadPrefab() { - int pathCount = m_paths.size(); - for (int number = 0; number < pathCount; ++number) + const size_t pathCount = m_paths.size(); + for (size_t number = 0; number < pathCount; ++number) { m_mockIOActionValidator->ReadPrefabDom( m_paths[number], UnitTest::PrefabTestDomUtils::CreatePrefabDom()); diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.h b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.h index 66ad2fbe44..f90a91ea3c 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.h +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.h @@ -38,7 +38,7 @@ namespace UnitTest const EntityAlias& entityAlias) { return GetPrefabDomEntitiesPath() - .Append(entityAlias.c_str(), entityAlias.length()); + .Append(entityAlias.c_str(), static_cast(entityAlias.length())); }; inline PrefabDomPath GetPrefabDomEntityNamePath( @@ -62,7 +62,7 @@ namespace UnitTest inline PrefabDomPath GetPrefabDomInstancePath( const InstanceAlias& instanceAlias) { - return GetPrefabDomInstancesPath().Append(instanceAlias.c_str(), instanceAlias.length()); + return GetPrefabDomInstancesPath().Append(instanceAlias.c_str(), static_cast(instanceAlias.length())); }; inline PrefabDomPath GetPrefabDomInstancePath( From 5e863f810dbaf5f98e4dd789f3c907213bdeed1d Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 09:31:15 -0700 Subject: [PATCH 07/75] some physx fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/PhysX/Code/Source/Material.cpp | 6 +++--- Gems/PhysX/Code/Source/Scene/PhysXScene.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gems/PhysX/Code/Source/Material.cpp b/Gems/PhysX/Code/Source/Material.cpp index be9e6385a1..813f86de0b 100644 --- a/Gems/PhysX/Code/Source/Material.cpp +++ b/Gems/PhysX/Code/Source/Material.cpp @@ -420,14 +420,14 @@ namespace PhysX if (physicsMaterialNameFromPhysicsAsset.empty() || physicsMaterialNameFromPhysicsAsset == Physics::DefaultPhysicsMaterialLabel) { - materialSelection.SetMaterialId(Physics::MaterialId(), slotIndex); + materialSelection.SetMaterialId(Physics::MaterialId(), static_cast(slotIndex)); continue; } if (auto it = FindOrCreateMaterial(physicsMaterialNameFromPhysicsAsset); it != m_materials.end()) { - materialSelection.SetMaterialId(Physics::MaterialId::FromUUID(it->first), slotIndex); + materialSelection.SetMaterialId(Physics::MaterialId::FromUUID(it->first), static_cast(slotIndex)); } else { @@ -435,7 +435,7 @@ namespace PhysX "UpdateMaterialSelectionFromPhysicsAsset: Physics material '%s' not found in the material library. Mesh material '%s' will use the default physics material.", physicsMaterialNameFromPhysicsAsset.c_str(), meshAsset->m_assetData.m_materialNames[slotIndex].c_str()); - materialSelection.SetMaterialId(Physics::MaterialId(), slotIndex); + materialSelection.SetMaterialId(Physics::MaterialId(), static_cast(slotIndex)); } } } diff --git a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp index b57f8c0fef..b6486995c0 100644 --- a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp +++ b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp @@ -680,7 +680,7 @@ namespace PhysX if (m_freeSceneSlots.empty()) { m_simulatedBodies.emplace_back(newBodyCrc, newBody); - index = m_simulatedBodies.size() - 1; + index = static_cast(m_simulatedBodies.size() - 1); } else { From 82ba53dee34f091a59b33d8daa222176c52635f0 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 16:45:18 -0700 Subject: [PATCH 08/75] AssetMemoryAnalyzer Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/AssetMemoryAnalyzer/Code/Source/DebugImGUI.cpp | 4 ++-- Gems/AssetMemoryAnalyzer/Code/Source/ExportJSON.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gems/AssetMemoryAnalyzer/Code/Source/DebugImGUI.cpp b/Gems/AssetMemoryAnalyzer/Code/Source/DebugImGUI.cpp index 6e9fe1855c..aecac5fa34 100644 --- a/Gems/AssetMemoryAnalyzer/Code/Source/DebugImGUI.cpp +++ b/Gems/AssetMemoryAnalyzer/Code/Source/DebugImGUI.cpp @@ -201,13 +201,13 @@ namespace AssetMemoryAnalyzer { case AllocationCategories::HEAP: ImGui::Text(FormatUtils::FormatCodePoint(*ap->m_codePoint)); - heapSummary.m_allocationCount = ap->m_allocations.size(); + heapSummary.m_allocationCount = static_cast(ap->m_allocations.size()); heapSummary.m_allocatedMemory = ap->m_totalAllocatedMemory; break; case AllocationCategories::VRAM: ImGui::Text("%s", ap->m_codePoint->m_file); - vramSummary.m_allocationCount = ap->m_allocations.size(); + vramSummary.m_allocationCount = static_cast(ap->m_allocations.size()); vramSummary.m_allocatedMemory = ap->m_totalAllocatedMemory; break; } diff --git a/Gems/AssetMemoryAnalyzer/Code/Source/ExportJSON.cpp b/Gems/AssetMemoryAnalyzer/Code/Source/ExportJSON.cpp index 20a6089323..9f75e62454 100644 --- a/Gems/AssetMemoryAnalyzer/Code/Source/ExportJSON.cpp +++ b/Gems/AssetMemoryAnalyzer/Code/Source/ExportJSON.cpp @@ -78,7 +78,7 @@ namespace AssetMemoryAnalyzer writer.StartObject(); writer.Key("id"); - writer.Int(idCounter++); + writer.Int(static_cast(idCounter++)); writer.Key("label"); writer.String(asset.m_id ? asset.m_id : "Root"); @@ -98,7 +98,7 @@ namespace AssetMemoryAnalyzer { writer.StartObject(); writer.Key("id"); - writer.Int(idCounter++); + writer.Int(static_cast(idCounter++)); writer.Key("label"); writer.String(""); @@ -119,7 +119,7 @@ namespace AssetMemoryAnalyzer writer.StartObject(); writer.Key("id"); - writer.Int(idCounter++); + writer.Int(static_cast(idCounter++)); writer.Key("label"); @@ -127,13 +127,13 @@ namespace AssetMemoryAnalyzer { case AllocationCategories::HEAP: writer.String(FormatUtils::FormatCodePoint(*ap.m_codePoint)); - heapSummary.m_allocationCount = ap.m_allocations.size(); + heapSummary.m_allocationCount = static_cast(ap.m_allocations.size()); heapSummary.m_allocatedMemory = ap.m_totalAllocatedMemory; break; case AllocationCategories::VRAM: writer.String(ap.m_codePoint->m_file); - vramSummary.m_allocationCount = ap.m_allocations.size(); + vramSummary.m_allocationCount = static_cast(ap.m_allocations.size()); vramSummary.m_allocatedMemory = ap.m_totalAllocatedMemory; break; } From 97f9ac870dee4199fd9069ff6fe78d9a60816f7e Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 16:45:42 -0700 Subject: [PATCH 09/75] =?UTF-8?q?=EF=BB=BFAtom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../CoreLights/PolygonLightFeatureProcessor.cpp | 2 +- .../Code/Source/FrameCaptureSystemComponent.cpp | 2 +- .../MorphTargets/MorphTargetDispatchItem.cpp | 2 +- .../Shadows/ProjectedShadowFeatureProcessor.cpp | 4 ++-- .../SkinnedMesh/SkinnedMeshInputBuffers.cpp | 2 +- .../Common/Code/Tests/SparseVectorTests.cpp | 8 ++++---- .../Code/Source/RHI/ShaderResourceGroupData.cpp | 4 ++-- .../Code/Source/RHI/ShaderResourceGroupPool.cpp | 4 ++-- .../Code/Source/RHI/RayTracingPipelineState.cpp | 4 ++-- .../Model/ModelAssetBuilderComponent.cpp | 16 ++++++++-------- .../RPI.Builders/Model/MorphTargetExporter.cpp | 6 +++--- Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp | 2 +- Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp | 8 ++++---- .../Code/Source/Window/MaterialEditorWindow.cpp | 2 +- 14 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/PolygonLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/PolygonLightFeatureProcessor.cpp index b1456f82fe..089adf4621 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/PolygonLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/PolygonLightFeatureProcessor.cpp @@ -145,7 +145,7 @@ namespace AZ::Render // individual point as its own element instead of each array being its own element. Since all // the arrays are stored in a contiguous vector, we can treat it as one giant array. const LightPosition* firstPosition = m_polygonLightData.GetDataVector<1>().at(0).data(); - m_lightPolygonPointBufferHandler.UpdateBuffer(firstPosition, m_polygonLightData.GetDataCount() * MaxPolygonPoints); + m_lightPolygonPointBufferHandler.UpdateBuffer(firstPosition, static_cast(m_polygonLightData.GetDataCount() * MaxPolygonPoints)); } m_deviceBufferNeedsUpdate = false; } diff --git a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp index 96041dc89d..4b1a6ec7f6 100644 --- a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp @@ -65,7 +65,7 @@ namespace AZ AZ::JobCompletion jobCompletion; const int numThreads = 8; - const int numPixelsPerThread = buffer->size() / numChannels / numThreads; + const int numPixelsPerThread = static_cast(buffer->size() / numChannels / numThreads); for (int i = 0; i < numThreads; ++i) { int startPixel = i * numPixelsPerThread; diff --git a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp index 71f17b3361..0f8a30d8aa 100644 --- a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp @@ -162,7 +162,7 @@ namespace AZ m_rootConstantData.SetConstant(colorOffsetIndex, m_morphInstanceMetaData.m_accumulatedColorDeltaOffsetInBytes / 4); } - m_dispatchItem.m_rootConstantSize = m_rootConstantData.GetConstantData().size(); + m_dispatchItem.m_rootConstantSize = static_cast(m_rootConstantData.GetConstantData().size()); m_dispatchItem.m_rootConstants = m_rootConstantData.GetConstantData().data(); } diff --git a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp index 03ee176fd0..5a25951163 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp @@ -497,7 +497,7 @@ namespace AZ::Render const ShadowmapAtlas& atlas = m_projectedShadowmapsPasses.front()->GetShadowmapAtlas(); const Data::Instance indexTableBuffer = atlas.CreateShadowmapIndexTableBuffer(indexTableBufferName); - m_filterParamBufferHandler.UpdateBuffer(m_shadowData.GetRawData(), m_shadowData.GetSize()); + m_filterParamBufferHandler.UpdateBuffer(m_shadowData.GetRawData(), static_cast(m_shadowData.GetSize())); // Set index table buffer and ESM parameter buffer to ESM pass. for (EsmShadowmapsPass* esmPass : m_esmShadowmapsPasses) @@ -564,7 +564,7 @@ namespace AZ::Render if (m_deviceBufferNeedsUpdate) { - m_shadowBufferHandler.UpdateBuffer(m_shadowData.GetRawData(), m_shadowData.GetSize()); + m_shadowBufferHandler.UpdateBuffer(m_shadowData.GetRawData(), static_cast(m_shadowData.GetSize())); m_deviceBufferNeedsUpdate = false; } } diff --git a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp index 155b751272..f0b1658885 100644 --- a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp @@ -446,7 +446,7 @@ namespace AZ // Positions start at the beginning of the allocation instanceMetaData.m_accumulatedPositionDeltaOffsetInBytes = allocation->GetVirtualAddress().m_ptr; - uint32_t deltaStreamSizeInBytes = vertexCount * MorphTargetConstants::s_unpackedMorphTargetDeltaSizeInBytes; + uint32_t deltaStreamSizeInBytes = static_cast(vertexCount * MorphTargetConstants::s_unpackedMorphTargetDeltaSizeInBytes); // Followed by normals, tangents, and bitangents instanceMetaData.m_accumulatedNormalDeltaOffsetInBytes = instanceMetaData.m_accumulatedPositionDeltaOffsetInBytes + deltaStreamSizeInBytes; diff --git a/Gems/Atom/Feature/Common/Code/Tests/SparseVectorTests.cpp b/Gems/Atom/Feature/Common/Code/Tests/SparseVectorTests.cpp index 0a31fe4c9e..e3f3ea906b 100644 --- a/Gems/Atom/Feature/Common/Code/Tests/SparseVectorTests.cpp +++ b/Gems/Atom/Feature/Common/Code/Tests/SparseVectorTests.cpp @@ -81,7 +81,7 @@ namespace UnitTest EXPECT_EQ(data.c, TestData::DefaultValueC); // Assign new unique values - data.a = TestData::DefaultValueA * i; + data.a = TestData::DefaultValueA * static_cast(i); data.b = TestData::DefaultValueB * float(i); data.c = i % 2 == 0; } @@ -190,12 +190,12 @@ namespace UnitTest EXPECT_EQ(data.b, TestData::DefaultValueB); EXPECT_EQ(data.c, TestData::DefaultValueC); - data.a = TestData::DefaultValueA * i; + data.a = TestData::DefaultValueA * static_cast(i); data.b = TestData::DefaultValueB * float(i); data.c = i % 2 == 0; // Assign some values to the uninitialized primitive types - container.GetElement<1>(indices[i]) = i * 10; + container.GetElement<1>(indices[i]) = static_cast(i * 10); container.GetElement<2>(indices[i]) = i * 20.0f; } @@ -254,7 +254,7 @@ namespace UnitTest { indices[i] = container.Reserve(); - container.GetElement<1>(i) = i * 10; + container.GetElement<1>(i) = static_cast(i * 10); container.GetElement<2>(i) = i * 20.0f; } diff --git a/Gems/Atom/RHI/Code/Source/RHI/ShaderResourceGroupData.cpp b/Gems/Atom/RHI/Code/Source/RHI/ShaderResourceGroupData.cpp index 7461a7c3e8..a9e08249c4 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/ShaderResourceGroupData.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/ShaderResourceGroupData.cpp @@ -139,7 +139,7 @@ namespace AZ bool isValidAll = true; for (size_t i = 0; i < imageViews.size(); ++i) { - const bool isValid = ValidateImageViewAccess(inputIndex, imageViews[i], i); + const bool isValid = ValidateImageViewAccess(inputIndex, imageViews[i], static_cast(i)); if (isValid) { m_imageViewsUnboundedArray.push_back(imageViews[i]); @@ -185,7 +185,7 @@ namespace AZ bool isValidAll = true; for (size_t i = 0; i < bufferViews.size(); ++i) { - const bool isValid = ValidateBufferViewAccess(inputIndex, bufferViews[i], i); + const bool isValid = ValidateBufferViewAccess(inputIndex, bufferViews[i], static_cast(i)); if (isValid) { m_bufferViewsUnboundedArray.push_back(bufferViews[i]); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/ShaderResourceGroupPool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/ShaderResourceGroupPool.cpp index 7437c3b339..d51fdd3495 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/ShaderResourceGroupPool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/ShaderResourceGroupPool.cpp @@ -356,7 +356,7 @@ namespace AZ if (!bufferViews.empty()) { - group.m_unboundedDescriptorTables[tableIndex] = m_descriptorContext->CreateDescriptorTable(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, bufferViews.size()); + group.m_unboundedDescriptorTables[tableIndex] = m_descriptorContext->CreateDescriptorTable(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, static_cast(bufferViews.size())); AZ_Assert(group.m_unboundedDescriptorTables[tableIndex].IsValid(), "Descriptor context failed to allocate unbounded array descriptor table, most likely out of memory."); ShaderResourceGroupCompiledData& compiledData = group.m_compiledData[group.m_compiledDataIndex]; @@ -415,7 +415,7 @@ namespace AZ if (!imageViews.empty()) { - group.m_unboundedDescriptorTables[tableIndex] = m_descriptorContext->CreateDescriptorTable(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, imageViews.size()); + group.m_unboundedDescriptorTables[tableIndex] = m_descriptorContext->CreateDescriptorTable(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, static_cast(imageViews.size())); AZ_Assert(group.m_unboundedDescriptorTables[tableIndex].IsValid(), "Descriptor context failed to allocate unbounded array descriptor table, most likely out of memory."); ShaderResourceGroupCompiledData& compiledData = group.m_compiledData[group.m_compiledDataIndex]; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RayTracingPipelineState.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RayTracingPipelineState.cpp index b4c153a38c..33623f93e4 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RayTracingPipelineState.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RayTracingPipelineState.cpp @@ -163,9 +163,9 @@ namespace AZ createInfo.sType = VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR; createInfo.pNext = nullptr; createInfo.flags = 0; - createInfo.stageCount = stages.size(); + createInfo.stageCount = static_cast(stages.size()); createInfo.pStages = stages.data(); - createInfo.groupCount = groups.size(); + createInfo.groupCount = static_cast(groups.size()); createInfo.pGroups = groups.data(); createInfo.maxPipelineRayRecursionDepth = descriptor->GetConfiguration().m_maxRecursionDepth; createInfo.layout = m_pipelineLayout; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp index aa2ad37647..d61d5340b0 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp @@ -883,7 +883,7 @@ namespace AZ processedMorphTargets = true; } - totalVertexCount += vertexCount; + totalVertexCount += static_cast(vertexCount); productMeshList.emplace_back(productMesh); } } @@ -961,7 +961,7 @@ namespace AZ for (const auto& skinData : sourceMesh.m_skinData) { const size_t numJoints = skinData->GetBoneCount(); - const AZ::u32 controlPointIndex = sourceMeshData->GetControlPointIndex(vertexIndex); + const AZ::u32 controlPointIndex = sourceMeshData->GetControlPointIndex(static_cast(vertexIndex)); const size_t numSkinInfluences = skinData->GetLinkCount(controlPointIndex); size_t numInfluencesExcess = 0; @@ -1196,15 +1196,15 @@ namespace AZ mesh.m_skinWeights.size(), m_numSkinJointInfluencesPerVertex, m_numSkinJointInfluencesPerVertex); const size_t numSkinInfluences = mesh.m_skinWeights.size(); - uint32_t jointIndicesSizeInBytes = numSkinInfluences * sizeof(uint16_t); + uint32_t jointIndicesSizeInBytes = static_cast(numSkinInfluences * sizeof(uint16_t)); meshView.m_skinJointIndicesView = RHI::BufferViewDescriptor::CreateRaw(0, jointIndicesSizeInBytes); - meshView.m_skinWeightsView = RHI::BufferViewDescriptor::CreateTyped(0, numSkinInfluences, SkinWeightFormat); + meshView.m_skinWeightsView = RHI::BufferViewDescriptor::CreateTyped(0, static_cast(numSkinInfluences), SkinWeightFormat); } if (!mesh.m_morphTargetVertexData.empty()) { const size_t numTotalVertices = mesh.m_morphTargetVertexData.size(); - meshView.m_morphTargetVertexDataView = RHI::BufferViewDescriptor::CreateStructured(0, numTotalVertices, sizeof(PackedCompressedMorphTargetDelta)); + meshView.m_morphTargetVertexDataView = RHI::BufferViewDescriptor::CreateStructured(0, static_cast(numTotalVertices), sizeof(PackedCompressedMorphTargetDelta)); } if (!mesh.m_clothData.empty()) @@ -1359,8 +1359,8 @@ namespace AZ const size_t numPrevSkinInfluences = lodBufferInfo.m_skinInfluencesCount; const size_t numNewSkinInfluences = mesh.m_skinWeights.size(); - meshView.m_skinJointIndicesView = RHI::BufferViewDescriptor::CreateRaw(/*byteOffset=*/numPrevSkinInfluences * sizeof(uint16_t), numNewSkinInfluences * sizeof(uint16_t)); - meshView.m_skinWeightsView = RHI::BufferViewDescriptor::CreateTyped(/*elementOffset=*/numPrevSkinInfluences, numNewSkinInfluences, SkinWeightFormat); + meshView.m_skinJointIndicesView = RHI::BufferViewDescriptor::CreateRaw(/*byteOffset=*/ static_cast(numPrevSkinInfluences * sizeof(uint16_t)), static_cast(numNewSkinInfluences * sizeof(uint16_t))); + meshView.m_skinWeightsView = RHI::BufferViewDescriptor::CreateTyped(/*elementOffset=*/ static_cast(numPrevSkinInfluences), static_cast(numNewSkinInfluences), SkinWeightFormat); lodBufferInfo.m_skinInfluencesCount += numNewSkinInfluences; } @@ -1370,7 +1370,7 @@ namespace AZ const size_t numPrevVertexDeltas = lodBufferInfo.m_morphTargetVertexDeltaCount; const size_t numNewVertexDeltas = mesh.m_morphTargetVertexData.size(); - meshView.m_morphTargetVertexDataView = RHI::BufferViewDescriptor::CreateStructured(/*elementOffset=*/numPrevVertexDeltas, numNewVertexDeltas, sizeof(PackedCompressedMorphTargetDelta)); + meshView.m_morphTargetVertexDataView = RHI::BufferViewDescriptor::CreateStructured(/*elementOffset=*/ static_cast(numPrevVertexDeltas), static_cast(numNewVertexDeltas), sizeof(PackedCompressedMorphTargetDelta)); lodBufferInfo.m_morphTargetVertexDeltaCount += numNewVertexDeltas; } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp index fefe835ee9..0a1fb49ab5 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp @@ -110,8 +110,8 @@ namespace AZ::RPI { AZ::Aabb meshAabb = AZ::Aabb::CreateNull(); - const size_t numVertices = mesh.m_meshData->GetVertexCount(); - for (size_t i = 0; i < numVertices; ++i) + const unsigned int numVertices = static_cast(mesh.m_meshData->GetVertexCount()); + for (unsigned int i = 0; i < numVertices; ++i) { meshAabb.AddPoint(mesh.m_meshData->GetPosition(i)); } @@ -164,7 +164,7 @@ namespace AZ::RPI blendShapeName.c_str(), numVertices, sourceMesh.m_meshData->GetVertexCount()); // The start index is after any previously added deltas - metaData.m_startIndex = aznumeric_caster(packedCompressedMorphTargetVertexData.size()); + metaData.m_startIndex = aznumeric_cast(packedCompressedMorphTargetVertexData.size()); // Multiply normal by inverse transpose to avoid incorrect values produced by non-uniformly scaled transforms. diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp index bc700dd24f..6b16ca6498 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp @@ -780,7 +780,7 @@ namespace AZ pipelineStateList.push_back(); pipelineStateList[size].m_multisampleState = rasterPass->GetMultisampleState(); pipelineStateList[size].m_renderAttachmentConfiguration = rasterPass->GetRenderAttachmentConfiguration(); - rasterPass->SetPipelineStateDataIndex(size); + rasterPass->SetPipelineStateDataIndex(static_cast(size)); } } } diff --git a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp index cdf0d0166d..ce774709f3 100644 --- a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp @@ -1025,23 +1025,23 @@ namespace UnitTest ); { - AZ::Data::Asset indexBuffer = BuildTestBuffer(indicesCount, sizeof(uint32_t)); + AZ::Data::Asset indexBuffer = BuildTestBuffer(static_cast(indicesCount), sizeof(uint32_t)); AZStd::copy(indices, indices + indicesCount, reinterpret_cast(const_cast(indexBuffer->GetBuffer().data()))); lodCreator.SetMeshIndexBuffer({ indexBuffer, - AZ::RHI::BufferViewDescriptor::CreateStructured(0, indicesCount, sizeof(uint32_t)) + AZ::RHI::BufferViewDescriptor::CreateStructured(0, static_cast(indicesCount), sizeof(uint32_t)) }); } { - AZ::Data::Asset positionBuffer = BuildTestBuffer(positionCount / 3, sizeof(float) * 3); + AZ::Data::Asset positionBuffer = BuildTestBuffer(static_cast(positionCount / 3), sizeof(float) * 3); AZStd::copy(positions, positions + positionCount, reinterpret_cast(const_cast(positionBuffer->GetBuffer().data()))); lodCreator.AddMeshStreamBuffer( AZ::RHI::ShaderSemantic(AZ::Name("POSITION")), AZ::Name(), { positionBuffer, - AZ::RHI::BufferViewDescriptor::CreateStructured(0, positionCount / 3, sizeof(float) * 3) + AZ::RHI::BufferViewDescriptor::CreateStructured(0, static_cast(positionCount / 3), sizeof(float) * 3) } ); } diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp index abb0102de6..47f2127405 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp @@ -144,7 +144,7 @@ namespace MaterialEditor if (!windowSettings->m_mainWindowState.empty()) { - QByteArray windowState(windowSettings->m_mainWindowState.data(), windowSettings->m_mainWindowState.size()); + QByteArray windowState(windowSettings->m_mainWindowState.data(), static_cast(windowSettings->m_mainWindowState.size())); m_advancedDockManager->restoreState(windowState); } From eb2da69e6e6220179aba693edb06b69814a05579 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 16:46:04 -0700 Subject: [PATCH 10/75] AtomLyIntegration Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- ...AssetCollectionAsyncLoaderTestComponent.cpp | 2 +- .../AtomFont/Code/Source/FFont.cpp | 18 +++++++++--------- ...AtomViewportDisplayIconsSystemComponent.cpp | 2 +- .../Source/CoreLights/PolygonLightDelegate.cpp | 2 +- .../Code/Source/Mesh/EditorMeshComponent.cpp | 2 +- .../Source/Mesh/MeshComponentController.cpp | 4 ++-- .../EMotionFXAtom/Code/Source/ActorAsset.cpp | 10 +++++----- .../Code/Source/AtomActorInstance.cpp | 10 +++++----- .../ImguiAtom/Code/Source/DebugConsole.cpp | 2 +- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Gems/AtomLyIntegration/AtomBridge/Code/Source/Editor/AssetCollectionAsyncLoaderTestComponent.cpp b/Gems/AtomLyIntegration/AtomBridge/Code/Source/Editor/AssetCollectionAsyncLoaderTestComponent.cpp index 08f3d8cf9e..b51e3b0e29 100644 --- a/Gems/AtomLyIntegration/AtomBridge/Code/Source/Editor/AssetCollectionAsyncLoaderTestComponent.cpp +++ b/Gems/AtomLyIntegration/AtomBridge/Code/Source/Editor/AssetCollectionAsyncLoaderTestComponent.cpp @@ -238,7 +238,7 @@ namespace AZ uint32_t AssetCollectionAsyncLoaderTestComponent::GetCountOfPendingAssets() const { - return m_pendingAssets.size(); + return static_cast(m_pendingAssets.size()); } bool AssetCollectionAsyncLoaderTestComponent::ValidateAssetWasLoaded(const AZStd::string& assetPath) const diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp index c07717945a..421a757b04 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp @@ -331,7 +331,7 @@ void AZ::FFont::DrawStringUInternal( m_vertexBuffer[vertexOffset + 3].color.dcolor = packedColor; m_vertexBuffer[vertexOffset + 3].st = tc3; - uint16_t startingIndex = vertexOffset - startingVertexCount; + uint16_t startingIndex = static_cast(vertexOffset - startingVertexCount); m_indexBuffer[indexOffset + 0] = startingIndex + 0; m_indexBuffer[indexOffset + 1] = startingIndex + 1; m_indexBuffer[indexOffset + 2] = startingIndex + 2; @@ -697,12 +697,12 @@ uint32_t AZ::FFont::WriteTextQuadsToBuffers(SVF_P2F_C4B_T2F_F4B* verts, uint16_t vertexData[vertexOffset + 3].texIndex2 = 0; vertexData[vertexOffset + 3].pad = 0; - indexData[indexOffset + 0] = vertexOffset + 0; - indexData[indexOffset + 1] = vertexOffset + 1; - indexData[indexOffset + 2] = vertexOffset + 2; - indexData[indexOffset + 3] = vertexOffset + 2; - indexData[indexOffset + 4] = vertexOffset + 3; - indexData[indexOffset + 5] = vertexOffset + 0; + indexData[indexOffset + 0] = static_cast(vertexOffset + 0); + indexData[indexOffset + 1] = static_cast(vertexOffset + 1); + indexData[indexOffset + 2] = static_cast(vertexOffset + 2); + indexData[indexOffset + 3] = static_cast(vertexOffset + 2); + indexData[indexOffset + 4] = static_cast(vertexOffset + 3); + indexData[indexOffset + 5] = static_cast(vertexOffset + 0); vertexOffset += 4; indexOffset += 6; @@ -1331,7 +1331,7 @@ unsigned int AZ::FFont::GetEffectId(const char* effectName) const { if (!strcmp(m_effects[i].m_name.c_str(), effectName)) { - return i; + return static_cast(i); } } } @@ -1341,7 +1341,7 @@ unsigned int AZ::FFont::GetEffectId(const char* effectName) const unsigned int AZ::FFont::GetNumEffects() const { - return m_effects.size(); + return static_cast(m_effects.size()); } const char* AZ::FFont::GetEffectName(unsigned int effectId) const diff --git a/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.cpp b/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.cpp index 62d673f9eb..6ea6a8e85f 100644 --- a/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.cpp +++ b/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.cpp @@ -207,7 +207,7 @@ namespace AZ::Render createVertex(-0.5f, 0.5f, 0.f, 1.f) }; AZStd::array indices = {0, 1, 2, 0, 2, 3}; - dynamicDraw->DrawIndexed(&vertices, vertices.size(), &indices, indices.size(), RHI::IndexFormat::Uint16, drawSrg); + dynamicDraw->DrawIndexed(&vertices, static_cast(vertices.size()), &indices, static_cast(indices.size()), RHI::IndexFormat::Uint16, drawSrg); } QString AtomViewportDisplayIconsSystemComponent::FindAssetPath(const QString& path) const diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/PolygonLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/PolygonLightDelegate.cpp index a001b5a453..7715dfde4f 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/PolygonLightDelegate.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/PolygonLightDelegate.cpp @@ -54,7 +54,7 @@ namespace AZ { transformedVertices.push_back(transform.TransformPoint(Vector3(vertex.GetX(), vertex.GetY(), 0.0f))); } - GetFeatureProcessor()->SetPolygonPoints(GetLightHandle(), transformedVertices.data(), transformedVertices.size(), GetTransform().GetBasisZ()); + GetFeatureProcessor()->SetPolygonPoints(GetLightHandle(), transformedVertices.data(), static_cast(transformedVertices.size()), GetTransform().GetBasisZ()); } } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/EditorMeshComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/EditorMeshComponent.cpp index fc62690cc4..4b3322c442 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/EditorMeshComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/EditorMeshComponent.cpp @@ -213,7 +213,7 @@ namespace AZ { EditorMeshStatsForLod stats; const auto& meshes = lodAsset->GetMeshes(); - stats.m_meshCount = meshes.size(); + stats.m_meshCount = static_cast(meshes.size()); for (const auto& mesh : meshes) { stats.m_vertCount += mesh.GetVertexCount(); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp index 29bd9a839b..2c57c10f4d 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp @@ -58,7 +58,7 @@ namespace AZ { if (m_modelAsset.IsReady()) { - lodCount = m_modelAsset->GetLodCount(); + lodCount = static_cast(m_modelAsset->GetLodCount()); } else { @@ -66,7 +66,7 @@ namespace AZ Data::Instance model = Data::InstanceDatabase::Instance().Find(Data::InstanceId::CreateFromAssetId(m_modelAsset.GetId())); if (model) { - lodCount = model->GetLodCount(); + lodCount = static_cast(model->GetLodCount()); } } } diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp index 3143191135..259fd0a6a9 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp @@ -212,7 +212,7 @@ namespace AZ for (uint32_t vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) { const uint32_t originalVertex = sourceOriginalVertex[vertexIndex + vertexStart]; - const uint32_t influenceCount = AZStd::GetMin(MaxSupportedSkinInfluences, sourceSkinningInfo->GetNumInfluences(originalVertex)); + const uint32_t influenceCount = AZStd::GetMin(MaxSupportedSkinInfluences, static_cast(sourceSkinningInfo->GetNumInfluences(originalVertex))); uint32_t influenceIndex = 0; float weightError = 1.0f; @@ -379,7 +379,7 @@ namespace AZ size_t skinnedMeshSubmeshIndex = 0; for (size_t jointIndex = 0; jointIndex < numJoints; ++jointIndex) { - const EMotionFX::Mesh* mesh = actor->GetMesh(lodIndex, jointIndex); + const EMotionFX::Mesh* mesh = actor->GetMesh(static_cast(lodIndex), static_cast(jointIndex)); if (!mesh || mesh->GetIsCollisionMesh()) { continue; @@ -405,7 +405,7 @@ namespace AZ for (size_t subMeshIndex = 0; subMeshIndex < numSubMeshes; ++subMeshIndex) { - const EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(subMeshIndex); + const EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(static_cast(subMeshIndex)); const size_t vertexCount = subMesh->GetNumVertices(); // Skip empty sub-meshes and sub-meshes that would put the total vertex count beyond the supported range @@ -509,7 +509,7 @@ namespace AZ if (morphBufferAssetView) { - ProcessMorphsForLod(actor, morphBufferAssetView->GetBufferAsset(), lodIndex, fullFileName, skinnedMeshLod); + ProcessMorphsForLod(actor, morphBufferAssetView->GetBufferAsset(), static_cast(lodIndex), fullFileName, skinnedMeshLod); } // Set colors after morphs are set, so that we know whether or not they are dynamic (if they exist) @@ -594,7 +594,7 @@ namespace AZ descriptor.m_bufferData = boneTransforms.data(); descriptor.m_bufferName = AZStd::string::format("BoneTransformBuffer_%s", actorInstance->GetActor()->GetName()); descriptor.m_byteCount = boneTransforms.size() * sizeof(float); - descriptor.m_elementSize = floatsPerBone * sizeof(float); + descriptor.m_elementSize = static_cast(floatsPerBone * sizeof(float)); descriptor.m_poolType = RPI::CommonBufferPoolType::ReadOnly; return RPI::BufferSystemInterface::Get()->CreateBufferFromCommonPool(descriptor); } diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp index 4c6045d7ce..6d3d78baa9 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp @@ -163,7 +163,7 @@ namespace AZ const AZ::Color skeletonColor(0.604f, 0.804f, 0.196f, 1.0f); RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; lineArgs.m_verts = m_auxVertices.data(); - lineArgs.m_vertCount = m_auxVertices.size(); + lineArgs.m_vertCount = static_cast(m_auxVertices.size()); lineArgs.m_colors = &skeletonColor; lineArgs.m_colorCount = 1; lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; @@ -204,9 +204,9 @@ namespace AZ RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; lineArgs.m_verts = m_auxVertices.data(); - lineArgs.m_vertCount = m_auxVertices.size(); + lineArgs.m_vertCount = static_cast(m_auxVertices.size()); lineArgs.m_colors = m_auxColors.data(); - lineArgs.m_colorCount = m_auxColors.size(); + lineArgs.m_colorCount = static_cast(m_auxColors.size()); lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; auxGeom->DrawLines(lineArgs); } @@ -786,7 +786,7 @@ namespace AZ for (size_t lodIndex = 0; lodIndex < m_skinnedMeshInputBuffers->GetLodCount(); ++lodIndex) { - EMotionFX::MorphSetup* morphSetup = actor->GetMorphSetup(lodIndex); + EMotionFX::MorphSetup* morphSetup = actor->GetMorphSetup(static_cast(lodIndex)); if (morphSetup) { const AZStd::vector& metaDatas = actor->GetMorphTargetMetaAsset()->GetMorphTargets(); @@ -836,7 +836,7 @@ namespace AZ // Set the weights for any active masks for (size_t i = 0; i < m_wrinkleMaskWeights.size(); ++i) { - wrinkleMaskObjectSrg->SetConstant(wrinkleMaskWeightsIndex, m_wrinkleMaskWeights[i], i); + wrinkleMaskObjectSrg->SetConstant(wrinkleMaskWeightsIndex, m_wrinkleMaskWeights[i], static_cast(i)); } AZ_Error("AtomActorInstance", m_wrinkleMaskWeights.size() <= s_maxActiveWrinkleMasks, "The skinning shader supports no more than %d active morph targets with wrinkle masks.", s_maxActiveWrinkleMasks); } diff --git a/Gems/AtomLyIntegration/ImguiAtom/Code/Source/DebugConsole.cpp b/Gems/AtomLyIntegration/ImguiAtom/Code/Source/DebugConsole.cpp index 73e0a61ad2..e47c8ba071 100644 --- a/Gems/AtomLyIntegration/ImguiAtom/Code/Source/DebugConsole.cpp +++ b/Gems/AtomLyIntegration/ImguiAtom/Code/Source/DebugConsole.cpp @@ -230,7 +230,7 @@ namespace AZ void DebugConsole::BrowseInputHistory(ImGuiInputTextCallbackData* data) { const int previousHistoryIndex = m_currentHistoryIndex; - const int maxHistoryIndex = m_textInputHistory.size() - 1; + const int maxHistoryIndex = static_cast(m_textInputHistory.size() - 1); switch (data->EventKey) { // Browse backwards through the history. From 2c11569df2d712fe8337923eac11d75d9c6fb92b Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 16:51:45 -0700 Subject: [PATCH 11/75] =?UTF-8?q?=EF=BB=BFAWSCore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/AWSCore/Code/Include/Public/Framework/ServiceJobUtil.h | 3 +-- Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJob.h | 2 +- Gems/AWSCore/Code/Source/Framework/JsonObjectHandler.cpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobUtil.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobUtil.h index e9c30566cd..ad160303f7 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobUtil.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobUtil.h @@ -43,8 +43,7 @@ namespace AWSCore if (urlSections.size() > ExpectedUrlSections) { - int i; - i = urlSections[ExpectedUrlSections - 1].find('.'); + int i = static_cast(urlSections[ExpectedUrlSections - 1].find('.')); if (i != -1) { // Handle APIGateway URLs with custom domains: diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJob.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJob.h index 20b94d6e1a..cd0686c2d0 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJob.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJob.h @@ -391,7 +391,7 @@ namespace AWSCore int offset = 0; while (offset < message.size()) { - int count = (offset + MAX_MESSAGE_LENGTH < message.size()) ? MAX_MESSAGE_LENGTH : message.size() - offset; + int count = static_cast((offset + MAX_MESSAGE_LENGTH < message.size()) ? MAX_MESSAGE_LENGTH : message.size() - offset); AZ_Warning(ServiceClientJobType::COMPONENT_DISPLAY_NAME, false, message.substr(offset, count).c_str()); offset += MAX_MESSAGE_LENGTH; } diff --git a/Gems/AWSCore/Code/Source/Framework/JsonObjectHandler.cpp b/Gems/AWSCore/Code/Source/Framework/JsonObjectHandler.cpp index 71fe0fc221..d041a97428 100644 --- a/Gems/AWSCore/Code/Source/Framework/JsonObjectHandler.cpp +++ b/Gems/AWSCore/Code/Source/Framework/JsonObjectHandler.cpp @@ -443,7 +443,7 @@ namespace AWSCore msg += AZStd::string::format(" at character %zu: ", result.Offset()); const int snippet_size = 40; - int start = result.Offset() - snippet_size / 2; + int start = static_cast(result.Offset() - snippet_size / 2); int length = snippet_size; int offset = snippet_size / 2; if (start < 0) { From 9b84f84d9c83b124f028eda0684db93d89ccadd1 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 16:52:06 -0700 Subject: [PATCH 12/75] AWSMetrics Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/AWSMetrics/Code/Source/MetricsEvent.cpp | 2 +- Gems/AWSMetrics/Code/Source/MetricsManager.cpp | 2 +- Gems/AWSMetrics/Code/Source/MetricsQueue.cpp | 4 ++-- Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp | 2 +- Gems/AWSMetrics/Code/Tests/MetricsQueueTest.cpp | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gems/AWSMetrics/Code/Source/MetricsEvent.cpp b/Gems/AWSMetrics/Code/Source/MetricsEvent.cpp index d787cf0bfb..e23c97a5fe 100644 --- a/Gems/AWSMetrics/Code/Source/MetricsEvent.cpp +++ b/Gems/AWSMetrics/Code/Source/MetricsEvent.cpp @@ -58,7 +58,7 @@ namespace AWSMetrics int MetricsEvent::GetNumAttributes() const { - return m_attributes.size(); + return static_cast(m_attributes.size()); } size_t MetricsEvent::GetSizeInBytes() const diff --git a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp index 680c946b37..025ebe212c 100644 --- a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp +++ b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp @@ -256,7 +256,7 @@ namespace AWSMetrics } m_globalStats.m_numSuccesses++; - m_globalStats.m_sendSizeInBytes += metricsEvent.GetSizeInBytes(); + m_globalStats.m_sendSizeInBytes += static_cast::value_type>(metricsEvent.GetSizeInBytes()); } else { diff --git a/Gems/AWSMetrics/Code/Source/MetricsQueue.cpp b/Gems/AWSMetrics/Code/Source/MetricsQueue.cpp index cd22bce5e0..ab54fb9e3e 100644 --- a/Gems/AWSMetrics/Code/Source/MetricsQueue.cpp +++ b/Gems/AWSMetrics/Code/Source/MetricsQueue.cpp @@ -134,7 +134,7 @@ namespace AWSMetrics int MetricsQueue::GetNumMetrics() const { - return m_metrics.size(); + return static_cast(m_metrics.size()); } size_t MetricsQueue::GetSizeInBytes() const @@ -175,7 +175,7 @@ namespace AWSMetrics MetricsEvent& curEvent = m_metrics.front(); curNum += 1; - curSizeInBytes += curEvent.GetSizeInBytes(); + curSizeInBytes += static_cast(curEvent.GetSizeInBytes()); if (curNum <= maxBatchedRecordsCount && curSizeInBytes <= maxPayloadSizeInBytes) { m_sizeSerializedToJson -= curEvent.GetSizeInBytes(); diff --git a/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp b/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp index 149f23ccf2..2d9990ad1e 100644 --- a/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp +++ b/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp @@ -452,7 +452,7 @@ namespace AWSMetrics EXPECT_EQ(stats.m_numErrors, MaxNumMetricsEvents / 2); EXPECT_EQ(stats.m_numDropped, 0); - int metricsEventSize = sizeof(AwsMetricsAttributeKeyEventName) - 1 + strlen(AttrValue); + int metricsEventSize = static_cast(sizeof(AwsMetricsAttributeKeyEventName) - 1 + strlen(AttrValue)); EXPECT_EQ(stats.m_sendSizeInBytes, metricsEventSize * MaxNumMetricsEvents / 2); ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), MaxNumMetricsEvents / 2); diff --git a/Gems/AWSMetrics/Code/Tests/MetricsQueueTest.cpp b/Gems/AWSMetrics/Code/Tests/MetricsQueueTest.cpp index cc05a60798..85a9d8a4a7 100644 --- a/Gems/AWSMetrics/Code/Tests/MetricsQueueTest.cpp +++ b/Gems/AWSMetrics/Code/Tests/MetricsQueueTest.cpp @@ -124,7 +124,7 @@ namespace AWSMetrics queue.AddMetrics(metrics); } - int maxCapacity = queue[0].GetSizeInBytes() * NumTestMetrics / 2; + int maxCapacity = static_cast(queue[0].GetSizeInBytes() * NumTestMetrics / 2); ASSERT_EQ(queue.FilterMetricsByPriority(maxCapacity), NumTestMetrics / 2); ASSERT_EQ(queue.GetNumMetrics(), NumTestMetrics / 2); @@ -230,7 +230,7 @@ namespace AWSMetrics { MetricsEvent metrics; metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue)); - int sizeOfEachMetrics = metrics.GetSizeInBytes(); + int sizeOfEachMetrics = static_cast(metrics.GetSizeInBytes()); MetricsQueue queue; queue.AddMetrics(metrics); From b67882a82f7efe2c4cb029d356c8802063058fd2 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 17:11:07 -0700 Subject: [PATCH 13/75] Blast Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/Blast/Code/Tests/Mocks/BlastMocks.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/Blast/Code/Tests/Mocks/BlastMocks.h b/Gems/Blast/Code/Tests/Mocks/BlastMocks.h index 6975573a73..0733862e25 100644 --- a/Gems/Blast/Code/Tests/Mocks/BlastMocks.h +++ b/Gems/Blast/Code/Tests/Mocks/BlastMocks.h @@ -68,7 +68,7 @@ namespace Blast uint32_t getChunkCount() const override { - return m_chunks.size(); + return static_cast(m_chunks.size()); } const Nv::Blast::ExtPxChunk* getChunks() const override @@ -78,7 +78,7 @@ namespace Blast uint32_t getSubchunkCount() const override { - return m_subchunks.size(); + return static_cast(m_subchunks.size()); } const Nv::Blast::ExtPxSubchunk* getSubchunks() const override From 150f37cb6be25b2546eb6c38d990bac42713df61 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 17:11:23 -0700 Subject: [PATCH 14/75] EMotionFX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../EMotionFX/Code/EMotionFX/Source/Actor.cpp | 40 +++++++++---------- .../EMotionFX/Source/DualQuatSkinDeformer.cpp | 2 +- .../Source/KeyTrackLinearDynamic.inl | 6 +-- Gems/EMotionFX/Code/EMotionFX/Source/Mesh.cpp | 6 +-- .../SkinningInfoVertexAttributeLayer.cpp | 2 +- .../Source/AnimGraph/GameControllerWindow.cpp | 20 +++++----- .../Source/KeyboardShortcutManager.cpp | 2 +- .../Components/AnimGraphComponent.cpp | 28 ++++++------- .../Tests/AnimGraphNodeEventFilterTests.cpp | 2 +- .../Tests/AnimGraphNodeProcessingTests.cpp | 2 +- .../Tests/AnimGraphReferenceNodeTests.cpp | 4 +- .../Editor/ParametersGroupDefaultValues.cpp | 2 +- .../Code/Tests/UI/CanAddMotionToMotionSet.cpp | 4 +- .../Code/Tests/UI/CanEditParameters.cpp | 2 +- .../Tests/UI/CanRemoveMotionFromMotionSet.cpp | 8 ++-- 15 files changed, 65 insertions(+), 65 deletions(-) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp index 56d08760c3..f419c56a6a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp @@ -192,7 +192,7 @@ namespace EMotionFX const size_t numLodLevels = m_meshLodData.m_lodLevels.size(); MeshLODData& resultMeshLodData = result->m_meshLodData; - result->SetNumLODLevels(numLodLevels); + result->SetNumLODLevels(static_cast(numLodLevels)); for (size_t lodLevel = 0; lodLevel < numLodLevels; ++lodLevel) { const MCore::Array& nodeInfos = m_meshLodData.m_lodLevels[lodLevel].mNodeInfos; @@ -319,10 +319,10 @@ namespace EMotionFX // get the number of nodes, iterate through them, create a new LOD level and copy over the meshes from the last LOD level for (size_t i = 0; i < numNodes; ++i) { - NodeLODInfo& newLODInfo = lodLevels[lodIndex].mNodeInfos[i]; + NodeLODInfo& newLODInfo = lodLevels[lodIndex].mNodeInfos[static_cast(i)]; if (copyFromLastLODLevel && lodIndex > 0) { - const NodeLODInfo& prevLODInfo = lodLevels[lodIndex - 1].mNodeInfos[i]; + const NodeLODInfo& prevLODInfo = lodLevels[lodIndex - 1].mNodeInfos[static_cast(i)]; newLODInfo.mMesh = (prevLODInfo.mMesh) ? prevLODInfo.mMesh->Clone() : nullptr; newLODInfo.mStack = (prevLODInfo.mStack) ? prevLODInfo.mStack->Clone(newLODInfo.mMesh) : nullptr; } @@ -334,8 +334,8 @@ namespace EMotionFX } // create a new material array for the new LOD level - mMaterials.Resize(lodLevels.size()); - mMaterials[lodIndex].SetMemoryCategory(EMFX_MEMCATEGORY_ACTORS); + mMaterials.Resize(static_cast(lodLevels.size())); + mMaterials[static_cast(lodIndex)].SetMemoryCategory(EMFX_MEMCATEGORY_ACTORS); // create an empty morph setup for the new LOD level mMorphSetups.Add(nullptr); @@ -343,7 +343,7 @@ namespace EMotionFX // copy data from the previous LOD level if wanted if (copyFromLastLODLevel && numLODs > 0) { - CopyLODLevel(this, lodIndex - 1, numLODs - 1, true); + CopyLODLevel(this, static_cast(lodIndex - 1), static_cast(numLODs - 1), true); } } @@ -1209,7 +1209,7 @@ namespace EMotionFX Node* node = mSkeleton->GetNode(n); // check if this node has a mesh, if not we can skip it - Mesh* mesh = GetMesh(geomLod, n); + Mesh* mesh = GetMesh(static_cast(geomLod), n); if (mesh == nullptr) { continue; @@ -1245,10 +1245,10 @@ namespace EMotionFX { // if the bone is disabled SkinInfluence* influence = layer->GetInfluence(orgVertex, i); - if (mSkeleton->GetNode(influence->GetNodeNr())->GetSkeletalLODStatus(geomLod) == false) + if (mSkeleton->GetNode(influence->GetNodeNr())->GetSkeletalLODStatus(static_cast(geomLod)) == false) { // find the first parent bone that is enabled in this LOD - const uint32 newNodeIndex = FindFirstActiveParentBone(geomLod, influence->GetNodeNr()); + const uint32 newNodeIndex = FindFirstActiveParentBone(static_cast(geomLod), influence->GetNodeNr()); if (newNodeIndex == MCORE_INVALIDINDEX32) { MCore::LogWarning("EMotionFX::Actor::MakeGeomLODsCompatibleWithSkeletalLODs() - Failed to find an enabled parent for node '%s' in skeletal LOD %d of actor '%s' (0x%x)", node->GetName(), geomLod, GetFileName(), this); @@ -1273,10 +1273,10 @@ namespace EMotionFX } // for all submeshes // reinit the mesh deformer stacks - MeshDeformerStack* stack = GetMeshDeformerStack(geomLod, node->GetNodeIndex()); + MeshDeformerStack* stack = GetMeshDeformerStack(static_cast(geomLod), node->GetNodeIndex()); if (stack) { - stack->ReinitializeDeformers(this, node, geomLod); + stack->ReinitializeDeformers(this, node, static_cast(geomLod)); } } // for all nodes } @@ -1519,7 +1519,7 @@ namespace EMotionFX { // Optional, not all actors have morph targets. const size_t numLODLevels = m_meshAsset->GetLodAssets().size(); - mMorphSetups.Resize(numLODLevels); + mMorphSetups.Resize(static_cast(numLODLevels)); for (AZ::u32 i = 0; i < numLODLevels; ++i) { mMorphSetups[i] = nullptr; @@ -1588,7 +1588,7 @@ namespace EMotionFX const uint32 orgVertex = orgVertices[startVertex + vertexIndex]; // for all skinning influences of the vertex - const uint32 numInfluences = layer->GetNumInfluences(orgVertex); + const uint32 numInfluences = static_cast(layer->GetNumInfluences(orgVertex)); float maxWeight = 0.0f; uint32 maxWeightNodeIndex = 0; for (uint32 i = 0; i < numInfluences; ++i) @@ -2786,13 +2786,13 @@ namespace EMotionFX const size_t numLODLevels = lodAssets.size(); lodLevels.clear(); - SetNumLODLevels(numLODLevels, /*adjustMorphSetup=*/false); + SetNumLODLevels(static_cast(numLODLevels), /*adjustMorphSetup=*/false); const uint32 numNodes = mSkeleton->GetNumNodes(); // Remove all the materials and add them back based on the meshAsset. Eventually we will remove all the material from Actor and // GLActor. RemoveAllMaterials(); - mMaterials.Resize(numLODLevels); + mMaterials.Resize(static_cast(numLODLevels)); for (size_t lodLevel = 0; lodLevel < numLODLevels; ++lodLevel) { @@ -2845,19 +2845,19 @@ namespace EMotionFX DualQuatSkinDeformer* skinDeformer = DualQuatSkinDeformer::Create(mesh); jointInfo.mStack->AddDeformer(skinDeformer); skinDeformer->ReserveLocalBones(numLocalJoints); - skinDeformer->Reinitialize(this, meshJoint, lodLevel); + skinDeformer->Reinitialize(this, meshJoint, static_cast(lodLevel)); } else { SoftSkinDeformer* skinDeformer = GetSoftSkinManager().CreateDeformer(mesh); jointInfo.mStack->AddDeformer(skinDeformer); skinDeformer->ReserveLocalBones(numLocalJoints); // pre-alloc data to prevent reallocs - skinDeformer->Reinitialize(this, meshJoint, lodLevel); + skinDeformer->Reinitialize(this, meshJoint, static_cast(lodLevel)); } } // Add material for this mesh - AddMaterial(lodLevel, Material::Create(GetName())); + AddMaterial(static_cast(lodLevel), Material::Create(GetName())); } } @@ -2919,7 +2919,7 @@ namespace EMotionFX const AZ::Data::Asset& lodAsset = lodAssets[lodLevel]; const AZStd::array_view& sourceMeshes = lodAsset->GetMeshes(); - MorphSetup* morphSetup = mMorphSetups[lodLevel]; + MorphSetup* morphSetup = mMorphSetups[static_cast(lodLevel)]; if (!morphSetup) { continue; @@ -3029,7 +3029,7 @@ namespace EMotionFX } // Sync the deformer passes with the morph target deform datas. - morphTargetDeformer->Reinitialize(this, meshJoint, lodLevel); + morphTargetDeformer->Reinitialize(this, meshJoint, static_cast(lodLevel)); } } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.cpp index 8c28a84698..2daaac6a85 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.cpp @@ -327,7 +327,7 @@ namespace EMotionFX AZ::Outcome boneIndexOutcome = FindLocalBoneIndex(influence->GetNodeNr()); if (boneIndexOutcome.IsSuccess()) { - influence->SetBoneNr(boneIndexOutcome.GetValue()); + influence->SetBoneNr(static_cast(boneIndexOutcome.GetValue())); } else { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.inl b/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.inl index 5d06291a92..b28c9973fc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.inl +++ b/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.inl @@ -170,7 +170,7 @@ MCORE_INLINE void KeyTrackLinearDynamic::AddKey(float t template MCORE_INLINE uint32 KeyTrackLinearDynamic::FindKeyNumber(float curTime) const { - return KeyFrameFinder::FindKey(curTime, &mKeys.front(), mKeys.size()); + return KeyFrameFinder::FindKey(curTime, &mKeys.front(), static_cast(mKeys.size())); } @@ -355,7 +355,7 @@ void KeyTrackLinearDynamic::AddKeySorted(float time, co { if (mKeys.capacity() == mKeys.size()) { - const uint32 numToReserve = mKeys.size() / 4; + const uint32 numToReserve = static_cast(mKeys.size() / 4); mKeys.reserve(mKeys.capacity() + numToReserve); } } @@ -385,7 +385,7 @@ void KeyTrackLinearDynamic::AddKeySorted(float time, co } // quickly find the location to insert, and insert it - const uint32 place = KeyFrameFinder::FindKey(keyTime, &mKeys.front(), mKeys.size()); + const uint32 place = KeyFrameFinder::FindKey(keyTime, &mKeys.front(), static_cast(mKeys.size())); mKeys.insert(mKeys.begin() + place + 1, KeyFrame(time, value)); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.cpp index 51486c39b5..993426f4c4 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.cpp @@ -266,7 +266,7 @@ namespace EMotionFX { // Atom stores the skin indices as uint16, but the buffer itself is a buffer of uint32 with two id's per element size_t influenceCount = elementCountInBytes / sizeof(AZ::u16); - maxSkinInfluences = influenceCount / modelVertexCount; + maxSkinInfluences = static_cast(influenceCount / modelVertexCount); AZ_Assert(maxSkinInfluences > 0 && maxSkinInfluences < 100, "Expect max skin influences in a reasonable value range."); AZ_Assert(influenceCount % modelVertexCount == 0, "Expect an equal number of influences for each vertex."); AZ_Assert(bufferAssetViewDescriptor.m_elementSize == 4, "Expect skin joint indices to be stored in a raw 32-bit per element buffer"); @@ -279,7 +279,7 @@ namespace EMotionFX { // Atom stores joint weights as float (range 0 - 1) size_t influenceCount = elementCountInBytes / sizeof(float); - maxSkinInfluences = influenceCount / modelVertexCount; + maxSkinInfluences = static_cast(influenceCount / modelVertexCount); AZ_Assert(maxSkinInfluences > 0 && maxSkinInfluences < 100, "Expect max skin influences in a reasonable value range."); skinWeights = static_cast(bufferData) + bufferAssetViewDescriptor.m_elementOffset; } @@ -290,7 +290,7 @@ namespace EMotionFX AZ::u32* originalVertexDataRaw = static_cast(originalVertexData->GetData()); for (size_t i = 0; i < modelVertexCount; ++i) { - originalVertexDataRaw[i] = i; + originalVertexDataRaw[i] = static_cast(i); } mesh->AddVertexAttributeLayer(originalVertexData); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.cpp index 9c241a6773..3ccfa85ca8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.cpp @@ -317,7 +317,7 @@ namespace EMotionFX // now we have located the skinning information for this vertex, we can see if our bones array // already contains the bone it uses by traversing all influences for this vertex, and checking // if the bone of that influence already is in the array with used bones - const uint32 numInfluences = GetNumInfluences(i); + const uint32 numInfluences = static_cast(GetNumInfluences(i)); for (uint32 a = 0; a < numInfluences; ++a) { EMotionFX::SkinInfluence* influence = GetInfluence(i, a); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp index bc8d874547..47bb9660a8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp @@ -327,7 +327,7 @@ namespace EMStudio EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = animGraph->GetGameControllerSettings(); // in case there is no preset yet create a default one - uint32 numPresets = gameControllerSettings.GetNumPresets(); + uint32 numPresets = static_cast(gameControllerSettings.GetNumPresets()); if (numPresets == 0) { EMotionFX::AnimGraphGameControllerSettings::Preset* preset = aznew EMotionFX::AnimGraphGameControllerSettings::Preset("Default"); @@ -374,7 +374,7 @@ namespace EMStudio QLabel* label = new QLabel(labelString.c_str()); label->setToolTip(parameter->GetDescription().c_str()); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - mParameterGridLayout->addWidget(label, parameterIndex, 0); + mParameterGridLayout->addWidget(label, static_cast(parameterIndex), 0); // add the axis combo box to the layout QComboBox* axesComboBox = new QComboBox(); @@ -434,7 +434,7 @@ namespace EMStudio // select the given axis in the combo box or select none if there is no assignment yet or the assigned axis wasn't found on the current game controller axesComboBox->setCurrentIndex(selectedComboItem); - mParameterGridLayout->addWidget(axesComboBox, parameterIndex, 1); + mParameterGridLayout->addWidget(axesComboBox, static_cast(parameterIndex), 1); // add the mode combo box to the layout QComboBox* modeComboBox = new QComboBox(); @@ -447,7 +447,7 @@ namespace EMStudio modeComboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); connect(modeComboBox, static_cast(&QComboBox::currentIndexChanged), this, &GameControllerWindow::OnParameterModeComboBox); modeComboBox->setCurrentIndex(settingsInfo->m_mode); - mParameterGridLayout->addWidget(modeComboBox, parameterIndex, 2); + mParameterGridLayout->addWidget(modeComboBox, static_cast(parameterIndex), 2); // add the invert checkbox to the layout QHBoxLayout* invertCheckBoxLayout = new QHBoxLayout(); @@ -460,7 +460,7 @@ namespace EMStudio connect(invertCheckbox, &QCheckBox::stateChanged, this, &GameControllerWindow::OnInvertCheckBoxChanged); invertCheckbox->setCheckState(settingsInfo->m_invert ? Qt::Checked : Qt::Unchecked); invertCheckBoxLayout->addWidget(invertCheckbox); - mParameterGridLayout->addLayout(invertCheckBoxLayout, parameterIndex, 3); + mParameterGridLayout->addLayout(invertCheckBoxLayout, static_cast(parameterIndex), 3); // add the current value edit field to the layout QLineEdit* valueEdit = new QLineEdit(); @@ -469,7 +469,7 @@ namespace EMStudio valueEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); valueEdit->setMinimumWidth(70); valueEdit->setMaximumWidth(70); - mParameterGridLayout->addWidget(valueEdit, parameterIndex, 4); + mParameterGridLayout->addWidget(valueEdit, static_cast(parameterIndex), 4); // create the parameter info and add it to the array ParameterInfo paramInfo; @@ -1053,7 +1053,7 @@ namespace EMStudio // get the game controller settings from the current anim graph EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); - uint32 presetNumber = gameControllerSettings.GetNumPresets(); + uint32 presetNumber = static_cast(gameControllerSettings.GetNumPresets()); mString = AZStd::string::format("Preset %d", presetNumber); while (gameControllerSettings.FindPresetIndexByName(mString.c_str()) != MCORE_INVALIDINDEX32) { @@ -1123,7 +1123,7 @@ namespace EMStudio // get the currently selected preset uint32 presetIndex = mPresetComboBox->currentIndex(); - uint32 newValueIndex = gameControllerSettings.FindPresetIndexByName(newValue.c_str()); + uint32 newValueIndex = static_cast(gameControllerSettings.FindPresetIndexByName(newValue.c_str())); if (newValueIndex == MCORE_INVALIDINDEX32) { EMotionFX::AnimGraphGameControllerSettings::Preset* preset = gameControllerSettings.GetPreset(presetIndex); @@ -1139,7 +1139,7 @@ namespace EMStudio EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); // check if there already is a preset with the currently entered name - uint32 presetIndex = gameControllerSettings.FindPresetIndexByName(FromQtString(text).c_str()); + uint32 presetIndex = static_cast(gameControllerSettings.FindPresetIndexByName(FromQtString(text).c_str())); if (presetIndex != MCORE_INVALIDINDEX32 && presetIndex != gameControllerSettings.GetActivePresetIndex()) { GetManager()->SetWidgetAsInvalidInput(mPresetNameLineEdit); @@ -1362,7 +1362,7 @@ namespace EMStudio } // find the corresponding attribute - MCore::Attribute* attribute = animGraphInstance->GetParameterValue(parameterIndex); + MCore::Attribute* attribute = animGraphInstance->GetParameterValue(static_cast(parameterIndex)); if (attribute->GetType() == MCore::AttributeFloat::TYPE_ID) { diff --git a/Gems/EMotionFX/Code/MysticQt/Source/KeyboardShortcutManager.cpp b/Gems/EMotionFX/Code/MysticQt/Source/KeyboardShortcutManager.cpp index 8f871d0d42..8fa5850407 100644 --- a/Gems/EMotionFX/Code/MysticQt/Source/KeyboardShortcutManager.cpp +++ b/Gems/EMotionFX/Code/MysticQt/Source/KeyboardShortcutManager.cpp @@ -163,7 +163,7 @@ namespace MysticQt // iterate through the groups and save all actions for them for (const AZStd::unique_ptr& group : m_groups) { - settings->beginGroup(QString::fromUtf8(group->GetName().data(), group->GetName().size())); + settings->beginGroup(QString::fromUtf8(group->GetName().data(), static_cast(group->GetName().size()))); // iterate through the actions and save them for (const AZStd::unique_ptr& action : group->GetActions()) diff --git a/Gems/EMotionFX/Code/Source/Integration/Components/AnimGraphComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/Components/AnimGraphComponent.cpp index ade713efa6..10046728ab 100644 --- a/Gems/EMotionFX/Code/Source/Integration/Components/AnimGraphComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/Components/AnimGraphComponent.cpp @@ -873,7 +873,7 @@ namespace EMotionFX AZ_Warning("EmotionFX", false, "Invalid anim graph parameter name: %s", parameterName); return; } - SetParameterFloat(parameterIndex.GetValue(), value); + SetParameterFloat(static_cast(parameterIndex.GetValue()), value); } } @@ -888,7 +888,7 @@ namespace EMotionFX AZ_Warning("EmotionFX", false, "Invalid anim graph parameter name: %s", parameterName); return; } - SetParameterBool(parameterIndex.GetValue(), value); + SetParameterBool(static_cast(parameterIndex.GetValue()), value); } } @@ -903,7 +903,7 @@ namespace EMotionFX AZ_Warning("EmotionFX", false, "Invalid anim graph parameter name: %s", parameterName); return; } - SetParameterString(parameterIndex.GetValue(), value); + SetParameterString(static_cast(parameterIndex.GetValue()), value); } } @@ -918,7 +918,7 @@ namespace EMotionFX AZ_Warning("EmotionFX", false, "Invalid anim graph parameter name: %s", parameterName); return; } - SetParameterVector2(parameterIndex.GetValue(), value); + SetParameterVector2(static_cast(parameterIndex.GetValue()), value); } } @@ -933,7 +933,7 @@ namespace EMotionFX AZ_Warning("EmotionFX", false, "Invalid anim graph parameter name: %s", parameterName); return; } - SetParameterVector3(parameterIndex.GetValue(), value); + SetParameterVector3(static_cast(parameterIndex.GetValue()), value); } } @@ -948,7 +948,7 @@ namespace EMotionFX AZ_Warning("EmotionFX", false, "Invalid anim graph parameter name: %s", parameterName); return; } - SetParameterRotationEuler(parameterIndex.GetValue(), value); + SetParameterRotationEuler(static_cast(parameterIndex.GetValue()), value); } } @@ -963,7 +963,7 @@ namespace EMotionFX AZ_Warning("EmotionFX", false, "Invalid anim graph parameter name: %s", parameterName); return; } - SetParameterRotation(parameterIndex.GetValue(), value); + SetParameterRotation(static_cast(parameterIndex.GetValue()), value); } } @@ -1119,7 +1119,7 @@ namespace EMotionFX const AZ::Outcome parameterIndex = m_animGraphInstance->FindParameterIndex(parameterName); if (parameterIndex.IsSuccess()) { - return GetParameterFloat(parameterIndex.GetValue()); + return GetParameterFloat(static_cast(parameterIndex.GetValue())); } } return 0.f; @@ -1133,7 +1133,7 @@ namespace EMotionFX const AZ::Outcome parameterIndex = m_animGraphInstance->FindParameterIndex(parameterName); if (parameterIndex.IsSuccess()) { - return GetParameterBool(parameterIndex.GetValue()); + return GetParameterBool(static_cast(parameterIndex.GetValue())); } } return false; @@ -1147,7 +1147,7 @@ namespace EMotionFX const AZ::Outcome parameterIndex = m_animGraphInstance->FindParameterIndex(parameterName); if (parameterIndex.IsSuccess()) { - return GetParameterString(parameterIndex.GetValue()); + return GetParameterString(static_cast(parameterIndex.GetValue())); } } return AZStd::string(); @@ -1161,7 +1161,7 @@ namespace EMotionFX const AZ::Outcome parameterIndex = m_animGraphInstance->FindParameterIndex(parameterName); if (parameterIndex.IsSuccess()) { - return GetParameterVector2(parameterIndex.GetValue()); + return GetParameterVector2(static_cast(parameterIndex.GetValue())); } } return AZ::Vector2::CreateZero(); @@ -1175,7 +1175,7 @@ namespace EMotionFX const AZ::Outcome parameterIndex = m_animGraphInstance->FindParameterIndex(parameterName); if (parameterIndex.IsSuccess()) { - return GetParameterVector3(parameterIndex.GetValue()); + return GetParameterVector3(static_cast(parameterIndex.GetValue())); } } return AZ::Vector3::CreateZero(); @@ -1189,7 +1189,7 @@ namespace EMotionFX const AZ::Outcome parameterIndex = m_animGraphInstance->FindParameterIndex(parameterName); if (parameterIndex.IsSuccess()) { - return GetParameterRotationEuler(parameterIndex.GetValue()); + return GetParameterRotationEuler(static_cast(parameterIndex.GetValue())); } } return AZ::Vector3::CreateZero(); @@ -1203,7 +1203,7 @@ namespace EMotionFX const AZ::Outcome parameterIndex = m_animGraphInstance->FindParameterIndex(parameterName); if (parameterIndex.IsSuccess()) { - return GetParameterRotation(parameterIndex.GetValue()); + return GetParameterRotation(static_cast(parameterIndex.GetValue())); } } return AZ::Quaternion::CreateIdentity(); diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphNodeEventFilterTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphNodeEventFilterTests.cpp index ed44be78a7..67f6fa860e 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphNodeEventFilterTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphNodeEventFilterTests.cpp @@ -86,7 +86,7 @@ namespace EMotionFX AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); motionNode->SetName(AZStd::string::format("MotionNode%zu", i).c_str()); m_blendTree->AddChildNode(motionNode); - m_blend2Node->AddConnection(motionNode, AnimGraphMotionNode::PORTID_OUTPUT_POSE, i); + m_blend2Node->AddConnection(motionNode, AnimGraphMotionNode::PORTID_OUTPUT_POSE, static_cast(i)); m_motionNodes.push_back(motionNode); } diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphNodeProcessingTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphNodeProcessingTests.cpp index a185b4a452..4a85d452a3 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphNodeProcessingTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphNodeProcessingTests.cpp @@ -69,7 +69,7 @@ namespace EMotionFX AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); motionNode->SetName(AZStd::string::format("MotionNode%zu", i).c_str()); m_blendTree->AddChildNode(motionNode); - m_blendNNode->AddConnection(motionNode, AnimGraphMotionNode::PORTID_OUTPUT_POSE, i); + m_blendNNode->AddConnection(motionNode, AnimGraphMotionNode::PORTID_OUTPUT_POSE, static_cast(i)); m_motionNodes.push_back(motionNode); } m_blendNNode->UpdateParamWeights(); diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphReferenceNodeTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphReferenceNodeTests.cpp index 57e8a6a90d..2c595c8b6c 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphReferenceNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphReferenceNodeTests.cpp @@ -260,7 +260,7 @@ namespace EMotionFX GetEMotionFX().Update(0.0f); EXPECT_EQ(Transform::CreateIdentity(), GetOutputTransform()); - static_cast(m_animGraphInstance->GetParameterValue(m_animGraph->FindParameterIndex(m_parameter).GetValue()))->SetValue(1.0f); + static_cast(m_animGraphInstance->GetParameterValue(static_cast(m_animGraph->FindParameterIndex(m_parameter).GetValue())))->SetValue(1.0f); GetEMotionFX().Update(0.0f); EXPECT_EQ(Transform::CreateIdentity() * AZ::Transform::CreateTranslation(AZ::Vector3(10.0f, 0.0f, 0.0f)), GetOutputTransform()); @@ -313,7 +313,7 @@ namespace EMotionFX // Changing this one parameter value should change it through all 3 // layers of reference nodes, down to the referenced Transform node - static_cast(m_animGraphInstance->GetParameterValue(m_animGraph->FindParameterIndex(m_topLevelParameter).GetValue()))->SetValue(1.0f); + static_cast(m_animGraphInstance->GetParameterValue(static_cast(m_animGraph->FindParameterIndex(m_topLevelParameter).GetValue())))->SetValue(1.0f); GetEMotionFX().Update(0.0f); EXPECT_EQ(Transform::CreateIdentity() * AZ::Transform::CreateTranslation(AZ::Vector3(10.0f, 0.0f, 0.0f)), GetOutputTransform()); diff --git a/Gems/EMotionFX/Code/Tests/Editor/ParametersGroupDefaultValues.cpp b/Gems/EMotionFX/Code/Tests/Editor/ParametersGroupDefaultValues.cpp index 7b7bf011a9..4219966d72 100644 --- a/Gems/EMotionFX/Code/Tests/Editor/ParametersGroupDefaultValues.cpp +++ b/Gems/EMotionFX/Code/Tests/Editor/ParametersGroupDefaultValues.cpp @@ -153,7 +153,7 @@ namespace EMotionFX TestInequality(defaultValueParameter->GetDefaultValue(), expectedValue); AnimGraphInstance* animGraphInstance = animGraph->GetAnimGraphInstance(0); - auto instanceValue = static_cast(animGraphInstance->GetParameterValue(animGraph->FindValueParameterIndex(valueParameter).GetValue())); + auto instanceValue = static_cast(animGraphInstance->GetParameterValue(static_cast(animGraph->FindValueParameterIndex(valueParameter).GetValue()))); ASSERT_EQ(instanceValue->GetType(), AttributeT::TYPE_ID); // Set the parameter's current value diff --git a/Gems/EMotionFX/Code/Tests/UI/CanAddMotionToMotionSet.cpp b/Gems/EMotionFX/Code/Tests/UI/CanAddMotionToMotionSet.cpp index a568431931..0e20d220d4 100644 --- a/Gems/EMotionFX/Code/Tests/UI/CanAddMotionToMotionSet.cpp +++ b/Gems/EMotionFX/Code/Tests/UI/CanAddMotionToMotionSet.cpp @@ -56,7 +56,7 @@ namespace EMotionFX motionSetPlugin->SetSelectedSet(motionSet); // It should be empty at the moment. - int numMotions = motionSet->GetNumMotionEntries(); + int numMotions = static_cast(motionSet->GetNumMotionEntries()); EXPECT_EQ(numMotions, 0); // Find the action to add a motion to the set and press it. @@ -65,7 +65,7 @@ namespace EMotionFX QTest::mouseClick(addMotionButton, Qt::LeftButton); // There should now be a motion. - int numMotionsAfterCreate = motionSet->GetNumMotionEntries(); + int numMotionsAfterCreate = static_cast(motionSet->GetNumMotionEntries()); ASSERT_EQ(numMotionsAfterCreate, 1); AZStd::unordered_map motions = motionSet->GetMotionEntries(); diff --git a/Gems/EMotionFX/Code/Tests/UI/CanEditParameters.cpp b/Gems/EMotionFX/Code/Tests/UI/CanEditParameters.cpp index e1ea78083a..82f509965c 100644 --- a/Gems/EMotionFX/Code/Tests/UI/CanEditParameters.cpp +++ b/Gems/EMotionFX/Code/Tests/UI/CanEditParameters.cpp @@ -74,7 +74,7 @@ namespace EMotionFX QTest::mouseClick(createButton, Qt::LeftButton); // Check we only have the one Parameter - int numParameters = newGraph->GetNumParameters(); + int numParameters = static_cast(newGraph->GetNumParameters()); EXPECT_EQ(numParameters, 1) << "Not just 1 parameter"; const RangedValueParameter* parameter = reinterpret_cast* >(newGraph->FindValueParameter(0)); diff --git a/Gems/EMotionFX/Code/Tests/UI/CanRemoveMotionFromMotionSet.cpp b/Gems/EMotionFX/Code/Tests/UI/CanRemoveMotionFromMotionSet.cpp index 8a13f35fbf..c6bec666b1 100644 --- a/Gems/EMotionFX/Code/Tests/UI/CanRemoveMotionFromMotionSet.cpp +++ b/Gems/EMotionFX/Code/Tests/UI/CanRemoveMotionFromMotionSet.cpp @@ -59,7 +59,7 @@ namespace EMotionFX motionSetPlugin->SetSelectedSet(motionSet); // It should be empty at the moment. - const int numMotions = motionSet->GetNumMotionEntries(); + const int numMotions = static_cast(motionSet->GetNumMotionEntries()); EXPECT_EQ(numMotions, 0); // Find the action to add a motion to the set and press it. @@ -68,7 +68,7 @@ namespace EMotionFX QTest::mouseClick(addMotionButton, Qt::LeftButton); // There should now be a motion. - const int numMotionsAfterCreate = motionSet->GetNumMotionEntries(); + const int numMotionsAfterCreate = static_cast(motionSet->GetNumMotionEntries()); ASSERT_EQ(numMotionsAfterCreate, 1); AZStd::unordered_map motions = motionSet->GetMotionEntries(); @@ -140,7 +140,7 @@ namespace EMotionFX motionSetPlugin->SetSelectedSet(motionSet); // It should be empty at the moment. - const int numMotions = motionSet->GetNumMotionEntries(); + const int numMotions = static_cast(motionSet->GetNumMotionEntries()); EXPECT_EQ(numMotions, 0); // Find the action to add a motion to the set and press it twice. @@ -150,7 +150,7 @@ namespace EMotionFX QTest::mouseClick(addMotionButton, Qt::LeftButton); // There should now be two motion. - const int numMotionsAfterCreate = motionSet->GetNumMotionEntries(); + const int numMotionsAfterCreate = static_cast(motionSet->GetNumMotionEntries()); ASSERT_EQ(numMotionsAfterCreate, 2); AZStd::unordered_map motions = motionSet->GetMotionEntries(); From 93384eebe15e4644dd1bd50006bfcb0d07d1190d Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 17:13:16 -0700 Subject: [PATCH 15/75] GameStateSamples Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Include/GameStateSamples/GameStateMainMenu.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/GameStateSamples/Code/Include/GameStateSamples/GameStateMainMenu.inl b/Gems/GameStateSamples/Code/Include/GameStateSamples/GameStateMainMenu.inl index 919b8c9449..41ee034844 100644 --- a/Gems/GameStateSamples/Code/Include/GameStateSamples/GameStateMainMenu.inl +++ b/Gems/GameStateSamples/Code/Include/GameStateSamples/GameStateMainMenu.inl @@ -300,7 +300,7 @@ namespace GameStateSamples // Add all the levels into the UI as buttons - UiDynamicLayoutBus::Event(dynamicLayoutElementId, &UiDynamicLayoutInterface::SetNumChildElements, levelNames.size()); + UiDynamicLayoutBus::Event(dynamicLayoutElementId, &UiDynamicLayoutInterface::SetNumChildElements, static_cast(levelNames.size())); for (int i = 0; i < levelNames.size(); ++i) { AZ::IO::PathView level(levelNames[i].c_str()); @@ -334,7 +334,7 @@ namespace GameStateSamples { // Get the level name (strip folder names from the path) const char* levelPath = levelSystem->GetLevelInfo(i)->GetName(); - const int levelPathLength = strlen(levelPath); + const int levelPathLength = static_cast(strlen(levelPath)); const char* levelName = levelPath; for (int j = 0; j < levelPathLength; ++j) { From 0af39dd6334c9d99d1d84257012e744c6cffcdd9 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 17:14:43 -0700 Subject: [PATCH 16/75] GradientSignal Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/GradientImageConversion.cpp | 8 ++++---- Gems/GradientSignal/Code/Tests/ImageAssetTests.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gems/GradientSignal/Code/Source/GradientImageConversion.cpp b/Gems/GradientSignal/Code/Source/GradientImageConversion.cpp index 4ed3ff1718..fdb3d77674 100644 --- a/Gems/GradientSignal/Code/Source/GradientImageConversion.cpp +++ b/Gems/GradientSignal/Code/Source/GradientImageConversion.cpp @@ -259,7 +259,7 @@ namespace for (AZStd::size_t i = 0; i < channels; ++i) { min = AZStd::min(min, Lerp(min, - arr[i], IsActive(i, mask))); + arr[i], IsActive(static_cast(i), mask))); } return min; @@ -273,7 +273,7 @@ namespace for (AZStd::size_t i = 0; i < channels; ++i) { max = AZStd::max(max, Lerp(max, - arr[i], IsActive(i, mask))); + arr[i], IsActive(static_cast(i), mask))); } return max; @@ -287,7 +287,7 @@ namespace for (AZStd::size_t i = 0; i < channels; ++i) { - AZ::u8 result = IsActive(i, mask); + AZ::u8 result = IsActive(static_cast(i), mask); total += result * arr[i]; active += result; } @@ -493,7 +493,7 @@ namespace GradientSignal newAsset->m_imageFormat = OperationHelper(settings.m_rgbTransform, newAsset->m_imageFormat, mask, settings.m_alphaTransform, newAsset->m_imageData); newAsset->m_imageFormat = ConvertBufferType(newAsset->m_imageData, newAsset->m_imageFormat, ExportFormatToPixelFormat(settings.m_format), settings.m_autoScale, AZStd::make_pair(settings.m_scaleRangeMin, settings.m_scaleRangeMax)); - newAsset->m_bytesPerPixel = newAsset->m_imageData.size() / aznumeric_cast(newAsset->m_imageWidth * newAsset->m_imageHeight); + newAsset->m_bytesPerPixel = static_cast(newAsset->m_imageData.size() / aznumeric_cast(newAsset->m_imageWidth * newAsset->m_imageHeight)); return newAsset; } diff --git a/Gems/GradientSignal/Code/Tests/ImageAssetTests.cpp b/Gems/GradientSignal/Code/Tests/ImageAssetTests.cpp index 54ca51f579..c5b003bf3c 100644 --- a/Gems/GradientSignal/Code/Tests/ImageAssetTests.cpp +++ b/Gems/GradientSignal/Code/Tests/ImageAssetTests.cpp @@ -40,7 +40,7 @@ namespace asset.m_imageWidth = dimensions; asset.m_imageHeight = dimensions; - asset.m_bytesPerPixel = bytesPerPixel; + asset.m_bytesPerPixel = static_cast(bytesPerPixel); asset.m_imageFormat = format; asset.m_imageData.resize(asset.m_bytesPerPixel * asset.m_imageWidth * asset.m_imageHeight); From 2ae8b36589863b1b3ea35198c3beaa49ab0098ac Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 17:20:30 -0700 Subject: [PATCH 17/75] ImGui Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/ImGui/Code/Include/LYImGuiUtils/HistogramContainer.h | 4 ++-- Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/ImGui/Code/Include/LYImGuiUtils/HistogramContainer.h b/Gems/ImGui/Code/Include/LYImGuiUtils/HistogramContainer.h index 630825035e..101b123bb5 100644 --- a/Gems/ImGui/Code/Include/LYImGuiUtils/HistogramContainer.h +++ b/Gems/ImGui/Code/Include/LYImGuiUtils/HistogramContainer.h @@ -45,7 +45,7 @@ namespace ImGui , bool autoExpandScale, bool startCollapsed = false, bool drawMostRecentValue = true); // How many values are in the container currently - int GetSize() { return m_values.size(); } + int GetSize() { return static_cast(m_values.size()); } // What is the max size of the container int GetMaxSize() { return m_maxSize; } @@ -57,7 +57,7 @@ namespace ImGui void PushValue(float val); // Get the last value pushed - float GetLastValue() { return GetValue(m_values.size() - 1); } + float GetLastValue() { return GetValue(static_cast(m_values.size() - 1)); } // Get a Values at a particular index float GetValue(int index) { return index < m_values.size() ? m_values.at(index) : 0.0f; } diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp index 39778d241b..8e0e23652c 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp +++ b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp @@ -940,7 +940,7 @@ namespace ImGui rootSliceComponent->GetEntityIds(entityIds); // Save off our count for use later. - m_totalEntitiesFound = entityIds.size(); + m_totalEntitiesFound = static_cast(entityIds.size()); // Clear the entityId to InfoNodePtr Map. m_entityIdToInfoNodePtrMap.clear(); From 9c8cc729b12ae63bfa18f16e03765f46d875025f Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 17:20:47 -0700 Subject: [PATCH 18/75] InAppPurchases Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/InAppPurchasesSystemComponent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/InAppPurchases/Code/Source/InAppPurchasesSystemComponent.cpp b/Gems/InAppPurchases/Code/Source/InAppPurchasesSystemComponent.cpp index fd1f4146dc..824208e918 100644 --- a/Gems/InAppPurchases/Code/Source/InAppPurchasesSystemComponent.cpp +++ b/Gems/InAppPurchases/Code/Source/InAppPurchasesSystemComponent.cpp @@ -329,7 +329,7 @@ namespace InAppPurchases { if (m_productInfoIndex < 0) { - m_productInfoIndex = productDetails->size() - 1; + m_productInfoIndex = static_cast(productDetails->size() - 1); } if (productDetails->size() > 0) @@ -375,7 +375,7 @@ namespace InAppPurchases { if (m_purchasedProductInfoIndex < 0) { - m_purchasedProductInfoIndex = purchasedProductDetails->size() - 1; + m_purchasedProductInfoIndex = static_cast(purchasedProductDetails->size() - 1); } if (purchasedProductDetails->size() > 0) From 89c99b15af39eecb3da09467b14411e903e67d35 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 17:24:42 -0700 Subject: [PATCH 19/75] =?UTF-8?q?=EF=BB=BFLmbrCentral?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp | 4 ++-- Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp index 2c6ce3dc72..223a3e14f2 100644 --- a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp +++ b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp @@ -355,7 +355,7 @@ namespace LmbrCentral return; } - const AZ::u32 segments = segmentCount * spline->GetSegmentGranularity() + segmentCount - 1; + const AZ::u32 segments = static_cast(segmentCount * spline->GetSegmentGranularity() + segmentCount - 1); const AZ::u32 totalSegments = segments + capSegments * 2; const AZ::u32 capSegmentTipVerts = capSegments > 0 ? 2 : 0; const size_t numVerts = sides * (totalSegments + 1) + capSegmentTipVerts; @@ -594,7 +594,7 @@ namespace LmbrCentral // to ensure the total radius stays positive if (GetTotalRadius(AZ::SplineAddress(vertIndex)) < 0.0f) { - SetVariableRadius(vertIndex, -GetRadius()); + SetVariableRadius(static_cast(vertIndex), -GetRadius()); } } diff --git a/Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp b/Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp index 3deb12fad0..86c7ce23e5 100644 --- a/Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp +++ b/Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp @@ -406,7 +406,7 @@ namespace UnitTest float variableRadius = 0.0f; LmbrCentral::TubeShapeComponentRequestsBus::EventResult( variableRadius, entity.GetId(), &LmbrCentral::TubeShapeComponentRequestsBus::Events::GetVariableRadius, - vertIndex); + static_cast(vertIndex)); EXPECT_THAT(totalRadius, FloatEq(radiis.first)); EXPECT_THAT(variableRadius, FloatEq(radiis.second)); From 3c56edb82765392797d6a5107e01c52b1802e6a6 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 15:47:56 -0700 Subject: [PATCH 20/75] LyShine Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Animation/Controls/UiSplineCtrlEx.cpp | 38 +++++++++---------- .../Animation/Controls/UiSplineCtrlEx.h | 2 +- .../Editor/Animation/UiAnimViewAnimNode.h | 2 +- .../Code/Editor/Animation/UiAnimViewNode.h | 4 +- .../Editor/Animation/UiAnimViewSequence.cpp | 4 +- .../Animation/UiAnimViewSequenceManager.h | 2 +- .../Code/Editor/Animation/UiAnimViewTrack.h | 2 +- .../Code/Editor/CanvasSizeToolbarSection.cpp | 2 +- .../Code/Editor/HierarchyClipboard.cpp | 2 +- .../Code/Editor/SpriteBorderEditor.cpp | 4 +- .../Code/Source/Animation/AnimNode.cpp | 2 +- .../Code/Source/Animation/AnimSequence.cpp | 4 +- .../LyShine/Code/Source/Animation/AnimTrack.h | 4 +- .../Code/Source/Animation/AzEntityNode.cpp | 6 +-- .../Code/Source/Animation/BoolTrack.cpp | 2 +- .../Source/Animation/UiAnimationSystem.cpp | 6 +-- Gems/LyShine/Code/Source/RenderGraph.cpp | 6 +-- Gems/LyShine/Code/Source/Sprite.cpp | 2 +- Gems/LyShine/Code/Source/StringUtfUtils.h | 2 +- .../Tests/internal/test_UiTextComponent.cpp | 2 +- .../LyShine/Code/Source/UiCanvasComponent.cpp | 8 ++-- .../Source/UiDynamicScrollBoxComponent.cpp | 6 +-- .../Code/Source/UiElementComponent.cpp | 34 ++++++++--------- Gems/LyShine/Code/Source/UiImageComponent.cpp | 4 +- .../Code/Source/UiImageSequenceComponent.cpp | 2 +- .../Code/Source/UiLayoutColumnComponent.cpp | 4 +- Gems/LyShine/Code/Source/UiLayoutHelpers.cpp | 2 +- .../Code/Source/UiLayoutRowComponent.cpp | 4 +- .../Code/Source/UiMarkupButtonComponent.cpp | 2 +- .../Source/UiParticleEmitterComponent.cpp | 10 ++--- Gems/LyShine/Code/Source/UiTextComponent.cpp | 2 +- .../Source/UiTextComponentOffsetsSelector.cpp | 2 +- .../Source/UiTextComponentOffsetsSelector.h | 2 +- .../Code/Source/UiTextInputComponent.cpp | 2 +- 34 files changed, 91 insertions(+), 91 deletions(-) diff --git a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp index 39e5bd0f5f..315a8ebfef 100644 --- a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp +++ b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp @@ -1402,7 +1402,7 @@ void SplineWidget::mouseMoveEvent(QMouseEvent* event) QString tipText; bool boFoundTheSelectedKey(false); - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (int splineIndex = 0, endSpline = static_cast(m_splines.size()); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; for (int i = 0; i < pSpline->GetKeyCount(); i++) @@ -1619,7 +1619,7 @@ bool AbstractSplineWidget::IsKeySelected(ISplineInterpolator* pSpline, int nKey, int AbstractSplineWidget::GetNumSelected() { int nSelected = 0; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { if (ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline) { @@ -1726,7 +1726,7 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point } // For each Spline... - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline; @@ -1867,7 +1867,7 @@ void AbstractSplineWidget::ScaleAmplitudeKeys(float time, float startValue, floa m_nHitKeyIndex = -1; m_nHitDimension = -1; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -1971,7 +1971,7 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT float affectedRangeMin = FLT_MAX; float affectedRangeMax = -FLT_MAX; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2078,7 +2078,7 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue) m_nHitKeyIndex = -1; m_nHitDimension = -1; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2119,7 +2119,7 @@ void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys) float affectedRangeMin = FLT_MAX; float affectedRangeMax = -FLT_MAX; // For each spline... - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2241,7 +2241,7 @@ void AbstractSplineWidget::RemoveSelectedKeys() m_pHitDetailSpline = 0; m_nHitKeyIndex = -1; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2281,7 +2281,7 @@ void AbstractSplineWidget::RemoveSelectedKeyTimesImpl() StoreUndo(); SendNotifyEvent(SPLN_BEFORE_CHANGE); - for (int splineIndex = 0, end = m_splines.size(); splineIndex < end; ++splineIndex) + for (int splineIndex = 0, end = static_cast(m_splines.size()); splineIndex < end; ++splineIndex) { std::vector::iterator itTime = m_keyTimes.begin(), endTime = m_keyTimes.end(); for (int keyIndex = 0, endIndex = m_splines[splineIndex].pSpline->GetKeyCount(); keyIndex < endIndex; ) @@ -2319,7 +2319,7 @@ void AbstractSplineWidget::RedrawWindowAroundMarker() { UpdateKeyTimes(); std::vector::iterator itKeyTime = std::lower_bound(m_keyTimes.begin(), m_keyTimes.end(), KeyTime(m_fTimeMarker, 0)); - int keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size()); + int keyTimeIndex = static_cast(itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size()); int redrawRangeStart = (keyTimeIndex >= 2 ? aznumeric_cast(TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time)) : m_rcSpline.left()); int redrawRangeEnd = (keyTimeIndex < int(m_keyTimes.size()) - 2 ? aznumeric_cast(TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time)) : m_rcSpline.right()); @@ -2421,7 +2421,7 @@ void AbstractSplineWidget::ClearSelection() { ConditionalStoreUndo(); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2465,7 +2465,7 @@ void AbstractSplineWidget::StoreUndo() if (UiAnimUndo::IsRecording() && !m_pCurrentUndo) { std::vector splines(m_splines.size()); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { splines[splineIndex] = m_splines[splineIndex].pSpline; } @@ -2508,7 +2508,7 @@ void AbstractSplineWidget::DuplicateSelectedKeys() typedef std::vector KeysToAddContainer; KeysToAddContainer keysToInsert; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2608,7 +2608,7 @@ void AbstractSplineWidget::KeyAll() ////////////////////////////////////////////////////////////////////////// void AbstractSplineWidget::SelectAll() { - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2756,7 +2756,7 @@ void AbstractSplineWidget::SelectRectangle(const QRect& rc, bool bSelect) { std::swap(t0, t1); } - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline; @@ -2972,7 +2972,7 @@ void AbstractSplineWidget::ModifySelectedKeysFlags(int nRemoveFlags, int nAddFla SendNotifyEvent(SPLN_BEFORE_CHANGE); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (int splineIndex = 0, splineCount = static_cast(m_splines.size()); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -3138,7 +3138,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey) { bool boFoundTheSelectedKey(false); - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (int splineIndex = 0, endSpline = static_cast(m_splines.size()); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; for (int i = 0; i < pSpline->GetKeyCount(); i++) @@ -3180,7 +3180,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey) } else { - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (int splineIndex = 0, endSpline = static_cast(m_splines.size()); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -3231,7 +3231,7 @@ void AbstractSplineWidget::RemoveAllKeysButThis() { std::vector keys; - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (int splineIndex = 0, endSpline = static_cast(m_splines.size()); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; diff --git a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.h b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.h index 18ee7e173c..edb0cfa4e2 100644 --- a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.h +++ b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.h @@ -90,7 +90,7 @@ public: void AddSpline(ISplineInterpolator * pSpline, ISplineInterpolator * pDetailSpline, COLORREF anColorArray[4]); void RemoveSpline(ISplineInterpolator* pSpline); void RemoveAllSplines(); - int GetSplineCount() const { return m_splines.size(); } + int GetSplineCount() const { return static_cast(m_splines.size()); } ISplineInterpolator* GetSpline(int nIndex) const { return m_splines[nIndex].pSpline; } void SetTimeMarker(float fTime); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h index 40d9013392..72dc7344ec 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h @@ -27,7 +27,7 @@ namespace AZ class CUiAnimViewAnimNodeBundle { public: - unsigned int GetCount() const { return m_animNodes.size(); } + unsigned int GetCount() const { return static_cast(m_animNodes.size()); } CUiAnimViewAnimNode* GetNode(const unsigned int index) { return m_animNodes[index]; } const CUiAnimViewAnimNode* GetNode(const unsigned int index) const { return m_animNodes[index]; } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h index 61833adcd6..5a82d1be7f 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h @@ -121,7 +121,7 @@ public: virtual bool AreAllKeysOfSameType() const override { return m_bAllOfSameType; } - virtual unsigned int GetKeyCount() const override { return m_keys.size(); } + virtual unsigned int GetKeyCount() const override { return static_cast(m_keys.size()); } virtual CUiAnimViewKeyHandle GetKey(unsigned int index) override { return m_keys[index]; } virtual void SelectKeys(const bool bSelected) override; @@ -173,7 +173,7 @@ public: CUiAnimViewNode* GetParentNode() const { return m_pParentNode; } // Children - unsigned int GetChildCount() const { return m_childNodes.size(); } + unsigned int GetChildCount() const { return static_cast(m_childNodes.size()); } CUiAnimViewNode* GetChild(unsigned int index) const { return m_childNodes[index].get(); } // Snap time value to prev/next key in sequence diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp index 7f7f8f7aaf..86554c2004 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp @@ -1320,7 +1320,7 @@ void CUiAnimViewSequence::CloneSelectedKeys() std::vector selectedKeyTimes; for (size_t k = 0; k < selectedKeys.GetKeyCount(); ++k) { - CUiAnimViewKeyHandle skey = selectedKeys.GetKey(k); + CUiAnimViewKeyHandle skey = selectedKeys.GetKey(static_cast(k)); if (pTrack != skey.GetTrack()) { pTrack = skey.GetTrack(); @@ -1332,7 +1332,7 @@ void CUiAnimViewSequence::CloneSelectedKeys() // Now, do the actual cloning. for (size_t k = 0; k < selectedKeyTimes.size(); ++k) { - CUiAnimViewKeyHandle skey = selectedKeys.GetKey(k); + CUiAnimViewKeyHandle skey = selectedKeys.GetKey(static_cast(k)); skey = skey.GetTrack()->GetKeyByTime(selectedKeyTimes[k]); assert(skey.IsValid()); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h index 61aecc9cd5..e26a1ceec3 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h @@ -36,7 +36,7 @@ public: virtual void OnEditorNotifyEvent(EEditorNotifyEvent event); - unsigned int GetCount() const { return m_sequences.size(); } + unsigned int GetCount() const { return static_cast(m_sequences.size()); } void CreateSequence(QString name); void DeleteSequence(CUiAnimViewSequence* pSequence); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h index 6d11f55247..a2e38edc51 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h @@ -23,7 +23,7 @@ public: : m_bAllOfSameType(true) , m_bHasRotationTrack(false) {} - unsigned int GetCount() const { return m_tracks.size(); } + unsigned int GetCount() const { return static_cast(m_tracks.size()); } CUiAnimViewTrack* GetTrack(const unsigned int index) { return m_tracks[index]; } const CUiAnimViewTrack* GetTrack(const unsigned int index) const { return m_tracks[index]; } diff --git a/Gems/LyShine/Code/Editor/CanvasSizeToolbarSection.cpp b/Gems/LyShine/Code/Editor/CanvasSizeToolbarSection.cpp index 39fe3e9719..de9e5e63bc 100644 --- a/Gems/LyShine/Code/Editor/CanvasSizeToolbarSection.cpp +++ b/Gems/LyShine/Code/Editor/CanvasSizeToolbarSection.cpp @@ -493,7 +493,7 @@ void CanvasSizeToolbarSection::HandleIndexChanged() int CanvasSizeToolbarSection::GetCustomSizeIndex() { - return m_canvasSizePresets.size() - 1; + return static_cast(m_canvasSizePresets.size() - 1); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Editor/HierarchyClipboard.cpp b/Gems/LyShine/Code/Editor/HierarchyClipboard.cpp index df65c677ef..41a29988e7 100644 --- a/Gems/LyShine/Code/Editor/HierarchyClipboard.cpp +++ b/Gems/LyShine/Code/Editor/HierarchyClipboard.cpp @@ -156,7 +156,7 @@ void HierarchyClipboard::CopySelectedItemsToClipboard(HierarchyWidget* widget, QMimeData* mimeData = pEditor->CreateQMimeData(); { // Concatenate all the data we need into a single QByteArray. - QByteArray data(xml.c_str(), xml.size()); + QByteArray data(xml.c_str(), static_cast(xml.size())); mimeData->setData(UICANVASEDITOR_MIMETYPE, data); } diff --git a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp index 2bb1686a93..1d8de3598e 100644 --- a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp +++ b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp @@ -286,8 +286,8 @@ void SpriteBorderEditor::AddConfigureSection(QGridLayout* gridLayout, int& rowNu // Count the number of unique entries along each axis to determine number // of rows/cols contained within the spritesheet. - m_numRows = vSet.size() > 1 ? vSet.size() - 1 : 1; - m_numCols = uSet.size() > 1 ? uSet.size() - 1 : 1; + m_numRows = static_cast(vSet.size() > 1 ? vSet.size() - 1 : 1); + m_numCols = static_cast(uSet.size() > 1 ? uSet.size() - 1 : 1); // Text input fields displaying row/col information for auto-extracting // spritesheet cells diff --git a/Gems/LyShine/Code/Source/Animation/AnimNode.cpp b/Gems/LyShine/Code/Source/Animation/AnimNode.cpp index f7a6015a56..a87dae6fbd 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AnimNode.cpp @@ -62,7 +62,7 @@ void CUiAnimNode::Activate([[maybe_unused]] bool bActivate) ////////////////////////////////////////////////////////////////////////// int CUiAnimNode::GetTrackCount() const { - return m_tracks.size(); + return static_cast(m_tracks.size()); } const char* CUiAnimNode::GetParamName(const CUiAnimParamType& paramType) const diff --git a/Gems/LyShine/Code/Source/Animation/AnimSequence.cpp b/Gems/LyShine/Code/Source/Animation/AnimSequence.cpp index f1ecb4af9e..51e5e925ca 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimSequence.cpp +++ b/Gems/LyShine/Code/Source/Animation/AnimSequence.cpp @@ -48,7 +48,7 @@ CUiAnimSequence::CUiAnimSequence(IUiAnimationSystem* pUiAnimationSystem, uint32 CUiAnimSequence::~CUiAnimSequence() { // clear reference to me from all my nodes - for (int i = m_nodes.size(); --i >= 0;) + for (int i = static_cast(m_nodes.size()); --i >= 0;) { if (m_nodes[i]) { @@ -144,7 +144,7 @@ const IUiAnimSequence* CUiAnimSequence::GetParentSequence() const ////////////////////////////////////////////////////////////////////////// int CUiAnimSequence::GetNodeCount() const { - return m_nodes.size(); + return static_cast(m_nodes.size()); } ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Source/Animation/AnimTrack.h b/Gems/LyShine/Code/Source/Animation/AnimTrack.h index e2d6fd1069..f73cd7ede7 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimTrack.h +++ b/Gems/LyShine/Code/Source/Animation/AnimTrack.h @@ -71,7 +71,7 @@ public: } //! Return number of keys in track. - virtual int GetNumKeys() const { return m_keys.size(); }; + virtual int GetNumKeys() const { return static_cast(m_keys.size()); }; //! Return true if keys exists in this track virtual bool HasKeys() const { return !m_keys.empty(); } @@ -517,7 +517,7 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) return -1; } - int nkeys = m_keys.size(); + int nkeys = static_cast(m_keys.size()); if (nkeys == 0) { m_lastTime = time; diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp index ca435dadf9..49c38c8eb0 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp @@ -163,7 +163,7 @@ CUiAnimAzEntityNode::~CUiAnimAzEntityNode() ////////////////////////////////////////////////////////////////////////// unsigned int CUiAnimAzEntityNode::GetParamCount() const { - return CUiAnimAzEntityNode::GetParamCountStatic() + m_entityScriptPropertiesParamInfos.size(); + return static_cast(CUiAnimAzEntityNode::GetParamCountStatic() + m_entityScriptPropertiesParamInfos.size()); } ////////////////////////////////////////////////////////////////////////// @@ -190,7 +190,7 @@ CUiAnimParamType CUiAnimAzEntityNode::GetParamType(unsigned int nIndex) const ////////////////////////////////////////////////////////////////////////// int CUiAnimAzEntityNode::GetParamCountStatic() { - return s_nodeParams.size(); + return static_cast(s_nodeParams.size()); } ////////////////////////////////////////////////////////////////////////// @@ -680,7 +680,7 @@ IUiAnimTrack* CUiAnimAzEntityNode::CreateTrackForAzField(const UiAnimParamData& // this is a compound type, create a compound track // We only support compound tracks with 2, 3 or 4 subtracks - int numElements = classData->m_elements.size(); + int numElements = static_cast(classData->m_elements.size()); if (numElements < 2 || numElements > 4) { return nullptr; diff --git a/Gems/LyShine/Code/Source/Animation/BoolTrack.cpp b/Gems/LyShine/Code/Source/Animation/BoolTrack.cpp index 911c3a29ce..4582cd7be1 100644 --- a/Gems/LyShine/Code/Source/Animation/BoolTrack.cpp +++ b/Gems/LyShine/Code/Source/Animation/BoolTrack.cpp @@ -31,7 +31,7 @@ void UiBoolTrack::GetValue(float time, bool& value) CheckValid(); - int nkeys = m_keys.size(); + int nkeys = static_cast(m_keys.size()); if (nkeys < 1) { return; diff --git a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp index 5c897620c7..d61090f79d 100644 --- a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp +++ b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp @@ -296,7 +296,7 @@ IUiAnimSequence* UiAnimationSystem::GetSequence(int i) const ////////////////////////////////////////////////////////////////////////// int UiAnimationSystem::GetNumSequences() const { - return m_sequences.size(); + return static_cast(m_sequences.size()); } ////////////////////////////////////////////////////////////////////////// @@ -315,7 +315,7 @@ IUiAnimSequence* UiAnimationSystem::GetPlayingSequence(int i) const ////////////////////////////////////////////////////////////////////////// int UiAnimationSystem::GetNumPlayingSequences() const { - return m_playingSequences.size(); + return static_cast(m_playingSequences.size()); } ////////////////////////////////////////////////////////////////////////// @@ -327,7 +327,7 @@ void UiAnimationSystem::AddSequence(IUiAnimSequence* pSequence) ////////////////////////////////////////////////////////////////////////// bool UiAnimationSystem::IsCutScenePlaying() const { - const uint numPlayingSequences = m_playingSequences.size(); + const uint numPlayingSequences = static_cast(m_playingSequences.size()); for (uint i = 0; i < numPlayingSequences; ++i) { const IUiAnimSequence* pAnimSequence = m_playingSequences[i].sequence.get(); diff --git a/Gems/LyShine/Code/Source/RenderGraph.cpp b/Gems/LyShine/Code/Source/RenderGraph.cpp index 9ee26cdf8e..637dfbbbb8 100644 --- a/Gems/LyShine/Code/Source/RenderGraph.cpp +++ b/Gems/LyShine/Code/Source/RenderGraph.cpp @@ -1128,7 +1128,7 @@ namespace LyShine // walk the graph recursively to add up all of the data GetDebugInfoRenderNodeList(m_renderNodes, info, uniqueTextures); - info.m_numUniqueTextures = uniqueTextures.size(); + info.m_numUniqueTextures = static_cast(uniqueTextures.size()); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1183,7 +1183,7 @@ namespace LyShine const PrimitiveListRenderNode* primListRenderNode = static_cast(renderNode); IRenderer::DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives(); - info.m_numPrimitives += primitives.size(); + info.m_numPrimitives += static_cast(primitives.size()); { for (const IRenderer::DynUiPrimitive& primitive : primitives) { @@ -1367,7 +1367,7 @@ namespace LyShine } IRenderer::DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives(); - int numPrimitives = primitives.size(); + int numPrimitives = static_cast(primitives.size()); int numTriangles = 0; for (const IRenderer::DynUiPrimitive& primitive : primitives) { diff --git a/Gems/LyShine/Code/Source/Sprite.cpp b/Gems/LyShine/Code/Source/Sprite.cpp index 134768f814..b24c473e0f 100644 --- a/Gems/LyShine/Code/Source/Sprite.cpp +++ b/Gems/LyShine/Code/Source/Sprite.cpp @@ -273,7 +273,7 @@ void CSprite::Serialize(TSerialize ser) if (hasSpriteSheetCells && ser.BeginOptionalGroup("SpriteSheet", true)) { - const int numSpriteSheetCells = ser.IsReading() ? m_numSpriteSheetCellTags : GetSpriteSheetCells().size(); + const int numSpriteSheetCells = static_cast(ser.IsReading() ? m_numSpriteSheetCellTags : GetSpriteSheetCells().size()); for (int i = 0; i < numSpriteSheetCells; ++i) { ser.BeginOptionalGroup("Cell", true); diff --git a/Gems/LyShine/Code/Source/StringUtfUtils.h b/Gems/LyShine/Code/Source/StringUtfUtils.h index 74a27afe9f..f57deb1d3d 100644 --- a/Gems/LyShine/Code/Source/StringUtfUtils.h +++ b/Gems/LyShine/Code/Source/StringUtfUtils.h @@ -37,7 +37,7 @@ namespace LyShine // this function and use Unicode::CIterator<>::Position instead. wchar_t wcharString[2] = { static_cast(multiByteChar), 0 }; AZStd::string utf8String(CryStringUtils::WStrToUTF8(wcharString)); - int utf8Length = utf8String.length(); + int utf8Length = static_cast(utf8String.length()); return utf8Length; } diff --git a/Gems/LyShine/Code/Source/Tests/internal/test_UiTextComponent.cpp b/Gems/LyShine/Code/Source/Tests/internal/test_UiTextComponent.cpp index 3cd137b25f..bb8bc47556 100644 --- a/Gems/LyShine/Code/Source/Tests/internal/test_UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/Tests/internal/test_UiTextComponent.cpp @@ -2716,7 +2716,7 @@ namespace float newWidth; EBUS_EVENT_ID_RESULT(newWidth, testElemId, UiLayoutCellDefaultBus, GetTargetWidth, LyShine::UiLayoutCellUnspecifiedSize); - const int testStringLength = testString.length(); + const int testStringLength = static_cast(testString.length()); const int numGapsBetweenCharacters = testStringLength >= 1 ? testStringLength - 1 : 0; const float ems = characterSpacing * 0.001f; float expectedWidth = baseWidth + numGapsBetweenCharacters * ems * fontSize; diff --git a/Gems/LyShine/Code/Source/UiCanvasComponent.cpp b/Gems/LyShine/Code/Source/UiCanvasComponent.cpp index 72d9f92d1f..6d2bc67eb0 100644 --- a/Gems/LyShine/Code/Source/UiCanvasComponent.cpp +++ b/Gems/LyShine/Code/Source/UiCanvasComponent.cpp @@ -705,7 +705,7 @@ AZStd::string UiCanvasComponent::GetUniqueChildName(AZ::EntityId parentEntityId, // Count trailing digits in base name int i; - for (i = baseName.length() - 1; i >= 0; i--) + for (i = static_cast(baseName.length() - 1); i >= 0; i--) { if (!isdigit(baseName[i])) { @@ -713,7 +713,7 @@ AZStd::string UiCanvasComponent::GetUniqueChildName(AZ::EntityId parentEntityId, } } int startDigitIndex = i + 1; - int numDigits = baseName.length() - startDigitIndex; + int numDigits = static_cast(baseName.length() - startDigitIndex); int suffix = 1; if (numDigits > 0) @@ -737,7 +737,7 @@ AZStd::string UiCanvasComponent::GetUniqueChildName(AZ::EntityId parentEntityId, AZStd::string suffixString = AZStd::string::format("%d", suffix); // Append leading zeros - int numLeadingZeros = (suffixString.length() < numDigits) ? numDigits - suffixString.length() : 0; + int numLeadingZeros = static_cast((suffixString.length() < numDigits) ? numDigits - suffixString.length() : 0); for (int zeroes = 0; zeroes < numLeadingZeros; zeroes++) { proposedChildName.push_back('0'); @@ -1978,7 +1978,7 @@ void UiCanvasComponent::GetDebugInfoNumElements(DebugInfoNumElements& info) cons info.m_numMaskElements = 0; info.m_numFaderElements = 0; info.m_numInteractableElements = 0; - info.m_numUpdateElements = UiCanvasUpdateNotificationBus::GetNumOfEventHandlers(GetEntityId()); + info.m_numUpdateElements = static_cast(UiCanvasUpdateNotificationBus::GetNumOfEventHandlers(GetEntityId())); DebugInfoCountChildren(m_rootElement, true, info); } diff --git a/Gems/LyShine/Code/Source/UiDynamicScrollBoxComponent.cpp b/Gems/LyShine/Code/Source/UiDynamicScrollBoxComponent.cpp index 30df88da2b..83c4a2d02a 100644 --- a/Gems/LyShine/Code/Source/UiDynamicScrollBoxComponent.cpp +++ b/Gems/LyShine/Code/Source/UiDynamicScrollBoxComponent.cpp @@ -1179,7 +1179,7 @@ void UiDynamicScrollBoxComponent::ResizeContentToFitElements() } else { - int numHeaders = m_sections.size(); + int numHeaders = static_cast(m_sections.size()); int numItems = m_numElements - numHeaders; newSize = numHeaders * m_prototypeElementSize[ElementType::SectionHeader] + numItems * m_prototypeElementSize[ElementType::Item]; } @@ -1201,7 +1201,7 @@ void UiDynamicScrollBoxComponent::ResizeContentToFitElements() } else { - int numHeaders = m_sections.size(); + int numHeaders = static_cast(m_sections.size()); int numItems = m_numElements - numHeaders; newSize = numHeaders * m_estimatedElementSize[ElementType::SectionHeader] + numItems * m_estimatedElementSize[ElementType::Item]; } @@ -1555,7 +1555,7 @@ float UiDynamicScrollBoxComponent::GetFixedSizeElementOffset(int index) const int numHeaders = 0; int numItems = 0; - int numSections = m_sections.size(); + int numSections = static_cast(m_sections.size()); if (numSections > 0) { if (index > m_sections[numSections - 1].m_headerElementIndex) diff --git a/Gems/LyShine/Code/Source/UiElementComponent.cpp b/Gems/LyShine/Code/Source/UiElementComponent.cpp index 388b280e9f..45ddea9877 100644 --- a/Gems/LyShine/Code/Source/UiElementComponent.cpp +++ b/Gems/LyShine/Code/Source/UiElementComponent.cpp @@ -142,7 +142,7 @@ void UiElementComponent::RenderElement(LyShine::IRenderGraph* renderGraph, bool if (m_renderControlInterface) { // give control of rendering this element and its children to the render control component on this element - m_renderControlInterface->Render(renderGraph, this, m_renderInterface, m_childElementComponents.size(), isInGame); + m_renderControlInterface->Render(renderGraph, this, m_renderInterface, static_cast(m_childElementComponents.size()), isInGame); } else { @@ -153,7 +153,7 @@ void UiElementComponent::RenderElement(LyShine::IRenderGraph* renderGraph, bool } // now render child elements - int numChildren = m_childElementComponents.size(); + int numChildren = static_cast(m_childElementComponents.size()); for (int i = 0; i < numChildren; ++i) { GetChildElementComponent(i)->RenderElement(renderGraph, isInGame); @@ -194,7 +194,7 @@ AZ::EntityId UiElementComponent::GetParentEntityId() //////////////////////////////////////////////////////////////////////////////////////////////////// int UiElementComponent::GetNumChildElements() { - return m_childEntityIdOrder.size(); + return static_cast(m_childEntityIdOrder.size()); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -236,7 +236,7 @@ UiElementInterface* UiElementComponent::GetChildElementInterface(int index) int UiElementComponent::GetIndexOfChild(const AZ::Entity* child) { AZ::EntityId childEntityId = child->GetId(); - int numChildren = m_childEntityIdOrder.size(); + int numChildren = static_cast(m_childEntityIdOrder.size()); for (int i = 0; i < numChildren; ++i) { if (m_childEntityIdOrder[i].m_entityId == childEntityId) @@ -251,7 +251,7 @@ int UiElementComponent::GetIndexOfChild(const AZ::Entity* child) //////////////////////////////////////////////////////////////////////////////////////////////////// int UiElementComponent::GetIndexOfChildByEntityId(AZ::EntityId childId) { - int numChildren = m_childEntityIdOrder.size(); + int numChildren = static_cast(m_childEntityIdOrder.size()); for (int i = 0; i < numChildren; ++i) { if (m_childEntityIdOrder[i].m_entityId == childId) @@ -266,7 +266,7 @@ int UiElementComponent::GetIndexOfChildByEntityId(AZ::EntityId childId) //////////////////////////////////////////////////////////////////////////////////////////////////// LyShine::EntityArray UiElementComponent::GetChildElements() { - int numChildren = m_childEntityIdOrder.size(); + int numChildren = static_cast(m_childEntityIdOrder.size()); LyShine::EntityArray children; children.reserve(numChildren); @@ -477,7 +477,7 @@ AZ::Entity* UiElementComponent::FindFrontmostChildContainingPoint(AZ::Vector2 po // this traverses all of the elements in reverse hierarchy order and returns the first one that // is containing the point. // If necessary, this could be optimized using a spatial partitioning data structure. - for (int i = m_childEntityIdOrder.size() - 1; !matchElem && i >= 0; i--) + for (int i = static_cast(m_childEntityIdOrder.size() - 1); !matchElem && i >= 0; i--) { AZ::EntityId child = m_childEntityIdOrder[i].m_entityId; @@ -602,7 +602,7 @@ AZ::EntityId UiElementComponent::FindInteractableToHandleEvent(AZ::Vector2 point EBUS_EVENT_ID_RESULT(isMasked, GetEntityId(), UiInteractionMaskBus, IsPointMasked, point); if (!isMasked) { - for (int i = m_childEntityIdOrder.size() - 1; !result.IsValid() && i >= 0; i--) + for (int i = static_cast(m_childEntityIdOrder.size() - 1); !result.IsValid() && i >= 0; i--) { result = GetChildElementComponent(i)->FindInteractableToHandleEvent(point); } @@ -674,7 +674,7 @@ AZ::Entity* UiElementComponent::FindChildByName(const LyShine::NameType& name) if (AreChildPointersValid()) { - int numChildren = m_childElementComponents.size(); + int numChildren = static_cast(m_childElementComponents.size()); for (int i = 0; i < numChildren; ++i) { AZ::Entity* childEntity = GetChildElementComponent(i)->GetEntity(); @@ -709,7 +709,7 @@ AZ::Entity* UiElementComponent::FindDescendantByName(const LyShine::NameType& na if (AreChildPointersValid()) { - int numChildren = m_childElementComponents.size(); + int numChildren = static_cast(m_childElementComponents.size()); for (int i = 0; i < numChildren; ++i) { UiElementComponent* childElementComponent = GetChildElementComponent(i); @@ -771,7 +771,7 @@ AZ::Entity* UiElementComponent::FindChildByEntityId(AZ::EntityId id) { AZ::Entity* matchElem = nullptr; - int numChildren = m_childEntityIdOrder.size(); + int numChildren = static_cast(m_childEntityIdOrder.size()); for (int i = 0; i < numChildren; ++i) { if (id == m_childEntityIdOrder[i].m_entityId) @@ -803,7 +803,7 @@ AZ::Entity* UiElementComponent::FindDescendantById(LyShine::ElementId id) if (AreChildPointersValid()) { - int numChildren = m_childEntityIdOrder.size(); + int numChildren = static_cast(m_childEntityIdOrder.size()); for (int i = 0; !match && i < numChildren; ++i) { match = GetChildElementComponent(i)->FindDescendantById(id); @@ -825,7 +825,7 @@ void UiElementComponent::FindDescendantElements(AZStd::function(m_childElementComponents.size()); for (int i = 0; i < numChildren; ++i) { UiElementComponent* childElementComponent = GetChildElementComponent(i); @@ -860,7 +860,7 @@ void UiElementComponent::CallOnDescendantElements(AZStd::function(m_childEntityIdOrder.size()); for (int i = 0; i < numChildren; ++i) { callFunction(m_childEntityIdOrder[i].m_entityId); @@ -1068,7 +1068,7 @@ void UiElementComponent::AddChild(AZ::Entity* child, AZ::Entity* insertBefore) if (insertBefore) { - int numChildren = m_childEntityIdOrder.size(); + int numChildren = static_cast(m_childEntityIdOrder.size()); for (int i = 0; i < numChildren; ++i) { if (m_childEntityIdOrder[i].m_entityId == insertBefore->GetId()) @@ -1696,7 +1696,7 @@ void UiElementComponent::OnPatchEnd(const AZ::DataPatchNodeInfo& patchInfo) // the lookupAddress is the same length as the "Children" address plus an index // check if the address is childrenAddress plus an extra element bool match = true; - for (int i = childrenAddress.size() - 1; i >= 0; --i) + for (int i = static_cast(childrenAddress.size() - 1); i >= 0; --i) { if (lookupAddress[i] != childrenAddress[i]) { @@ -1827,7 +1827,7 @@ void UiElementComponent::OnPatchEnd(const AZ::DataPatchNodeInfo& patchInfo) // This will sort all the entity order entries by sort index (primary) and entity id (secondary) which should never result in any collisions // This is used since slice data patching may create duplicate entries for the same sort index, missing indices and the like. // It should never result in multiple entity id entries since the serialization of this data uses a persistent id which is the entity id - int numChildren = m_childEntityIdOrder.size(); + int numChildren = static_cast(m_childEntityIdOrder.size()); if (numChildren > 0) { AZStd::sort(m_childEntityIdOrder.begin(), m_childEntityIdOrder.end()); diff --git a/Gems/LyShine/Code/Source/UiImageComponent.cpp b/Gems/LyShine/Code/Source/UiImageComponent.cpp index 901c13d594..1e48bdff51 100644 --- a/Gems/LyShine/Code/Source/UiImageComponent.cpp +++ b/Gems/LyShine/Code/Source/UiImageComponent.cpp @@ -699,7 +699,7 @@ const AZ::u32 UiImageComponent::GetImageIndexCount() { if (m_sprite) { - return m_sprite->GetSpriteSheetCells().size(); + return static_cast(m_sprite->GetSpriteSheetCells().size()); } return 0; @@ -2635,7 +2635,7 @@ LyShine::AZu32ComboBoxVec UiImageComponent::PopulateIndexStringList() const // There may not be a sprite loaded for this component if (m_sprite) { - const AZ::u32 numCells = m_sprite->GetSpriteSheetCells().size(); + const AZ::u32 numCells = static_cast(m_sprite->GetSpriteSheetCells().size()); if (numCells != 0) { diff --git a/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp b/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp index 33b73dfa63..086aed9f58 100644 --- a/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp +++ b/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp @@ -268,7 +268,7 @@ const AZ::u32 UiImageSequenceComponent::GetImageIndex() //////////////////////////////////////////////////////////////////////////////////////////////////// const AZ::u32 UiImageSequenceComponent::GetImageIndexCount() { - return m_spriteList.size(); + return static_cast(m_spriteList.size()); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Source/UiLayoutColumnComponent.cpp b/Gems/LyShine/Code/Source/UiLayoutColumnComponent.cpp index f385a2eead..bd557ad64e 100644 --- a/Gems/LyShine/Code/Source/UiLayoutColumnComponent.cpp +++ b/Gems/LyShine/Code/Source/UiLayoutColumnComponent.cpp @@ -452,7 +452,7 @@ void UiLayoutColumnComponent::ApplyLayoutWidth(float availableWidth) // Get the child element cell widths UiLayoutHelpers::LayoutCellSizes layoutCells; UiLayoutHelpers::GetLayoutCellWidths(GetEntityId(), m_ignoreDefaultLayoutCells, layoutCells); - int numChildren = layoutCells.size(); + int numChildren = static_cast(layoutCells.size()); if (numChildren > 0) { // Set the child elements' transform properties based on the calculated child widths @@ -492,7 +492,7 @@ void UiLayoutColumnComponent::ApplyLayoutHeight(float availableHeight) // Get the child element cell heights UiLayoutHelpers::LayoutCellSizes layoutCells; UiLayoutHelpers::GetLayoutCellHeights(GetEntityId(), m_ignoreDefaultLayoutCells, layoutCells); - int numChildren = layoutCells.size(); + int numChildren = static_cast(layoutCells.size()); if (numChildren > 0) { // Calculate child heights diff --git a/Gems/LyShine/Code/Source/UiLayoutHelpers.cpp b/Gems/LyShine/Code/Source/UiLayoutHelpers.cpp index 5f53635ae8..49b1f59f97 100644 --- a/Gems/LyShine/Code/Source/UiLayoutHelpers.cpp +++ b/Gems/LyShine/Code/Source/UiLayoutHelpers.cpp @@ -434,7 +434,7 @@ namespace UiLayoutHelpers //////////////////////////////////////////////////////////////////////////////////////////////////// void CalculateElementSizes(const LayoutCellSizes& layoutCells, float availableSize, float spacing, AZStd::vector& sizesOut) { - int numElements = layoutCells.size(); + int numElements = static_cast(layoutCells.size()); availableSize -= (numElements - 1) * spacing; diff --git a/Gems/LyShine/Code/Source/UiLayoutRowComponent.cpp b/Gems/LyShine/Code/Source/UiLayoutRowComponent.cpp index 08770ebe83..3dcc8afdef 100644 --- a/Gems/LyShine/Code/Source/UiLayoutRowComponent.cpp +++ b/Gems/LyShine/Code/Source/UiLayoutRowComponent.cpp @@ -452,7 +452,7 @@ void UiLayoutRowComponent::ApplyLayoutWidth(float availableWidth) // Get the child element cell widths UiLayoutHelpers::LayoutCellSizes layoutCells; UiLayoutHelpers::GetLayoutCellWidths(GetEntityId(), m_ignoreDefaultLayoutCells, layoutCells); - int numChildren = layoutCells.size(); + int numChildren = static_cast(layoutCells.size()); if (numChildren > 0) { // Calculate child widths @@ -529,7 +529,7 @@ void UiLayoutRowComponent::ApplyLayoutHeight(float availableHeight) // Get the child element cell heights UiLayoutHelpers::LayoutCellSizes layoutCells; UiLayoutHelpers::GetLayoutCellHeights(GetEntityId(), m_ignoreDefaultLayoutCells, layoutCells); - int numChildren = layoutCells.size(); + int numChildren = static_cast(layoutCells.size()); if (numChildren > 0) { // Set the child elements' transform properties based on the calculated child heights diff --git a/Gems/LyShine/Code/Source/UiMarkupButtonComponent.cpp b/Gems/LyShine/Code/Source/UiMarkupButtonComponent.cpp index 8373ebf0d3..5df648cf5e 100644 --- a/Gems/LyShine/Code/Source/UiMarkupButtonComponent.cpp +++ b/Gems/LyShine/Code/Source/UiMarkupButtonComponent.cpp @@ -32,7 +32,7 @@ namespace { // Iterate through the clickable rects to find one that contains the point int clickableRectIndex = -1; - const int numClickableRects = clickableTextRects.size(); + const int numClickableRects = static_cast(clickableTextRects.size()); for (int i = 0; i < numClickableRects; ++i) { const auto& clickableRect = clickableTextRects[i]; diff --git a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp index 860eaf0d78..9668ebf463 100644 --- a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp +++ b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp @@ -409,7 +409,7 @@ void UiParticleEmitterComponent::SetSpriteSheetCellIndex(int spriteSheetIndex) if (m_sprite) { - const AZ::u32 numCells = m_sprite->GetSpriteSheetCells().size(); + const AZ::u32 numCells = static_cast(m_sprite->GetSpriteSheetCells().size()); m_spriteSheetCellIndex = AZ::GetMin(numCells, m_spriteSheetCellIndex); m_spriteSheetCellEndIndex = AZ::GetMax(m_spriteSheetCellIndex, m_spriteSheetCellEndIndex); } @@ -428,7 +428,7 @@ void UiParticleEmitterComponent::SetSpriteSheetCellEndIndex(int spriteSheetEndIn if (m_sprite) { - const AZ::u32 numCells = m_sprite->GetSpriteSheetCells().size(); + const AZ::u32 numCells = static_cast(m_sprite->GetSpriteSheetCells().size()); m_spriteSheetCellEndIndex = AZ::GetMin(numCells, m_spriteSheetCellEndIndex); m_spriteSheetCellIndex = AZ::GetMin(m_spriteSheetCellIndex, m_spriteSheetCellEndIndex); } @@ -759,7 +759,7 @@ void UiParticleEmitterComponent::InGamePostActivate() //////////////////////////////////////////////////////////////////////////////////////////////////// void UiParticleEmitterComponent::Render(LyShine::IRenderGraph* renderGraph) { - AZ::u32 particlesToRender = AZ::GetMin(m_particleContainer.size(), m_particleBufferSize); + AZ::u32 particlesToRender = AZ::GetMin(static_cast(m_particleContainer.size()), m_particleBufferSize); if (particlesToRender == 0) { return; @@ -1943,7 +1943,7 @@ void UiParticleEmitterComponent::OnSpritePathnameChange() m_spriteSheetCellIndex = 0; if (IsSpriteTypeSpriteSheet()) { - m_spriteSheetCellEndIndex = m_sprite->GetSpriteSheetCells().size() - 1; + m_spriteSheetCellEndIndex = static_cast(m_sprite->GetSpriteSheetCells().size() - 1); } } @@ -2086,7 +2086,7 @@ UiParticleEmitterComponent::AZu32ComboBoxVec UiParticleEmitterComponent::Populat // There may not be a sprite loaded for this component if (m_sprite) { - const AZ::u32 numCells = m_sprite->GetSpriteSheetCells().size(); + const AZ::u32 numCells = static_cast(m_sprite->GetSpriteSheetCells().size()); if (numCells != 0) { diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index 025c22a895..d95b15622b 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -4413,7 +4413,7 @@ void UiTextComponent::HandleWidthOnlyShrinkToFitWithWrapping( { // Consider the sizes of all overflowing lines when calculating the // scale to reduce the number of times we need to iterate. - int numOverflowingLines = drawBatchLinesOut.batchLines.size() - maxLinesElementCanHold; + int numOverflowingLines = static_cast(drawBatchLinesOut.batchLines.size() - maxLinesElementCanHold); DrawBatchLineContainer::reverse_iterator riter; int overflowLineCount = 0; float overflowingLineSize = 0.0f; diff --git a/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.cpp b/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.cpp index b4e8a8d63e..24f2bff49c 100644 --- a/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.cpp @@ -92,7 +92,7 @@ void UiTextComponentOffsetsSelector::ParseBatchLine(const UiTextComponent::DrawB // on the same line or not. else if (!lastIndexFound) { - int substrLength = drawBatch.text.length() - firstIndexLineIndex; + int substrLength = static_cast(drawBatch.text.length() - firstIndexLineIndex); AZStd::string curSubstring(drawBatch.text.substr(firstIndexLineIndex, substrLength)); curLineWidth += drawBatch.font->GetTextSize(curSubstring.c_str(), false, m_fontContext).x; lineOffsetsStack.top()->right.SetX(AZStd::GetMax(lineOffsetsStack.top()->right.GetX(), curLineWidth)); diff --git a/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.h b/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.h index 1c98e53970..896e93a3be 100644 --- a/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.h +++ b/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.h @@ -29,7 +29,7 @@ struct UiTextComponentOffsetsSelector , m_firstIndex(firstIndex) , m_lastIndex(lastIndex) , m_lastIndexLineNumber(lastIndexLineNumber) - , m_numLines(m_drawBatchLines.batchLines.size()) + , m_numLines(static_cast(m_drawBatchLines.batchLines.size())) , m_indexIter(0) , m_numCharsSelected(0) , m_lineCounter(0) diff --git a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp index e37d8787e1..6a02d94b1f 100644 --- a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp @@ -647,7 +647,7 @@ bool UiTextInputComponent::HandleKeyInputBegan(const AzFramework::InputChannel:: // Append text from clipboard textString.insert(m_textCursorPos, clipboardText); - m_textCursorPos += clipboardText.length(); + m_textCursorPos += static_cast(clipboardText.length()); m_textSelectionStartPos = m_textCursorPos; // If max length is set, remove extra characters From a66f9c0e5983f7e4d3784fe8fb345a49b4472798 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 15:48:17 -0700 Subject: [PATCH 21/75] Maestro Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp | 2 +- Gems/Maestro/Code/Source/Cinematics/AnimPostFXNode.cpp | 2 +- Gems/Maestro/Code/Source/Cinematics/AnimScreenFaderNode.cpp | 6 +++--- Gems/Maestro/Code/Source/Cinematics/AnimSequence.cpp | 4 ++-- Gems/Maestro/Code/Source/Cinematics/AnimTrack.h | 4 ++-- Gems/Maestro/Code/Source/Cinematics/BoolTrack.cpp | 2 +- Gems/Maestro/Code/Source/Cinematics/CommentNode.cpp | 2 +- Gems/Maestro/Code/Source/Cinematics/GotoTrack.cpp | 2 +- Gems/Maestro/Code/Source/Cinematics/LayerNode.cpp | 2 +- Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp | 2 +- Gems/Maestro/Code/Source/Cinematics/Movie.cpp | 6 +++--- Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp | 4 ++-- Gems/Maestro/Code/Source/Cinematics/ShadowsSetupNode.cpp | 2 +- Gems/Maestro/Code/Source/Cinematics/TimeRangesTrack.cpp | 2 +- .../Code/Source/Components/EditorSequenceAgentComponent.cpp | 2 +- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp index e932f21388..828e5ad20f 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp @@ -74,7 +74,7 @@ void CAnimNode::Activate([[maybe_unused]] bool bActivate) ////////////////////////////////////////////////////////////////////////// int CAnimNode::GetTrackCount() const { - return m_tracks.size(); + return static_cast(m_tracks.size()); } const char* CAnimNode::GetParamName(const CAnimParamType& paramType) const diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimPostFXNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimPostFXNode.cpp index 78d878c0eb..8160f97de7 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimPostFXNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/AnimPostFXNode.cpp @@ -288,7 +288,7 @@ void CAnimPostFXNode::SerializeAnims(XmlNodeRef& xmlNode, bool bLoading, bool bL //----------------------------------------------------------------------------- unsigned int CAnimPostFXNode::GetParamCount() const { - return m_pDescription->m_nodeParams.size(); + return static_cast(m_pDescription->m_nodeParams.size()); } //----------------------------------------------------------------------------- diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimScreenFaderNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimScreenFaderNode.cpp index 22e3cbba86..62cffcefb1 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimScreenFaderNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/AnimScreenFaderNode.cpp @@ -114,7 +114,7 @@ void CAnimScreenFaderNode::Animate(SAnimContext& ac) for (size_t nFaderTrackNo = 0; nFaderTrackNo < nScreenFaderTracksNumber; ++nFaderTrackNo) { - CScreenFaderTrack* pTrack = static_cast(GetTrackForParameter(AnimParamType::ScreenFader, nFaderTrackNo)); + CScreenFaderTrack* pTrack = static_cast(GetTrackForParameter(AnimParamType::ScreenFader, static_cast(nFaderTrackNo))); if (!pTrack) { @@ -298,7 +298,7 @@ void CAnimScreenFaderNode::Reflect(AZ::ReflectContext* context) //----------------------------------------------------------------------------- unsigned int CAnimScreenFaderNode::GetParamCount() const { - return s_screenFaderNodeParams.size(); + return static_cast(s_screenFaderNodeParams.size()); } //----------------------------------------------------------------------------- @@ -350,7 +350,7 @@ bool CAnimScreenFaderNode::IsAnyTextureVisible() const size_t const paramCount = m_tracks.size(); for (size_t paramIndex = 0; paramIndex < paramCount; ++paramIndex) { - CScreenFaderTrack* pTrack = static_cast(GetTrackForParameter(AnimParamType::ScreenFader, paramIndex)); + CScreenFaderTrack* pTrack = static_cast(GetTrackForParameter(AnimParamType::ScreenFader, static_cast(paramIndex))); if (!pTrack) { diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimSequence.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimSequence.cpp index e9f77f7947..ad78e4e420 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimSequence.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/AnimSequence.cpp @@ -66,7 +66,7 @@ CAnimSequence::CAnimSequence() CAnimSequence::~CAnimSequence() { // clear reference to me from all my nodes - for (int i = m_nodes.size(); --i >= 0;) + for (int i = static_cast(m_nodes.size()); --i >= 0;) { if (m_nodes[i]) { @@ -181,7 +181,7 @@ const IAnimSequence* CAnimSequence::GetParentSequence() const ////////////////////////////////////////////////////////////////////////// int CAnimSequence::GetNodeCount() const { - return m_nodes.size(); + return static_cast(m_nodes.size()); } ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h b/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h index 2a1aa970e5..b65dad1323 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h @@ -96,7 +96,7 @@ public: } //! Return number of keys in track. - virtual int GetNumKeys() const { return m_keys.size(); }; + virtual int GetNumKeys() const { return static_cast(m_keys.size()); }; //! Return true if keys exists in this track virtual bool HasKeys() const { return !m_keys.empty(); } @@ -575,7 +575,7 @@ inline int TAnimTrack::GetActiveKey(float time, KeyType* key) return -1; } - int nkeys = m_keys.size(); + int nkeys = static_cast(m_keys.size()); if (nkeys == 0) { m_lastTime = time; diff --git a/Gems/Maestro/Code/Source/Cinematics/BoolTrack.cpp b/Gems/Maestro/Code/Source/Cinematics/BoolTrack.cpp index 3b3e9a213c..b64abcc64f 100644 --- a/Gems/Maestro/Code/Source/Cinematics/BoolTrack.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/BoolTrack.cpp @@ -38,7 +38,7 @@ void CBoolTrack::GetValue(float time, bool& value) CheckValid(); - int nkeys = m_keys.size(); + int nkeys = static_cast(m_keys.size()); if (nkeys < 1) { return; diff --git a/Gems/Maestro/Code/Source/Cinematics/CommentNode.cpp b/Gems/Maestro/Code/Source/Cinematics/CommentNode.cpp index a24b207e6e..fc58b91723 100644 --- a/Gems/Maestro/Code/Source/Cinematics/CommentNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/CommentNode.cpp @@ -114,7 +114,7 @@ void CCommentNode::Reflect(AZ::ReflectContext* context) //----------------------------------------------------------------------------- unsigned int CCommentNode::GetParamCount() const { - return s_nodeParameters.size(); + return static_cast(s_nodeParameters.size()); } //----------------------------------------------------------------------------- diff --git a/Gems/Maestro/Code/Source/Cinematics/GotoTrack.cpp b/Gems/Maestro/Code/Source/Cinematics/GotoTrack.cpp index 8fac693496..350741f688 100644 --- a/Gems/Maestro/Code/Source/Cinematics/GotoTrack.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/GotoTrack.cpp @@ -132,7 +132,7 @@ void CGotoTrack::SetKeyAtTime(float time, IKey* key) if (fabs(keyt - time) < MIN_TIME_PRECISION) { key->flags = m_keys[i].flags; // Reserve the flag value. - SetKey(i, key); + SetKey(static_cast(i), key); found = true; break; } diff --git a/Gems/Maestro/Code/Source/Cinematics/LayerNode.cpp b/Gems/Maestro/Code/Source/Cinematics/LayerNode.cpp index fb28fb71a3..8c518f5a54 100644 --- a/Gems/Maestro/Code/Source/Cinematics/LayerNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/LayerNode.cpp @@ -138,7 +138,7 @@ void CLayerNode::Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyTr //----------------------------------------------------------------------------- unsigned int CLayerNode::GetParamCount() const { - return s_nodeParams.size(); + return static_cast(s_nodeParams.size()); } //----------------------------------------------------------------------------- diff --git a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp index b045ae0050..08d4d92e8b 100644 --- a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp @@ -174,7 +174,7 @@ void CAnimMaterialNode::UpdateDynamicParamsInternal() ////////////////////////////////////////////////////////////////////////// unsigned int CAnimMaterialNode::GetParamCount() const { - return s_nodeParams.size() + m_dynamicShaderParamInfos.size(); + return static_cast(s_nodeParams.size() + m_dynamicShaderParamInfos.size()); } ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Maestro/Code/Source/Cinematics/Movie.cpp b/Gems/Maestro/Code/Source/Cinematics/Movie.cpp index 2d5aa7b410..b781dd6c82 100644 --- a/Gems/Maestro/Code/Source/Cinematics/Movie.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/Movie.cpp @@ -379,7 +379,7 @@ IAnimSequence* CMovieSystem::GetSequence(int i) const ////////////////////////////////////////////////////////////////////////// int CMovieSystem::GetNumSequences() const { - return m_sequences.size(); + return static_cast(m_sequences.size()); } ////////////////////////////////////////////////////////////////////////// @@ -398,7 +398,7 @@ IAnimSequence* CMovieSystem::GetPlayingSequence(int i) const ////////////////////////////////////////////////////////////////////////// int CMovieSystem::GetNumPlayingSequences() const { - return m_playingSequences.size(); + return static_cast(m_playingSequences.size()); } ////////////////////////////////////////////////////////////////////////// @@ -410,7 +410,7 @@ void CMovieSystem::AddSequence(IAnimSequence* sequence) ////////////////////////////////////////////////////////////////////////// bool CMovieSystem::IsCutScenePlaying() const { - const uint numPlayingSequences = m_playingSequences.size(); + const uint numPlayingSequences = static_cast(m_playingSequences.size()); for (uint i = 0; i < numPlayingSequences; ++i) { const IAnimSequence* pAnimSequence = m_playingSequences[i].sequence.get(); diff --git a/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp b/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp index 4ffb7f0413..fb12b3e795 100644 --- a/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp @@ -254,7 +254,7 @@ void CAnimSceneNode::CreateDefaultTracks() ////////////////////////////////////////////////////////////////////////// unsigned int CAnimSceneNode::GetParamCount() const { - return s_nodeParams.size(); + return static_cast(s_nodeParams.size()); } ////////////////////////////////////////////////////////////////////////// @@ -661,7 +661,7 @@ void CAnimSceneNode::OnStop() ////////////////////////////////////////////////////////////////////////// void CAnimSceneNode::ResetSounds() { - for (int i = m_SoundInfo.size(); --i >= 0; ) + for (int i = static_cast(m_SoundInfo.size()); --i >= 0; ) { m_SoundInfo[i].Reset(); } diff --git a/Gems/Maestro/Code/Source/Cinematics/ShadowsSetupNode.cpp b/Gems/Maestro/Code/Source/Cinematics/ShadowsSetupNode.cpp index 0adb27f49f..fd5e30199e 100644 --- a/Gems/Maestro/Code/Source/Cinematics/ShadowsSetupNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/ShadowsSetupNode.cpp @@ -81,7 +81,7 @@ void CShadowsSetupNode::OnReset() //----------------------------------------------------------------------------- unsigned int CShadowsSetupNode::GetParamCount() const { - return ShadowSetupNode::s_shadowSetupParams.size(); + return static_cast(ShadowSetupNode::s_shadowSetupParams.size()); } //----------------------------------------------------------------------------- diff --git a/Gems/Maestro/Code/Source/Cinematics/TimeRangesTrack.cpp b/Gems/Maestro/Code/Source/Cinematics/TimeRangesTrack.cpp index 8cce920dc0..2b71aed3b5 100644 --- a/Gems/Maestro/Code/Source/Cinematics/TimeRangesTrack.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/TimeRangesTrack.cpp @@ -69,7 +69,7 @@ void CTimeRangesTrack::GetKeyInfo(int key, const char*& description, float& dura int CTimeRangesTrack::GetActiveKeyIndexForTime(const float time) { - const unsigned int numKeys = m_keys.size(); + const unsigned int numKeys = static_cast(m_keys.size()); if (numKeys == 0 || m_keys[0].time > time) { diff --git a/Gems/Maestro/Code/Source/Components/EditorSequenceAgentComponent.cpp b/Gems/Maestro/Code/Source/Components/EditorSequenceAgentComponent.cpp index 5533bc14a9..4264dd0ab3 100644 --- a/Gems/Maestro/Code/Source/Components/EditorSequenceAgentComponent.cpp +++ b/Gems/Maestro/Code/Source/Components/EditorSequenceAgentComponent.cpp @@ -231,7 +231,7 @@ namespace Maestro // check for paramType specialization attributes on the getter method of the virtual property. if found, reset // to the eAnimParamType enum - this leaves the paramType name unchanged but changes the type. - for (int i = virtualProperty->m_getter->m_attributes.size(); --i >= 0;) + for (int i = static_cast(virtualProperty->m_getter->m_attributes.size()); --i >= 0;) { if (virtualProperty->m_getter->m_attributes[i].first == AZ::Edit::Attributes::PropertyPosition) { From 93caf57c3a2b551d948973b77df94ac6e8752d3a Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 15:50:37 -0700 Subject: [PATCH 22/75] MessagePopup Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/MessagePopup/Code/Source/MessagePopupManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/MessagePopup/Code/Source/MessagePopupManager.h b/Gems/MessagePopup/Code/Source/MessagePopupManager.h index 7fdaf8d918..7dde587416 100644 --- a/Gems/MessagePopup/Code/Source/MessagePopupManager.h +++ b/Gems/MessagePopup/Code/Source/MessagePopupManager.h @@ -27,7 +27,7 @@ namespace MessagePopup bool RemovePopup(AZ::u32 _popupID); void* GetPopupClientData(AZ::u32 _popupID); MessagePopupInfo* GetPopupInfo(AZ::u32 _popupID); - AZ::u32 GetNumActivePopups() const { return m_currentPopups.size(); } + AZ::u32 GetNumActivePopups() const { return static_cast(m_currentPopups.size()); } protected: ////////////////////////////////////////////////////////////////////////// From 2338bd09d45cb7361f89da5227079fb5911f6d38 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 15:50:54 -0700 Subject: [PATCH 23/75] Microphone Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Windows/MicrophoneSystemComponent_Windows.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gems/Microphone/Code/Source/Platform/Windows/MicrophoneSystemComponent_Windows.cpp b/Gems/Microphone/Code/Source/Platform/Windows/MicrophoneSystemComponent_Windows.cpp index 80e42cf208..c182ec4f3b 100644 --- a/Gems/Microphone/Code/Source/Platform/Windows/MicrophoneSystemComponent_Windows.cpp +++ b/Gems/Microphone/Code/Source/Platform/Windows/MicrophoneSystemComponent_Windows.cpp @@ -384,7 +384,7 @@ namespace Audio src_short_to_float_array( reinterpret_cast(m_conversionBufferIn.m_data), reinterpret_cast(m_conversionBufferOut.m_data), - numFrames * m_config.m_numChannels + static_cast(numFrames * m_config.m_numChannels) ); // Swap to move the 'working' buffer back to the 'In' buffer. @@ -397,8 +397,8 @@ namespace Audio { // Setup Conversion Data m_srcData.end_of_input = 0; - m_srcData.input_frames = numFrames; - m_srcData.output_frames = numFrames; + m_srcData.input_frames = static_cast(numFrames); + m_srcData.output_frames = static_cast(numFrames); m_srcData.data_in = reinterpret_cast(m_conversionBufferIn.m_data); m_srcData.data_out = reinterpret_cast(m_conversionBufferOut.m_data); @@ -478,7 +478,7 @@ namespace Audio src_float_to_short_array( reinterpret_cast(m_conversionBufferIn.m_data), *reinterpret_cast(outputData), - numFrames * m_config.m_numChannels + static_cast(numFrames * m_config.m_numChannels) ); } else From 0f0a6c5cd32aadefe5d3dd4fbd0815c3c2cfa159 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 15:54:43 -0700 Subject: [PATCH 24/75] Multiplayer Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../LocalPredictionPlayerInputComponent.cpp | 12 ++++++------ .../EntityReplication/EntityReplicationManager.cpp | 6 +++--- .../EntityReplication/EntityReplicator.cpp | 2 +- .../Source/NetworkEntity/NetworkEntityManager.cpp | 2 +- .../Source/NetworkEntity/NetworkEntityRpcMessage.cpp | 6 +++--- .../NetworkEntity/NetworkEntityUpdateMessage.cpp | 2 +- .../Code/Source/Pipeline/NetBindMarkerComponent.cpp | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp index df0d84c427..927b8134f6 100644 --- a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp @@ -198,7 +198,7 @@ namespace Multiplayer // Produce correction for client AzNetworking::PacketEncodingBuffer correction; correction.Resize(correction.GetCapacity()); - AzNetworking::NetworkInputSerializer serializer(correction.GetBuffer(), correction.GetCapacity()); + AzNetworking::NetworkInputSerializer serializer(correction.GetBuffer(), static_cast(correction.GetCapacity())); // only deserialize if we have data (for client/server profile/debug mismatches) if (correction.GetSize() > 0) @@ -218,7 +218,7 @@ namespace Multiplayer { // In debug, show which states caused the correction // Write in client state - AzNetworking::NetworkOutputSerializer clientStateSerializer(clientState.GetBuffer(), clientState.GetSize()); + AzNetworking::NetworkOutputSerializer clientStateSerializer(clientState.GetBuffer(), static_cast(clientState.GetSize())); GetNetBindComponent()->SerializeEntityCorrection(clientStateSerializer); // Read out state values @@ -226,7 +226,7 @@ namespace Multiplayer GetNetBindComponent()->SerializeEntityCorrection(clientValues); // Restore server state - AzNetworking::NetworkOutputSerializer serverStateSerializer(correction.GetBuffer(), correction.GetSize()); + AzNetworking::NetworkOutputSerializer serverStateSerializer(correction.GetBuffer(), static_cast(correction.GetSize())); GetNetBindComponent()->SerializeEntityCorrection(serverStateSerializer); // Read out state values @@ -352,7 +352,7 @@ namespace Multiplayer m_lastCorrectionInputId = inputId; // Apply the correction - AzNetworking::TrackChangedSerializer serializer(correction.GetBuffer(), correction.GetSize()); + AzNetworking::TrackChangedSerializer serializer(correction.GetBuffer(), static_cast(correction.GetSize())); GetNetBindComponent()->SerializeEntityCorrection(serializer); m_correctionEvent.Signal(); @@ -364,7 +364,7 @@ namespace Multiplayer GetCorrectionDataString(GetNetBindComponent()).c_str() ); - const uint32_t inputHistorySize = m_inputHistory.Size(); + const uint32_t inputHistorySize = static_cast(m_inputHistory.Size()); const uint32_t historicalDelta = aznumeric_cast(m_clientInputId - inputId); // Do not replay the move we just corrected, that was already processed by the server // If this correction is for a move outside our input history window, just start replaying from the oldest move we have available @@ -524,7 +524,7 @@ namespace Multiplayer #ifndef AZ_RELEASE_BUILD if (cl_EnableDesyncDebugging) { - AzNetworking::NetworkInputSerializer processInputResultSerializer(processInputResult.GetBuffer(), processInputResult.GetCapacity()); + AzNetworking::NetworkInputSerializer processInputResultSerializer(processInputResult.GetBuffer(), static_cast(processInputResult.GetCapacity())); GetNetBindComponent()->SerializeEntityCorrection(processInputResultSerializer); processInputResult.Resize(processInputResultSerializer.GetSize()); } diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicationManager.cpp b/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicationManager.cpp index b9e9a9a87e..b8a77dab58 100644 --- a/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicationManager.cpp +++ b/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicationManager.cpp @@ -769,7 +769,7 @@ namespace Multiplayer return HandleEntityDeleteMessage(entityReplicator, packetHeader, updateMessage); } - AzNetworking::TrackChangedSerializer outputSerializer(updateMessage.GetData()->GetBuffer(), updateMessage.GetData()->GetSize()); + AzNetworking::TrackChangedSerializer outputSerializer(updateMessage.GetData()->GetBuffer(), static_cast(updateMessage.GetData()->GetSize())); PrefabEntityId prefabEntityId; if (updateMessage.GetHasValidPrefabId()) @@ -1102,7 +1102,7 @@ namespace Multiplayer // Send an update packet if it needs one propPublisher->GenerateRecord(); bool needsNetworkPropertyUpdate = propPublisher->PrepareSerialization(); - AzNetworking::NetworkInputSerializer inputSerializer(message.m_propertyUpdateData.GetBuffer(), message.m_propertyUpdateData.GetCapacity()); + AzNetworking::NetworkInputSerializer inputSerializer(message.m_propertyUpdateData.GetBuffer(), static_cast(message.m_propertyUpdateData.GetCapacity())); if (needsNetworkPropertyUpdate) { // Write out entity state into the buffer @@ -1127,7 +1127,7 @@ namespace Multiplayer { if (message.m_propertyUpdateData.GetSize() > 0) { - AzNetworking::TrackChangedSerializer outputSerializer(message.m_propertyUpdateData.GetBuffer(), message.m_propertyUpdateData.GetSize()); + AzNetworking::TrackChangedSerializer outputSerializer(message.m_propertyUpdateData.GetBuffer(), static_cast(message.m_propertyUpdateData.GetSize())); if (!HandlePropertyChangeMessage ( replicator, diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicator.cpp b/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicator.cpp index 93fd3ea652..eb51c3c478 100644 --- a/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicator.cpp +++ b/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicator.cpp @@ -430,7 +430,7 @@ namespace Multiplayer updateMessage.SetPrefabEntityId(netBindComponent->GetPrefabEntityId()); } - AzNetworking::NetworkInputSerializer inputSerializer(updateMessage.ModifyData().GetBuffer(), updateMessage.ModifyData().GetCapacity()); + AzNetworking::NetworkInputSerializer inputSerializer(updateMessage.ModifyData().GetBuffer(), static_cast(updateMessage.ModifyData().GetCapacity())); m_propertyPublisher->UpdateSerialization(inputSerializer); updateMessage.ModifyData().Resize(inputSerializer.GetSize()); diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp index 1460d015fa..cff05b9151 100644 --- a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp +++ b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp @@ -75,7 +75,7 @@ namespace Multiplayer uint32_t NetworkEntityManager::GetEntityCount() const { - return m_networkEntityTracker.size(); + return static_cast(m_networkEntityTracker.size()); } NetworkEntityHandle NetworkEntityManager::AddEntityToEntityMap(NetEntityId netEntityId, AZ::Entity* entity) diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityRpcMessage.cpp b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityRpcMessage.cpp index 85fc7118cc..5f4b849eac 100644 --- a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityRpcMessage.cpp +++ b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityRpcMessage.cpp @@ -97,7 +97,7 @@ namespace Multiplayer + sizeof(RpcIndex); // 2-byte size header + the actual blob payload itself - const uint32_t sizeOfBlob = (m_data != nullptr) ? sizeof(uint16_t) + m_data->GetSize() : 0; + const uint32_t sizeOfBlob = static_cast((m_data != nullptr) ? sizeof(uint16_t) + m_data->GetSize() : 0); // No sliceId, remote replicator already exists so we don't need to know what type of entity this is return sizeOfFields + sizeOfBlob; @@ -135,7 +135,7 @@ namespace Multiplayer m_data = AZStd::make_unique(); } - AzNetworking::NetworkInputSerializer serializer(m_data->GetBuffer(), m_data->GetCapacity()); + AzNetworking::NetworkInputSerializer serializer(m_data->GetBuffer(), static_cast(m_data->GetCapacity())); if (params.Serialize(serializer)) { m_data->Resize(serializer.GetSize()); @@ -154,7 +154,7 @@ namespace Multiplayer return false; } - AzNetworking::NetworkOutputSerializer serializer(m_data->GetBuffer(), m_data->GetSize()); + AzNetworking::NetworkOutputSerializer serializer(m_data->GetBuffer(), static_cast(m_data->GetSize())); return outParams.Serialize(serializer); } diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityUpdateMessage.cpp b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityUpdateMessage.cpp index 1bf10d0ad0..4a2f12ce17 100644 --- a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityUpdateMessage.cpp +++ b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityUpdateMessage.cpp @@ -128,7 +128,7 @@ namespace Multiplayer } // 2-byte size header + the actual blob payload itself - const uint32_t sizeOfBlob = (m_data != nullptr) ? sizeof(PropertyIndex) + m_data->GetSize() : 0; + const uint32_t sizeOfBlob = static_cast((m_data != nullptr) ? sizeof(PropertyIndex) + m_data->GetSize() : 0); if (m_hasValidPrefabId) { diff --git a/Gems/Multiplayer/Code/Source/Pipeline/NetBindMarkerComponent.cpp b/Gems/Multiplayer/Code/Source/Pipeline/NetBindMarkerComponent.cpp index 9b3187d46d..c8abac25cb 100644 --- a/Gems/Multiplayer/Code/Source/Pipeline/NetBindMarkerComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Pipeline/NetBindMarkerComponent.cpp @@ -67,7 +67,7 @@ namespace Multiplayer AZ::Name spawnableName = AZ::Interface::Get()->GetSpawnableNameFromAssetId(spawnableAssetId); PrefabEntityId prefabEntityId; prefabEntityId.m_prefabName = spawnableName; - prefabEntityId.m_entityOffset = netEntityIndex; + prefabEntityId.m_entityOffset = static_cast(netEntityIndex); AZ::Interface::Get()->SetupNetEntity(netEntity, prefabEntityId, NetEntityRole::Authority); } else From 31467479cee5858affb4bcbd4a342067051aaea5 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 15:56:41 -0700 Subject: [PATCH 25/75] MultiplayerCompression Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/MultiplayerCompression/Code/Source/LZ4Compressor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gems/MultiplayerCompression/Code/Source/LZ4Compressor.cpp b/Gems/MultiplayerCompression/Code/Source/LZ4Compressor.cpp index a9001d0e80..351935d0bb 100644 --- a/Gems/MultiplayerCompression/Code/Source/LZ4Compressor.cpp +++ b/Gems/MultiplayerCompression/Code/Source/LZ4Compressor.cpp @@ -20,7 +20,7 @@ namespace MultiplayerCompression size_t LZ4Compressor::GetMaxCompressedBufferSize(size_t uncompSize) const { - return LZ4_compressBound(uncompSize); + return LZ4_compressBound(static_cast(uncompSize)); } AzNetworking::CompressorError LZ4Compressor::Compress @@ -46,7 +46,7 @@ namespace MultiplayerCompression return AzNetworking::CompressorError::Uninitialized; } - const int compWorstCaseSize = LZ4_compressBound(uncompSize); + const int compWorstCaseSize = LZ4_compressBound(static_cast(uncompSize)); if (compWorstCaseSize == 0) { AZ_Warning("Multiplayer Compressor", false, "Input size (%lu) passed to Compress() is greater than max allowed (%lu)", uncompSize, LZ4_MAX_INPUT_SIZE); @@ -56,7 +56,7 @@ namespace MultiplayerCompression AZ_Warning("Multiplayer Compressor", compDataSize >= compWorstCaseSize, "Outbuffer size (%lu B) passed to Compress() is less than estimated worst case (%lu B)", compDataSize, compWorstCaseSize); // Note that this returns a non-negative int so we are narrowing into a size_t here - compSize = LZ4_compressHC(reinterpret_cast(uncompData), reinterpret_cast(compData), uncompSize); + compSize = LZ4_compressHC(reinterpret_cast(uncompData), reinterpret_cast(compData), static_cast(uncompSize)); if (compSize == 0) { @@ -84,7 +84,7 @@ namespace MultiplayerCompression return AzNetworking::CompressorError::Uninitialized; } - const int uncompSize = LZ4_decompress_safe(reinterpret_cast(compData), reinterpret_cast(uncompData), compDataSize, uncompDataSize); + const int uncompSize = LZ4_decompress_safe(reinterpret_cast(compData), reinterpret_cast(uncompData), static_cast(compDataSize), static_cast(uncompDataSize)); consumedSizeOut = compDataSize; if (uncompSize < 0) From 7a929165c662cde1dfde54ff97ae4527eccfccd1 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:04:10 -0700 Subject: [PATCH 26/75] NvCloth Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../ClothComponentMesh/ActorClothColliders.cpp | 8 ++++---- .../ClothComponentMesh/ActorClothSkinning.cpp | 4 ++-- .../ClothComponentMesh/ClothComponentMesh.cpp | 2 +- Gems/NvCloth/Code/Tests/System/ClothTest.cpp | 18 +++++++++--------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothColliders.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothColliders.cpp index 660220c446..1e57999b6e 100644 --- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothColliders.cpp +++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothColliders.cpp @@ -112,7 +112,7 @@ namespace NvCloth colliderConfig.get(), static_cast(shapeConfigPair.second.get()), static_cast(jointIndex), - sphereCount); + static_cast(sphereCount)); sphereColliders.push_back(sphereCollider); ++sphereCount; @@ -144,9 +144,9 @@ namespace NvCloth colliderConfig.get(), static_cast(shapeConfigPair.second.get()), static_cast(jointIndex), - capsuleCount * 2, // Each capsule holds 2 sphere indices - sphereCount + 0, // First sphere index - sphereCount + 1); // Second sphere index + static_cast(capsuleCount * 2), // Each capsule holds 2 sphere indices + static_cast(sphereCount + 0), // First sphere index + static_cast(sphereCount + 1)); // Second sphere index capsuleColliders.push_back(capsuleCollider); ++capsuleCount; diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp index d42d66293b..5359ed6ad5 100644 --- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp +++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp @@ -481,13 +481,13 @@ namespace NvCloth if (remappedIndex >= 0) { - actorClothSkinning->m_simulatedVertices[remappedIndex] = vertexIndex; + actorClothSkinning->m_simulatedVertices[remappedIndex] = static_cast(vertexIndex); } if (remappedIndex < 0 || originalMeshParticles[vertexIndex].GetW() == 0.0f) { - actorClothSkinning->m_nonSimulatedVertices.emplace_back(vertexIndex); + actorClothSkinning->m_nonSimulatedVertices.emplace_back(static_cast(vertexIndex)); } } actorClothSkinning->m_nonSimulatedVertices.shrink_to_fit(); diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp index 9381d98620..46f9d9a88b 100644 --- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp +++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp @@ -556,7 +556,7 @@ namespace NvCloth for (size_t index = 0; index < numVertices; ++index) { - const int renderVertexIndex = firstVertex + index; + const int renderVertexIndex = static_cast(firstVertex + index); const SimParticleFormat& renderParticle = renderParticles[renderVertexIndex]; destVerticesBuffer[index].Set( diff --git a/Gems/NvCloth/Code/Tests/System/ClothTest.cpp b/Gems/NvCloth/Code/Tests/System/ClothTest.cpp index 63d8c78dff..15940570f7 100644 --- a/Gems/NvCloth/Code/Tests/System/ClothTest.cpp +++ b/Gems/NvCloth/Code/Tests/System/ClothTest.cpp @@ -145,7 +145,7 @@ namespace UnitTest }}; nv::cloth::Vector::Type nvEmpty; - nv::cloth::Vector::Type nvValues(azValues.size()); + nv::cloth::Vector::Type nvValues(static_cast(azValues.size())); nv::cloth::Range nvEmptyRange(nvEmpty.begin(), nvEmpty.end()); nv::cloth::Range nvValuesRange(nvValues.begin(), nvValues.end()); @@ -192,7 +192,7 @@ namespace UnitTest }}; nv::cloth::Vector::Type nvEmpty; - nv::cloth::Vector::Type nvValues(azValues.size()); + nv::cloth::Vector::Type nvValues(static_cast(azValues.size())); nv::cloth::Range nvEmptyRange(nvEmpty.begin(), nvEmpty.end()); nv::cloth::Range nvValuesRange(nvValues.begin(), nvValues.end()); @@ -336,7 +336,7 @@ namespace UnitTest const nv::cloth::MappedRange nvClothPreviousParticles = nv::cloth::readPreviousParticles(*m_nvCloth); for (size_t i = 0; i < newParticles.size(); ++i) { - EXPECT_NEAR(newParticles[i].GetW(), nvClothPreviousParticles[i].w, Tolerance); + EXPECT_NEAR(newParticles[i].GetW(), nvClothPreviousParticles[static_cast(i)].w, Tolerance); } } @@ -364,7 +364,7 @@ namespace UnitTest const nv::cloth::MappedRange nvClothPreviousParticles = nv::cloth::readPreviousParticles(*m_nvCloth); for (size_t i = 0; i < newParticles.size(); ++i) { - EXPECT_NEAR(newParticles[i].GetW(), nvClothPreviousParticles[i].w, Tolerance); + EXPECT_NEAR(newParticles[i].GetW(), nvClothPreviousParticles[static_cast(i)].w, Tolerance); } } @@ -378,7 +378,7 @@ namespace UnitTest EXPECT_EQ(nvClothCurrentParticles.size(), nvClothPreviousParticles.size()); for (size_t i = 0; i < nvClothCurrentParticles.size(); ++i) { - ExpectEq(nvClothCurrentParticles[i], nvClothPreviousParticles[i]); + ExpectEq(nvClothCurrentParticles[static_cast(i)], nvClothPreviousParticles[static_cast(i)]); } } @@ -468,7 +468,7 @@ namespace UnitTest EXPECT_EQ(nvClothCurrentParticles.size(), nvClothPreviousParticles.size()); for (size_t i = 0; i < nvClothCurrentParticles.size(); ++i) { - ExpectEq(nvClothCurrentParticles[i], nvClothPreviousParticles[i]); + ExpectEq(nvClothCurrentParticles[static_cast(i)], nvClothPreviousParticles[static_cast(i)]); } } @@ -504,8 +504,8 @@ namespace UnitTest EXPECT_EQ(initialParticles.size(), nvClothPreviousParticles.size()); for (size_t i = 0; i < initialParticles.size(); ++i) { - ExpectEq(initialParticles[i], nvClothCurrentParticles[i]); - ExpectEq(initialParticles[i], nvClothPreviousParticles[i]); + ExpectEq(initialParticles[i], nvClothCurrentParticles[static_cast(i)]); + ExpectEq(initialParticles[i], nvClothPreviousParticles[static_cast(i)]); } } @@ -614,7 +614,7 @@ namespace UnitTest const nv::cloth::MappedRange nvClothPreviousParticles = nv::cloth::readPreviousParticles(*m_nvCloth); for (size_t i = 0; i < initialParticles.size(); ++i) { - EXPECT_NEAR(nvClothPreviousParticles[i].w, initialParticles[i].GetW() / globalMass, Tolerance); + EXPECT_NEAR(nvClothPreviousParticles[static_cast(i)].w, initialParticles[i].GetW() / globalMass, Tolerance); } } } // namespace UnitTest From f53d1f955a0928bf3114cb217face9807d817a7b Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:05:20 -0700 Subject: [PATCH 27/75] =?UTF-8?q?=EF=BB=BFPhysX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/PhysX/Code/Editor/MaterialIdWidget.cpp | 4 ++-- .../Code/Source/EditorColliderComponent.cpp | 6 +++--- Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp | 16 ++++++++-------- .../PrimitiveShapeFitter.cpp | 2 +- Gems/PhysX/Code/Source/Scene/PhysXScene.cpp | 2 +- Gems/PhysX/Code/Source/System/PhysXSystem.cpp | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Gems/PhysX/Code/Editor/MaterialIdWidget.cpp b/Gems/PhysX/Code/Editor/MaterialIdWidget.cpp index 7bbdf91c20..4fba93da39 100644 --- a/Gems/PhysX/Code/Editor/MaterialIdWidget.cpp +++ b/Gems/PhysX/Code/Editor/MaterialIdWidget.cpp @@ -69,7 +69,7 @@ namespace PhysX auto lockToDefault = [gui]() { - gui->addItem(QLatin1String(Physics::DefaultPhysicsMaterialLabel.data(), Physics::DefaultPhysicsMaterialLabel.size())); + gui->addItem(QLatin1String(Physics::DefaultPhysicsMaterialLabel.data(), static_cast(Physics::DefaultPhysicsMaterialLabel.size()))); gui->setCurrentIndex(0); return false; }; @@ -98,7 +98,7 @@ namespace PhysX // Add default physics material first m_libraryIds.push_back(Physics::MaterialId()); - gui->addItem(QLatin1String(Physics::DefaultPhysicsMaterialLabel.data(), Physics::DefaultPhysicsMaterialLabel.size())); + gui->addItem(QLatin1String(Physics::DefaultPhysicsMaterialLabel.data(), static_cast(Physics::DefaultPhysicsMaterialLabel.size()))); for (const auto& material : materials) { diff --git a/Gems/PhysX/Code/Source/EditorColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorColliderComponent.cpp index 1409760742..c1056bdd73 100644 --- a/Gems/PhysX/Code/Source/EditorColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorColliderComponent.cpp @@ -780,7 +780,7 @@ namespace PhysX entityRigidbody->GetRigidBody()->IsKinematic() == false) { AZStd::string assetPath = m_shapeConfiguration.m_physicsAsset.m_configuration.m_asset.GetHint().c_str(); - const uint lastSlash = assetPath.rfind('/'); + const uint lastSlash = static_cast(assetPath.rfind('/')); if (lastSlash != AZStd::string::npos) { assetPath = assetPath.substr(lastSlash + 1); @@ -831,7 +831,7 @@ namespace PhysX if (shapeConfiguration) { - m_colliderDebugDraw.BuildMeshes(*shapeConfiguration, shapeIndex); + m_colliderDebugDraw.BuildMeshes(*shapeConfiguration, static_cast(shapeIndex)); } } } @@ -917,7 +917,7 @@ namespace PhysX const AZ::Vector3 overallScale = Utils::GetTransformScale(GetEntityId()) * m_cachedNonUniformScale * assetScale; m_colliderDebugDraw.DrawMesh(debugDisplay, *colliderConfiguration, *cookedMeshShapeConfiguration, - overallScale, shapeIndex); + overallScale, static_cast(shapeIndex)); break; } case Physics::ShapeType::Sphere: diff --git a/Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp b/Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp index 068e0f68df..c882252d50 100644 --- a/Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp +++ b/Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp @@ -155,7 +155,7 @@ namespace PhysX if (materialIndexIter != materialIndexByName.end()) { - return materialIndexIter->second; + return static_cast(materialIndexIter->second); } // Add it to the list otherwise @@ -417,7 +417,7 @@ namespace PhysX AZ_Assert(pxCooking, "Failed to create PxCooking"); physx::PxBoundedData strideData; - strideData.count = vertices.size(); + strideData.count = static_cast(vertices.size()); strideData.stride = sizeof(Vec3); strideData.data = vertices.data(); @@ -453,7 +453,7 @@ namespace PhysX physx::PxTriangleMeshDesc meshDesc; meshDesc.points = strideData; - meshDesc.triangles.count = indices.size() / 3; + meshDesc.triangles.count = static_cast(indices.size() / 3); meshDesc.triangles.stride = sizeof(AZ::u32) * 3; meshDesc.triangles.data = indices.data(); @@ -638,9 +638,9 @@ namespace PhysX { decomposer->Compute( vhacdVertices.data(), - vhacdVertices.size() / 3, + static_cast(vhacdVertices.size() / 3), nodeExportData.m_indices.data(), - nodeExportData.m_indices.size() / 3, + static_cast(nodeExportData.m_indices.size() / 3), vhacdParams ); } @@ -656,9 +656,9 @@ namespace PhysX decomposer->Compute( vhacdVertices.data(), - vhacdVertices.size() / 3, + static_cast(vhacdVertices.size() / 3), vhacdIndices.data(), - vhacdIndices.size() / 3, + static_cast(vhacdIndices.size() / 3), vhacdParams ); } @@ -841,7 +841,7 @@ namespace PhysX // by the amount of vertices already added in the last iteration for (const NodeCollisionGeomExportData& exportData : totalExportData) { - vtx_idx startingIndex = mergedVertices.size(); + vtx_idx startingIndex = static_cast(mergedVertices.size()); mergedVertices.insert(mergedVertices.end(), exportData.m_vertices.begin(), exportData.m_vertices.end()); diff --git a/Gems/PhysX/Code/Source/Pipeline/PrimitiveShapeFitter/PrimitiveShapeFitter.cpp b/Gems/PhysX/Code/Source/Pipeline/PrimitiveShapeFitter/PrimitiveShapeFitter.cpp index 1c73a48a09..1482e9438a 100644 --- a/Gems/PhysX/Code/Source/Pipeline/PrimitiveShapeFitter/PrimitiveShapeFitter.cpp +++ b/Gems/PhysX/Code/Source/Pipeline/PrimitiveShapeFitter/PrimitiveShapeFitter.cpp @@ -279,7 +279,7 @@ namespace PhysX::Pipeline { if (volumeTermWeight >= 0.0 && volumeTermWeight < 1.0) { - const AZ::u32 numberOfVertices = vertices.size(); + const AZ::u32 numberOfVertices = static_cast(vertices.size()); // Convert vertices and compute the mean of the vertex cloud. AZStd::vector verticesConverted(numberOfVertices, Vector{{ 0.0, 0.0, 0.0 }}); diff --git a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp index b6486995c0..a47f0ba16f 100644 --- a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp +++ b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp @@ -867,7 +867,7 @@ namespace PhysX if (newJoint != nullptr) { - AzPhysics::JointIndex index = index = m_joints.size(); + AzPhysics::JointIndex index = static_cast(m_joints.size()); m_joints.emplace_back(newJointCrc, newJoint); const AzPhysics::JointHandle newJointHandle(newJointCrc, index); diff --git a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp index 353085d1c1..cc55255e24 100644 --- a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp +++ b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp @@ -219,7 +219,7 @@ namespace PhysX if (m_sceneList.size() < std::numeric_limits::max()) //add a new scene if it is under the limit { - const AzPhysics::SceneHandle sceneHandle(AZ::Crc32(config.m_sceneName), (m_sceneList.size())); + const AzPhysics::SceneHandle sceneHandle(AZ::Crc32(config.m_sceneName), static_cast(m_sceneList.size())); m_sceneList.emplace_back(AZStd::make_unique(config, sceneHandle)); m_sceneAddedEvent.Signal(sceneHandle); return sceneHandle; From 9a5265d77dcfd39a8ee74c8edb3bb3f76d5adc02 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:06:21 -0700 Subject: [PATCH 28/75] PhysXDebug Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/PhysXDebug/Code/Source/SystemComponent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp index 96da22480d..7e1c3630cb 100644 --- a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp +++ b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp @@ -561,7 +561,7 @@ namespace PhysXDebug static void physx_CullingBoxSize([[maybe_unused]] const AZ::ConsoleCommandContainer& arguments) { - const int argumentCount = arguments.size(); + const size_t argumentCount = arguments.size(); if (argumentCount == 1) { float newCullingBoxSize = (float)strtol(AZ::CVarFixedString(arguments[0]).c_str(), nullptr, 10); @@ -579,7 +579,7 @@ namespace PhysXDebug { using namespace CryStringUtils; - const int argumentCount = arguments.size(); + const size_t argumentCount = arguments.size(); if (argumentCount == 1) { From 41a1cb58cf5160bcb802b1293e78fc5244744849 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:14:49 -0700 Subject: [PATCH 29/75] SceneProcessing Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Components/MeshOptimizer/MeshOptimizerComponent.cpp | 2 +- .../TangentGenerators/BlendShapeMikkTGenerator.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshOptimizerComponent.cpp b/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshOptimizerComponent.cpp index 6bc47476f8..7541e2fce7 100644 --- a/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshOptimizerComponent.cpp +++ b/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshOptimizerComponent.cpp @@ -651,7 +651,7 @@ namespace AZ::SceneGenerationComponents const auto& faceInfo = optimizedMesh->GetFaceInfo(optimizedMesh->GetFaceCount() - 1); AZStd::copy(AZStd::begin(faceInfo.vertexIndex), AZStd::end(faceInfo.vertexIndex), AZStd::inserter(usedIndexes, usedIndexes.begin())); } - indexOffset += usedIndexes.size(); + indexOffset += static_cast(usedIndexes.size()); } AZStd::unique_ptr optimizedSkinWeights; diff --git a/Gems/SceneProcessing/Code/Source/Generation/Components/TangentGenerator/TangentGenerators/BlendShapeMikkTGenerator.cpp b/Gems/SceneProcessing/Code/Source/Generation/Components/TangentGenerator/TangentGenerators/BlendShapeMikkTGenerator.cpp index b472aa4e09..c4b0888f13 100644 --- a/Gems/SceneProcessing/Code/Source/Generation/Components/TangentGenerator/TangentGenerators/BlendShapeMikkTGenerator.cpp +++ b/Gems/SceneProcessing/Code/Source/Generation/Components/TangentGenerator/TangentGenerators/BlendShapeMikkTGenerator.cpp @@ -55,7 +55,7 @@ namespace AZ::TangentGeneration::BlendShape::MikkT { MikktCustomData* customData = static_cast(context->m_pUserData); const AZ::u32 vertexIndex = customData->m_blendShapeData->GetFaceVertexIndex(face, vert); - const AZ::Vector2& uv = customData->m_blendShapeData->GetUV(vertexIndex, customData->m_uvSetIndex); + const AZ::Vector2& uv = customData->m_blendShapeData->GetUV(vertexIndex, static_cast(customData->m_uvSetIndex)); texOut[0] = uv.GetX(); texOut[1] = uv.GetY(); } @@ -105,7 +105,7 @@ namespace AZ::TangentGeneration::BlendShape::MikkT AZ::SceneAPI::DataTypes::MikkTSpaceMethod tSpaceMethod) { // Create tangent and bitangent data sets and relate them to the given UV set. - const AZStd::vector& uvSet = blendShapeData->GetUVs(uvSetIndex); + const AZStd::vector& uvSet = blendShapeData->GetUVs(static_cast(uvSetIndex)); if (uvSet.empty()) { AZ_Error(AZ::SceneAPI::Utilities::ErrorWindow, false, From e3344bdf8dc7e9e39925d1774092501e6cd2e895 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:15:06 -0700 Subject: [PATCH 30/75] ScriptCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Editor/View/Windows/MainWindow.cpp | 4 ++-- .../View/Windows/Tools/UpgradeTool/VersionExplorer.cpp | 10 +++++----- .../Execution/Interpreted/ExecutionInterpretedAPI.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp index 2a9814e281..87bf4cf23c 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp @@ -1384,7 +1384,7 @@ namespace ScriptCanvasEditor AZStd::string assetPath = scriptCanvasAsset.GetAbsolutePath(); if (!assetPath.empty() && !m_loadingNewlySavedFile) { - int eraseCount = m_loadingWorkspaceAssets.erase(fileAssetId); + const size_t eraseCount = m_loadingWorkspaceAssets.erase(fileAssetId); if (eraseCount == 0) { @@ -2529,7 +2529,7 @@ namespace ScriptCanvasEditor AZ::Data::AssetId fileAssetId = memoryAsset.GetFileAssetId(); AZ::Data::AssetId memoryAssetId = memoryAsset.GetId(); - int eraseCount = m_loadingAssets.erase(fileAssetId); + size_t eraseCount = m_loadingAssets.erase(fileAssetId); if (eraseCount > 0) { diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp index 1f6a93b9a2..b9aff660f2 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp @@ -651,9 +651,9 @@ namespace ScriptCanvasEditor return; } - m_ui->tableWidget->insertRow(m_inspectedAssets); + m_ui->tableWidget->insertRow(static_cast(m_inspectedAssets)); QTableWidgetItem* rowName = new QTableWidgetItem(tr(asset.GetHint().c_str())); - m_ui->tableWidget->setItem(m_inspectedAssets, ColumnAsset, rowName); + m_ui->tableWidget->setItem(static_cast(m_inspectedAssets), static_cast(ColumnAsset), rowName); if (!graphComponent->GetVersion().IsLatest()) { @@ -675,9 +675,9 @@ namespace ScriptCanvasEditor AZ::SystemTickBus::ExecuteQueuedEvents(); }); - m_ui->tableWidget->setCellWidget(m_inspectedAssets, ColumnAction, rowGoToButton); + m_ui->tableWidget->setCellWidget(static_cast(m_inspectedAssets), static_cast(ColumnAction), rowGoToButton); - m_ui->tableWidget->setCellWidget(m_inspectedAssets, ColumnStatus, spinner); + m_ui->tableWidget->setCellWidget(static_cast(m_inspectedAssets), static_cast(ColumnStatus), spinner); } QToolButton* browseButton = new QToolButton(this); @@ -705,7 +705,7 @@ namespace ScriptCanvasEditor connect(browseButton, &QPushButton::clicked, [absolutePath] { AzQtComponents::ShowFileOnDesktop(absolutePath); }); - m_ui->tableWidget->setCellWidget(m_inspectedAssets, ColumnBrowse, browseButton); + m_ui->tableWidget->setCellWidget(static_cast(m_inspectedAssets), static_cast(ColumnBrowse), browseButton); ++m_inspectedAssets; ++m_currentAssetIndex; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp index 83d8b6f52b..e01a3a0e7a 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp @@ -699,7 +699,7 @@ namespace ScriptCanvas ActivationData data(args.runtimeOverrides, storage); ActivationInputRange range = Execution::Context::CreateActivateInputRange(data, args.executionState->GetEntityId()); PushActivationArgs(lua, range.inputs, range.totalCount); - return range.totalCount; + return static_cast(range.totalCount); } int UnpackDependencyConstructionArgs(lua_State* lua) From 9076f60dda8c45b91ee9a499fadf8351fed7e2cf Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:16:53 -0700 Subject: [PATCH 31/75] SliceFavorites Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp b/Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp index a686b54b9d..94b9d78247 100644 --- a/Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp +++ b/Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp @@ -473,14 +473,14 @@ namespace SliceFavorites for (size_t index = 0; index < currentList.size(); index++) { - FavoriteData* current = currentList[index]; + FavoriteData* current = currentList[static_cast(index)]; if (!current) { continue; } - settings.setArrayIndex(index); + settings.setArrayIndex(static_cast(index)); settings.setValue("name", current->m_name); AZStd::string assetIdString; From 4ca2222532ce64e074f480afa4e832baeb02c1e7 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:17:07 -0700 Subject: [PATCH 32/75] SurfaceData Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Include/SurfaceData/Tests/SurfaceDataTestMocks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/SurfaceData/Code/Include/SurfaceData/Tests/SurfaceDataTestMocks.h b/Gems/SurfaceData/Code/Include/SurfaceData/Tests/SurfaceDataTestMocks.h index 1ebeec5880..2f45d22748 100644 --- a/Gems/SurfaceData/Code/Include/SurfaceData/Tests/SurfaceDataTestMocks.h +++ b/Gems/SurfaceData/Code/Include/SurfaceData/Tests/SurfaceDataTestMocks.h @@ -265,7 +265,7 @@ namespace UnitTest { // Keep a list of registered entries. Use the "list index + 1" as the handle. (We add +1 because 0 is used to mean "invalid handle") entryList.emplace_back(entry); - return entryList.size(); + return static_cast(entryList.size()); } void UnregisterEntry(const SurfaceData::SurfaceDataRegistryHandle& handle, AZStd::vector& entryList) From 9dc13db8ba212ecfd3d9579a2b5b1cfbea3e4ade Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:20:59 -0700 Subject: [PATCH 33/75] Vegetation Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/AreaSystemComponent.cpp | 6 +++--- .../Code/Source/Components/SpawnerComponent.cpp | 2 +- .../Code/Source/Debugger/DebugComponent.cpp | 16 ++++++++-------- .../Code/Source/InstanceSystemComponent.cpp | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp index 93995faaf6..f5153a37b2 100644 --- a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp @@ -1010,7 +1010,7 @@ namespace Vegetation if (m_debugData) { - m_debugData->m_areaTaskQueueCount.store(m_vegetationThreadTasks.size(), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); } } @@ -1025,8 +1025,8 @@ namespace Vegetation if (m_debugData) { - m_debugData->m_areaTaskQueueCount.store(m_vegetationThreadTasks.size(), AZStd::memory_order_relaxed); - m_debugData->m_areaTaskActiveCount.store(tasks.size(), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskActiveCount.store(static_cast(tasks.size()), AZStd::memory_order_relaxed); } } diff --git a/Gems/Vegetation/Code/Source/Components/SpawnerComponent.cpp b/Gems/Vegetation/Code/Source/Components/SpawnerComponent.cpp index 88581aaea0..b373edf051 100644 --- a/Gems/Vegetation/Code/Source/Components/SpawnerComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/SpawnerComponent.cpp @@ -528,7 +528,7 @@ namespace Vegetation AZ::u32 SpawnerComponent::GetProductCount() const { AZStd::lock_guard claimInstanceMappingMutexLock(m_claimInstanceMappingMutex); - return m_claimInstanceMapping.size(); + return static_cast(m_claimInstanceMapping.size()); } void SpawnerComponent::OnCompositionChanged() diff --git a/Gems/Vegetation/Code/Source/Debugger/DebugComponent.cpp b/Gems/Vegetation/Code/Source/Debugger/DebugComponent.cpp index bfe74a8b28..b415a7c41c 100644 --- a/Gems/Vegetation/Code/Source/Debugger/DebugComponent.cpp +++ b/Gems/Vegetation/Code/Source/Debugger/DebugComponent.cpp @@ -599,8 +599,8 @@ namespace DebugUtility timing.m_lowestTimeUs = AZ::GetMin(timeSpan, timing.m_lowestTimeUs); timing.m_peakTimeUs = AZ::GetMax(timeSpan, timing.m_peakTimeUs); timing.m_totalUpdateTimeUs += timeSpan; - timing.m_numInstancesCreated += datum.m_numInstancesCreated; - timing.m_numClaimPointsRemaining += datum.m_numClaimPointsRemaining; + timing.m_numInstancesCreated += static_cast(datum.m_numInstancesCreated); + timing.m_numClaimPointsRemaining += static_cast(datum.m_numClaimPointsRemaining); ++timing.m_totalCount; timing.m_averageTimeUs = timing.m_totalUpdateTimeUs / timing.m_totalCount; @@ -615,8 +615,8 @@ namespace DebugUtility timing.m_peakTimeUs = timeSpan; timing.m_averageTimeUs = timeSpan; timing.m_totalUpdateTimeUs = timeSpan; - timing.m_numInstancesCreated = datum.m_numInstancesCreated; - timing.m_numClaimPointsRemaining = datum.m_numClaimPointsRemaining; + timing.m_numInstancesCreated = static_cast(datum.m_numInstancesCreated); + timing.m_numClaimPointsRemaining = static_cast(datum.m_numClaimPointsRemaining); timing.m_totalCount = 1; mergeData(datum, timing); @@ -876,7 +876,7 @@ void DebugComponent::PrepareNextReport() { AreaSectorTiming& areaSectorTiming = iterator->second; areaSectorTiming.m_totalTime += AZStd::chrono::microseconds(sectorAreaData.m_end - sectorAreaData.m_start).count(); - areaSectorTiming.m_numInstances += sectorAreaData.m_numInstancesCreated; + areaSectorTiming.m_numInstances += static_cast(sectorAreaData.m_numInstancesCreated); for( const auto& reasonValue : sectorAreaData.m_numInstancesRejectedByFilters ) { DebugComponentUtilities::IncrementFilterReason(areaSectorTiming.m_numInstancesRejectedByFilters, reasonValue.first, reasonValue.second); @@ -887,7 +887,7 @@ void DebugComponent::PrepareNextReport() { AreaSectorTiming newAreaSectorTiming; newAreaSectorTiming.m_totalTime = AZStd::chrono::microseconds(sectorAreaData.m_end - sectorAreaData.m_start).count(); - newAreaSectorTiming.m_numInstances = sectorAreaData.m_numInstancesCreated; + newAreaSectorTiming.m_numInstances = static_cast(sectorAreaData.m_numInstancesCreated); newAreaSectorTiming.m_numInstancesRejectedByFilters = sectorAreaData.m_numInstancesRejectedByFilters; newAreaSectorTiming.m_filteredByMasks = sectorAreaData.m_filteredByMasks; sectorTiming.m_perAreaData[areaId] = newAreaSectorTiming; @@ -913,7 +913,7 @@ void DebugComponent::PrepareNextReport() AreaSectorTiming& areaSectorTiming = iterator->second; areaSectorTiming.m_totalTime += AZStd::chrono::microseconds(areaTracker.m_end - areaTracker.m_start).count(); - areaSectorTiming.m_numInstances += areaTracker.m_numInstancesCreated; + areaSectorTiming.m_numInstances += static_cast(areaTracker.m_numInstancesCreated); for (const auto& filterReasonEntry : areaTracker.m_numInstancesRejectedByFilters) { DebugComponentUtilities::IncrementFilterReason(areaSectorTiming.m_numInstancesRejectedByFilters, filterReasonEntry.first, filterReasonEntry.second); @@ -925,7 +925,7 @@ void DebugComponent::PrepareNextReport() { AreaSectorTiming newAreaSectorTiming; newAreaSectorTiming.m_totalTime = AZStd::chrono::microseconds(areaTracker.m_end - areaTracker.m_start).count(); - newAreaSectorTiming.m_numInstances = areaTracker.m_numInstancesCreated; + newAreaSectorTiming.m_numInstances = static_cast(areaTracker.m_numInstancesCreated); newAreaSectorTiming.m_numInstancesRejectedByFilters = areaTracker.m_numInstancesRejectedByFilters; newAreaSectorTiming.m_filteredByMasks = areaTracker.m_filteredByMasks; areaTiming.m_perSectorData[areaTracker.m_sectorId] = newAreaSectorTiming; diff --git a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp index 0e2fc582e9..efdebcaff8 100644 --- a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp @@ -483,7 +483,7 @@ namespace Vegetation AZStd::lock_guard scopedLock(m_instanceMapMutex); AZ_Assert(m_instanceMap.find(instanceData.m_instanceId) == m_instanceMap.end(), "InstanceId %llu is already in use!", instanceData.m_instanceId); m_instanceMap[instanceData.m_instanceId] = AZStd::make_pair(instanceData.m_descriptorPtr, opaqueInstanceData); - m_instanceCount = m_instanceMap.size(); + m_instanceCount = static_cast(m_instanceMap.size()); } } @@ -503,7 +503,7 @@ namespace Vegetation opaqueInstanceData = instanceItr->second.second; m_instanceMap.erase(instanceItr); } - m_instanceCount = m_instanceMap.size(); + m_instanceCount = static_cast(m_instanceMap.size()); } if (opaqueInstanceData) From 7c62fde361d4e575bab27e096b4d9a0d0bd908d6 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:21:19 -0700 Subject: [PATCH 34/75] Whitebox Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp | 2 +- Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h | 4 ++-- .../Code/Source/Rendering/Atom/WhiteBoxMeshAtomData.cpp | 8 ++++---- .../Code/Source/Viewport/WhiteBoxEdgeScaleModifier.cpp | 2 +- .../Source/Viewport/WhiteBoxVertexTranslationModifier.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp index bc4bc42abd..3bcd2dbd94 100644 --- a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp +++ b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp @@ -1400,7 +1400,7 @@ namespace WhiteBox HalfedgeHandle EdgeHalfedgeHandle( const WhiteBoxMesh& whiteBox, const EdgeHandle edgeHandle, const EdgeHalfedge edgeHalfedge) { - return wb_heh(whiteBox.mesh.halfedge_handle(om_eh(edgeHandle), EdgeHalfedgeMapping(edgeHalfedge))); + return wb_heh(whiteBox.mesh.halfedge_handle(om_eh(edgeHandle), static_cast(EdgeHalfedgeMapping(edgeHalfedge)))); } HalfedgeHandles EdgeHalfedgeHandles(const WhiteBoxMesh& whiteBox, EdgeHandle edgeHandle) diff --git a/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h b/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h index e3602da7ed..a96ccd98be 100644 --- a/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h +++ b/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h @@ -85,7 +85,7 @@ namespace WhiteBox template Buffer::Buffer(const AZStd::vector& data) { - const uint32_t elementCount = data.size(); + const uint32_t elementCount = static_cast(data.size()); const uint32_t elementSize = sizeof(VertexStreamDataType); const uint32_t bufferSize = elementCount * elementSize; @@ -166,7 +166,7 @@ namespace WhiteBox return false; } - const uint32_t elementCount = data.size(); + const uint32_t elementCount = static_cast(data.size()); const uint32_t elementSize = sizeof(VertexStreamDataType); const uint32_t bufferSize = elementCount * elementSize; diff --git a/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxMeshAtomData.cpp b/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxMeshAtomData.cpp index 63f16d32fc..e15ee37632 100644 --- a/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxMeshAtomData.cpp +++ b/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxMeshAtomData.cpp @@ -58,9 +58,9 @@ namespace WhiteBox for (size_t i = 0; i < vertCount; i++) { - const auto normal = tangentSpaceCalculation.GetNormal(i); - const auto tangent = tangentSpaceCalculation.GetTangent(i); - const auto bitangent = tangentSpaceCalculation.GetBitangent(i); + const auto normal = tangentSpaceCalculation.GetNormal(static_cast(i)); + const auto tangent = tangentSpaceCalculation.GetTangent(static_cast(i)); + const auto bitangent = tangentSpaceCalculation.GetBitangent(static_cast(i)); m_aabb.AddPoint(positions[i]); @@ -75,7 +75,7 @@ namespace WhiteBox const uint32_t WhiteBoxMeshAtomData::VertexCount() const { - return m_indices.size(); + return static_cast(m_indices.size()); } const AZStd::vector& WhiteBoxMeshAtomData::GetIndices() const diff --git a/Gems/WhiteBox/Code/Source/Viewport/WhiteBoxEdgeScaleModifier.cpp b/Gems/WhiteBox/Code/Source/Viewport/WhiteBoxEdgeScaleModifier.cpp index ac8d929599..0024a1cb6f 100644 --- a/Gems/WhiteBox/Code/Source/Viewport/WhiteBoxEdgeScaleModifier.cpp +++ b/Gems/WhiteBox/Code/Source/Viewport/WhiteBoxEdgeScaleModifier.cpp @@ -106,7 +106,7 @@ namespace WhiteBox WhiteBoxMesh* whiteBox = nullptr; EditorWhiteBoxComponentRequestBus::EventResult( whiteBox, m_entityComponentIdPair, &EditorWhiteBoxComponentRequests::GetWhiteBoxMesh); - m_selectedHandleIndex = vertexIndex; + m_selectedHandleIndex = static_cast(vertexIndex); InitializeScaleModifier(whiteBox, action); }); diff --git a/Gems/WhiteBox/Code/Source/Viewport/WhiteBoxVertexTranslationModifier.cpp b/Gems/WhiteBox/Code/Source/Viewport/WhiteBoxVertexTranslationModifier.cpp index 15917a768f..daa81c9aa3 100644 --- a/Gems/WhiteBox/Code/Source/Viewport/WhiteBoxVertexTranslationModifier.cpp +++ b/Gems/WhiteBox/Code/Source/Viewport/WhiteBoxVertexTranslationModifier.cpp @@ -89,7 +89,7 @@ namespace WhiteBox const auto screenLength = std::fabs(currentAction.ScreenOffset().Dot(screenAxis)); if (screenLength > maxLength) { - axisIndex = actionIndex; + axisIndex = static_cast(actionIndex); maxLength = screenLength; } } From f301c3b43a2d3dd055fa78b8700b246d12a520ec Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:35:44 -0700 Subject: [PATCH 35/75] Code/Tools Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AssetBundler/source/ui/PlatformSelectionWidget.cpp | 2 +- .../AssetProcessor/native/resourcecompiler/RCBuilder.cpp | 2 +- .../SceneBuilder/Importers/AssImpAnimationImporter.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Code/Tools/AssetBundler/source/ui/PlatformSelectionWidget.cpp b/Code/Tools/AssetBundler/source/ui/PlatformSelectionWidget.cpp index 4f1e7a6337..e59bdfa8ac 100644 --- a/Code/Tools/AssetBundler/source/ui/PlatformSelectionWidget.cpp +++ b/Code/Tools/AssetBundler/source/ui/PlatformSelectionWidget.cpp @@ -34,7 +34,7 @@ namespace AssetBundler for (const AZStd::string_view& platformString : m_platformHelper->GetPlatforms(PlatformFlags::AllNamedPlatforms)) { // Create the CheckBox and store what platform it maps to - QSharedPointer platformCheckBox(new QCheckBox(QString::fromUtf8(platformString.data(), platformString.size()))); + QSharedPointer platformCheckBox(new QCheckBox(QString::fromUtf8(platformString.data(), static_cast(platformString.size())))); m_platformCheckBoxes.push_back(platformCheckBox); PlatformFlags currentPlatformFlag = m_platformHelper->GetPlatformFlag(platformString); m_platformList.push_back(currentPlatformFlag); diff --git a/Code/Tools/AssetProcessor/native/resourcecompiler/RCBuilder.cpp b/Code/Tools/AssetProcessor/native/resourcecompiler/RCBuilder.cpp index 08546365c5..27210685fc 100644 --- a/Code/Tools/AssetProcessor/native/resourcecompiler/RCBuilder.cpp +++ b/Code/Tools/AssetProcessor/native/resourcecompiler/RCBuilder.cpp @@ -322,7 +322,7 @@ namespace AssetProcessor executableDirectory /= ASSETPROCESSOR_TRAIT_LEGACY_RC_RELATIVE_PATH; if (AZ::IO::SystemFile::Exists(executableDirectory.c_str())) { - rcAbsolutePathOut = QString::fromUtf8(executableDirectory.c_str(), executableDirectory.Native().size()); + rcAbsolutePathOut = QString::fromUtf8(executableDirectory.c_str(), static_cast(executableDirectory.Native().size())); return true; } diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp index 1b712cb134..aadb834aa9 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp @@ -634,21 +634,21 @@ namespace AZ AZStd::shared_ptr morphAnimNode = AZStd::make_shared(); - const size_t numKeyFrames = GetNumKeyFrames(keys.size(), animation->mDuration, animation->mTicksPerSecond); + const size_t numKeyFrames = GetNumKeyFrames(static_cast(keys.size()), animation->mDuration, animation->mTicksPerSecond); morphAnimNode->ReserveKeyFrames(numKeyFrames); morphAnimNode->SetTimeStepBetweenFrames(s_defaultTimeStepBetweenFrames); aiAnimMesh* aiAnimMesh = mesh->mAnimMeshes[meshIdx]; AZStd::string_view nodeName(aiAnimMesh->mName.C_Str()); - const AZ::u32 maxKeys = keys.size(); + const AZ::u32 maxKeys = static_cast(keys.size()); AZ::u32 keyIdx = 0; for (AZ::u32 frame = 0; frame < numKeyFrames; ++frame) { const double time = GetTimeForFrame(frame, animation->mTicksPerSecond); float weight = 0; - if (!SampleKeyFrame(weight, keys, keys.size(), time + keyOffset, keyIdx)) + if (!SampleKeyFrame(weight, keys, static_cast(keys.size()), time + keyOffset, keyIdx)) { return Events::ProcessingResult::Failure; } From 20a4ec9b7df67eb3043ef8599660580b59dd894d Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:36:30 -0700 Subject: [PATCH 36/75] =?UTF-8?q?=EF=BB=BFSandbox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/EditorViewportWidget.h | 6 +++--- Code/Editor/ErrorReport.h | 2 +- Code/Editor/Objects/DisplayContextShared.inl | 10 +++++----- Code/Editor/Objects/EntityObject.h | 4 ++-- Code/Editor/Objects/ObjectLoader.h | 2 +- Code/Editor/Objects/ObjectManager.h | 2 +- Code/Editor/Objects/SelectionGroup.h | 2 +- Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp | 2 +- Code/Editor/RenderHelpers/AxisHelperShared.inl | 2 +- Code/Editor/RenderViewport.cpp | 6 +++--- Code/Editor/RenderViewport.h | 6 +++--- Code/Editor/TrackView/TrackViewAnimNode.h | 2 +- Code/Editor/TrackView/TrackViewNode.h | 4 ++-- Code/Editor/TrackView/TrackViewSequenceManager.h | 2 +- Code/Editor/TrackView/TrackViewTrack.h | 2 +- Code/Editor/Undo/Undo.h | 4 ++-- Code/Editor/ViewManager.h | 2 +- Code/Legacy/CryCommon/UnicodeBinding.h | 2 +- 18 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Code/Editor/EditorViewportWidget.h b/Code/Editor/EditorViewportWidget.h index 1829995d02..b682de1cc3 100644 --- a/Code/Editor/EditorViewportWidget.h +++ b/Code/Editor/EditorViewportWidget.h @@ -258,19 +258,19 @@ public: m_relCameraRotX = 0; m_relCameraRotZ = 0; - uint32 numSample6 = m_arrAnimatedCharacterPath.size(); + uint32 numSample6 = static_cast(m_arrAnimatedCharacterPath.size()); for (uint32 i = 0; i < numSample6; i++) { m_arrAnimatedCharacterPath[i] = Vec3(ZERO); } - numSample6 = m_arrSmoothEntityPath.size(); + numSample6 = static_cast(m_arrSmoothEntityPath.size()); for (uint32 i = 0; i < numSample6; i++) { m_arrSmoothEntityPath[i] = Vec3(ZERO); } - uint32 numSample7 = m_arrRunStrafeSmoothing.size(); + uint32 numSample7 = static_cast(m_arrRunStrafeSmoothing.size()); for (uint32 i = 0; i < numSample7; i++) { m_arrRunStrafeSmoothing[i] = 0; diff --git a/Code/Editor/ErrorReport.h b/Code/Editor/ErrorReport.h index dec5cd4fb8..2bef4105f8 100644 --- a/Code/Editor/ErrorReport.h +++ b/Code/Editor/ErrorReport.h @@ -105,7 +105,7 @@ public: bool IsEmpty() const; //! Get number of contained error records. - int GetErrorCount() const { return m_errors.size(); }; + int GetErrorCount() const { return static_cast(m_errors.size()); }; //! Get access to indexed error record. CErrorRecord& GetError(int i); //! Clear all error records. diff --git a/Code/Editor/Objects/DisplayContextShared.inl b/Code/Editor/Objects/DisplayContextShared.inl index 1791c22443..a602d8eca9 100644 --- a/Code/Editor/Objects/DisplayContextShared.inl +++ b/Code/Editor/Objects/DisplayContextShared.inl @@ -74,12 +74,12 @@ void DisplayContext::DrawTri(const Vec3& p1, const Vec3& p2, const Vec3& p3) void DisplayContext::DrawTriangles(const AZStd::vector& vertices, const ColorB& color) { - pRenderAuxGeom->DrawTriangles(vertices.begin(), vertices.size(), color); + pRenderAuxGeom->DrawTriangles(vertices.begin(), static_cast(vertices.size()), color); } void DisplayContext::DrawTrianglesIndexed(const AZStd::vector& vertices, const AZStd::vector& indices, const ColorB& color) { - pRenderAuxGeom->DrawTriangles(vertices.begin(), vertices.size(), indices.begin(), indices.size(), color); + pRenderAuxGeom->DrawTriangles(vertices.begin(), static_cast(vertices.size()), indices.begin(), static_cast(indices.size()), color); } ////////////////////////////////////////////////////////////////////////// @@ -862,7 +862,7 @@ void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const QColor& rgb1 ////////////////////////////////////////////////////////////////////////// void DisplayContext::DrawLines(const AZStd::vector& points, const ColorF& color) { - pRenderAuxGeom->DrawLines(points.begin(), points.size(), color, m_thickness); + pRenderAuxGeom->DrawLines(points.begin(), static_cast(points.size()), color, m_thickness); } ////////////////////////////////////////////////////////////////////////// @@ -1287,8 +1287,8 @@ void DisplayContext::Flush2D() uvs[3] = 0; uvt[3] = 0; - int nLabels = m_textureLabels.size(); - for (int i = 0; i < nLabels; i++) + const size_t nLabels = m_textureLabels.size(); + for (size_t i = 0; i < nLabels; i++) { STextureLabel& t = m_textureLabels[i]; float w2 = t.w * 0.5f; diff --git a/Code/Editor/Objects/EntityObject.h b/Code/Editor/Objects/EntityObject.h index 76bd71a1f1..34d3342ad4 100644 --- a/Code/Editor/Objects/EntityObject.h +++ b/Code/Editor/Objects/EntityObject.h @@ -163,7 +163,7 @@ public: ////////////////////////////////////////////////////////////////////////// //! Return number of event targets of Script. - int GetEventTargetCount() const { return m_eventTargets.size(); }; + int GetEventTargetCount() const { return static_cast(m_eventTargets.size()); }; CEntityEventTarget& GetEventTarget(int index) { return m_eventTargets[index]; }; //! Add new event target, returns index of created event target. //! Event targets are Always entities. @@ -176,7 +176,7 @@ public: // Entity Links. ////////////////////////////////////////////////////////////////////////// //! Return number of event targets of Script. - int GetEntityLinkCount() const { return m_links.size(); }; + int GetEntityLinkCount() const { return static_cast(m_links.size()); }; CEntityLink& GetEntityLink(int index) { return m_links[index]; }; virtual int AddEntityLink(const QString& name, GUID targetEntityId); virtual bool EntityLinkExists(const QString& name, GUID targetEntityId); diff --git a/Code/Editor/Objects/ObjectLoader.h b/Code/Editor/Objects/ObjectLoader.h index 350ffa10a9..ccfaeb78f0 100644 --- a/Code/Editor/Objects/ObjectLoader.h +++ b/Code/Editor/Objects/ObjectLoader.h @@ -70,7 +70,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING CBaseObject* LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject = NULL); ////////////////////////////////////////////////////////////////////////// - int GetLoadedObjectsCount() { return m_loadedObjects.size(); } + int GetLoadedObjectsCount() { return static_cast(m_loadedObjects.size()); } CBaseObject* GetLoadedObject(int nIndex) const { return m_loadedObjects[nIndex].pObject; } //! If true new loaded objects will be assigned new GUIDs. diff --git a/Code/Editor/Objects/ObjectManager.h b/Code/Editor/Objects/ObjectManager.h index f59f6c43b8..aa9faab0e4 100644 --- a/Code/Editor/Objects/ObjectManager.h +++ b/Code/Editor/Objects/ObjectManager.h @@ -58,7 +58,7 @@ public: class CBaseObjectsCache { public: - int GetObjectCount() const { return m_objects.size(); } + int GetObjectCount() const { return static_cast(m_objects.size()); } CBaseObject* GetObject(int nIndex) const { return m_objects[nIndex]; } void AddObject(CBaseObject* object); diff --git a/Code/Editor/Objects/SelectionGroup.h b/Code/Editor/Objects/SelectionGroup.h index 8f6feb32ad..600bce5f26 100644 --- a/Code/Editor/Objects/SelectionGroup.h +++ b/Code/Editor/Objects/SelectionGroup.h @@ -71,7 +71,7 @@ public: //! And save resulting objects to saveTo selection. void FilterParents(); //! Get number of child filtered objects. - int GetFilteredCount() const { return m_filtered.size(); } + int GetFilteredCount() const { return static_cast(m_filtered.size()); } CBaseObject* GetFilteredObject(int i) const { return m_filtered[i]; } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp b/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp index f1f742949c..6e9c0a42b0 100644 --- a/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp +++ b/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp @@ -53,7 +53,7 @@ namespace PerforceConnection setEnabled(false); - int numSettingsToGet = m_retrievedSettings.size(); + int numSettingsToGet = static_cast(m_retrievedSettings.size()); auto applySettingResultFunction = [this, &numSettingsToGet](AZStd::string setting, const SourceControlSettingInfo& info) -> void { diff --git a/Code/Editor/RenderHelpers/AxisHelperShared.inl b/Code/Editor/RenderHelpers/AxisHelperShared.inl index 9db4c82e84..2ceac98eae 100644 --- a/Code/Editor/RenderHelpers/AxisHelperShared.inl +++ b/Code/Editor/RenderHelpers/AxisHelperShared.inl @@ -546,7 +546,7 @@ bool CAxisHelper::HitTestForRotationCircle(const Matrix34& worldTM, IDisplayView Vec3 vShortestHitPos; float shortestDist = 3e11f; - for (int i = 0, iCount(vList.size()); i < iCount; ++i) + for (int i = 0, iCount(static_cast(vList.size())); i < iCount; ++i) { const Vec3& v0 = vList[i]; const Vec3& v1 = vList[(i + 1) % iCount]; diff --git a/Code/Editor/RenderViewport.cpp b/Code/Editor/RenderViewport.cpp index d268a57684..47e5106221 100644 --- a/Code/Editor/RenderViewport.cpp +++ b/Code/Editor/RenderViewport.cpp @@ -2342,7 +2342,7 @@ bool CRenderViewport::AddCameraMenuItems(QMenu* menu) AZ::EBusAggregateResults getCameraResults; Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras); - const int numCameras = getCameraResults.values.size(); + const int numCameras = static_cast(getCameraResults.values.size()); // only enable if we're editing a sequence in Track View and have cameras in the level bool enableSequenceCameraMenu = (GetIEditor()->GetAnimation()->GetSequence() && numCameras); @@ -2354,7 +2354,7 @@ bool CRenderViewport::AddCameraMenuItems(QMenu* menu) connect(action, &QAction::triggered, this, &CRenderViewport::SetSequenceCamera); QVector additionalCameras; - additionalCameras.reserve(getCameraResults.values.size()); + additionalCameras.reserve(static_cast(getCameraResults.values.size())); for (const AZ::EntityId& entityId : getCameraResults.values) { @@ -2930,7 +2930,7 @@ void CRenderViewport::RenderSelectedRegion() // Draw volume dc.DepthWriteOff(); dc.CullOff(); - dc.pRenderAuxGeom->DrawTriangles(&verts[0], verts.size(), &inds[0], numInds, &colors[0]); + dc.pRenderAuxGeom->DrawTriangles(&verts[0], static_cast(verts.size()), &inds[0], numInds, &colors[0]); dc.CullOn(); dc.DepthWriteOn(); } diff --git a/Code/Editor/RenderViewport.h b/Code/Editor/RenderViewport.h index c66d56176e..d63f319276 100644 --- a/Code/Editor/RenderViewport.h +++ b/Code/Editor/RenderViewport.h @@ -275,19 +275,19 @@ public: m_relCameraRotX = 0; m_relCameraRotZ = 0; - uint32 numSample6 = m_arrAnimatedCharacterPath.size(); + uint32 numSample6 = static_cast(m_arrAnimatedCharacterPath.size()); for (uint32 i = 0; i < numSample6; i++) { m_arrAnimatedCharacterPath[i] = Vec3(ZERO); } - numSample6 = m_arrSmoothEntityPath.size(); + numSample6 = static_cast(m_arrSmoothEntityPath.size()); for (uint32 i = 0; i < numSample6; i++) { m_arrSmoothEntityPath[i] = Vec3(ZERO); } - uint32 numSample7 = m_arrRunStrafeSmoothing.size(); + uint32 numSample7 = static_cast(m_arrRunStrafeSmoothing.size()); for (uint32 i = 0; i < numSample7; i++) { m_arrRunStrafeSmoothing[i] = 0; diff --git a/Code/Editor/TrackView/TrackViewAnimNode.h b/Code/Editor/TrackView/TrackViewAnimNode.h index 475307ffa9..466e60bcf0 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.h +++ b/Code/Editor/TrackView/TrackViewAnimNode.h @@ -27,7 +27,7 @@ class QWidget; class CTrackViewAnimNodeBundle { public: - unsigned int GetCount() const { return m_animNodes.size(); } + unsigned int GetCount() const { return static_cast(m_animNodes.size()); } CTrackViewAnimNode* GetNode(const unsigned int index) { return m_animNodes[index]; } const CTrackViewAnimNode* GetNode(const unsigned int index) const { return m_animNodes[index]; } diff --git a/Code/Editor/TrackView/TrackViewNode.h b/Code/Editor/TrackView/TrackViewNode.h index 600a66877f..2c289049e9 100644 --- a/Code/Editor/TrackView/TrackViewNode.h +++ b/Code/Editor/TrackView/TrackViewNode.h @@ -123,7 +123,7 @@ public: virtual bool AreAllKeysOfSameType() const override { return m_bAllOfSameType; } - virtual unsigned int GetKeyCount() const override { return m_keys.size(); } + virtual unsigned int GetKeyCount() const override { return static_cast(m_keys.size()); } virtual CTrackViewKeyHandle GetKey(unsigned int index) override { return m_keys[index]; } virtual void SelectKeys(const bool bSelected) override; @@ -174,7 +174,7 @@ public: CTrackViewNode* GetParentNode() const { return m_pParentNode; } // Children - unsigned int GetChildCount() const { return m_childNodes.size(); } + unsigned int GetChildCount() const { return static_cast(m_childNodes.size()); } CTrackViewNode* GetChild(unsigned int index) const { return m_childNodes[index].get(); } // Snap time value to prev/next key in sequence diff --git a/Code/Editor/TrackView/TrackViewSequenceManager.h b/Code/Editor/TrackView/TrackViewSequenceManager.h index b181cf54b1..21c10f009a 100644 --- a/Code/Editor/TrackView/TrackViewSequenceManager.h +++ b/Code/Editor/TrackView/TrackViewSequenceManager.h @@ -29,7 +29,7 @@ public: virtual void OnEditorNotifyEvent(EEditorNotifyEvent event); - unsigned int GetCount() const { return m_sequences.size(); } + unsigned int GetCount() const { return static_cast(m_sequences.size()); } void CreateSequence(QString name, SequenceType sequenceType); void DeleteSequence(CTrackViewSequence* pSequence); diff --git a/Code/Editor/TrackView/TrackViewTrack.h b/Code/Editor/TrackView/TrackViewTrack.h index 0c1f13274c..bbe81f6377 100644 --- a/Code/Editor/TrackView/TrackViewTrack.h +++ b/Code/Editor/TrackView/TrackViewTrack.h @@ -27,7 +27,7 @@ public: : m_bAllOfSameType(true) , m_bHasRotationTrack(false) {} - unsigned int GetCount() const { return m_tracks.size(); } + unsigned int GetCount() const { return static_cast(m_tracks.size()); } CTrackViewTrack* GetTrack(const unsigned int index) { return m_tracks[index]; } const CTrackViewTrack* GetTrack(const unsigned int index) const { return m_tracks[index]; } diff --git a/Code/Editor/Undo/Undo.h b/Code/Editor/Undo/Undo.h index 3f943f7a82..594d3b3f3d 100644 --- a/Code/Editor/Undo/Undo.h +++ b/Code/Editor/Undo/Undo.h @@ -61,12 +61,12 @@ public: // Confetti: Get the size of m_undoObjects virtual int GetCount() const { - return m_undoObjects.size(); + return static_cast(m_undoObjects.size()); } virtual bool IsEmpty() const { return m_undoObjects.empty(); }; virtual void Undo(bool bUndo) { - for (int i = m_undoObjects.size() - 1; i >= 0; i--) + for (int i = static_cast(m_undoObjects.size() - 1); i >= 0; i--) { m_undoObjects[i]->Undo(bUndo); } diff --git a/Code/Editor/ViewManager.h b/Code/Editor/ViewManager.h index 22f9f6804f..434c38df2f 100644 --- a/Code/Editor/ViewManager.h +++ b/Code/Editor/ViewManager.h @@ -86,7 +86,7 @@ public: ////////////////////////////////////////////////////////////////////////// //! Get number of currently existing viewports. - virtual int GetViewCount() { return m_viewports.size(); }; + virtual int GetViewCount() { return static_cast(m_viewports.size()); }; //! Get viewport by index. //! @param index 0 <= index < GetViewportCount() virtual CViewport* GetView(int index) { return m_viewports[index]; } diff --git a/Code/Legacy/CryCommon/UnicodeBinding.h b/Code/Legacy/CryCommon/UnicodeBinding.h index 6bfa846035..e6e82aaf49 100644 --- a/Code/Legacy/CryCommon/UnicodeBinding.h +++ b/Code/Legacy/CryCommon/UnicodeBinding.h @@ -843,7 +843,7 @@ namespace Unicode { const size_t offset = Append ? out.size() : 0; length += offset; - out.resize(length); // resize() can't fail without exceptions, so assert instead. + out.resize(static_cast(length)); // resize() can't fail without exceptions, so assert instead. assert((out.size() == length) && "Buffer resize failed (out-of-memory?)"); const CharType* base = length ? out.data() : 0; ptr = const_cast(base + offset); From 95914e3fd61b3c7b6356115246e2e107bc720a03 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 24 Jun 2021 18:10:14 -0700 Subject: [PATCH 37/75] merging from development + fixing linux Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Dependency/TestImpactSourceCoveringTestsSerializer.cpp | 4 ++-- Gems/AWSMetrics/Code/Source/MetricsManager.cpp | 2 +- .../Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp | 2 +- Gems/Vegetation/Code/Source/AreaSystemComponent.cpp | 6 +++--- Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactSourceCoveringTestsSerializer.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactSourceCoveringTestsSerializer.cpp index 4de52e0f78..266791e05c 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactSourceCoveringTestsSerializer.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactSourceCoveringTestsSerializer.cpp @@ -50,8 +50,8 @@ namespace TestImpact AZStd::vector coveringTests; sourceCoveringTests.reserve(1U << 16); // Reserve for approx. 65k source files const AZStd::string delim = "\n"; - auto start = 0U; - auto end = sourceCoveringTestsListString.find(delim); + size_t start = 0U; + size_t end = sourceCoveringTestsListString.find(delim); while (end != AZStd::string::npos) { diff --git a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp index 025ebe212c..5c4d910658 100644 --- a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp +++ b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp @@ -256,7 +256,7 @@ namespace AWSMetrics } m_globalStats.m_numSuccesses++; - m_globalStats.m_sendSizeInBytes += static_cast::value_type>(metricsEvent.GetSizeInBytes()); + m_globalStats.m_sendSizeInBytes += static_cast(metricsEvent.GetSizeInBytes()); } else { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp index 1436e62d7f..f2d82918ea 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp @@ -516,7 +516,7 @@ namespace AZ SupervariantIndex ShaderAsset::GetSupervariantIndexInternal(AZ::Name supervariantName) const { const auto& supervariants = GetCurrentShaderApiData().m_supervariants; - const uint32_t supervariantCount = supervariants.size(); + const uint32_t supervariantCount = static_cast(supervariants.size()); for (uint32_t index = 0; index < supervariantCount; ++index) { if (supervariants[index].m_name == supervariantName) diff --git a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp index f5153a37b2..7ce1a2c0a3 100644 --- a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp @@ -1010,7 +1010,7 @@ namespace Vegetation if (m_debugData) { - m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); } } @@ -1025,8 +1025,8 @@ namespace Vegetation if (m_debugData) { - m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); - m_debugData->m_areaTaskActiveCount.store(static_cast(tasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskActiveCount.store(static_cast(tasks.size()), AZStd::memory_order_relaxed); } } diff --git a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp index efdebcaff8..74fb2696ea 100644 --- a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp @@ -483,7 +483,7 @@ namespace Vegetation AZStd::lock_guard scopedLock(m_instanceMapMutex); AZ_Assert(m_instanceMap.find(instanceData.m_instanceId) == m_instanceMap.end(), "InstanceId %llu is already in use!", instanceData.m_instanceId); m_instanceMap[instanceData.m_instanceId] = AZStd::make_pair(instanceData.m_descriptorPtr, opaqueInstanceData); - m_instanceCount = static_cast(m_instanceMap.size()); + m_instanceCount = static_cast(m_instanceMap.size()); } } @@ -503,7 +503,7 @@ namespace Vegetation opaqueInstanceData = instanceItr->second.second; m_instanceMap.erase(instanceItr); } - m_instanceCount = static_cast(m_instanceMap.size()); + m_instanceCount = static_cast(m_instanceMap.size()); } if (opaqueInstanceData) From 074e33081f065840cb2962dc1b4d0403d3ffbff7 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 27 Jul 2021 19:11:22 -0700 Subject: [PATCH 38/75] more fixes for w4267 Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../ReflectedPropertyControl/ReflectedPropertyItem.h | 2 +- .../SandboxIntegration.cpp | 2 +- .../UI/Outliner/OutlinerListModel.cpp | 2 +- .../ScriptCanvas/AWSScriptBehaviorsComponentTest.cpp | 2 +- .../Source/AuxGeom/DynamicPrimitiveProcessor.cpp | 12 ++++++------ Gems/BarrierInput/Code/Source/BarrierInputClient.cpp | 6 +++--- .../Code/Source/ViewportCameraSelectorWindow.cpp | 2 +- Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp | 2 +- Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h index 0abf7d295c..9bd34f3f7c 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h @@ -122,7 +122,7 @@ protected: public: //! Get number of child nodes. - int GetChildCount() const { return m_childs.size(); }; + int GetChildCount() const { return static_cast(m_childs.size()); }; //! Get Child by id. ReflectedPropertyItem* GetChild(int index) const { return m_childs[index]; } PropertyType GetType() const { return m_type; } diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp index 874868b5bc..ead320367e 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp @@ -803,7 +803,7 @@ void SandboxIntegrationManager::SetupLayerContextMenu(QMenu* menu) menu->addSeparator(); - const int selectedLayerCount = layersInSelection.size(); + const int selectedLayerCount = static_cast(layersInSelection.size()); QString saveTitle = QObject::tr("Save layer"); if(selectedLayerCount > 1) { diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp index 50d111d9b3..02d2174fb8 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp @@ -259,7 +259,7 @@ QVariant OutlinerListModel::dataForName(const QModelIndex& index, int role) cons if (highlightTextIndex >= 0) { const QString BACKGROUND_COLOR{ "#707070" }; - label.insert(highlightTextIndex + m_filterString.length(), ""); + label.insert(static_cast(highlightTextIndex + m_filterString.length()), ""); label.insert(highlightTextIndex, ""); } } while(highlightTextIndex > 0); diff --git a/Gems/AWSCore/Code/Tests/ScriptCanvas/AWSScriptBehaviorsComponentTest.cpp b/Gems/AWSCore/Code/Tests/ScriptCanvas/AWSScriptBehaviorsComponentTest.cpp index 5c80813590..caba8b5ae7 100644 --- a/Gems/AWSCore/Code/Tests/ScriptCanvas/AWSScriptBehaviorsComponentTest.cpp +++ b/Gems/AWSCore/Code/Tests/ScriptCanvas/AWSScriptBehaviorsComponentTest.cpp @@ -51,7 +51,7 @@ protected: TEST_F(AWSScriptBehaviorsComponentTest, Reflect) { - int oldEBusNum = m_behaviorContext->m_ebuses.size(); + int oldEBusNum = static_cast(m_behaviorContext->m_ebuses.size()); m_componentDescriptor.reset(AWSScriptBehaviorsComponent::CreateDescriptor()); m_componentDescriptor->Reflect(m_serializeContext.get()); m_componentDescriptor->Reflect(m_behaviorContext.get()); diff --git a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp index 08b3821b41..ea726dd914 100644 --- a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp @@ -196,13 +196,13 @@ namespace AZ { const size_t sourceByteSize = source.size() * sizeof(AuxGeomIndex); - RHI::Ptr dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(sourceByteSize); + RHI::Ptr dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(static_cast(sourceByteSize)); if (!dynamicBuffer) { AZ_WarningOnce("AuxGeom", false, "Failed to allocate dynamic buffer of size %d.", sourceByteSize); return false; - } - dynamicBuffer->Write(source.data(), sourceByteSize); + } + dynamicBuffer->Write(source.data(), static_cast(sourceByteSize)); group.m_indexBufferView = dynamicBuffer->GetIndexBufferView(RHI::IndexFormat::Uint32); return true; } @@ -211,13 +211,13 @@ namespace AZ { const size_t sourceByteSize = source.size() * sizeof(AuxGeomDynamicVertex); - RHI::Ptr dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(sourceByteSize); + RHI::Ptr dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(static_cast(sourceByteSize)); if (!dynamicBuffer) { AZ_WarningOnce("AuxGeom", false, "Failed to allocate dynamic buffer of size %d.", sourceByteSize); return false; - } - dynamicBuffer->Write(source.data(), sourceByteSize); + } + dynamicBuffer->Write(source.data(), static_cast(sourceByteSize)); group.m_streamBufferViews[0] = dynamicBuffer->GetStreamBufferView(sizeof(AuxGeomDynamicVertex)); return true; } diff --git a/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp b/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp index b1ca6cb7d7..495ef88467 100644 --- a/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp +++ b/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp @@ -54,7 +54,7 @@ namespace BarrierInput int ReadU8() { int ret = data[0]; data += 1; return ret; } void Eat(int len) { data += len; } - void InsertString(const char* str) { int len = strlen(str); memcpy(end, str, len); end += len; } + void InsertString(const char* str) { int len = static_cast(strlen(str)); memcpy(end, str, len); end += len; } void InsertU32(int a) { end[0] = a >> 24; end[1] = a >> 16; end[2] = a >> 8; end[3] = a; end += 4; } void InsertU16(int a) { end[0] = a >> 8; end[1] = a; end += 2; } void InsertU8(int a) { end[0] = a; end += 1; } @@ -93,7 +93,7 @@ namespace BarrierInput stream.InsertString("Barrier"); stream.InsertU16(1); stream.InsertU16(4); - stream.InsertU32(pContext->GetClientScreenName().length()); + stream.InsertU32(static_cast(pContext->GetClientScreenName().length())); stream.InsertString(pContext->GetClientScreenName().c_str()); stream.ClosePacket(); return barrierSendFunc(pContext, stream.GetBuffer(), stream.GetLength()); @@ -268,7 +268,7 @@ namespace BarrierInput int i; for (i = 0; i < numPackets; ++i) { - const int len = strlen(s_packets[i].pattern); + const int len = static_cast(strlen(s_packets[i].pattern)); if (packetLength >= len && memcmp(stream.GetData(), s_packets[i].pattern, len) == 0) { bool bDone = false; diff --git a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp index 9644aa76f9..f664d78c0e 100644 --- a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp +++ b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp @@ -102,7 +102,7 @@ namespace Camera int CameraListModel::rowCount([[maybe_unused]] const QModelIndex& parent) const { - return m_cameraItems.size(); + return static_cast(m_cameraItems.size()); } QVariant CameraListModel::data(const QModelIndex& index, int role) const diff --git a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp index 223a3e14f2..68198c491a 100644 --- a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp +++ b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp @@ -401,7 +401,7 @@ namespace LmbrCentral // 2 verts for each segment // loops == sides // 2 loops per segment - const AZ::u32 segments = segmentCount * spline->GetSegmentGranularity(); + const AZ::u32 segments = static_cast(segmentCount * spline->GetSegmentGranularity()); const AZ::u32 totalEndSegments = capSegments * 2 * 2 * 2 * 2; const AZ::u32 totalSegments = segments * 2 * 2 * 2; const AZ::u32 totalLoops = 2 * sides * segments * 2; diff --git a/Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp b/Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp index c882252d50..412e53d0da 100644 --- a/Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp +++ b/Gems/PhysX/Code/Source/Pipeline/MeshExporter.cpp @@ -161,7 +161,7 @@ namespace PhysX // Add it to the list otherwise sourceSceneMaterialNames.push_back(materialName); - AZ::u16 newIndex = sourceSceneMaterialNames.size() - 1; + AZ::u16 newIndex = static_cast(sourceSceneMaterialNames.size() - 1); materialIndexByName[materialName] = newIndex; return newIndex; From e97c62c3e0f5ab171d279c31f336f39765655c30 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 2 Aug 2021 18:14:56 -0700 Subject: [PATCH 39/75] New warning fix Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/LyShine/Code/Source/UiElementComponent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/LyShine/Code/Source/UiElementComponent.cpp b/Gems/LyShine/Code/Source/UiElementComponent.cpp index 45ddea9877..d06b87cf6a 100644 --- a/Gems/LyShine/Code/Source/UiElementComponent.cpp +++ b/Gems/LyShine/Code/Source/UiElementComponent.cpp @@ -1211,8 +1211,8 @@ bool UiElementComponent::FixupPostLoad(AZ::Entity* entity, UiCanvasComponent* ca #ifdef AZ_DEBUG_BUILD // check that the m_childEntityIdOrder is ordered such that the m_sortIndex fields are in order and contiguous { - int numChildren = m_childEntityIdOrder.size(); - for (AZ::u64 index = 0; index < numChildren; ++index) + size_t numChildren = m_childEntityIdOrder.size(); + for (size_t index = 0; index < numChildren; ++index) { if (m_childEntityIdOrder[index].m_sortIndex != index) { From f269d222b7e699ae6fb4f02fdcbcd50a792e959d Mon Sep 17 00:00:00 2001 From: Guthrie Adams Date: Tue, 3 Aug 2021 17:07:03 -0500 Subject: [PATCH 40/75] Fixing issues with shader management console startup Updating test scripts Synchronizing SMC and ME application classes Signed-off-by: Guthrie Adams --- .../Application/AtomToolsApplication.cpp | 6 +-- .../Code/Source/MaterialEditorApplication.cpp | 10 ++-- .../Scripts/GenerateAllMaterialScreenshots.py | 4 +- .../ShaderManagementConsoleApplication.cpp | 48 ++++++++++--------- .../ShaderManagementConsoleApplication.h | 7 +-- 5 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp index 3a542db1a4..3d9219edc5 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp @@ -87,14 +87,12 @@ namespace AtomToolsFramework if (auto behaviorContext = azrtti_cast(context)) { - auto targetName = GetBuildTargetName(); - // this will put these methods into the 'azlmbr.AtomTools.general' module - auto addGeneral = [targetName](AZ::BehaviorContext::GlobalMethodBuilder methodBuilder) + auto addGeneral = [](AZ::BehaviorContext::GlobalMethodBuilder methodBuilder) { methodBuilder->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation) ->Attribute(AZ::Script::Attributes::Category, "Editor") - ->Attribute(AZ::Script::Attributes::Module, targetName); + ->Attribute(AZ::Script::Attributes::Module, "atomtools.general"); }; // The reflection here is based on patterns in CryEditPythonHandler::Reflect addGeneral(behaviorContext->Method( diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp index 0977694b90..c68c139961 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -28,11 +27,11 @@ #include -#include #include #include #include +#include #include #include #include @@ -73,15 +72,14 @@ namespace MaterialEditor { QApplication::setApplicationName("O3DE Material Editor"); + // The settings registry has been created at this point, so add the CMake target AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddBuildSystemTargetSpecialization( *AZ::SettingsRegistry::Get(), GetBuildTargetName()); } MaterialEditorApplication::~MaterialEditorApplication() { - AzToolsFramework::AssetDatabase::AssetDatabaseRequestsBus::Handler::BusDisconnect(); MaterialEditorWindowNotificationBus::Handler::BusDisconnect(); - AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect(); } void MaterialEditorApplication::CreateStaticModules(AZStd::vector& outModules) @@ -122,8 +120,8 @@ namespace MaterialEditor &MaterialEditor::MaterialEditorWindowRequestBus::Handler::ActivateWindow); } - // Process command line options for opening one or more material documents on startup - size_t openDocumentCount = commandLine.GetNumMiscValues(); + // Process command line options for opening one or more documents on startup + size_t openDocumentCount = m_commandLine.GetNumMiscValues(); for (size_t openDocumentIndex = 0; openDocumentIndex < openDocumentCount; ++openDocumentIndex) { const AZStd::string openDocumentPath = commandLine.GetMiscValue(openDocumentIndex); diff --git a/Gems/Atom/Tools/MaterialEditor/Scripts/GenerateAllMaterialScreenshots.py b/Gems/Atom/Tools/MaterialEditor/Scripts/GenerateAllMaterialScreenshots.py index d2c9bf209e..d7f52d7a24 100755 --- a/Gems/Atom/Tools/MaterialEditor/Scripts/GenerateAllMaterialScreenshots.py +++ b/Gems/Atom/Tools/MaterialEditor/Scripts/GenerateAllMaterialScreenshots.py @@ -114,11 +114,11 @@ def SetCameraPitch(pitch): azlmbr.render.ArcBallControllerRequestBus(azlmbr.bus.Broadcast, 'SetPitch', pitch) def IdleFrames(numFrames): - azlmbr.materialeditor.general.idle_wait_frames(numFrames) + azlmbr.atomtools.general.idle_wait_frames(numFrames) def CaptureScreenshot(screenshotOutputPath): print("Capturing screenshot to " + screenshotOutputPath + " ...") - return ScreenshotHelper(azlmbr.materialeditor.general.idle_wait_frames).capture_screenshot_blocking(screenshotOutputPath) + return ScreenshotHelper(azlmbr.atomtools.general.idle_wait_frames).capture_screenshot_blocking(screenshotOutputPath) def ResizeViewport(width, height): # This locks the size of the render target to the desired resolution diff --git a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.cpp b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.cpp index 7e09f88f4f..66580e5906 100644 --- a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.cpp +++ b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.cpp @@ -25,26 +25,27 @@ #include #include -#include -#include #include -#include -#include +#include +#include #include #include #include #include +#include +#include + AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT -#include #include #include AZ_POP_DISABLE_WARNING namespace ShaderManagementConsole { + //! This function returns the build system target name of "ShaderManagementConsole AZStd::string ShaderManagementConsoleApplication::GetBuildTargetName() const { #if !defined(LY_CMAKE_TARGET) @@ -74,6 +75,11 @@ namespace ShaderManagementConsole *AZ::SettingsRegistry::Get(), GetBuildTargetName()); } + ShaderManagementConsoleApplication::~ShaderManagementConsoleApplication() + { + ShaderManagementConsoleWindowNotificationBus::Handler::BusDisconnect(); + } + void ShaderManagementConsoleApplication::CreateStaticModules(AZStd::vector& outModules) { Base::CreateStaticModules(outModules); @@ -84,8 +90,6 @@ namespace ShaderManagementConsole void ShaderManagementConsoleApplication::OnShaderManagementConsoleWindowClosing() { ExitMainLoop(); - ShaderManagementConsoleWindowNotificationBus::Handler::BusDisconnect(); - AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect(); } void ShaderManagementConsoleApplication::Destroy() @@ -104,27 +108,19 @@ namespace ShaderManagementConsole return AZStd::vector({ "passes/", "config/" }); } - void ShaderManagementConsoleApplication::ProcessCommandLine() + void ShaderManagementConsoleApplication::ProcessCommandLine(const AZ::CommandLine& commandLine) { - // Process command line options for running one or more python scripts on startup - const AZStd::string runPythonScriptSwitchName = "runpython"; - size_t runPythonScriptCount = m_commandLine.GetNumSwitchValues(runPythonScriptSwitchName); - for (size_t runPythonScriptIndex = 0; runPythonScriptIndex < runPythonScriptCount; ++runPythonScriptIndex) - { - const AZStd::string runPythonScriptPath = m_commandLine.GetSwitchValue(runPythonScriptSwitchName, runPythonScriptIndex); - AZStd::vector runPythonArgs; - AzToolsFramework::EditorPythonRunnerRequestBus::Broadcast( - &AzToolsFramework::EditorPythonRunnerRequestBus::Events::ExecuteByFilenameWithArgs, runPythonScriptPath, runPythonArgs); - } - // Process command line options for opening one or more documents on startup size_t openDocumentCount = m_commandLine.GetNumMiscValues(); for (size_t openDocumentIndex = 0; openDocumentIndex < openDocumentCount; ++openDocumentIndex) { - const AZStd::string openDocumentPath = m_commandLine.GetMiscValue(openDocumentIndex); - ShaderManagementConsoleDocumentSystemRequestBus::Broadcast( - &ShaderManagementConsoleDocumentSystemRequestBus::Events::OpenDocument, openDocumentPath); + const AZStd::string openDocumentPath = commandLine.GetMiscValue(openDocumentIndex); + + AZ_Printf(GetBuildTargetName().c_str(), "Opening document: %s", openDocumentPath.c_str()); + ShaderManagementConsoleDocumentSystemRequestBus::Broadcast(&ShaderManagementConsoleDocumentSystemRequestBus::Events::OpenDocument, openDocumentPath); } + + Base::ProcessCommandLine(commandLine); } void ShaderManagementConsoleApplication::StartInternal() @@ -136,4 +132,12 @@ namespace ShaderManagementConsole ShaderManagementConsole::ShaderManagementConsoleWindowRequestBus::Broadcast( &ShaderManagementConsole::ShaderManagementConsoleWindowRequestBus::Handler::CreateShaderManagementConsoleWindow); } + + void ShaderManagementConsoleApplication::Stop() + { + ShaderManagementConsole::ShaderManagementConsoleWindowRequestBus::Broadcast( + &ShaderManagementConsole::ShaderManagementConsoleWindowRequestBus::Handler::DestroyShaderManagementConsoleWindow); + + Base::Stop(); + } } // namespace ShaderManagementConsole diff --git a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.h b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.h index 5d3696fee3..d0a2b800b2 100644 --- a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.h +++ b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.h @@ -26,12 +26,13 @@ namespace ShaderManagementConsole using Base = AtomToolsFramework::AtomToolsApplication; ShaderManagementConsoleApplication(int* argc, char*** argv); - virtual ~ShaderManagementConsoleApplication() = default; + virtual ~ShaderManagementConsoleApplication(); ////////////////////////////////////////////////////////////////////////// // AzFramework::Application void CreateStaticModules(AZStd::vector& outModules) override; const char* GetCurrentConfigurationName() const override; + void Stop() override; private: ////////////////////////////////////////////////////////////////////////// @@ -44,9 +45,9 @@ namespace ShaderManagementConsole void Destroy() override; ////////////////////////////////////////////////////////////////////////// - void ProcessCommandLine(); + void ProcessCommandLine(const AZ::CommandLine& commandLine) override; void StartInternal() override; AZStd::string GetBuildTargetName() const override; AZStd::vector GetCriticalAssetFilters() const override; - }; + }; } // namespace ShaderManagementConsole From b594132a47b834570763eb3bbac15110f4356de1 Mon Sep 17 00:00:00 2001 From: Guthrie Adams Date: Tue, 3 Aug 2021 17:19:30 -0500 Subject: [PATCH 41/75] using command line parameter instead of member Signed-off-by: Guthrie Adams --- .../MaterialEditor/Code/Source/MaterialEditorApplication.cpp | 2 +- .../Code/Source/ShaderManagementConsoleApplication.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp index c68c139961..6f1bdfb083 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp @@ -121,7 +121,7 @@ namespace MaterialEditor } // Process command line options for opening one or more documents on startup - size_t openDocumentCount = m_commandLine.GetNumMiscValues(); + size_t openDocumentCount = commandLine.GetNumMiscValues(); for (size_t openDocumentIndex = 0; openDocumentIndex < openDocumentCount; ++openDocumentIndex) { const AZStd::string openDocumentPath = commandLine.GetMiscValue(openDocumentIndex); diff --git a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.cpp b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.cpp index 66580e5906..947cf55050 100644 --- a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.cpp +++ b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/ShaderManagementConsoleApplication.cpp @@ -111,7 +111,7 @@ namespace ShaderManagementConsole void ShaderManagementConsoleApplication::ProcessCommandLine(const AZ::CommandLine& commandLine) { // Process command line options for opening one or more documents on startup - size_t openDocumentCount = m_commandLine.GetNumMiscValues(); + size_t openDocumentCount = commandLine.GetNumMiscValues(); for (size_t openDocumentIndex = 0; openDocumentIndex < openDocumentCount; ++openDocumentIndex) { const AZStd::string openDocumentPath = commandLine.GetMiscValue(openDocumentIndex); From 6188df4b4964e303d2bc8e83d7bc2091a33f1146 Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Tue, 3 Aug 2021 15:36:56 -0700 Subject: [PATCH 42/75] Added Get Direction Vector node for Vector2,3 and 4 Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- .../Editor/Translation/scriptcanvas_en_us.ts | 195 ++++++++++++++++++ .../Libraries/Math/Vector2Nodes.h | 17 ++ .../Libraries/Math/Vector3Nodes.h | 18 ++ .../Libraries/Math/Vector4Nodes.h | 19 +- 4 files changed, 248 insertions(+), 1 deletion(-) diff --git a/Assets/Editor/Translation/scriptcanvas_en_us.ts b/Assets/Editor/Translation/scriptcanvas_en_us.ts index f057ba2f30..5604cfb631 100644 --- a/Assets/Editor/Translation/scriptcanvas_en_us.ts +++ b/Assets/Editor/Translation/scriptcanvas_en_us.ts @@ -2771,6 +2771,71 @@ VECTOR2_CREATEONE_OUTPUT0_TOOLTIP + + VECTOR2_DIRECTIONTO_NAME + Class/Bus: Vector2 Event/Method: DirectionTo + Get Direction Vector + + + VECTOR2_DIRECTIONTO_TOOLTIP + + + + VECTOR2_DIRECTIONTO_CATEGORY + + + + VECTOR2_DIRECTIONTO_OUT_NAME + + + + VECTOR2_DIRECTIONTO_OUT_TOOLTIP + + + + VECTOR2_DIRECTIONTOL_IN_NAME + + + + VECTOR2_DIRECTIONTO_IN_TOOLTIP + + + + VECTOR2_DIRECTIONTO_OUTPUT0_NAME + C++ Type: const Vector2 + Direction + + + VECTOR2_DIRECTIONTO_OUTPUT0_TOOLTIP + + + + VECTOR2_DIRECTIONTO_PARAM0_NAME + Simple Type: Vector2 C++ Type: Vector2* + From + + + VECTOR2_DIRECTIONTO_PARAM0_TOOLTIP + + + + VECTOR2_DIRECTIONTO_PARAM1_NAME + Simple Type: Vector2 C++ Type: Vector2* + To + + + VECTOR2_DIRECTIONTO_PARAM1_TOOLTIP + + + + VECTOR2_DIRECTIONTO_PARAM2_NAME + Simple Type: Vector2 C++ Type: Vector2* + Scale + + + VECTOR2_DIRECTIONTO_PARAM2_TOOLTIP + + VECTOR2_GETPROJECTED_NAME Class/Bus: Vector2 Event/Method: GetProjected @@ -32262,6 +32327,71 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro VECTOR4_GETRECIPROCAL_PARAM0_TOOLTIP + + VECTOR4_DIRECTIONTO_NAME + Class/Bus: Vector4 Event/Method: DirectionTo + Get Direction Vector + + + VECTOR4_DIRECTIONTO_TOOLTIP + + + + VECTOR4_DIRECTIONTO_CATEGORY + + + + VECTOR4_DIRECTIONTO_OUT_NAME + + + + VECTOR4_DIRECTIONTO_OUT_TOOLTIP + + + + VECTOR4_DIRECTIONTOL_IN_NAME + + + + VECTOR4_DIRECTIONTO_IN_TOOLTIP + + + + VECTOR4_DIRECTIONTO_OUTPUT0_NAME + C++ Type: const Vector4 + Direction + + + VECTOR4_DIRECTIONTO_OUTPUT0_TOOLTIP + + + + VECTOR4_DIRECTIONTO_PARAM0_NAME + Simple Type: Vector4 C++ Type: Vector4* + From + + + VECTOR4_DIRECTIONTO_PARAM0_TOOLTIP + + + + VECTOR4_DIRECTIONTO_PARAM1_NAME + Simple Type: Vector4 C++ Type: Vector4* + To + + + VECTOR4_DIRECTIONTO_PARAM1_TOOLTIP + + + + VECTOR4_DIRECTIONTO_PARAM2_NAME + Simple Type: Vector4 C++ Type: Vector4* + Scale + + + VECTOR4_DIRECTIONTO_PARAM2_TOOLTIP + + VECTOR4_AXISX_NAME Class/Bus: Vector4 Event/Method: CreateAxisX @@ -37469,6 +37599,71 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro VECTOR3_GETRECIPROCAL_PARAM0_TOOLTIP + + VECTOR3_DIRECTIONTO_NAME + Class/Bus: Vector3 Event/Method: DirectionTo + Get Direction Vector + + + VECTOR3_DIRECTIONTO_TOOLTIP + + + + VECTOR3_DIRECTIONTO_CATEGORY + + + + VECTOR3_DIRECTIONTO_OUT_NAME + + + + VECTOR3_DIRECTIONTO_OUT_TOOLTIP + + + + VECTOR3_DIRECTIONTOL_IN_NAME + + + + VECTOR3_DIRECTIONTO_IN_TOOLTIP + + + + VECTOR3_DIRECTIONTO_OUTPUT0_NAME + C++ Type: const Vector3 + Direction + + + VECTOR3_DIRECTIONTO_OUTPUT0_TOOLTIP + + + + VECTOR3_DIRECTIONTO_PARAM0_NAME + Simple Type: Vector3 C++ Type: Vector3* + From + + + VECTOR3_DIRECTIONTO_PARAM0_TOOLTIP + + + + VECTOR3_DIRECTIONTO_PARAM1_NAME + Simple Type: Vector3 C++ Type: Vector3* + To + + + VECTOR3_DIRECTIONTO_PARAM1_TOOLTIP + + + + VECTOR3_DIRECTIONTO_PARAM2_NAME + Simple Type: Vector3 C++ Type: Vector3* + Scale + + + VECTOR3_DIRECTIONTO_PARAM2_TOOLTIP + + VECTOR3_PROJECT_NAME Class/Bus: Vector3 Event/Method: Project diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h index c4fee491a3..4ac14a7db6 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h @@ -243,6 +243,22 @@ namespace ScriptCanvas } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(ToPerpendicular, k_categoryName, "{CC4DC102-8B50-4828-BA94-0586F34E0D37}", "returns the vector (-Source.y, Source.x), a 90 degree, positive rotation", "Source"); + AZ_INLINE void DirectionToDefaults(Node& node) + { + SetDefaultValuesByIndex<0>::_(node, Data::Vector2Type()); + SetDefaultValuesByIndex<1>::_(node, Data::Vector2Type()); + SetDefaultValuesByIndex<2>::_(node, Data::NumberType(1.)); + } + + AZ_INLINE Vector2Type DirectionTo(const Vector2Type from, const Vector2Type to, NumberType optionalScale = 1.f) + { + Vector2Type r = to - from; + r.Normalize(); + r.SetLength(optionalScale); + return r; + } + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Given two points in space, return a direction vector", "From", "To", "Scale"); + using Registrar = RegistrarGeneric < AbsoluteNode , AddNode @@ -295,6 +311,7 @@ namespace ScriptCanvas , SlerpNode , SubtractNode , ToPerpendicularNode + , DirectionToNode > ; } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h index 5962cee487..eb304c8362 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h @@ -329,6 +329,23 @@ namespace ScriptCanvas } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(ZAxisCross, k_categoryName, "{29206E84-392C-412E-9DD5-781B2759260D}", "returns the vector cross product of Z-Axis X Source", "Source"); + AZ_INLINE void DirectionToDefaults(Node& node) + { + SetDefaultValuesByIndex<0>::_(node, Data::Vector3Type()); + SetDefaultValuesByIndex<1>::_(node, Data::Vector3Type()); + SetDefaultValuesByIndex<2>::_(node, Data::NumberType(1.)); + } + + AZ_INLINE Vector3Type DirectionTo(const Vector3Type from, const Vector3Type to, NumberType optionalScale = 1.f) + { + Vector3Type r = to - from; + r.Normalize(); + r.SetLength(optionalScale); + return r; + } + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}", "Given two points in space, return a direction vector", "From", "To", "Scale"); + + using Registrar = RegistrarGeneric < AbsoluteNode , AddNode @@ -403,6 +420,7 @@ namespace ScriptCanvas , SlerpNode , SubtractNode + , DirectionToNode #if ENABLE_EXTENDED_MATH_SUPPORT , XAxisCrossNode diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h index 4522ba07dc..ac9be8f135 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h @@ -214,6 +214,22 @@ namespace ScriptCanvas } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_DEPRECATED(Subtract, k_categoryName, "{A5FA6465-9C39-4A44-BD7C-E8ECF9503E46}", "This node is deprecated, use Subtract (-), it provides contextual type and slots", "A", "B"); + AZ_INLINE void DirectionToDefaults(Node& node) + { + SetDefaultValuesByIndex<0>::_(node, Data::Vector4Type()); + SetDefaultValuesByIndex<1>::_(node, Data::Vector4Type()); + SetDefaultValuesByIndex<2>::_(node, Data::NumberType(1.)); + } + + AZ_INLINE Vector4Type DirectionTo(const Vector4Type from, const Vector4Type to, NumberType optionalScale = 1.f) + { + Vector4Type r = to - from; + r.Normalize(); + r.SetLength(optionalScale); + return r; + } + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Given two points in space, return a direction vector", "From", "To", "Scale"); + using Registrar = RegistrarGeneric < AbsoluteNode, AddNode, @@ -260,7 +276,8 @@ namespace ScriptCanvas #endif ReciprocalNode, - SubtractNode + SubtractNode, + DirectionToNode > ; } From d06ec45aaa2f882f13008c6a5cc9578e9cbb291d Mon Sep 17 00:00:00 2001 From: aaguilea Date: Wed, 4 Aug 2021 13:05:00 +0100 Subject: [PATCH 43/75] changes to the move rotate and scale Signed-off-by: aaguilea --- Code/Editor/Core/LevelEditorMenuHandler.cpp | 8 +-- Code/Editor/CryEdit.cpp | 3 - Code/Editor/MainWindow.cpp | 69 ++++++++++++++++++--- Code/Editor/MainWindow.h | 14 +++-- Code/Editor/Resource.h | 5 -- Code/Editor/ViewportTitleDlg.cpp | 8 +-- 6 files changed, 79 insertions(+), 28 deletions(-) diff --git a/Code/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Editor/Core/LevelEditorMenuHandler.cpp index 3c27c25c9a..70ff51c3d6 100644 --- a/Code/Editor/Core/LevelEditorMenuHandler.cpp +++ b/Code/Editor/Core/LevelEditorMenuHandler.cpp @@ -544,12 +544,12 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe auto snapMenu = modifyMenu.AddMenu(tr("Snap")); - snapMenu.AddAction(ID_SNAPANGLE); + snapMenu.AddAction(AzToolsFramework::SnapAngle); auto transformModeMenu = modifyMenu.AddMenu(tr("Transform Mode")); - transformModeMenu.AddAction(ID_EDITMODE_MOVE); - transformModeMenu.AddAction(ID_EDITMODE_ROTATE); - transformModeMenu.AddAction(ID_EDITMODE_SCALE); + transformModeMenu.AddAction(AzToolsFramework::EditModeMove); + transformModeMenu.AddAction(AzToolsFramework::EditModeRotate); + transformModeMenu.AddAction(AzToolsFramework::EditModeScale); editMenu.AddSeparator(); diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index 4bfc6a319d..407dfffd3e 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -375,9 +375,6 @@ void CCryEditApp::RegisterActionHandlers() }); ON_COMMAND(ID_MOVE_OBJECT, OnMoveObject) ON_COMMAND(ID_RENAME_OBJ, OnRenameObj) - ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove) - ON_COMMAND(ID_EDITMODE_ROTATE, OnEditmodeRotate) - ON_COMMAND(ID_EDITMODE_SCALE, OnEditmodeScale) ON_COMMAND(ID_UNDO, OnUndo) ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnUndo) // Can't use the same ID, because for the menu we can't have a QWidgetAction, while for the toolbar we want one ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter) diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp index ff322b79ac..8309d99691 100644 --- a/Code/Editor/MainWindow.cpp +++ b/Code/Editor/MainWindow.cpp @@ -46,6 +46,7 @@ AZ_POP_DISABLE_WARNING #include #include #include +#include // AzQtComponents #include @@ -731,32 +732,84 @@ void MainWindow::InitActions() .SetStatusTip(tr("Restore saved state (Fetch)")); // Modify actions - am->AddAction(ID_EDITMODE_MOVE, tr("Move")) + am->AddAction(AzToolsFramework::EditModeMove, tr("Move")) .SetIcon(Style::icon("Move")) .SetApplyHoverEffect() .SetShortcut(tr("1")) .SetToolTip(tr("Move (1)")) .SetCheckable(true) .SetStatusTip(tr("Select and move selected object(s)")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeMove); - am->AddAction(ID_EDITMODE_ROTATE, tr("Rotate")) + .RegisterUpdateCallback([](QAction* action) + { + Q_ASSERT(action->isCheckable()); + + AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; + AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( + mode, AzToolsFramework::GetEntityContextId(), + &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); + + action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation); + }) + .Connect( + &QAction::triggered, + []() + { + EditorTransformComponentSelectionRequestBus::Event( + GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode, + EditorTransformComponentSelectionRequests::Mode::Translation); + }); + am->AddAction(AzToolsFramework::EditModeRotate, tr("Rotate")) .SetIcon(Style::icon("Translate")) .SetApplyHoverEffect() .SetShortcut(tr("2")) .SetToolTip(tr("Rotate (2)")) .SetCheckable(true) .SetStatusTip(tr("Select and rotate selected object(s)")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeRotate); - am->AddAction(ID_EDITMODE_SCALE, tr("Scale")) + .RegisterUpdateCallback([](QAction* action) + { + Q_ASSERT(action->isCheckable()); + + AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; + AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( + mode, AzToolsFramework::GetEntityContextId(), + &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); + + action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation); + }) + .Connect( + &QAction::triggered, + []() + { + EditorTransformComponentSelectionRequestBus::Event( + GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode, + EditorTransformComponentSelectionRequests::Mode::Rotation); + }); + am->AddAction(AzToolsFramework::EditModeScale, tr("Scale")) .SetIcon(Style::icon("Scale")) .SetApplyHoverEffect() .SetShortcut(tr("3")) .SetToolTip(tr("Scale (3)")) .SetCheckable(true) .SetStatusTip(tr("Select and scale selected object(s)")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeScale); + .RegisterUpdateCallback([](QAction* action) + { + Q_ASSERT(action->isCheckable()); - am->AddAction(ID_SNAP_TO_GRID, tr("Snap to grid")) + AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; + AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( + mode, AzToolsFramework::GetEntityContextId(), + &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); + + action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale); + }) + .Connect( &QAction::triggered,[]() + { + EditorTransformComponentSelectionRequestBus::Event( + GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode, + EditorTransformComponentSelectionRequests::Mode::Scale); + }); + + am->AddAction(AzToolsFramework::SnapToGrid, tr("Snap to grid")) .SetIcon(Style::icon("Grid")) .SetApplyHoverEffect() .SetShortcut(tr("G")) @@ -769,7 +822,7 @@ void MainWindow::InitActions() }) .Connect(&QAction::triggered, []() { SandboxEditor::SetGridSnapping(!SandboxEditor::GridSnappingEnabled()); }); - am->AddAction(ID_SNAPANGLE, tr("Snap angle")) + am->AddAction(AzToolsFramework::SnapAngle, tr("Snap angle")) .SetIcon(Style::icon("Angle")) .SetApplyHoverEffect() .SetStatusTip(tr("Snap angle")) diff --git a/Code/Editor/MainWindow.h b/Code/Editor/MainWindow.h index e70355827c..1e375b08f2 100644 --- a/Code/Editor/MainWindow.h +++ b/Code/Editor/MainWindow.h @@ -59,11 +59,17 @@ namespace AzQtComponents namespace AzToolsFramework { class Ticker; -} - -namespace AzToolsFramework -{ class QtSourceControlNotificationHandler; + + //! @name Reverse URLs. + //! Used to identify common actions and override them when necessary. + //@{ + constexpr inline AZ::Crc32 EditModeMove = AZ_CRC_CE("com.o3de.action.editor.editmode.move"); + constexpr inline AZ::Crc32 EditModeRotate = AZ_CRC_CE("com.o3de.action.editor.editmode.rotate"); + constexpr inline AZ::Crc32 EditModeScale = AZ_CRC_CE("com.o3de.action.editor.editmode.scale"); + constexpr inline AZ::Crc32 SnapToGrid = AZ_CRC_CE("com.o3de.action.editor.snaptogrid"); + constexpr inline AZ::Crc32 SnapAngle = AZ_CRC_CE("com.o3de.action.editor.snapangle"); + //@} } #define MAINFRM_LAYOUT_NORMAL "NormalLayout" diff --git a/Code/Editor/Resource.h b/Code/Editor/Resource.h index a6f714afa4..b3640fac70 100644 --- a/Code/Editor/Resource.h +++ b/Code/Editor/Resource.h @@ -82,7 +82,6 @@ #define ID_TOOLS_CUSTOMIZEKEYBOARD 32914 #define ID_EXPORT_INDOORS 32915 #define ID_VIEW_CYCLE2DVIEWPORT 32916 -#define ID_SNAPANGLE 32917 #define ID_PHYSICS_GETPHYSICSSTATE 32937 #define ID_PHYSICS_RESETPHYSICSSTATE 32938 #define ID_GAME_SYNCPLAYER 32941 @@ -108,9 +107,6 @@ #define ID_MOVE_OBJECT 33481 #define ID_RENAME_OBJ 33483 #define ID_FETCH 33496 -#define ID_EDITMODE_ROTATE 33506 -#define ID_EDITMODE_SCALE 33507 -#define ID_EDITMODE_MOVE 33508 #define ID_SELECTION_DELETE 33512 #define ID_EDIT_ESCAPE 33513 #define ID_UNDO 33524 @@ -137,7 +133,6 @@ #define ID_ADDNODE 33570 #define ID_ADDSCENETRACK 33573 #define ID_FIND 33574 -#define ID_SNAP_TO_GRID 33575 #define ID_TAG_LOC1 33576 #define ID_TAG_LOC2 33577 #define ID_TAG_LOC3 33578 diff --git a/Code/Editor/ViewportTitleDlg.cpp b/Code/Editor/ViewportTitleDlg.cpp index 4d27506929..c1e1afb908 100644 --- a/Code/Editor/ViewportTitleDlg.cpp +++ b/Code/Editor/ViewportTitleDlg.cpp @@ -953,13 +953,13 @@ void CViewportTitleDlg::CheckForCameraSpeedUpdate() void CViewportTitleDlg::OnGridSnappingToggled() { m_gridSizeActionWidget->setEnabled(m_enableGridSnappingAction->isChecked()); - MainWindow::instance()->GetActionManager()->GetAction(ID_SNAP_TO_GRID)->trigger(); + MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapToGrid)->trigger(); } void CViewportTitleDlg::OnAngleSnappingToggled() { m_angleSizeActionWidget->setEnabled(m_enableAngleSnappingAction->isChecked()); - MainWindow::instance()->GetActionManager()->GetAction(ID_SNAPANGLE)->trigger(); + MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapAngle)->trigger(); } void CViewportTitleDlg::OnGridSpinBoxChanged(double value) @@ -974,14 +974,14 @@ void CViewportTitleDlg::OnAngleSpinBoxChanged(double value) void CViewportTitleDlg::UpdateOverFlowMenuState() { - bool gridSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(ID_SNAP_TO_GRID)->isChecked(); + bool gridSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapToGrid)->isChecked(); { QSignalBlocker signalBlocker(m_enableGridSnappingAction); m_enableGridSnappingAction->setChecked(gridSnappingActive); } m_gridSizeActionWidget->setEnabled(gridSnappingActive); - bool angleSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(ID_SNAPANGLE)->isChecked(); + bool angleSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapAngle)->isChecked(); { QSignalBlocker signalBlocker(m_enableAngleSnappingAction); m_enableAngleSnappingAction->setChecked(angleSnappingActive); From c9e16c1c42e4fbad0bb949beaabb06850f3c2e67 Mon Sep 17 00:00:00 2001 From: aaguilea Date: Wed, 4 Aug 2021 14:44:50 +0100 Subject: [PATCH 44/75] Erased some legacy function that are no longer necessary Signed-off-by: aaguilea --- Code/Editor/CryEdit.cpp | 69 ----------------------------------------- Code/Editor/CryEdit.h | 6 ---- 2 files changed, 75 deletions(-) diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index 407dfffd3e..3b68758d17 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -2576,75 +2576,6 @@ void CCryEditApp::OnRenameObj() { } -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnEditmodeMove() -{ - using namespace AzToolsFramework; - EditorTransformComponentSelectionRequestBus::Event( - GetEntityContextId(), - &EditorTransformComponentSelectionRequests::SetTransformMode, - EditorTransformComponentSelectionRequests::Mode::Translation); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnEditmodeRotate() -{ - using namespace AzToolsFramework; - EditorTransformComponentSelectionRequestBus::Event( - GetEntityContextId(), - &EditorTransformComponentSelectionRequests::SetTransformMode, - EditorTransformComponentSelectionRequests::Mode::Rotation); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnEditmodeScale() -{ - using namespace AzToolsFramework; - EditorTransformComponentSelectionRequestBus::Event( - GetEntityContextId(), - &EditorTransformComponentSelectionRequests::SetTransformMode, - EditorTransformComponentSelectionRequests::Mode::Scale); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnUpdateEditmodeMove(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - - AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; - AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( - mode, AzToolsFramework::GetEntityContextId(), - &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); - - action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnUpdateEditmodeRotate(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - - AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; - AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( - mode, AzToolsFramework::GetEntityContextId(), - &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); - - action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnUpdateEditmodeScale(QAction* action) -{ - Q_ASSERT(action->isCheckable()); - - AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode; - AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( - mode, AzToolsFramework::GetEntityContextId(), - &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode); - - action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale); -} - void CCryEditApp::OnViewSwitchToGame() { if (IsInPreviewMode()) diff --git a/Code/Editor/CryEdit.h b/Code/Editor/CryEdit.h index af0fbb0971..9406b37ea2 100644 --- a/Code/Editor/CryEdit.h +++ b/Code/Editor/CryEdit.h @@ -208,12 +208,6 @@ public: void DeleteSelectedEntities(bool includeDescendants); void OnMoveObject(); void OnRenameObj(); - void OnEditmodeMove(); - void OnEditmodeRotate(); - void OnEditmodeScale(); - void OnUpdateEditmodeMove(QAction* action); - void OnUpdateEditmodeRotate(QAction* action); - void OnUpdateEditmodeScale(QAction* action); void OnUndo(); void OnOpenAssetImporter(); void OnUpdateSelected(QAction* action); From 20515c46beb88c8ffe9b2fd0c09f4ac64ebea7c1 Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Wed, 4 Aug 2021 08:20:41 -0700 Subject: [PATCH 45/75] Updated DirectionTo node's tooltips to match the translation file Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- .../Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h | 2 +- .../Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h | 2 +- .../Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h index 4ac14a7db6..5caff9ff25 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h @@ -257,7 +257,7 @@ namespace ScriptCanvas r.SetLength(optionalScale); return r; } - SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Given two points in space, return a direction vector", "From", "To", "Scale"); + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); using Registrar = RegistrarGeneric < AbsoluteNode diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h index eb304c8362..24a1710655 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h @@ -343,7 +343,7 @@ namespace ScriptCanvas r.SetLength(optionalScale); return r; } - SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}", "Given two points in space, return a direction vector", "From", "To", "Scale"); + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}", "Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); using Registrar = RegistrarGeneric < diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h index ac9be8f135..d420affd9a 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h @@ -228,7 +228,7 @@ namespace ScriptCanvas r.SetLength(optionalScale); return r; } - SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Given two points in space, return a direction vector", "From", "To", "Scale"); + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); using Registrar = RegistrarGeneric < AbsoluteNode, From 760acdcdcc14fde196ced69002cf3251632fc812 Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Wed, 4 Aug 2021 08:21:41 -0700 Subject: [PATCH 46/75] Updated DirectionTo tooltips in the translation file Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- Assets/Editor/Translation/scriptcanvas_en_us.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Editor/Translation/scriptcanvas_en_us.ts b/Assets/Editor/Translation/scriptcanvas_en_us.ts index 5604cfb631..22cd00aaea 100644 --- a/Assets/Editor/Translation/scriptcanvas_en_us.ts +++ b/Assets/Editor/Translation/scriptcanvas_en_us.ts @@ -2778,7 +2778,7 @@ VECTOR2_DIRECTIONTO_TOOLTIP - + Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0 VECTOR2_DIRECTIONTO_CATEGORY @@ -32334,7 +32334,7 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro VECTOR4_DIRECTIONTO_TOOLTIP - + Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0 VECTOR4_DIRECTIONTO_CATEGORY @@ -37606,7 +37606,7 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro VECTOR3_DIRECTIONTO_TOOLTIP - + Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0 VECTOR3_DIRECTIONTO_CATEGORY From 1f0fcf2aa27ed3bd3a353ce40ba583afd7ef5887 Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Wed, 4 Aug 2021 08:42:26 -0700 Subject: [PATCH 47/75] Updates GetDirectionVector nodes to also return the distance between the points Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- .../Editor/Translation/scriptcanvas_en_us.ts | 43 +++++++++++++++---- .../Libraries/Math/Vector2Nodes.h | 8 ++-- .../Libraries/Math/Vector3Nodes.h | 8 ++-- .../Libraries/Math/Vector4Nodes.h | 8 ++-- 4 files changed, 47 insertions(+), 20 deletions(-) diff --git a/Assets/Editor/Translation/scriptcanvas_en_us.ts b/Assets/Editor/Translation/scriptcanvas_en_us.ts index 22cd00aaea..937f6a4d96 100644 --- a/Assets/Editor/Translation/scriptcanvas_en_us.ts +++ b/Assets/Editor/Translation/scriptcanvas_en_us.ts @@ -2778,7 +2778,7 @@ VECTOR2_DIRECTIONTO_TOOLTIP - Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0 + Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0 VECTOR2_DIRECTIONTO_CATEGORY @@ -2800,14 +2800,23 @@ VECTOR2_DIRECTIONTO_IN_TOOLTIP - + VECTOR2_DIRECTIONTO_OUTPUT0_NAME C++ Type: const Vector2 Direction VECTOR2_DIRECTIONTO_OUTPUT0_TOOLTIP - + The direction between To and From normalized and optionally scaled + + + VECTOR2_DIRECTIONTO_OUTPUT1_NAME + C++ Type: float + Distance + + + VECTOR2_DIRECTIONTO_OUTPUT1_TOOLTIP + The distance between To and From VECTOR2_DIRECTIONTO_PARAM0_NAME @@ -32334,7 +32343,7 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro VECTOR4_DIRECTIONTO_TOOLTIP - Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0 + Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0 VECTOR4_DIRECTIONTO_CATEGORY @@ -32363,7 +32372,16 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro VECTOR4_DIRECTIONTO_OUTPUT0_TOOLTIP - + The direction between To and From normalized and optionally scaled + + + VECTOR4_DIRECTIONTO_OUTPUT1_NAME + C++ Type: float + Distance + + + VECTOR4_DIRECTIONTO_OUTPUT1_TOOLTIP + The distance between To and From VECTOR4_DIRECTIONTO_PARAM0_NAME @@ -37606,7 +37624,7 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro VECTOR3_DIRECTIONTO_TOOLTIP - Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0 + Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0 VECTOR3_DIRECTIONTO_CATEGORY @@ -37628,14 +37646,23 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro VECTOR3_DIRECTIONTO_IN_TOOLTIP - + VECTOR3_DIRECTIONTO_OUTPUT0_NAME C++ Type: const Vector3 Direction VECTOR3_DIRECTIONTO_OUTPUT0_TOOLTIP - + The direction between To and From normalized and optionally scaled + + + VECTOR3_DIRECTIONTO_OUTPUT1_NAME + C++ Type: float + Distance + + + VECTOR3_DIRECTIONTO_OUTPUT1_TOOLTIP + The distance between To and From VECTOR3_DIRECTIONTO_PARAM0_NAME diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h index 5caff9ff25..670c9f31a1 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h @@ -250,14 +250,14 @@ namespace ScriptCanvas SetDefaultValuesByIndex<2>::_(node, Data::NumberType(1.)); } - AZ_INLINE Vector2Type DirectionTo(const Vector2Type from, const Vector2Type to, NumberType optionalScale = 1.f) + AZ_INLINE std::tuple DirectionTo(const Vector2Type from, const Vector2Type to, NumberType optionalScale = 1.f) { Vector2Type r = to - from; - r.Normalize(); + float length = r.NormalizeWithLength(); r.SetLength(optionalScale); - return r; + return std::make_tuple(r, length); } - SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); using Registrar = RegistrarGeneric < AbsoluteNode diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h index 24a1710655..492bc83e33 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h @@ -336,14 +336,14 @@ namespace ScriptCanvas SetDefaultValuesByIndex<2>::_(node, Data::NumberType(1.)); } - AZ_INLINE Vector3Type DirectionTo(const Vector3Type from, const Vector3Type to, NumberType optionalScale = 1.f) + AZ_INLINE std::tuple DirectionTo(const Vector3Type from, const Vector3Type to, NumberType optionalScale = 1.f) { Vector3Type r = to - from; - r.Normalize(); + float length = r.NormalizeWithLength(); r.SetLength(optionalScale); - return r; + return std::make_tuple(r, length); } - SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}", "Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); using Registrar = RegistrarGeneric < diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h index d420affd9a..26099c59c6 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h @@ -221,14 +221,14 @@ namespace ScriptCanvas SetDefaultValuesByIndex<2>::_(node, Data::NumberType(1.)); } - AZ_INLINE Vector4Type DirectionTo(const Vector4Type from, const Vector4Type to, NumberType optionalScale = 1.f) + AZ_INLINE std::tuple DirectionTo(const Vector4Type from, const Vector4Type to, NumberType optionalScale = 1.f) { Vector4Type r = to - from; - r.Normalize(); + float length = r.NormalizeWithLength(); r.SetLength(optionalScale); - return r; + return std::make_tuple(r, length); } - SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Returns a direction vector between two points, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", false, "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); using Registrar = RegistrarGeneric < AbsoluteNode, From 2c9655657695b9dc21c13b07d340bb9f0e18790e Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Wed, 4 Aug 2021 08:47:37 -0700 Subject: [PATCH 48/75] Removed unnecessary argument in node generic macro Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- .../Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h index 26099c59c6..14256fc969 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h @@ -228,7 +228,7 @@ namespace ScriptCanvas r.SetLength(optionalScale); return std::make_tuple(r, length); } - SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", false, "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); + SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); using Registrar = RegistrarGeneric < AbsoluteNode, From 26c6d41e6358737f51c686b58fb76f9e76f374f6 Mon Sep 17 00:00:00 2001 From: Chris Aniszczyk Date: Wed, 4 Aug 2021 11:14:25 -0500 Subject: [PATCH 49/75] Update language Signed-off-by: Chris Aniszczyk --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c129fffb6c..e3eb6aa588 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Open 3D Engine +# O3DE (Open 3D Engine) -Open 3D Engine (O3DE) is an open-source, real-time, multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations. +O3DE (Open 3D Engine)is an open-source, real-time, multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations. ## Contribute For information about contributing to Open 3D Engine, visit https://o3de.org/docs/contributing/ From dbb6c1ae469eea0b9f7eebd2460f1d619bb9b23d Mon Sep 17 00:00:00 2001 From: moraaar Date: Wed, 4 Aug 2021 17:57:48 +0100 Subject: [PATCH 50/75] Fixed EntitySpawnTicket move constructor (#2832) Signed-off-by: moraaar --- .../Spawnable/SpawnableEntitiesInterface.cpp | 2 ++ .../SpawnableEntitiesManagerTests.cpp | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.cpp b/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.cpp index 87353c5807..617eb3a0b9 100644 --- a/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.cpp +++ b/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.cpp @@ -227,8 +227,10 @@ namespace AzFramework EntitySpawnTicket::EntitySpawnTicket(EntitySpawnTicket&& rhs) : m_payload(rhs.m_payload) + , m_id(rhs.m_id) { rhs.m_payload = nullptr; + rhs.m_id = 0; } EntitySpawnTicket::EntitySpawnTicket(AZ::Data::Asset spawnable) diff --git a/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp b/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp index 7eff4b5eeb..f68af08f4a 100644 --- a/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp +++ b/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp @@ -366,6 +366,24 @@ namespace UnitTest } } + TEST_F(SpawnableEntitiesManagerTest, EntitySpawnTicket_Move_Works) + { + AzFramework::EntitySpawnTicket ticket1(*m_spawnableAsset); + AzFramework::EntitySpawnTicket ticket2(*m_spawnableAsset); + + const AzFramework::EntitySpawnTicket::Id ticket1Id = ticket1.GetId(); + const AzFramework::EntitySpawnTicket::Id ticket2Id = ticket2.GetId(); + + AzFramework::EntitySpawnTicket ticketMoveConstructor(AZStd::move(ticket1)); + EXPECT_TRUE(ticketMoveConstructor.IsValid()); + EXPECT_EQ(ticketMoveConstructor.GetId(), ticket1Id); + + AzFramework::EntitySpawnTicket ticketMoveOperator; + ticketMoveOperator = AZStd::move(ticket2); + EXPECT_TRUE(ticketMoveOperator.IsValid()); + EXPECT_EQ(ticketMoveOperator.GetId(), ticket2Id); + } + TEST_F(SpawnableEntitiesManagerTest, SpawnAllEntities_DeleteTicketBeforeCall_NoCrash) { { From 6d345512c136b65e471335616130d41cb683a0d7 Mon Sep 17 00:00:00 2001 From: Jacob Hilliard <64656371+jcbhl@users.noreply.github.com> Date: Wed, 4 Aug 2021 10:26:06 -0700 Subject: [PATCH 51/75] Visualizer: switch to erase_if to improve performance (#2779) Signed-off-by: Jacob Hilliard --- .../Code/Include/Atom/Utils/ImGuiCpuProfiler.inl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl index ffd7af2f20..ae707a10a7 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl @@ -520,13 +520,14 @@ namespace AZ { AZStd::size_t sizeBeforeRemove = savedRegions.size(); - auto firstRegionToKeep = AZStd::lower_bound( - savedRegions.begin(), savedRegions.end(), deleteBeforeTick, - [](const TimeRegion& region, AZStd::sys_time_t target) + // Use erase_if over plain upper_bound + erase to avoid repeated shifts. erase requires a shift of all elements to the right + // for each element that is erased, while erase_if squashes all removes into a single shift which significantly improves perf. + AZStd::erase_if( + savedRegions, + [deleteBeforeTick](const TimeRegion& region) { - return region.m_startTick < target; + return region.m_startTick < deleteBeforeTick; }); - savedRegions.erase(savedRegions.begin(), firstRegionToKeep); m_savedRegionCount -= sizeBeforeRemove - savedRegions.size(); } From b3901b32513d2c1b0b089325f8757f92cb1f2436 Mon Sep 17 00:00:00 2001 From: Chris Aniszczyk Date: Wed, 4 Aug 2021 12:27:19 -0500 Subject: [PATCH 52/75] fix space Signed-off-by: Chris Aniszczyk --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e3eb6aa588..a783139eef 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # O3DE (Open 3D Engine) -O3DE (Open 3D Engine)is an open-source, real-time, multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations. +O3DE (Open 3D Engine) is an open-source, real-time, multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations. ## Contribute For information about contributing to Open 3D Engine, visit https://o3de.org/docs/contributing/ From 21ca3a4aea3b79b530e9abc1f0e2618aae88f05d Mon Sep 17 00:00:00 2001 From: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Date: Wed, 4 Aug 2021 13:13:28 -0500 Subject: [PATCH 53/75] The enable-gem command registers gem with project if not registered (#2817) * The enable_gems command now registers the gem with the project if only registered with o3de_manifest.json Updated the `enable_gems` command to register the gem with the project if the gem is not registered with either the project or the engine being used. This allows the gem to be added to the build system if it wasn't registered before. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Adding quoting around the invocation of the OpenProjectManager command The --project-path parameter now is able to pass in a path with spaces to the invocation of the Project Manager. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> --- Code/Editor/CryEdit.cpp | 9 +- scripts/o3de/o3de/enable_gem.py | 22 ++- scripts/o3de/o3de/register.py | 6 +- scripts/o3de/tests/CMakeLists.txt | 7 + scripts/o3de/tests/unit_test_enable_gem.py | 126 ++++++++++++++++++ .../tests/unit_test_project_properties.py | 36 +++-- 6 files changed, 183 insertions(+), 23 deletions(-) create mode 100644 scripts/o3de/tests/unit_test_enable_gem.py diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index 4bfc6a319d..61d4fd5aea 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -2901,7 +2901,14 @@ 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(); - const AZStd::string commandLineOptions = AZStd::string::format(" --screen %s --project-path %s", screen.c_str(), projectPath.c_str()); +#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); bool launchSuccess = AzFramework::ProjectManager::LaunchProjectManager(commandLineOptions); if (!launchSuccess) { diff --git a/scripts/o3de/o3de/enable_gem.py b/scripts/o3de/o3de/enable_gem.py index 67e1624086..1614dc4eda 100644 --- a/scripts/o3de/o3de/enable_gem.py +++ b/scripts/o3de/o3de/enable_gem.py @@ -16,7 +16,7 @@ import os import pathlib import sys -from o3de import cmake, manifest, validation +from o3de import cmake, manifest, register, validation logger = logging.getLogger() logging.basicConfig() @@ -87,8 +87,7 @@ def enable_gem_in_project(gem_name: str = None, if not enabled_gem_file.is_file(): logger.error(f'Enabled gem file {enabled_gem_file} is not present.') return 1 - # add the gem - ret_val = cmake.add_gem_dependency(enabled_gem_file, gem_json_data['gem_name']) + project_enabled_gem_file = enabled_gem_file else: # Find the path to enabled gem file. @@ -96,8 +95,21 @@ def enable_gem_in_project(gem_name: str = None, project_enabled_gem_file = cmake.get_enabled_gem_cmake_file(project_path=project_path) if not project_enabled_gem_file.is_file(): project_enabled_gem_file.touch() - # add the gem - ret_val = cmake.add_gem_dependency(project_enabled_gem_file, gem_json_data['gem_name']) + + # Before adding the gem_dependency check if the project is registered in either the project or engine + # manifest + buildable_gems = manifest.get_engine_gems() + buildable_gems.extend(manifest.get_project_gems(project_path)) + # Convert each path to pathlib.Path object and filter out duplictes using dict.fromkeys + buildable_gems = list(dict.fromkeys(map(lambda gem_path_string: pathlib.Path(gem_path_string), buildable_gems))) + + ret_val = 0 + # If the gem is not part of buildable set, it needs to be registered + if not gem_path in buildable_gems: + ret_val = register.register(gem_path=gem_path, external_subdir_project_path=project_path) + + # add the gem if it is registered in either the project.json or engine.json + ret_val = ret_val or cmake.add_gem_dependency(project_enabled_gem_file, gem_json_data['gem_name']) return ret_val diff --git a/scripts/o3de/o3de/register.py b/scripts/o3de/o3de/register.py index 8481c5fae0..7e182b5d2d 100644 --- a/scripts/o3de/o3de/register.py +++ b/scripts/o3de/o3de/register.py @@ -285,14 +285,14 @@ def register_o3de_object_path(json_data: dict, manifest_data = None if engine_path: - manifest_data = manifest.get_engine_json_data(json_data, engine_path) + manifest_data = manifest.get_engine_json_data(None, engine_path) if not manifest_data: logger.error(f'Cannot load engine.json data at path {engine_path}') return 1 save_path = engine_path / 'engine.json' elif project_path: - manifest_data = manifest.get_project_json_data(json_data, project_path) + manifest_data = manifest.get_project_json_data(None, project_path) if not manifest_data: logger.error(f'Cannot load project.json data at path {project_path}') return 1 @@ -329,7 +329,7 @@ def register_o3de_object_path(json_data: dict, try: o3de_object_path = o3de_object_path.relative_to(save_path.parent) except ValueError: - pass # It is OK relative path cannot be formed + pass # It is OK relative path cannot be formed manifest_data[o3de_object_key].insert(0, o3de_object_path.as_posix()) if save_path: manifest.save_o3de_manifest(manifest_data, save_path) diff --git a/scripts/o3de/tests/CMakeLists.txt b/scripts/o3de/tests/CMakeLists.txt index 1cd6eac7ee..de8e9e4974 100644 --- a/scripts/o3de/tests/CMakeLists.txt +++ b/scripts/o3de/tests/CMakeLists.txt @@ -25,6 +25,13 @@ ly_add_pytest( EXCLUDE_TEST_RUN_TARGET_FROM_IDE ) +ly_add_pytest( + NAME o3de_enable_gem + PATH ${CMAKE_CURRENT_LIST_DIR}/unit_test_enable_gem.py + TEST_SUITE smoke + EXCLUDE_TEST_RUN_TARGET_FROM_IDE +) + ly_add_pytest( NAME o3de_global_project PATH ${CMAKE_CURRENT_LIST_DIR}/unit_test_global_project.py diff --git a/scripts/o3de/tests/unit_test_enable_gem.py b/scripts/o3de/tests/unit_test_enable_gem.py new file mode 100644 index 0000000000..12896a51ba --- /dev/null +++ b/scripts/o3de/tests/unit_test_enable_gem.py @@ -0,0 +1,126 @@ +# +# 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 +# +# + +import io +import json +import logging + +import pytest +import pathlib +from unittest.mock import patch + +from o3de import enable_gem + + +TEST_PROJECT_JSON_PAYLOAD = ''' +{ + "project_name": "TestProject", + "origin": "The primary repo for TestProject goes here: i.e. http://www.mydomain.com", + "license": "What license TestProject uses goes here: i.e. https://opensource.org/licenses/MIT", + "display_name": "TestProject", + "summary": "A short description of TestProject.", + "canonical_tags": [ + "Project" + ], + "user_tags": [ + "TestProject" + ], + "icon_path": "preview.png", + "engine": "o3de-install", + "restricted_name": "projects", + "external_subdirectories": [ + ] +} +''' + +TEST_GEM_JSON_PAYLOAD = ''' +{ + "gem_name": "TestGem", + "display_name": "TestGem", + "license": "What license TestGem uses goes here: i.e. https://opensource.org/licenses/MIT", + "origin": "The primary repo for TestGem goes here: i.e. http://www.mydomain.com", + "type": "Code", + "summary": "A short description of TestGem.", + "canonical_tags": [ + "Gem" + ], + "user_tags": [ + "TestGem" + ], + "icon_path": "preview.png", + "requirements": "" +} +''' + + +@pytest.fixture(scope='class') +def init_enable_gem_data(request): + class EnableGemData: + def __init__(self): + self.project_data = json.loads(TEST_PROJECT_JSON_PAYLOAD) + self.gem_data = json.loads(TEST_GEM_JSON_PAYLOAD) + request.cls.enable_gem = EnableGemData() + + +@pytest.mark.usefixtures('init_enable_gem_data') +class TestEnableGemCommand: + @pytest.mark.parametrize("gem_path, project_path, gem_registered_with_project, gem_registered_with_engine," + "expected_result", [ + pytest.param(pathlib.PurePath('E:/TestGem'), pathlib.PurePath('E:/TestProject'), False, True, 0), + pytest.param(pathlib.PurePath('E:/TestGem'), pathlib.PurePath('E:/TestProject'), False, False, 0), + pytest.param(pathlib.PurePath('E:/TestGem'), pathlib.PurePath('E:/TestProject'), True, False, 0), + ] + ) + def test_enable_gem_registers_gem_as_well(self, gem_path, project_path, gem_registered_with_project, gem_registered_with_engine, + expected_result): + + def get_registered_path(project_name: str = None, gem_name: str = None) -> pathlib.Path: + if project_name: + return project_path + elif gem_name: + return gem_path + return None + + def get_registered_gem_path(gem_name: str) -> pathlib.Path: + return gem_path + + def save_o3de_manifest(new_project_data: dict, manifest_path: pathlib.Path = None) -> bool: + if manifest_path == project_path: + self.enable_gem.project_data = new_project_data + return True + + def get_project_json_data(json_data: pathlib.Path, project_path: pathlib.Path): + return self.enable_gem.project_data + + def get_gem_json_data(gem_path: pathlib.Path, project_path: pathlib.Path): + return self.enable_gem.gem_data + + def get_project_gems(project_path: pathlib.Path): + return [gem_path] if gem_registered_with_project else [] + + def get_engine_gems(): + return [gem_path] if gem_registered_with_engine else [] + + def add_gem_dependency(enable_gem_cmake_file: pathlib.Path, gem_name: str): + return 0 + + with patch('pathlib.Path.is_dir', return_value=True) as pathlib_is_dir_patch,\ + patch('pathlib.Path.is_file', return_value=True) as pathlib_is_file_patch,\ + patch('o3de.manifest.save_o3de_manifest', side_effect=save_o3de_manifest) as save_o3de_manifest_patch,\ + patch('o3de.manifest.get_registered', side_effect=get_registered_path) as get_registered_patch,\ + patch('o3de.manifest.get_gem_json_data', side_effect=get_gem_json_data) as get_gem_json_data_patch,\ + patch('o3de.manifest.get_project_json_data', side_effect=get_project_json_data) as get_gem_json_data_patch,\ + patch('o3de.manifest.get_project_gems', side_effect=get_project_gems) as get_project_gems_patch,\ + patch('o3de.manifest.get_engine_gems', side_effect=get_engine_gems) as get_engine_gems_patch,\ + patch('o3de.cmake.add_gem_dependency', side_effect=add_gem_dependency) as add_gem_dependency_patch,\ + patch('o3de.validation.valid_o3de_gem_json', return_value=True) as valid_gem_json_patch: + result = enable_gem.enable_gem_in_project(gem_path=gem_path, project_path=project_path) + assert result == expected_result + # If the gem isn't registered with the engine or project already it should now be registered with the project + if not gem_registered_with_engine and gem_registered_with_project: + assert gem_path.as_posix() in self.enable_gem.project_data.get('external_subdirectories', []) diff --git a/scripts/o3de/tests/unit_test_project_properties.py b/scripts/o3de/tests/unit_test_project_properties.py index f72a4dfe4c..0236e6cf90 100644 --- a/scripts/o3de/tests/unit_test_project_properties.py +++ b/scripts/o3de/tests/unit_test_project_properties.py @@ -6,33 +6,41 @@ # # +import json import pytest import pathlib from unittest.mock import patch from o3de import project_properties -TEST_DEFAULT_PROJECT_DATA = { - "template_name": "DefaultProject", - "restricted_name": "o3de", - "restricted_platform_relative_path": "Templates", - "origin": "The primary repo for DefaultProject goes here: i.e. http://www.mydomain.com", - "license": "What license DefaultProject uses goes here: i.e. https://opensource.org/licenses/MIT", - "display_name": "Default", - "summary": "A short description of DefaultProject.", - "included_gems": ["Atom","Camera","EMotionFX","UI","Maestro","Input","ImGui"], - "canonical_tags": [], - "user_tags": [ - "DefaultProject" +TEST_PROJECT_JSON_PAYLOAD = ''' +{ + "project_name": "TestProject", + "origin": "The primary repo for TestProject goes here: i.e. http://www.mydomain.com", + "license": "What license TestProject uses goes here: i.e. https://opensource.org/licenses/MIT", + "display_name": "TestProject", + "summary": "A short description of TestProject.", + "canonical_tags": [ + "Project" ], - "icon_path": "preview.png" + "user_tags": [ + "TestProject" + ], + "icon_path": "preview.png", + "engine": "o3de-install", + "restricted_name": "projects", + "external_subdirectories": [ + "D:/TestGem" + ] } +''' + @pytest.fixture(scope='class') def init_project_json_data(request): class ProjectJsonData: def __init__(self): - self.data = TEST_DEFAULT_PROJECT_DATA + self.data = json.loads(TEST_PROJECT_JSON_PAYLOAD) request.cls.project_json = ProjectJsonData() @pytest.mark.usefixtures('init_project_json_data') From 627dcc49f1e151e0f881dd9ec6690e831175a022 Mon Sep 17 00:00:00 2001 From: nemerle <96597+nemerle@users.noreply.github.com> Date: Wed, 4 Aug 2021 20:56:37 +0200 Subject: [PATCH 54/75] GetActivePathName was using default - constructed enum DocumentEditingMode() Also, SaveLevel was not using destName when constructing newFilePath Other code changes: * LogLoadTime is simplified by using QFile * reduce nesting in DoSaveDocument by using early return. * marked a few eligible methods as const * Simplified OnEnvironmentPropertyChanged a bit Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> --- Code/Editor/CryEditDoc.cpp | 147 ++++++++++++++++--------------------- Code/Editor/CryEditDoc.h | 30 ++++---- 2 files changed, 79 insertions(+), 98 deletions(-) diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index 43f599b191..9421198de7 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -108,21 +108,12 @@ namespace Internal // CCryEditDoc construction/destruction CCryEditDoc::CCryEditDoc() - : doc_validate_surface_types(0) + : doc_validate_surface_types(nullptr) , m_modifiedModuleFlags(eModifiedNothing) - // It assumes loaded levels have already been exported. Can be a big fat lie, though. - // The right way would require us to save to the level folder the export status of the - // level. - , m_boLevelExported(true) - , m_modified(false) - , m_envProbeHeight(200.0f) - , m_envProbeSliceRelativePath("EngineAssets/Slices/DefaultLevelSetup.slice") { //////////////////////////////////////////////////////////////////////// // Set member variables to initial values //////////////////////////////////////////////////////////////////////// - m_bLoadFailed = false; - m_waterColor = QColor(0, 0, 255); m_fogTemplate = GetIEditor()->FindTemplate("Fog"); m_environmentTemplate = GetIEditor()->FindTemplate("Environment"); @@ -136,7 +127,6 @@ CCryEditDoc::CCryEditDoc() m_environmentTemplate = XmlHelpers::CreateXmlNode("Environment"); } - m_bDocumentReady = false; GetIEditor()->SetDocument(this); CLogFile::WriteLine("Document created"); RegisterConsoleVariables(); @@ -195,7 +185,7 @@ CCryEditDoc::DocumentEditingMode CCryEditDoc::GetEditMode() const QString CCryEditDoc::GetActivePathName() const { - return DocumentEditingMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName(); + return GetEditMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName(); } QString CCryEditDoc::GetTitle() const @@ -260,9 +250,9 @@ void CCryEditDoc::DeleteContents() GetIEditor()->FlushUndo(); // Notify listeners. - for (std::list::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) + for (IDocListener* listener : m_listeners) { - (*it)->OnCloseDocument(); + listener->OnCloseDocument(); } GetIEditor()->ResetViews(); @@ -458,7 +448,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename) ////////////////////////////////////////////////////////////////////////// // Load water color. ////////////////////////////////////////////////////////////////////////// - (*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor); + (*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor); ////////////////////////////////////////////////////////////////////////// // Load View Settings @@ -507,9 +497,9 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename) CAutoLogTime logtime("Post Load"); // Notify listeners. - for (std::list::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) + for (IDocListener* listener : m_listeners) { - (*it)->OnLoadDocument(); + listener->OnLoadDocument(); } } @@ -708,7 +698,8 @@ bool CCryEditDoc::SaveModified() return true; } - auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); + auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()), + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (button) { case QMessageBox::Cancel: @@ -933,8 +924,7 @@ bool CCryEditDoc::OnSaveDocument(const QString& lpszPathName) } TSaveDocContext context; - if (shouldSaveLevel && - BeforeSaveDocument(lpszPathName, context)) + if (shouldSaveLevel && BeforeSaveDocument(lpszPathName, context)) { DoSaveDocument(lpszPathName, context); saveSuccess = AfterSaveDocument(lpszPathName, context); @@ -972,7 +962,7 @@ bool CCryEditDoc::BeforeSaveDocument(const QString& lpszPathName, TSaveDocContex return TRUE; } -bool CCryEditDoc::HasLayerNameConflicts() +bool CCryEditDoc::HasLayerNameConflicts() const { AZStd::vector editorEntities; AzToolsFramework::EditorEntityContextRequestBus::Broadcast( @@ -1004,43 +994,42 @@ bool CCryEditDoc::HasLayerNameConflicts() bool CCryEditDoc::DoSaveDocument(const QString& filename, TSaveDocContext& context) { bool& bSaved = context.bSaved; - if (bSaved) + if (!bSaved) { - // Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath) - // If nothing is loaded, we don't need to save anything - if (filename.isEmpty()) - { - bSaved = false; - } - else - { - // Save Tag Point locations to file if auto save of tag points disabled - if (!gSettings.bAutoSaveTagPoints) - { - CCryEditApp::instance()->SaveTagLocations(); - } - - QString normalizedPath = Path::ToUnixPath(filename); - if (IsSliceFile(normalizedPath)) - { - bSaved = SaveSlice(normalizedPath); - } - else - { - bSaved = SaveLevel(normalizedPath); - } - - // Changes filename for this document. - SetPathName(normalizedPath); - } + return false; + } + // Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath) + // If nothing is loaded, we don't need to save anything + if (filename.isEmpty()) + { + bSaved = false; + return false; } + // Save Tag Point locations to file if auto save of tag points disabled + if (!gSettings.bAutoSaveTagPoints) + { + CCryEditApp::instance()->SaveTagLocations(); + } + + QString normalizedPath = Path::ToUnixPath(filename); + if (IsSliceFile(normalizedPath)) + { + bSaved = SaveSlice(normalizedPath); + } + else + { + bSaved = SaveLevel(normalizedPath); + } + + // Changes filename for this document. + SetPathName(normalizedPath); return bSaved; } bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt) { - bool& bSaved = context.bSaved; + bool bSaved = context.bSaved; GetIEditor()->Notify(eNotify_OnEndSceneSave); @@ -1067,8 +1056,7 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName static void GetUserSettingsFile(const QString& levelFolder, QString& userSettings) { const char* pUserName = GetISystem()->GetUserName(); - QString fileName; - fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName); + QString fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName); userSettings = Path::Make(levelFolder, fileName); } @@ -1182,9 +1170,9 @@ bool CCryEditDoc::SaveLevel(const QString& filename) } QString oldFilePath = QDir(oldLevelFolder).absoluteFilePath(sourceName); - QString newFilePath = QDir(newLevelFolder).absoluteFilePath(sourceName); + QString newFilePath = QDir(newLevelFolder).absoluteFilePath(destName); CFileUtil::CopyFile(oldFilePath, newFilePath); - } while (findHandle = pIPak->FindNext(findHandle)); + } while ((findHandle = pIPak->FindNext(findHandle))); pIPak->FindClose(findHandle); } @@ -1506,7 +1494,7 @@ bool CCryEditDoc::LoadEntitiesFromLevel(const QString& levelPakFile) { AZStd::vector fileBuffer; fileBuffer.resize(entitiesFile.GetLength()); - if (fileBuffer.size() > 0) + if (!fileBuffer.empty()) { if (fileBuffer.size() == entitiesFile.ReadRaw(fileBuffer.begin(), fileBuffer.size())) { @@ -1910,7 +1898,7 @@ void CCryEditDoc::UnregisterListener(IDocListener* listener) m_listeners.remove(listener); } -void CCryEditDoc::LogLoadTime(int time) +void CCryEditDoc::LogLoadTime(int time) const { QString appFilePath = QDir::toNativeSeparators(QCoreApplication::applicationFilePath()); QString exePath = Path::GetPath(appFilePath); @@ -1922,21 +1910,18 @@ void CCryEditDoc::LogLoadTime(int time) SetFileAttributes(filename.toUtf8().data(), FILE_ATTRIBUTE_ARCHIVE); #endif - FILE* file = nullptr; - azfopen(&file, filename.toUtf8().data(), "at"); - - if (file) + QFile file(filename); + if (!file.open(QFile::Append | QFile::Text)) { - char version[50]; - GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version)); - - QString text; - - time = time / 1000; - text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time); - fwrite(text.toUtf8().data(), text.toUtf8().length(), 1, file); - fclose(file); + return; } + + char version[50]; + GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version)); + + time = time / 1000; + QString text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time); + file.write(text.toUtf8()); } void CCryEditDoc::SetDocumentReady(bool bReady) @@ -1944,7 +1929,7 @@ void CCryEditDoc::SetDocumentReady(bool bReady) m_bDocumentReady = bReady; } -void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer) +void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer) const { { SIZER_COMPONENT_NAME(pSizer, "UndoManager(estimate)"); @@ -2068,12 +2053,9 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU { // Notify listeners. std::list listeners = m_listeners; - std::list::iterator it, next; - for (it = listeners.begin(); it != listeners.end(); it = next) + for (IDocListener* listener : listeners) { - next = it; - next++; - (*it)->OnNewDocument(); + listener->OnNewDocument(); } } @@ -2134,25 +2116,23 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar) { return; } + QString childValue; if (pVar->GetDataType() == IVariable::DT_COLOR) { Vec3 value; pVar->Get(value); - QString buff; QColor gammaColor = ColorLinearToGamma(ColorF(value.x, value.y, value.z)); - buff = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue()); - childNode->setAttr("value", buff.toUtf8().data()); + childValue = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue()); } else { - QString value; - pVar->Get(value); - childNode->setAttr("value", value.toUtf8().data()); + pVar->Get(childValue); } + childNode->setAttr("value", childValue.toUtf8().data()); } -QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath) +QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath) const { QString levelPath = Path::GetPath(levelFilePath); QString levelName = Path::GetFileName(levelFilePath); @@ -2183,8 +2163,7 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& } CPakFile pakFile; - bool loadFromPakSuccess; - loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile); + bool loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile); pIPak->ClosePack(absoluteLevelPath.toUtf8().data()); if (!loadFromPakSuccess) { diff --git a/Code/Editor/CryEditDoc.h b/Code/Editor/CryEditDoc.h index 574f8eb7da..d32e8e5bb1 100644 --- a/Code/Editor/CryEditDoc.h +++ b/Code/Editor/CryEditDoc.h @@ -91,7 +91,7 @@ public: // Create from serialization only // ClassWizard generated virtual function overrides virtual bool OnOpenDocument(const QString& lpszPathName); - const bool IsLevelLoadFailed() const { return m_bLoadFailed; } + bool IsLevelLoadFailed() const { return m_bLoadFailed; } //! Marks this document as having errors. void SetHasErrors() { m_hasErrors = true; } @@ -121,7 +121,7 @@ public: // Create from serialization only CClouds* GetClouds() { return m_pClouds; } void SetWaterColor(const QColor& col) { m_waterColor = col; } - QColor GetWaterColor() { return m_waterColor; } + QColor GetWaterColor() const { return m_waterColor; } XmlNodeRef& GetFogTemplate() { return m_fogTemplate; } XmlNodeRef& GetEnvironmentTemplate() { return m_environmentTemplate; } void OnEnvironmentPropertyChanged(IVariable* pVar); @@ -129,7 +129,7 @@ public: // Create from serialization only void RegisterListener(IDocListener* listener); void UnregisterListener(IDocListener* listener); - void GetMemoryUsage(ICrySizer* pSizer); + void GetMemoryUsage(ICrySizer* pSizer) const; static bool IsBackupOrTempLevelSubdirectory(const QString& folderName); protected: @@ -161,14 +161,14 @@ protected: void SerializeFogSettings(CXmlArchive& xmlAr); virtual void SerializeViewSettings(CXmlArchive& xmlAr); void SerializeNameSelection(CXmlArchive& xmlAr); - void LogLoadTime(int time); + void LogLoadTime(int time) const; struct TSaveDocContext { bool bSaved; }; bool BeforeSaveDocument(const QString& lpszPathName, TSaveDocContext& context); - bool HasLayerNameConflicts(); + bool HasLayerNameConflicts() const; bool DoSaveDocument(const QString& lpszPathName, TSaveDocContext& context); bool AfterSaveDocument(const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt = true); @@ -180,7 +180,7 @@ protected: void OnStartLevelResourceList(); static void OnValidateSurfaceTypesChanged(ICVar*); - QString GetCryIndexPath(const LPCTSTR levelFilePath); + QString GetCryIndexPath(const LPCTSTR levelFilePath) const; ////////////////////////////////////////////////////////////////////////// // SliceEditorEntityOwnershipServiceNotificationBus::Handler @@ -188,24 +188,26 @@ protected: void OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId, const AzFramework::SliceInstantiationTicket& /*ticket*/) override; ////////////////////////////////////////////////////////////////////////// - bool m_bLoadFailed; - QColor m_waterColor; + bool m_bLoadFailed = false; + QColor m_waterColor = QColor(0, 0, 255); XmlNodeRef m_fogTemplate; XmlNodeRef m_environmentTemplate; CClouds* m_pClouds; std::list m_listeners; - bool m_bDocumentReady; - ICVar* doc_validate_surface_types; + bool m_bDocumentReady = false; + ICVar* doc_validate_surface_types = nullptr; int m_modifiedModuleFlags; - bool m_boLevelExported; - bool m_modified; + // On construction, it assumes loaded levels have already been exported. Can be a big fat lie, though. + // The right way would require us to save to the level folder the export status of the level. + bool m_boLevelExported = true; + bool m_modified = false; QString m_pathName; QString m_slicePathName; QString m_title; AZ::Data::AssetId m_envProbeSliceAssetId; float m_terrainSize; - const char* m_envProbeSliceRelativePath; - const float m_envProbeHeight; + const char* m_envProbeSliceRelativePath = "EngineAssets/Slices/DefaultLevelSetup.slice"; + const float m_envProbeHeight = 200.0f; bool m_hasErrors = false; ///< This is used to warn the user that they may lose work when they go to save. }; From b7e69a1d1dc41722f0bf7553d66dbda128026365 Mon Sep 17 00:00:00 2001 From: jackalbe <23512001+jackalbe@users.noreply.github.com> Date: Wed, 4 Aug 2021 14:11:10 -0500 Subject: [PATCH 55/75] turning off editor.blast.tests due to AR failures on suite shutdown (#2837) removed unused code Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com> --- .../EditorBlastChunksAssetHandlerTest.cpp | 23 ------------------- .../Blast/Code/blast_editor_tests_files.cmake | 2 +- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/Gems/Blast/Code/Tests/Editor/EditorBlastChunksAssetHandlerTest.cpp b/Gems/Blast/Code/Tests/Editor/EditorBlastChunksAssetHandlerTest.cpp index 9f48cae4da..80a0587b1b 100644 --- a/Gems/Blast/Code/Tests/Editor/EditorBlastChunksAssetHandlerTest.cpp +++ b/Gems/Blast/Code/Tests/Editor/EditorBlastChunksAssetHandlerTest.cpp @@ -88,20 +88,6 @@ namespace UnitTest AZStd::unique_ptr m_mockComponentApplicationBusHandler; AZStd::unique_ptr m_mockAssetCatalogRequestBusHandler; AZStd::unique_ptr m_mockAssetManager; - AZStd::unique_ptr m_serializeContext; - - void SetUpChunkComponents() - { - m_serializeContext = AZStd::make_unique(); - - AZ::Entity::Reflect(m_serializeContext.get()); - AzToolsFramework::Components::EditorComponentBase::Reflect(m_serializeContext.get()); - } - - void TearDownChunkComponents() - { - m_serializeContext.reset(); - } void SetUp() override final { @@ -128,15 +114,6 @@ namespace UnitTest AZ::AllocatorInstance::Destroy(); AllocatorsTestFixture::TearDown(); } - - void SaveChunkAssetToStream(AZ::Entity* chunkAssetEntity, AZStd::vector& buffer) - { - buffer.clear(); - AZ::IO::ByteContainerStream> stream(&buffer); - AZ::ObjectStream* objStream = AZ::ObjectStream::Create(&stream, *m_serializeContext.get(), AZ::ObjectStream::ST_XML); - objStream->WriteClass(chunkAssetEntity); - EXPECT_TRUE(objStream->Finalize()); - } }; TEST_F(EditorBlastChunkAssetHandlerTestFixture, EditorBlastChunkAssetHandler_AssetManager_Registered) diff --git a/Gems/Blast/Code/blast_editor_tests_files.cmake b/Gems/Blast/Code/blast_editor_tests_files.cmake index 7076530312..10d2377ccf 100644 --- a/Gems/Blast/Code/blast_editor_tests_files.cmake +++ b/Gems/Blast/Code/blast_editor_tests_files.cmake @@ -7,6 +7,6 @@ # set(FILES - Tests/Editor/EditorBlastChunksAssetHandlerTest.cpp + # Disabled until SPEC-7904 is fixed Tests/Editor/EditorBlastChunksAssetHandlerTest.cpp Tests/Editor/EditorTestMain.cpp ) From 1e4c147e0bf86737e4803cb60579ed4aae3660bd Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Wed, 4 Aug 2021 15:34:22 -0500 Subject: [PATCH 56/75] Fixed asset name for default groundplane. Signed-off-by: Chris Galvan --- Assets/Editor/Prefabs/Default_Level.prefab | 6 +++--- .../{groundplane_521x521m.fbx => groundplane_512x512m.fbx} | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename Gems/AtomLyIntegration/CommonFeatures/Assets/Objects/Groudplane/{groundplane_521x521m.fbx => groundplane_512x512m.fbx} (100%) diff --git a/Assets/Editor/Prefabs/Default_Level.prefab b/Assets/Editor/Prefabs/Default_Level.prefab index 64656e1e2f..d02d669f53 100644 --- a/Assets/Editor/Prefabs/Default_Level.prefab +++ b/Assets/Editor/Prefabs/Default_Level.prefab @@ -212,10 +212,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{935F694A-8639-515B-8133-81CDC7948E5B}", - "subId": 277333723 + "guid": "{0CD745C0-6AA8-569A-A68A-73A3270986C4}", + "subId": 277889906 }, - "assetHint": "objects/groudplane/groundplane_521x521m.azmodel" + "assetHint": "objects/groudplane/groundplane_512x512m.azmodel" } } } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Assets/Objects/Groudplane/groundplane_521x521m.fbx b/Gems/AtomLyIntegration/CommonFeatures/Assets/Objects/Groudplane/groundplane_512x512m.fbx similarity index 100% rename from Gems/AtomLyIntegration/CommonFeatures/Assets/Objects/Groudplane/groundplane_521x521m.fbx rename to Gems/AtomLyIntegration/CommonFeatures/Assets/Objects/Groudplane/groundplane_512x512m.fbx From 7404622b482cd5a40b5832552958ed2c33de317f Mon Sep 17 00:00:00 2001 From: srikappa-amzn <82230713+srikappa-amzn@users.noreply.github.com> Date: Wed, 4 Aug 2021 16:54:40 -0700 Subject: [PATCH 57/75] Clear prefab templates on new level creations and loads (#2842) * Clear prefab templates on new level creations and loads Signed-off-by: srikappa-amzn * Fixed failing prefab unit tests after change to clear templates Signed-off-by: srikappa-amzn --- .../Entity/PrefabEditorEntityOwnershipService.cpp | 11 ++--------- .../PrefabInstanceToTemplatePropagatorTests.cpp | 4 +++- .../Tests/Prefab/PrefabUpdateInstancesTests.cpp | 1 + .../Tests/Prefab/PrefabUpdateTemplateTests.cpp | 1 + 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp index 2d97689610..b5cf5fb878 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp @@ -72,15 +72,8 @@ namespace AzToolsFramework if (m_rootInstance != nullptr) { - // Need to save off the template id to remove the template after the instance is deleted. - Prefab::TemplateId templateId = m_rootInstance->GetTemplateId(); m_rootInstance.reset(); - if (templateId != Prefab::InvalidTemplateId) - { - // Remove the template here so that if we're in a Deactivate/Activate cycle, it can recreate the template/rootInstance - // correctly - m_prefabSystemComponent->RemoveTemplate(templateId); - } + m_prefabSystemComponent->RemoveAllTemplates(); } } @@ -95,7 +88,7 @@ namespace AzToolsFramework if (templateId != Prefab::InvalidTemplateId) { m_rootInstance->SetTemplateId(Prefab::InvalidTemplateId); - m_prefabSystemComponent->RemoveTemplate(templateId); + m_prefabSystemComponent->RemoveAllTemplates(); } m_rootInstance->SetContainerEntityName("Level"); } diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstanceToTemplatePropagatorTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstanceToTemplatePropagatorTests.cpp index e3b65db97e..8379992553 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstanceToTemplatePropagatorTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstanceToTemplatePropagatorTests.cpp @@ -245,7 +245,9 @@ namespace UnitTest m_instanceToTemplateInterface->GenerateDomForInstance(instanceDomBeforeUpdate, *firstInstance); //remove instance from instance - firstInstance->DetachNestedInstance(addedAlias); + AZStd::unique_ptr detachedInstance = firstInstance->DetachNestedInstance(addedAlias); + ASSERT_TRUE(detachedInstance != nullptr); + m_prefabSystemComponent->RemoveLink(detachedInstance->GetLinkId()); //create document with after change snapshot PrefabDom instanceDomAfterUpdate; diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateInstancesTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateInstancesTests.cpp index 0d955789ac..baded6d43e 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateInstancesTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateInstancesTests.cpp @@ -309,6 +309,7 @@ namespace UnitTest // and use the updated enclosing Instance to update the PrefabDom of Template. AZStd::unique_ptr detachedInstance = newEnclosingInstance->DetachNestedInstance(nestedInstanceAliases.front()); ASSERT_TRUE(detachedInstance); + m_prefabSystemComponent->RemoveLink(detachedInstance->GetLinkId()); PrefabDom updatedTemplateDom; ASSERT_TRUE(PrefabDomUtils::StoreInstanceInPrefabDom(*newEnclosingInstance, updatedTemplateDom)); diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateTemplateTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateTemplateTests.cpp index 4e7d9d95d1..6f90e245f7 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateTemplateTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateTemplateTests.cpp @@ -274,6 +274,7 @@ namespace UnitTest InstanceAlias aliasOfWheelInstanceToRetain = wheelInstanceAliasesUnderAxle.front(); AZStd::unique_ptr detachedInstance = axleInstance->DetachNestedInstance(wheelInstanceAliasesUnderAxle.back()); ASSERT_TRUE(detachedInstance); + m_prefabSystemComponent->RemoveLink(detachedInstance->GetLinkId()); PrefabDom updatedAxleInstanceDom; ASSERT_TRUE(PrefabDomUtils::StoreInstanceInPrefabDom(*axleInstance, updatedAxleInstanceDom)); m_prefabSystemComponent->UpdatePrefabTemplate(axleTemplateId, updatedAxleInstanceDom); From 1169c82b98d4522541fb831d69902c54792ad7a3 Mon Sep 17 00:00:00 2001 From: hultonha <82228511+hultonha@users.noreply.github.com> Date: Thu, 5 Aug 2021 09:45:03 +0100 Subject: [PATCH 58/75] Make camera controller priority customizable (#2826) * make 'should handle' logic customizable Signed-off-by: hultonha * updates to get priority function Signed-off-by: hultonha * minor comment tweak Signed-off-by: hultonha --- Code/Editor/EditorViewportWidget.cpp | 7 +++ .../ModularViewportCameraController.h | 35 ++++++++++--- .../ModularViewportCameraController.cpp | 50 ++++++++++++------- 3 files changed, 66 insertions(+), 26 deletions(-) diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index 4ea36728ad..4c638e1f82 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -1240,6 +1240,13 @@ AZStd::shared_ptr CreateMod AzFramework::ViewportId viewportId) { auto controller = AZStd::make_shared(); + + controller->SetCameraPriorityBuilderCallback( + [](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn) + { + cameraControllerPriorityFn = AtomToolsFramework::DefaultCameraControllerPriority; + }); + controller->SetCameraPropsBuilderCallback( [](AzFramework::CameraProps& cameraProps) { diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h index d8778a9b9d..e6a666c640 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h @@ -18,6 +18,14 @@ namespace AtomToolsFramework { class ModularViewportCameraControllerInstance; + //! A function object to represent returning a camera controller priority. + using CameraControllerPriorityFn = + AZStd::function; + + //! The default behavior for what priority the camera controller should respond to events at. + //! @note This can change based on the state of the camera controller/system. + AzFramework::ViewportControllerPriority DefaultCameraControllerPriority(const AzFramework::CameraSystem& cameraSystem); + //! Builder class to create and configure a ModularViewportCameraControllerInstance. class ModularViewportCameraController : public AzFramework::MultiViewportController< @@ -25,23 +33,33 @@ namespace AtomToolsFramework AzFramework::ViewportControllerPriority::DispatchToAllPriorities> { public: + friend ModularViewportCameraControllerInstance; + using CameraListBuilder = AZStd::function; using CameraPropsBuilder = AZStd::function; + using CameraPriorityBuilder = AZStd::function; - //! Sets the camera list builder callback used to populate new ModularViewportCameraControllerInstances + //! Sets the camera list builder callback used to populate new ModularViewportCameraControllerInstances. void SetCameraListBuilderCallback(const CameraListBuilder& builder); - //! Sets the camera props builder callback used to populate new ModularViewportCameraControllerInstances + //! Sets the camera props builder callback used to populate new ModularViewportCameraControllerInstances. void SetCameraPropsBuilderCallback(const CameraPropsBuilder& builder); - //! Sets up a camera list based on this controller's CameraListBuilderCallback - void SetupCameras(AzFramework::Cameras& cameras); - //! Sets up properties shared across all cameras - void SetupCameraProperies(AzFramework::CameraProps& cameraProps); + //! Sets the camera controller priority builder callback used to populate new ModularViewportCameraControllerInstances. + void SetCameraPriorityBuilderCallback(const CameraPriorityBuilder& builder); private: + //! Sets up a camera list based on this controller's CameraListBuilderCallback. + void SetupCameras(AzFramework::Cameras& cameras); + //! Sets up properties shared across all cameras. + void SetupCameraProperties(AzFramework::CameraProps& cameraProps); + //! Sets up how the camera controller should decide at what priority level to respond to. + void SetupCameraControllerPriority(CameraControllerPriorityFn& cameraPriorityFn); + //! Builder to generate a list of CameraInputs to run in the ModularViewportCameraControllerInstance. CameraListBuilder m_cameraListBuilder; - CameraPropsBuilder m_cameraPropsBuilder; //!< Builder to define custom camera properties to use for things such as rotate and - //!< translate interpolation. + //! Builder to define custom camera properties to use for things such as rotate and translate interpolation. + CameraPropsBuilder m_cameraPropsBuilder; + //! Builder to define what priority level the camera controller should respond to events at. + CameraPriorityBuilder m_cameraControllerPriorityBuilder; }; //! A customizable camera controller that can be configured to run a varying set of CameraInput instances. @@ -87,6 +105,7 @@ namespace AtomToolsFramework AzFramework::Camera m_targetCamera; //!< The target (next) camera state that m_camera is catching up to. AzFramework::CameraSystem m_cameraSystem; //!< The camera system responsible for managing all CameraInputs. AzFramework::CameraProps m_cameraProps; //!< Camera properties to control rotate and translate smoothness. + CameraControllerPriorityFn m_priorityFn; //!< Controls at what priority the camera controller should respond to events. CameraAnimation m_cameraAnimation; //!< Camera animation state (used during CameraMode::Animation). CameraMode m_cameraMode = CameraMode::Control; //!< The current mode the camera is operating in. diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp index cc87ba1e46..e98df83930 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp @@ -68,6 +68,11 @@ namespace AtomToolsFramework m_cameraPropsBuilder = builder; } + void ModularViewportCameraController::SetCameraPriorityBuilderCallback(const CameraPriorityBuilder& builder) + { + m_cameraControllerPriorityBuilder = builder; + } + void ModularViewportCameraController::SetupCameras(AzFramework::Cameras& cameras) { if (m_cameraListBuilder) @@ -76,7 +81,7 @@ namespace AtomToolsFramework } } - void ModularViewportCameraController::SetupCameraProperies(AzFramework::CameraProps& cameraProps) + void ModularViewportCameraController::SetupCameraProperties(AzFramework::CameraProps& cameraProps) { if (m_cameraPropsBuilder) { @@ -84,12 +89,36 @@ namespace AtomToolsFramework } } + void ModularViewportCameraController::SetupCameraControllerPriority(CameraControllerPriorityFn& cameraPriorityFn) + { + if (m_cameraControllerPriorityBuilder) + { + m_cameraControllerPriorityBuilder(cameraPriorityFn); + } + } + + // what priority should the camera system respond to + AzFramework::ViewportControllerPriority DefaultCameraControllerPriority(const AzFramework::CameraSystem& cameraSystem) + { + // ModernViewportCameraControllerInstance receives events at all priorities, when it is in 'exclusive' mode + // or it is actively handling events (essentially when the camera system is 'active' and responding to inputs) + // it should only respond to the highest priority + if (cameraSystem.m_cameras.Exclusive() || cameraSystem.HandlingEvents()) + { + return AzFramework::ViewportControllerPriority::Highest; + } + + // otherwise it should only respond to normal priority events + return AzFramework::ViewportControllerPriority::Normal; + } + ModularViewportCameraControllerInstance::ModularViewportCameraControllerInstance( const AzFramework::ViewportId viewportId, ModularViewportCameraController* controller) : MultiViewportControllerInstanceInterface(viewportId, controller) { controller->SetupCameras(m_cameraSystem.m_cameras); - controller->SetupCameraProperies(m_cameraProps); + controller->SetupCameraProperties(m_cameraProps); + controller->SetupCameraControllerPriority(m_priorityFn); if (auto viewportContext = RetrieveViewportContext(GetViewportId())) { @@ -118,24 +147,9 @@ namespace AtomToolsFramework AzFramework::ViewportDebugDisplayEventBus::Handler::BusDisconnect(); } - // what priority should the camera system respond to - static AzFramework::ViewportControllerPriority GetPriority(const AzFramework::CameraSystem& cameraSystem) - { - // ModernViewportCameraControllerInstance receives events at all priorities, when it is in 'exclusive' mode - // or it is actively handling events (essentially when the camera system is 'active' and responding to inputs) - // it should only respond to the highest priority - if (cameraSystem.m_cameras.Exclusive() || cameraSystem.HandlingEvents()) - { - return AzFramework::ViewportControllerPriority::Highest; - } - - // otherwise it should only respond to normal priority events - return AzFramework::ViewportControllerPriority::Normal; - } - bool ModularViewportCameraControllerInstance::HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) { - if (event.m_priority == GetPriority(m_cameraSystem)) + if (event.m_priority == m_priorityFn(m_cameraSystem)) { return m_cameraSystem.HandleEvents(AzFramework::BuildInputEvent(event.m_inputChannel)); } From e55c31d959957ab9e26ea34b9d2befe986c010f1 Mon Sep 17 00:00:00 2001 From: AMZN-AlexOteiza <82234181+AMZN-AlexOteiza@users.noreply.github.com> Date: Thu, 5 Aug 2021 11:03:02 +0100 Subject: [PATCH 59/75] Improve ui object tree to show the actual instance class (#2844) Signed-off-by: Garcia Ruiz Co-authored-by: Garcia Ruiz --- Gems/QtForPython/Editor/Scripts/show_object_tree.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gems/QtForPython/Editor/Scripts/show_object_tree.py b/Gems/QtForPython/Editor/Scripts/show_object_tree.py index d68a288a3e..48fb5e585b 100755 --- a/Gems/QtForPython/Editor/Scripts/show_object_tree.py +++ b/Gems/QtForPython/Editor/Scripts/show_object_tree.py @@ -220,6 +220,8 @@ class ObjectTreeDialog(QDialog): return for child in obj.children(): object_type = type(child).__name__ + if child.metaObject().className() != object_type: + object_type = f"{child.metaObject().className()} ({object_type})" object_name = child.objectName() text = icon_text = title = window_title = geometry_str = classes = "(N/A)" if isinstance(child, QtGui.QWindow): From 34afed6792ef8a31532daebee86d168a2c3c135f Mon Sep 17 00:00:00 2001 From: amzn-sean <75276488+amzn-sean@users.noreply.github.com> Date: Thu, 5 Aug 2021 14:27:31 +0100 Subject: [PATCH 60/75] fixed Ragdoll component can crash on deactivate (#2834) fixes #2650 The root of the crash was connecting/disconnecting to the AZ::Event SceneSimulationStart when not on the main thread, as that is not thread safe. The connection/disconnection was originally handled from Enable/EnableQueued and Disable/DisabledQueued which can be called from other threads within EmotionFX. I've moved the connection/disconnection to the Constructor / destructor, as the handler is responsible for executing the queued enable/disable actions and it makes sense to have that connection happen external to the Enable/disable path. Signed-off-by: amzn-sean 75276488+amzn-sean@users.noreply.github.com --- .../Source/PhysXCharacters/API/Ragdoll.cpp | 30 ++++--------------- .../Code/Source/PhysXCharacters/API/Ragdoll.h | 1 - 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/Gems/PhysX/Code/Source/PhysXCharacters/API/Ragdoll.cpp b/Gems/PhysX/Code/Source/PhysXCharacters/API/Ragdoll.cpp index 5d3f6bf0e1..038a1e2ee7 100644 --- a/Gems/PhysX/Code/Source/PhysXCharacters/API/Ragdoll.cpp +++ b/Gems/PhysX/Code/Source/PhysXCharacters/API/Ragdoll.cpp @@ -36,9 +36,6 @@ namespace PhysX } } // namespace Internal - // PhysX::Ragdoll - /*static*/ AZStd::mutex Ragdoll::m_sceneEventMutex; - void Ragdoll::Reflect(AZ::ReflectContext* context) { AZ::SerializeContext* serializeContext = azrtti_cast(context); @@ -109,14 +106,15 @@ namespace PhysX }) { m_sceneOwner = sceneHandle; + if (auto* sceneInterface = AZ::Interface::Get()) + { + sceneInterface->RegisterSceneSimulationStartHandler(m_sceneOwner, m_sceneStartSimHandler); + } } Ragdoll::~Ragdoll() { - { - AZStd::scoped_lock lock(m_sceneEventMutex); - m_sceneStartSimHandler.Disconnect(); - } + m_sceneStartSimHandler.Disconnect(); m_nodes.clear(); //the nodes destructor will remove the simulated body from the scene. } @@ -214,13 +212,6 @@ namespace PhysX } } - // the handler is also connected in EnableSimulationQueued(), - // which will call this function, so if called from that path dont connect here. - if (!m_sceneStartSimHandler.IsConnected()) - { - AZStd::scoped_lock lock(m_sceneEventMutex); - sceneInterface->RegisterSceneSimulationStartHandler(m_sceneOwner, m_sceneStartSimHandler); - } sceneInterface->EnableSimulationOfBody(m_sceneOwner, m_bodyHandle); } @@ -231,12 +222,6 @@ namespace PhysX return; } - if (auto* sceneInterface = AZ::Interface::Get()) - { - AZStd::scoped_lock lock(m_sceneEventMutex); - sceneInterface->RegisterSceneSimulationStartHandler(m_sceneOwner, m_sceneStartSimHandler); - } - m_queuedInitialState = initialState; } @@ -253,11 +238,6 @@ namespace PhysX return; } - { - AZStd::scoped_lock lock(m_sceneEventMutex); - m_sceneStartSimHandler.Disconnect(); - } - physx::PxScene* pxScene = Internal::GetPxScene(m_sceneOwner); const size_t numNodes = m_nodes.size(); diff --git a/Gems/PhysX/Code/Source/PhysXCharacters/API/Ragdoll.h b/Gems/PhysX/Code/Source/PhysXCharacters/API/Ragdoll.h index 94a39d9732..c9d0d5d661 100644 --- a/Gems/PhysX/Code/Source/PhysXCharacters/API/Ragdoll.h +++ b/Gems/PhysX/Code/Source/PhysXCharacters/API/Ragdoll.h @@ -81,6 +81,5 @@ namespace PhysX bool m_queuedDisableSimulation = false; AzPhysics::SceneEvents::OnSceneSimulationStartHandler m_sceneStartSimHandler; - static AZStd::mutex m_sceneEventMutex; }; } // namespace PhysX From b8bed115f0b5366405d1f3058c1e2107e36f0f1b Mon Sep 17 00:00:00 2001 From: Nemerle Date: Thu, 5 Aug 2021 16:37:43 +0200 Subject: [PATCH 61/75] Editor code: tidy up BOOLs,NULLs and overrides pt1. A few 'typedefs' replaced by 'using's This shouldn't have any functional changes at all, just c++17 modernization It's a part 1 of a split #2847 Signed-off-by: Nemerle --- Code/Editor/Animation/SkeletonHierarchy.cpp | 2 +- Code/Editor/Animation/SkeletonMapper.cpp | 8 +- .../Animation/SkeletonMapperOperator.cpp | 4 +- Code/Editor/AnimationContext.cpp.rej | 11 --- .../AzAssetBrowser/AzAssetBrowserWindow.cpp | 2 +- Code/Editor/Commands/CommandManager.cpp | 6 +- Code/Editor/Commands/CommandManager.h | 2 +- Code/Editor/Controls/BitmapToolTip.h | 2 +- Code/Editor/Controls/ColorGradientCtrl.cpp | 6 +- Code/Editor/Controls/ColorGradientCtrl.h | 2 +- Code/Editor/Controls/ConsoleSCB.cpp | 6 +- Code/Editor/Controls/HotTrackingTreeCtrl.cpp | 8 +- .../ReflectedPropertiesPanel.cpp | 2 +- .../ReflectedPropertyCtrl.cpp | 14 ++-- .../ReflectedPropertyItem.cpp | 8 +- .../ReflectedVarWrapper.cpp | 2 +- Code/Editor/Controls/SplineCtrl.cpp | 10 +-- Code/Editor/Controls/SplineCtrl.h | 2 +- Code/Editor/Controls/SplineCtrlEx.cpp | 76 +++++++++---------- Code/Editor/Controls/TimelineCtrl.cpp | 2 +- Code/Editor/Core/LevelEditorMenuHandler.cpp | 4 +- Code/Editor/Core/QtEditorApplication.cpp | 2 +- Code/Editor/Core/Tests/test_Main.cpp | 2 +- Code/Editor/Dialogs/ErrorsDlg.cpp | 2 +- Code/Editor/Dialogs/PythonScriptsDialog.cpp | 2 +- Code/Editor/Export/ExportManager.cpp | 22 +++--- Code/Editor/Export/OBJExporter.cpp | 2 +- Code/Editor/Geometry/TriMesh.cpp | 22 +++--- Code/Editor/Include/IAssetItem.h | 6 +- Code/Editor/Include/IFileUtil.h | 11 ++- 30 files changed, 123 insertions(+), 127 deletions(-) delete mode 100644 Code/Editor/AnimationContext.cpp.rej diff --git a/Code/Editor/Animation/SkeletonHierarchy.cpp b/Code/Editor/Animation/SkeletonHierarchy.cpp index 3015ff5e27..d1cc44b31d 100644 --- a/Code/Editor/Animation/SkeletonHierarchy.cpp +++ b/Code/Editor/Animation/SkeletonHierarchy.cpp @@ -63,7 +63,7 @@ int32 CHierarchy::FindNodeIndexByName(const char* name) const const CHierarchy::SNode* CHierarchy::FindNode(const char* name) const { int32 index = FindNodeIndexByName(name); - return index < 0 ? NULL : &m_nodes[index]; + return index < 0 ? nullptr : &m_nodes[index]; } void CHierarchy::CreateFrom(IDefaultSkeleton* pIDefaultSkeleton) diff --git a/Code/Editor/Animation/SkeletonMapper.cpp b/Code/Editor/Animation/SkeletonMapper.cpp index 3913801fc8..24f01f56ad 100644 --- a/Code/Editor/Animation/SkeletonMapper.cpp +++ b/Code/Editor/Animation/SkeletonMapper.cpp @@ -56,8 +56,8 @@ void CMapper::ClearLocations() uint32 count = uint32(m_nodes.size()); for (uint32 i = 0; i < count; ++i) { - m_nodes[i].position = NULL; - m_nodes[i].orientation = NULL; + m_nodes[i].position = nullptr; + m_nodes[i].orientation = nullptr; } m_locations.clear(); @@ -141,7 +141,7 @@ void CMapper::Map(QuatT* pResult) } CHierarchy::SNode* pParent = pNode->parent < 0 ? - NULL : m_hierarchy.GetNode(pNode->parent); + nullptr : m_hierarchy.GetNode(pNode->parent); if (pParent) { pResult[i].t = @@ -173,7 +173,7 @@ void CMapper::Map(QuatT* pResult) } CHierarchy::SNode* pParent = pNode->parent < 0 ? - NULL : m_hierarchy.GetNode(pNode->parent); + nullptr : m_hierarchy.GetNode(pNode->parent); if (!pParent) { pResult[i].q = absolutes[i]; diff --git a/Code/Editor/Animation/SkeletonMapperOperator.cpp b/Code/Editor/Animation/SkeletonMapperOperator.cpp index 7a69173bed..cc53957115 100644 --- a/Code/Editor/Animation/SkeletonMapperOperator.cpp +++ b/Code/Editor/Animation/SkeletonMapperOperator.cpp @@ -37,8 +37,8 @@ CMapperOperatorDesc::CMapperOperatorDesc(const char* name) CMapperOperator::CMapperOperator(const char* className, uint32 positionCount, uint32 orientationCount) { m_className = className; - m_position.resize(positionCount, NULL); - m_orientation.resize(orientationCount, NULL); + m_position.resize(positionCount, nullptr); + m_orientation.resize(orientationCount, nullptr); } CMapperOperator::~CMapperOperator() diff --git a/Code/Editor/AnimationContext.cpp.rej b/Code/Editor/AnimationContext.cpp.rej deleted file mode 100644 index 3ee0913c9d..0000000000 --- a/Code/Editor/AnimationContext.cpp.rej +++ /dev/null @@ -1,11 +0,0 @@ ---- Editor/AnimationContext.cpp -+++ Editor/AnimationContext.cpp -@@ -612,7 +612,7 @@ void CAnimationContext::UpdateAnimatedLights() - return; - - std::vector entityObjects; -- GetIEditor()->GetObjectManager()->FindObjectsOfType(entityObjects); -+ GetIEditor()->GetObjectManager()->FindObjectsOfType(&CEntityObject::staticMetaObject, entityObjects); - std::for_each(std::begin(entityObjects), std::end(entityObjects), - [this](CBaseObject *pBaseObject) - { diff --git a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp index f1047ae62b..c93ad087ce 100644 --- a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp +++ b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp @@ -42,7 +42,7 @@ public: AzToolsFramework::EditorEvents::Bus::Handler::BusConnect(); } - ~ListenerForShowAssetEditorEvent() + ~ListenerForShowAssetEditorEvent() override { AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect(); } diff --git a/Code/Editor/Commands/CommandManager.cpp b/Code/Editor/Commands/CommandManager.cpp index 90059ea195..0712e35e79 100644 --- a/Code/Editor/Commands/CommandManager.cpp +++ b/Code/Editor/Commands/CommandManager.cpp @@ -20,8 +20,8 @@ // AzToolsFramework #include -CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pFirst = 0; -CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pLast = 0; +CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pFirst = nullptr; +CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pLast = nullptr; CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::GetFirst() { @@ -31,7 +31,7 @@ CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::GetFirst() CAutoRegisterCommandHelper::CAutoRegisterCommandHelper(void(*registerFunc)(CEditorCommandManager &)) { m_registerFunc = registerFunc; - m_pNext = 0; + m_pNext = nullptr; if (!s_pLast) { diff --git a/Code/Editor/Commands/CommandManager.h b/Code/Editor/Commands/CommandManager.h index 2ec4a137bc..761c79f79c 100644 --- a/Code/Editor/Commands/CommandManager.h +++ b/Code/Editor/Commands/CommandManager.h @@ -38,7 +38,7 @@ public: void RegisterAutoCommands(); - bool AddCommand(CCommand* pCommand, TPfnDeleter deleter = NULL); + bool AddCommand(CCommand* pCommand, TPfnDeleter deleter = nullptr); bool UnregisterCommand(const char* module, const char* name); bool RegisterUICommand( const char* module, diff --git a/Code/Editor/Controls/BitmapToolTip.h b/Code/Editor/Controls/BitmapToolTip.h index d4bb89c625..5b7c56cbf3 100644 --- a/Code/Editor/Controls/BitmapToolTip.h +++ b/Code/Editor/Controls/BitmapToolTip.h @@ -42,7 +42,7 @@ public: CBitmapToolTip(QWidget* parent = nullptr); virtual ~CBitmapToolTip(); - BOOL Create(const RECT& rect); + bool Create(const RECT& rect); // Attributes public: diff --git a/Code/Editor/Controls/ColorGradientCtrl.cpp b/Code/Editor/Controls/ColorGradientCtrl.cpp index 555d285192..3bd3b11690 100644 --- a/Code/Editor/Controls/ColorGradientCtrl.cpp +++ b/Code/Editor/Controls/ColorGradientCtrl.cpp @@ -29,7 +29,7 @@ CColorGradientCtrl::CColorGradientCtrl(QWidget* parent) m_nHitKeyIndex = -1; m_nKeyDrawRadius = 3; m_bTracking = false; - m_pSpline = 0; + m_pSpline = nullptr; m_fMinTime = -1; m_fMaxTime = 1; m_fMinValue = -1; @@ -474,7 +474,7 @@ void CColorGradientCtrl::SetActiveKey(int nIndex) } ///////////////////////////////////////////////////////////////////////////// -void CColorGradientCtrl::SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw) +void CColorGradientCtrl::SetSpline(ISplineInterpolator* pSpline, bool bRedraw) { if (pSpline != m_pSpline) { @@ -501,7 +501,7 @@ ISplineInterpolator* CColorGradientCtrl::GetSpline() ///////////////////////////////////////////////////////////////////////////// void CColorGradientCtrl::keyPressEvent(QKeyEvent* event) { - BOOL bProcessed = false; + bool bProcessed = false; if (m_nActiveKey != -1 && m_pSpline) { diff --git a/Code/Editor/Controls/ColorGradientCtrl.h b/Code/Editor/Controls/ColorGradientCtrl.h index 9533fecdfa..80d8b966f4 100644 --- a/Code/Editor/Controls/ColorGradientCtrl.h +++ b/Code/Editor/Controls/ColorGradientCtrl.h @@ -54,7 +54,7 @@ public: // Lock value of first and last key to be the same. void LockFirstAndLastKeys(bool bLock) { m_bLockFirstLastKey = bLock; } - void SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw = FALSE); + void SetSpline(ISplineInterpolator* pSpline, bool bRedraw = false); ISplineInterpolator* GetSpline(); void SetTimeMarker(float fTime); diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp index 9f1921395c..3fda904844 100644 --- a/Code/Editor/Controls/ConsoleSCB.cpp +++ b/Code/Editor/Controls/ConsoleSCB.cpp @@ -62,14 +62,14 @@ public: } protected: - void highlightBlock(const QString &text) + void highlightBlock(const QString &text) override { auto pos = -1; QTextCharFormat myClassFormat; myClassFormat.setFontWeight(QFont::Bold); myClassFormat.setBackground(Qt::yellow); - while (1) + while (true) { pos = text.indexOf(m_searchTerm, pos+1, Qt::CaseInsensitive); @@ -567,7 +567,7 @@ static CVarBlock* VarBlockFromConsoleVars() size_t cmdCount = console->GetSortedVars(&cmds[0], cmds.size()); CVarBlock* vb = new CVarBlock; - IVariable* pVariable = 0; + IVariable* pVariable = nullptr; for (int i = 0; i < cmdCount; i++) { ICVar* pCVar = console->GetCVar(cmds[i]); diff --git a/Code/Editor/Controls/HotTrackingTreeCtrl.cpp b/Code/Editor/Controls/HotTrackingTreeCtrl.cpp index 917d02155b..54152a9fd4 100644 --- a/Code/Editor/Controls/HotTrackingTreeCtrl.cpp +++ b/Code/Editor/Controls/HotTrackingTreeCtrl.cpp @@ -19,22 +19,22 @@ CHotTrackingTreeCtrl::CHotTrackingTreeCtrl(QWidget* parent) : QTreeWidget(parent) { setMouseTracking(true); - m_hHoverItem = NULL; + m_hHoverItem = nullptr; } void CHotTrackingTreeCtrl::mouseMoveEvent(QMouseEvent* event) { QTreeWidgetItem* hItem = itemAt(event->pos()); - if (m_hHoverItem != NULL) + if (m_hHoverItem != nullptr) { QFont font = m_hHoverItem->font(0); font.setBold(false); m_hHoverItem->setFont(0, font); - m_hHoverItem = NULL; + m_hHoverItem = nullptr; } - if (hItem != NULL) + if (hItem != nullptr) { QFont font = hItem->font(0); font.setBold(true); diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertiesPanel.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertiesPanel.cpp index 323fe2a07a..8651db7e96 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertiesPanel.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertiesPanel.cpp @@ -27,7 +27,7 @@ void ReflectedPropertiesPanel::DeleteVars() { ClearVarBlock(); m_updateCallbacks.clear(); - m_varBlock = 0; + m_varBlock = nullptr; } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp index 89938d9735..1a7060aa8d 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp @@ -198,7 +198,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node) void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlockPtr, IVariable::OnSetCallback* func, bool splitCamelCaseIntoWords) { - SelectItem(0); + SelectItem(nullptr); outBlockPtr = new CVarBlock; for (size_t i = 0, iGroupCount(node->getChildCount()); i < iGroupCount; ++i) @@ -505,7 +505,7 @@ void ReflectedPropertyControl::RemoveAllItems() void ReflectedPropertyControl::ClearVarBlock() { RemoveAllItems(); - m_pVarBlock = 0; + m_pVarBlock = nullptr; } void ReflectedPropertyControl::RecreateAllItems() @@ -688,11 +688,11 @@ void ReflectedPropertyControl::OnItemChange(ReflectedPropertyItem *item, bool de // callback until after the current event queue is processed, so that we aren't changing other widgets // as a ton of them are still being created. Qt::ConnectionType connectionType = deferCallbacks ? Qt::QueuedConnection : Qt::DirectConnection; - if (m_updateVarFunc != 0 && m_bEnableCallback) + if (m_updateVarFunc && m_bEnableCallback) { QMetaObject::invokeMethod(this, "DoUpdateCallback", connectionType, Q_ARG(IVariable*, item->GetVariable())); } - if (m_updateObjectFunc != 0 && m_bEnableCallback) + if (m_updateObjectFunc && m_bEnableCallback) { // KDAB: This callback has same signature as DoUpdateCallback. I think the only reason there are 2 is because some // EntityObject registers callback and some derived objects want to register their own callback. the normal UpdateCallback @@ -709,7 +709,7 @@ void ReflectedPropertyControl::DoUpdateCallback(IVariable *var) const bool variableStillExists = FindVariable(var); AZ_Assert(variableStillExists, "This variable and the item containing it were destroyed during a deferred callback. Change to non-deferred callback."); - if (m_updateVarFunc == 0 || !variableStillExists) + if (!m_updateVarFunc || !variableStillExists) { return; } @@ -724,7 +724,7 @@ void ReflectedPropertyControl::DoUpdateObjectCallback(IVariable *var) const bool variableStillExists = FindVariable(var); AZ_Assert(variableStillExists, "This variable and the item containing it were destroyed during a deferred callback. Change to non-deferred callback."); - if (m_updateVarFunc == 0 || !variableStillExists) + if ( !m_updateVarFunc || !variableStillExists) { return; } @@ -904,7 +904,7 @@ void ReflectedPropertyControl::SetUndoCallback(UndoCallback &callback) void ReflectedPropertyControl::ClearUndoCallback() { - m_undoFunc = 0; + m_undoFunc = nullptr; } bool ReflectedPropertyControl::FindVariable(IVariable *categoryItem) const diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp index 0bea6902c9..5a9d61be42 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp @@ -82,7 +82,7 @@ public: } //helps implement ReflectedPropertyControl::ReplaceVarBlock - void ReplaceVarBlock(CVarBlock *varBlock) + void ReplaceVarBlock(CVarBlock *varBlock) override { m_containerVar->Clear(); UpdateCommon(m_item->GetVariable(), varBlock); @@ -207,7 +207,7 @@ void ReflectedPropertyItem::SetVariable(IVariable *var) ReleaseVariable(); m_pVariable = pInputVar; - assert(m_pVariable != NULL); + assert(m_pVariable != nullptr); m_pVariable->AddOnSetCallback(&m_onSetCallback); m_pVariable->AddOnSetEnumCallback(&m_onSetEnumCallback); @@ -332,7 +332,7 @@ void ReflectedPropertyItem::RemoveAllChildren() { for (int i = 0; i < m_childs.size(); i++) { - m_childs[i]->m_parent = 0; + m_childs[i]->m_parent = nullptr; } m_childs.clear(); @@ -473,7 +473,7 @@ void ReflectedPropertyItem::ReleaseVariable() m_pVariable->RemoveOnSetCallback(&m_onSetCallback); m_pVariable->RemoveOnSetEnumCallback(&m_onSetEnumCallback); } - m_pVariable = 0; + m_pVariable = nullptr; delete m_reflectedVarAdapter; m_reflectedVarAdapter = nullptr; } diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp index 20e86c6838..5639fa95b0 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp @@ -473,7 +473,7 @@ void ReflectedVarUserAdapter::SyncReflectedVarToIVar(IVariable *pVariable) //extract the list of custom items from the IVariable user data IVariable::IGetCustomItems* pGetCustomItems = static_cast (pVariable->GetUserData().value()); - if (pGetCustomItems != 0) + if (pGetCustomItems != nullptr) { std::vector items; QString dlgTitle; diff --git a/Code/Editor/Controls/SplineCtrl.cpp b/Code/Editor/Controls/SplineCtrl.cpp index 63481d27df..d66fc16ade 100644 --- a/Code/Editor/Controls/SplineCtrl.cpp +++ b/Code/Editor/Controls/SplineCtrl.cpp @@ -30,7 +30,7 @@ CSplineCtrl::CSplineCtrl(QWidget* parent) m_nHitKeyIndex = -1; m_nKeyDrawRadius = 3; m_bTracking = false; - m_pSpline = 0; + m_pSpline = nullptr; m_gridX = 10; m_gridY = 10; m_fMinTime = -1; @@ -40,7 +40,7 @@ CSplineCtrl::CSplineCtrl(QWidget* parent) m_fTooltipScaleX = 1; m_fTooltipScaleY = 1; m_bLockFirstLastKey = false; - m_pTimelineCtrl = 0; + m_pTimelineCtrl = nullptr; m_bSelectedKeys.reserve(0); @@ -417,7 +417,7 @@ void CSplineCtrl::SetActiveKey(int nIndex) } ///////////////////////////////////////////////////////////////////////////// -void CSplineCtrl::SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw) +void CSplineCtrl::SetSpline(ISplineInterpolator* pSpline, bool bRedraw) { if (pSpline != m_pSpline) { @@ -596,7 +596,7 @@ CSplineCtrl::EHitCode CSplineCtrl::HitTest(const QPoint& point) /////////////////////////////////////////////////////////////////////////////// void CSplineCtrl::StartTracking() { - m_bTracking = TRUE; + m_bTracking = true; GetIEditor()->BeginUndo(); @@ -674,7 +674,7 @@ void CSplineCtrl::StopTracking() GetIEditor()->AcceptUndo("Spline Move"); - m_bTracking = FALSE; + m_bTracking = false; } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Controls/SplineCtrl.h b/Code/Editor/Controls/SplineCtrl.h index e90fc1820e..ec5b3e52ce 100644 --- a/Code/Editor/Controls/SplineCtrl.h +++ b/Code/Editor/Controls/SplineCtrl.h @@ -59,7 +59,7 @@ public: // Lock value of first and last key to be the same. void LockFirstAndLastKeys(bool bLock) { m_bLockFirstLastKey = bLock; } - void SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw = FALSE); + void SetSpline(ISplineInterpolator* pSpline, bool bRedraw = false); ISplineInterpolator* GetSpline(); void SetTimeMarker(float fTime); diff --git a/Code/Editor/Controls/SplineCtrlEx.cpp b/Code/Editor/Controls/SplineCtrlEx.cpp index 2afc3f16aa..36a9d8afef 100644 --- a/Code/Editor/Controls/SplineCtrlEx.cpp +++ b/Code/Editor/Controls/SplineCtrlEx.cpp @@ -69,8 +69,8 @@ protected: AbstractSplineWidget* pCtrl = FindControl(m_pCtrl); m_splineEntries.resize(m_splineEntries.size() + 1); SplineEntry& entry = m_splineEntries.back(); - ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0); - entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : 0); + ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr); + entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : nullptr); entry.pSpline = pSpline; const int numKeys = pSpline->GetKeyCount(); @@ -81,10 +81,10 @@ protected: } } - virtual int GetSize() { return sizeof(*this); } - virtual QString GetDescription() { return "UndoSplineCtrlEx"; }; + int GetSize() override { return sizeof(*this); } + QString GetDescription() override { return "UndoSplineCtrlEx"; }; - virtual void Undo(bool bUndo) + void Undo(bool bUndo) override { AbstractSplineWidget* pCtrl = FindControl(m_pCtrl); if (pCtrl) @@ -104,7 +104,7 @@ protected: } } - virtual void Redo() + void Redo() override { AbstractSplineWidget* pCtrl = FindControl(m_pCtrl); if (pCtrl) @@ -134,7 +134,7 @@ private: void SerializeSplines(_smart_ptr SplineEntry::* backup, bool bLoading) { AbstractSplineWidget* pCtrl = FindControl(m_pCtrl); - ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0); + ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr); for (auto it = m_splineEntries.begin(); it != m_splineEntries.end(); ++it) { SplineEntry& entry = *it; @@ -157,19 +157,19 @@ private: } public: - typedef std::list CSplineCtrls; + using CSplineCtrls = std::list; static AbstractSplineWidget* FindControl(AbstractSplineWidget* pCtrl) { if (!pCtrl) { - return 0; + return nullptr; } auto iter = std::find(s_activeCtrls.begin(), s_activeCtrls.end(), pCtrl); if (iter == s_activeCtrls.end()) { - return 0; + return nullptr; } return *iter; @@ -193,10 +193,10 @@ public: static CSplineCtrls s_activeCtrls; - virtual bool IsSelectionChanged() const + bool IsSelectionChanged() const override { AbstractSplineWidget* pCtrl = FindControl(m_pCtrl); - ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0); + ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr); for (auto it = m_splineEntries.begin(); it != m_splineEntries.end(); ++it) { @@ -256,11 +256,11 @@ SplineWidget::~SplineWidget() AbstractSplineWidget::AbstractSplineWidget() : m_defaultKeyTangentType(SPLINE_KEY_TANGENT_NONE) { - m_pTimelineCtrl = 0; + m_pTimelineCtrl = nullptr; m_totalSplineCount = 0; - m_pHitSpline = 0; - m_pHitDetailSpline = 0; + m_pHitSpline = nullptr; + m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; m_nHitDimension = -1; m_bHitIncomingHandle = true; @@ -301,7 +301,7 @@ AbstractSplineWidget::AbstractSplineWidget() m_boLeftMouseButtonDown = false; - m_pSplineSet = 0; + m_pSplineSet = nullptr; m_controlAmplitude = false; @@ -1633,7 +1633,7 @@ void SplineWidget::wheelEvent(QWheelEvent* event) void SplineWidget::keyPressEvent(QKeyEvent* e) { - BOOL bProcessed = false; + bool bProcessed = false; switch (e->key()) { @@ -1780,7 +1780,7 @@ void AbstractSplineWidget::SetHorizontalExtent([[maybe_unused]] int min, [[maybe //si.nPage = max(0,m_rcClient.Width() - m_leftOffset*2); //si.nPage = 1; //si.nPage = 1; - SetScrollInfo( SB_HORZ,&si,TRUE ); + SetScrollInfo( SB_HORZ,&si,true ); */ } @@ -1792,7 +1792,7 @@ ISplineInterpolator* AbstractSplineWidget::HitSpline(const QPoint& point) return m_pHitSpline; } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////////// @@ -1806,8 +1806,8 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point PointToTimeValue(point, time, val); m_hitCode = HIT_NOTHING; - m_pHitSpline = NULL; - m_pHitDetailSpline = NULL; + m_pHitSpline = nullptr; + m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; m_nHitDimension = -1; m_bHitIncomingHandle = true; @@ -1968,8 +1968,8 @@ void AbstractSplineWidget::StopTracking() void AbstractSplineWidget::ScaleAmplitudeKeys(float time, float startValue, float offset) { //TODO: Test it in the facial animation pane and fix it... - m_pHitSpline = 0; - m_pHitDetailSpline = 0; + m_pHitSpline = nullptr; + m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; m_nHitDimension = -1; @@ -2071,8 +2071,8 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT float timeScaleC = endTime - startTime * timeScaleM; // Loop through all keys that are selected. - m_pHitSpline = 0; - m_pHitDetailSpline = 0; + m_pHitSpline = nullptr; + m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; float affectedRangeMin = FLT_MAX; @@ -2179,8 +2179,8 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue) } // Loop through all keys that are selected. - m_pHitSpline = 0; - m_pHitDetailSpline = 0; + m_pHitSpline = nullptr; + m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; m_nHitDimension = -1; @@ -2212,8 +2212,8 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue) ////////////////////////////////////////////////////////////////////////// void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys) { - m_pHitSpline = 0; - m_pHitDetailSpline = 0; + m_pHitSpline = nullptr; + m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; m_nHitDimension = -1; @@ -2275,8 +2275,8 @@ void AbstractSplineWidget::RemoveKey(ISplineInterpolator* pSpline, int nKey) SendNotifyEvent(SPLN_BEFORE_CHANGE); - m_pHitSpline = 0; - m_pHitDetailSpline = 0; + m_pHitSpline = nullptr; + m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; if (nKey != -1) { @@ -2294,8 +2294,8 @@ void AbstractSplineWidget::RemoveSelectedKeys() SendNotifyEvent(SPLN_BEFORE_CHANGE); - m_pHitSpline = 0; - m_pHitDetailSpline = 0; + m_pHitSpline = nullptr; + m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) @@ -2558,11 +2558,11 @@ public: }; void AbstractSplineWidget::DuplicateSelectedKeys() { - m_pHitSpline = 0; - m_pHitDetailSpline = 0; + m_pHitSpline = nullptr; + m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; - typedef std::vector KeysToAddContainer; + using KeysToAddContainer = std::vector; KeysToAddContainer keysToInsert; for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { @@ -2600,7 +2600,7 @@ void AbstractSplineWidget::ZeroAll() { GetIEditor()->BeginUndo(); - typedef std::vector SplineContainer; + using SplineContainer = std::vector; SplineContainer splines; for (int splineIndex = 0; splineIndex < int(m_splines.size()); ++splineIndex) { @@ -2632,7 +2632,7 @@ void AbstractSplineWidget::KeyAll() { GetIEditor()->BeginUndo(); - typedef std::vector SplineContainer; + using SplineContainer = std::vector; SplineContainer splines; for (int splineIndex = 0; splineIndex < int(m_splines.size()); ++splineIndex) { diff --git a/Code/Editor/Controls/TimelineCtrl.cpp b/Code/Editor/Controls/TimelineCtrl.cpp index d1590c5346..a5a941fc78 100644 --- a/Code/Editor/Controls/TimelineCtrl.cpp +++ b/Code/Editor/Controls/TimelineCtrl.cpp @@ -58,7 +58,7 @@ TimelineWidget::TimelineWidget(QWidget* parent /* = nullptr */) m_bIgnoreSetTime = false; - m_pKeyTimeSet = 0; + m_pKeyTimeSet = nullptr; m_markerStyle = MARKER_STYLE_SECONDS; m_fps = 30.0f; diff --git a/Code/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Editor/Core/LevelEditorMenuHandler.cpp index 3c27c25c9a..b0e586031e 100644 --- a/Code/Editor/Core/LevelEditorMenuHandler.cpp +++ b/Code/Editor/Core/LevelEditorMenuHandler.cpp @@ -80,12 +80,12 @@ namespace , m_trigger(trigger) {} - virtual ~EditorListener() + ~EditorListener() override { GetIEditor()->UnregisterNotifyListener(this); } - void OnEditorNotifyEvent(EEditorNotifyEvent event) + void OnEditorNotifyEvent(EEditorNotifyEvent event) override { m_trigger(event); } diff --git a/Code/Editor/Core/QtEditorApplication.cpp b/Code/Editor/Core/QtEditorApplication.cpp index 5a4763d8e8..0776a96a4d 100644 --- a/Code/Editor/Core/QtEditorApplication.cpp +++ b/Code/Editor/Core/QtEditorApplication.cpp @@ -423,7 +423,7 @@ namespace Editor { UINT rawInputSize; const UINT rawInputHeaderSize = sizeof(RAWINPUTHEADER); - GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, NULL, &rawInputSize, rawInputHeaderSize); + GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, nullptr, &rawInputSize, rawInputHeaderSize); AZStd::array rawInputBytesArray; LPBYTE rawInputBytes = rawInputBytesArray.data(); diff --git a/Code/Editor/Core/Tests/test_Main.cpp b/Code/Editor/Core/Tests/test_Main.cpp index c0772753c6..6acedb6e57 100644 --- a/Code/Editor/Core/Tests/test_Main.cpp +++ b/Code/Editor/Core/Tests/test_Main.cpp @@ -26,7 +26,7 @@ class EditorCoreTestEnvironment public: AZ_TEST_CLASS_ALLOCATOR(EditorCoreTestEnvironment); - virtual ~EditorCoreTestEnvironment() + ~EditorCoreTestEnvironment() override { } diff --git a/Code/Editor/Dialogs/ErrorsDlg.cpp b/Code/Editor/Dialogs/ErrorsDlg.cpp index e89a3a6ded..280ffbbab6 100644 --- a/Code/Editor/Dialogs/ErrorsDlg.cpp +++ b/Code/Editor/Dialogs/ErrorsDlg.cpp @@ -20,7 +20,7 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING -CErrorsDlg::CErrorsDlg(QWidget* pParent /*=NULL*/) +CErrorsDlg::CErrorsDlg(QWidget* pParent /*=nullptr*/) : QDialog(pParent) , ui(new Ui::CErrorsDlg) { diff --git a/Code/Editor/Dialogs/PythonScriptsDialog.cpp b/Code/Editor/Dialogs/PythonScriptsDialog.cpp index 98365769bb..7c6b445387 100644 --- a/Code/Editor/Dialogs/PythonScriptsDialog.cpp +++ b/Code/Editor/Dialogs/PythonScriptsDialog.cpp @@ -159,7 +159,7 @@ void CPythonScriptsDialog::OnExecute() QList selectedItems = ui->treeView->GetSelectedItems(); QStandardItem* selectedItem = selectedItems.empty() ? nullptr : selectedItems.first(); - if (selectedItem == NULL) + if (selectedItem == nullptr) { return; } diff --git a/Code/Editor/Export/ExportManager.cpp b/Code/Editor/Export/ExportManager.cpp index 682dcf3980..10f96ce71b 100644 --- a/Code/Editor/Export/ExportManager.cpp +++ b/Code/Editor/Export/ExportManager.cpp @@ -96,7 +96,7 @@ Export::CObject::CObject(const char* pName) cameraTargetNodeName[0] = '\0'; - m_pLastObject = 0; + m_pLastObject = nullptr; } @@ -116,14 +116,14 @@ void Export::CData::Clear() // CExportManager CExportManager::CExportManager() : m_isPrecaching(false) - , m_pBaseObj(0) + , m_pBaseObj(nullptr) , m_FBXBakedExportFPS(0.0f) , m_fScale(100.0f) , // this scale is used by CryEngine RC m_bAnimationExport(false) , m_bExportLocalCoords(false) , m_numberOfExportFrames(0) - , m_pivotEntityObject(0) + , m_pivotEntityObject(nullptr) , m_bBakedKeysSequenceExport(true) , m_animTimeExportPrimarySequenceCurrentTime(0.0f) , m_animKeyTimeExport(true) @@ -290,7 +290,7 @@ void CExportManager::ProcessEntityAnimationTrack( const AZ::EntityId entityId, Export::CObject* pObj, AnimParamType entityTrackParamType) { CTrackViewAnimNode* pEntityNode = GetIEditor()->GetSequenceManager()->GetActiveAnimNode(entityId); - CTrackViewTrack* pEntityTrack = (pEntityNode ? pEntityNode->GetTrackForParameter(entityTrackParamType) : 0); + CTrackViewTrack* pEntityTrack = (pEntityNode ? pEntityNode->GetTrackForParameter(entityTrackParamType) : nullptr); if (!pEntityTrack) { @@ -397,7 +397,7 @@ void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh else { Export::CMesh* pMesh = new Export::CMesh(); - if (meshDesc.m_nFaceCount == 0 && meshDesc.m_nIndexCount != 0 && meshDesc.m_pIndices != 0) + if (meshDesc.m_nFaceCount == 0 && meshDesc.m_nIndexCount != 0 && meshDesc.m_pIndices != nullptr) { const vtx_idx* pIndices = &meshDesc.m_pIndices[0]; int nTris = meshDesc.m_nIndexCount / 3; @@ -431,7 +431,7 @@ void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matrix34A* pTm) { - IIndexedMesh* pIndMesh = 0; + IIndexedMesh* pIndMesh = nullptr; if (pStatObj->GetSubObjectCount()) { @@ -440,7 +440,7 @@ bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matri IStatObj::SSubObject* pSubObj = pStatObj->GetSubObject(i); if (pSubObj && pSubObj->nType == STATIC_SUB_OBJECT_MESH && pSubObj->pStatObj) { - pIndMesh = 0; + pIndMesh = nullptr; if (m_isOccluder) { if (pSubObj->pStatObj->GetLodObject(2)) @@ -542,7 +542,7 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj) if (m_isPrecaching) { - AddMeshes(0); + AddMeshes(nullptr); return true; } @@ -554,7 +554,7 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj) m_objectMap[pBaseObj] = int(m_data.m_objects.size() - 1); AddMeshes(pObj); - m_pBaseObj = 0; + m_pBaseObj = nullptr; return true; } @@ -678,7 +678,7 @@ bool CExportManager::ProcessObjectsForExport() for (size_t objectID = 0; objectID < m_data.m_objects.size(); ++objectID) { Export::CObject* pObj2 = m_data.m_objects[objectID]; - CBaseObject* pObject = 0; + CBaseObject* pObject = nullptr; if (QString::compare(pObj2->name, kPrimaryCameraName) == 0) { @@ -983,7 +983,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo { if (pSubSequence && !pSubSequence->IsDisabled()) { - XmlNodeRef subSeqNode = 0; + XmlNodeRef subSeqNode = nullptr; if (!seqNode) { diff --git a/Code/Editor/Export/OBJExporter.cpp b/Code/Editor/Export/OBJExporter.cpp index 893512e236..bd2696090e 100644 --- a/Code/Editor/Export/OBJExporter.cpp +++ b/Code/Editor/Export/OBJExporter.cpp @@ -67,7 +67,7 @@ bool COBJExporter::ExportToFile(const char* filename, const Export::IData* pExpo while (nParent >= 0 && nParent < pExportData->GetObjectCount()) { const Export::Object* pParentObj = pExportData->GetObject(nParent); - assert(NULL != pParentObj); + assert(nullptr != pParentObj); Vec3 pos2(pParentObj->pos.x, pParentObj->pos.y, pParentObj->pos.z); Quat rot2(pParentObj->rot.w, pParentObj->rot.v.x, pParentObj->rot.v.y, pParentObj->rot.v.z); diff --git a/Code/Editor/Geometry/TriMesh.cpp b/Code/Editor/Geometry/TriMesh.cpp index fe755ca6c3..737886cabc 100644 --- a/Code/Editor/Geometry/TriMesh.cpp +++ b/Code/Editor/Geometry/TriMesh.cpp @@ -19,13 +19,13 @@ ////////////////////////////////////////////////////////////////////////// CTriMesh::CTriMesh() { - pFaces = NULL; - pVertices = NULL; - pWSVertices = NULL; - pUV = NULL; - pColors = NULL; - pEdges = NULL; - pWeights = NULL; + pFaces = nullptr; + pVertices = nullptr; + pWSVertices = nullptr; + pUV = nullptr; + pColors = nullptr; + pEdges = nullptr; + pWeights = nullptr; nFacesCount = 0; nVertCount = 0; @@ -67,7 +67,7 @@ void CTriMesh::ReallocStream(int stream, int nNewCount) { return; // Stream already have required size. } - void* pStream = 0; + void* pStream = nullptr; int nElementSize = 0; GetStreamInfo(stream, pStream, nElementSize); pStream = ReAllocElements(pStream, nNewCount, nElementSize); @@ -256,7 +256,7 @@ void CTriMesh::SharePositions() std::vector arrHashTable[256]; CTriVertex* pNewVerts = new CTriVertex[GetVertexCount()]; - SMeshColor* pNewColors = 0; + SMeshColor* pNewColors = nullptr; if (pColors) { pNewColors = new SMeshColor[GetVertexCount()]; @@ -433,8 +433,8 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const ////////////////////////////////////////////////////////////////////////// void CTriMesh::CopyStream(CTriMesh& fromMesh, int stream) { - void* pTrgStream = 0; - void* pSrcStream = 0; + void* pTrgStream = nullptr; + void* pSrcStream = nullptr; int nElemSize = 0; fromMesh.GetStreamInfo(stream, pSrcStream, nElemSize); if (pSrcStream) diff --git a/Code/Editor/Include/IAssetItem.h b/Code/Editor/Include/IAssetItem.h index 892d347431..ff80331af5 100644 --- a/Code/Editor/Include/IAssetItem.h +++ b/Code/Editor/Include/IAssetItem.h @@ -334,12 +334,12 @@ struct IAssetItem virtual void OnEndPreview() = 0; // Description: // If the asset has a special preview panel with utility controls, to be placed at the top of the Preview window, it can return an child dialog window - // otherwise it can return NULL, if no panel is available + // otherwise it can return nullptr, if no panel is available // Arguments: - // pParentWnd - a valid CDialog*, or NULL + // pParentWnd - a valid CDialog*, or nullptr // Return Value: // A valid child dialog window handle, if this asset wants to have a custom panel in the top side of the Asset Preview window, - // otherwise it can return NULL, if no panel is available + // otherwise it can return nullptr, if no panel is available // See Also: // OnBeginPreview(), OnEndPreview() virtual QWidget* GetCustomPreviewPanelHeader(QWidget* pParentWnd) = 0; diff --git a/Code/Editor/Include/IFileUtil.h b/Code/Editor/Include/IFileUtil.h index f402786e67..f83c7e0d59 100644 --- a/Code/Editor/Include/IFileUtil.h +++ b/Code/Editor/Include/IFileUtil.h @@ -186,8 +186,15 @@ struct IFileUtil virtual ECopyTreeResult CopyTree(const QString& strSourceDirectory, const QString& strTargetDirectory, bool boRecurse = true, bool boConfirmOverwrite = false) = 0; ////////////////////////////////////////////////////////////////////////// - // @param LPPROGRESS_ROUTINE pfnProgress - called by the system to notify of file copy progress - // @param LPBOOL pbCancel - when the contents of this BOOL are set to TRUE, the system cancels the copy operation + /** + * @brief CopyFile + * @param strSourceFile + * @param strTargetFile + * @param boConfirmOverwrite + * @param pfnProgress - called by the system to notify of file copy progress + * @param pbCancel - when the contents of this bool are set to true, the system cancels the copy operation + * @return + */ virtual ECopyTreeResult CopyFile(const QString& strSourceFile, const QString& strTargetFile, bool boConfirmOverwrite = false, ProgressRoutine pfnProgress = nullptr, bool* pbCancel = nullptr) = 0; // As we don't have a FileUtil interface here, we have to duplicate some code :-( in order to keep From c6760d8935c9afbebecca82c6237bfb7de304fe9 Mon Sep 17 00:00:00 2001 From: Nemerle Date: Thu, 5 Aug 2021 16:48:00 +0200 Subject: [PATCH 62/75] Editor code: tidy up BOOLs,NULLs and overrides pt3. A few 'typedefs' replaced by 'using's This shouldn't have any functional changes at all, just c++17 modernization It's a part 3 of a split #2847 Signed-off-by: Nemerle --- Code/Editor/QtUI/QCollapsibleGroupBox.cpp | 2 +- Code/Editor/RenderHelpers/AxisHelper.h | 2 +- .../TrackView/2DBezierKeyUIControls.cpp | 10 ++++---- .../TrackView/AssetBlendKeyUIControls.cpp | 10 ++++---- .../Editor/TrackView/CaptureKeyUIControls.cpp | 10 ++++---- .../TrackView/CharacterKeyUIControls.cpp | 10 ++++---- .../Editor/TrackView/CommentKeyUIControls.cpp | 14 +++++------ Code/Editor/TrackView/CommentNodeAnimator.cpp | 2 +- .../Editor/TrackView/ConsoleKeyUIControls.cpp | 10 ++++---- Code/Editor/TrackView/EventKeyUIControls.cpp | 14 +++++------ Code/Editor/TrackView/GotoKeyUIControls.cpp | 10 ++++---- .../TrackView/ScreenFaderKeyUIControls.cpp | 14 +++++------ Code/Editor/TrackView/SelectKeyUIControls.cpp | 18 +++++++------- .../TrackView/SequenceBatchRenderDialog.cpp | 15 ++++++------ .../TrackView/SequenceBatchRenderDialog.h | 6 ++--- .../TrackView/SequenceKeyUIControls.cpp | 14 +++++------ Code/Editor/TrackView/SoundKeyUIControls.cpp | 10 ++++---- .../TrackView/TVCustomizeTrackColorsDlg.cpp | 2 +- Code/Editor/TrackView/TVEventsDialog.cpp | 2 +- Code/Editor/TrackView/TVSequenceProps.cpp | 6 ++--- Code/Editor/TrackView/TVSequenceProps.h | 4 ++-- .../TrackView/TimeRangeKeyUIControls.cpp | 10 ++++---- .../TrackView/TrackEventKeyUIControls.cpp | 12 +++++----- Code/Editor/TrackView/TrackViewAnimNode.cpp | 4 ++-- Code/Editor/TrackView/TrackViewDialog.cpp | 18 +++++++------- Code/Editor/TrackView/TrackViewDialog.h | 4 ++-- .../TrackView/TrackViewDopeSheetBase.cpp | 24 +++++++++---------- Code/Editor/TrackView/TrackViewFindDlg.cpp | 4 ++-- Code/Editor/TrackView/TrackViewFindDlg.h | 2 +- .../TrackView/TrackViewKeyPropertiesDlg.cpp | 4 ++-- .../TrackView/TrackViewKeyPropertiesDlg.h | 2 +- Code/Editor/TrackView/TrackViewNodes.cpp | 16 ++++++------- Code/Editor/TrackView/TrackViewSplineCtrl.cpp | 22 ++++++++--------- 33 files changed, 153 insertions(+), 154 deletions(-) diff --git a/Code/Editor/QtUI/QCollapsibleGroupBox.cpp b/Code/Editor/QtUI/QCollapsibleGroupBox.cpp index e1d3f59510..7fe56285e6 100644 --- a/Code/Editor/QtUI/QCollapsibleGroupBox.cpp +++ b/Code/Editor/QtUI/QCollapsibleGroupBox.cpp @@ -13,7 +13,7 @@ QCollapsibleGroupBox::QCollapsibleGroupBox(QWidget* parent) : QGroupBox(parent) , m_collapsed(false) - , m_toggleButton(0) + , m_toggleButton(nullptr) { m_toggleButton = new QToolButton(this); m_toggleButton->setFixedSize(16, 16); diff --git a/Code/Editor/RenderHelpers/AxisHelper.h b/Code/Editor/RenderHelpers/AxisHelper.h index b7d246d48c..70dcd2dae2 100644 --- a/Code/Editor/RenderHelpers/AxisHelper.h +++ b/Code/Editor/RenderHelpers/AxisHelper.h @@ -60,7 +60,7 @@ public: void DrawDome(const Matrix34& worldTM, const SGizmoParameters& setup, DisplayContext& dc, AABB& objectBox); bool HitTest(const Matrix34& worldTM, const SGizmoParameters& setup, HitContext& hc); - bool HitTestForRotationCircle(const Matrix34& worldTM, IDisplayViewport* view, const QPoint& pos, float fHitWidth, Vec3* pOutHitPos = NULL, Vec3* pOutHitNormal = NULL); + bool HitTestForRotationCircle(const Matrix34& worldTM, IDisplayViewport* view, const QPoint& pos, float fHitWidth, Vec3* pOutHitPos = nullptr, Vec3* pOutHitNormal = nullptr); void SetHighlightAxis(int axis) { m_highlightAxis = axis; }; int GetHighlightAxis() const { return m_highlightAxis; }; diff --git a/Code/Editor/TrackView/2DBezierKeyUIControls.cpp b/Code/Editor/TrackView/2DBezierKeyUIControls.cpp index 1709ea2eac..81cd151373 100644 --- a/Code/Editor/TrackView/2DBezierKeyUIControls.cpp +++ b/Code/Editor/TrackView/2DBezierKeyUIControls.cpp @@ -26,19 +26,19 @@ public: CSmartVariableArray mv_table; CSmartVariable mv_value; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_value, "Value"); } - bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return trackType == eAnimCurveType_BezierFloat; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 0; } + unsigned int GetPriority() const override { return 0; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/AssetBlendKeyUIControls.cpp b/Code/Editor/TrackView/AssetBlendKeyUIControls.cpp index a8e24cf58d..038a9d9780 100644 --- a/Code/Editor/TrackView/AssetBlendKeyUIControls.cpp +++ b/Code/Editor/TrackView/AssetBlendKeyUIControls.cpp @@ -41,7 +41,7 @@ public: CSmartVariable mv_blendInTime; CSmartVariable mv_blendOutTime; - virtual void OnCreateVars() + void OnCreateVars() override { // Init to an invalid id AZ::Data::AssetId assetId; @@ -62,15 +62,15 @@ public: mv_timeScale->SetLimits(0.001f, 100.f); } - bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, AnimValueType valueType) const + bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, AnimValueType valueType) const override { return valueType == AnimValueType::AssetBlend; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/CaptureKeyUIControls.cpp b/Code/Editor/TrackView/CaptureKeyUIControls.cpp index 821066d4a3..e6d88a6cd6 100644 --- a/Code/Editor/TrackView/CaptureKeyUIControls.cpp +++ b/Code/Editor/TrackView/CaptureKeyUIControls.cpp @@ -27,7 +27,7 @@ public: CSmartVariable mv_folder; CSmartVariable mv_once; - virtual void OnCreateVars() + void OnCreateVars() override { mv_duration.GetVar()->SetLimits(0, 100000.0f); mv_timeStep.GetVar()->SetLimits(0.001f, 1.0f); @@ -39,14 +39,14 @@ public: AddVariable(mv_table, mv_folder, "Output Folder"); AddVariable(mv_table, mv_once, "Just one frame?"); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return paramType == AnimParamType::Capture; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/CharacterKeyUIControls.cpp b/Code/Editor/TrackView/CharacterKeyUIControls.cpp index 9ff41f1275..24bfd9f680 100644 --- a/Code/Editor/TrackView/CharacterKeyUIControls.cpp +++ b/Code/Editor/TrackView/CharacterKeyUIControls.cpp @@ -33,7 +33,7 @@ public: CSmartVariable mv_endTime; CSmartVariable mv_timeScale; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_animation, "Animation", IVariable::DT_ANIMATION); @@ -45,14 +45,14 @@ public: AddVariable(mv_table, mv_timeScale, "Time Scale"); mv_timeScale->SetLimits(0.001f, 100.f); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, AnimValueType valueType) const override { return paramType == AnimParamType::Animation || valueType == AnimValueType::CharacterAnim; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/CommentKeyUIControls.cpp b/Code/Editor/TrackView/CommentKeyUIControls.cpp index 4c5dc10bfa..b5a706c843 100644 --- a/Code/Editor/TrackView/CommentKeyUIControls.cpp +++ b/Code/Editor/TrackView/CommentKeyUIControls.cpp @@ -30,7 +30,7 @@ public: CSmartVariableEnum mv_font; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_comment, "Comment"); @@ -41,13 +41,13 @@ public: AddVariable(mv_table, mv_color, "Color", IVariable::DT_COLOR); - mv_align->SetEnumList(NULL); + mv_align->SetEnumList(nullptr); mv_align->AddEnumItem("Left", ICommentKey::eTA_Left); mv_align->AddEnumItem("Center", ICommentKey::eTA_Center); mv_align->AddEnumItem("Right", ICommentKey::eTA_Right); AddVariable(mv_table, mv_align, "Align"); - mv_font->SetEnumList(NULL); + mv_font->SetEnumList(nullptr); IFileUtil::FileArray fa; CFileUtil::ScanDirectory((Path::GetEditingGameDataFolder() + "/Fonts/").c_str(), "*.xml", fa, true); for (size_t i = 0; i < fa.size(); ++i) @@ -58,14 +58,14 @@ public: } AddVariable(mv_table, mv_font, "Font"); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return paramType == AnimParamType::CommentText; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/CommentNodeAnimator.cpp b/Code/Editor/TrackView/CommentNodeAnimator.cpp index 47f4c5d9ae..15dcce1566 100644 --- a/Code/Editor/TrackView/CommentNodeAnimator.cpp +++ b/Code/Editor/TrackView/CommentNodeAnimator.cpp @@ -26,7 +26,7 @@ CCommentNodeAnimator::CCommentNodeAnimator(CTrackViewAnimNode* pCommentNode) CCommentNodeAnimator::~CCommentNodeAnimator() { - m_pCommentNode = 0; + m_pCommentNode = nullptr; } void CCommentNodeAnimator::Animate(CTrackViewAnimNode* pNode, const SAnimContext& ac) diff --git a/Code/Editor/TrackView/ConsoleKeyUIControls.cpp b/Code/Editor/TrackView/ConsoleKeyUIControls.cpp index cbf22f63e6..7bf23e0b52 100644 --- a/Code/Editor/TrackView/ConsoleKeyUIControls.cpp +++ b/Code/Editor/TrackView/ConsoleKeyUIControls.cpp @@ -24,19 +24,19 @@ public: CSmartVariableArray mv_table; CSmartVariable mv_command; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_command, "Command"); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return paramType == AnimParamType::Console; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/EventKeyUIControls.cpp b/Code/Editor/TrackView/EventKeyUIControls.cpp index a45e59dc1a..56b16d7c02 100644 --- a/Code/Editor/TrackView/EventKeyUIControls.cpp +++ b/Code/Editor/TrackView/EventKeyUIControls.cpp @@ -26,7 +26,7 @@ public: CSmartVariable mv_value; CSmartVariable mv_notrigger_in_scrubbing; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_event, "Event"); @@ -35,14 +35,14 @@ public: AddVariable(mv_deprecated, "Deprecated"); AddVariable(mv_deprecated, mv_animation, "Animation"); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return paramType == AnimParamType::Event; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { @@ -73,8 +73,8 @@ bool CEventKeyUIControls::OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys CAnimParamType paramType = keyHandle.GetTrack()->GetParameterType(); if (paramType == AnimParamType::Event) { - mv_event.SetEnumList(NULL); - mv_animation.SetEnumList(NULL); + mv_event.SetEnumList(nullptr); + mv_animation.SetEnumList(nullptr); // Add for empty, unset event mv_event->AddEnumItem(QObject::tr(""), ""); diff --git a/Code/Editor/TrackView/GotoKeyUIControls.cpp b/Code/Editor/TrackView/GotoKeyUIControls.cpp index 6435745d2a..c48ce4c5ad 100644 --- a/Code/Editor/TrackView/GotoKeyUIControls.cpp +++ b/Code/Editor/TrackView/GotoKeyUIControls.cpp @@ -24,12 +24,12 @@ public: CSmartVariableArray mv_table; CSmartVariable mv_command; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_command, "Goto Time"); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { if (paramType == AnimParamType::Goto) { @@ -40,10 +40,10 @@ public: return false; } } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp b/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp index 786016cb37..a62ab17cbf 100644 --- a/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp +++ b/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp @@ -33,23 +33,23 @@ class CScreenFaderKeyUIControls public: //----------------------------------------------------------------------------- //! - virtual bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return paramType == AnimParamType::ScreenFader; } //----------------------------------------------------------------------------- //! - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); - mv_fadeType->SetEnumList(NULL); + mv_fadeType->SetEnumList(nullptr); mv_fadeType->AddEnumItem("FadeIn", IScreenFaderKey::eFT_FadeIn); mv_fadeType->AddEnumItem("FadeOut", IScreenFaderKey::eFT_FadeOut); AddVariable(mv_table, mv_fadeType, "Type"); - mv_fadechangeType->SetEnumList(NULL); + mv_fadechangeType->SetEnumList(nullptr); mv_fadechangeType->AddEnumItem("Linear", IScreenFaderKey::eFCT_Linear); mv_fadechangeType->AddEnumItem("Square", IScreenFaderKey::eFCT_Square); mv_fadechangeType->AddEnumItem("Cubic Square", IScreenFaderKey::eFCT_CubicSquare); @@ -67,13 +67,13 @@ public: //----------------------------------------------------------------------------- //! - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& keys); + bool OnKeySelectionChange(CTrackViewKeyBundle& keys) override; //----------------------------------------------------------------------------- //! - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& keys); + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& keys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/SelectKeyUIControls.cpp b/Code/Editor/TrackView/SelectKeyUIControls.cpp index 37acf105f3..d12f449c73 100644 --- a/Code/Editor/TrackView/SelectKeyUIControls.cpp +++ b/Code/Editor/TrackView/SelectKeyUIControls.cpp @@ -22,7 +22,7 @@ class CSelectKeyUIControls , protected AZ::EntitySystemBus::Handler { public: - CSelectKeyUIControls() {} + CSelectKeyUIControls() = default; ~CSelectKeyUIControls() override; @@ -30,7 +30,7 @@ public: CSmartVariableEnum mv_camera; CSmartVariable mv_BlendTime; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_camera, "Camera"); @@ -39,14 +39,14 @@ public: Camera::CameraNotificationBus::Handler::BusConnect(); AZ::EntitySystemBus::Handler::BusConnect(); } - bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, AnimValueType valueType) const + bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, AnimValueType valueType) const override { return valueType == AnimValueType::Select; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { @@ -98,7 +98,7 @@ bool CSelectKeyUIControls::OnKeySelectionChange(CTrackViewKeyBundle& selectedKey ResetCameraEntries(); // Get All cameras. - mv_camera.SetEnumList(NULL); + mv_camera.SetEnumList(nullptr); mv_camera->AddEnumItem(QObject::tr(""), QString::number(static_cast(AZ::EntityId::InvalidEntityId))); @@ -217,7 +217,7 @@ void CSelectKeyUIControls::OnCameraRemoved(const AZ::EntityId & cameraId) // We can't iterate or remove an item from the enum list, and Camera::CameraRequests::GetCameras // still includes the deleted camera at this point. Reset the list anyway and filter out the // deleted camera. - mv_camera->SetEnumList(NULL); + mv_camera->SetEnumList(nullptr); mv_camera->AddEnumItem(QObject::tr(""), QString::number(static_cast(AZ::EntityId::InvalidEntityId))); AZ::EBusAggregateResults cameraComponentEntities; @@ -256,7 +256,7 @@ void CSelectKeyUIControls::OnEntityNameChanged(const AZ::EntityId & entityId, [[ void CSelectKeyUIControls::ResetCameraEntries() { - mv_camera.SetEnumList(NULL); + mv_camera.SetEnumList(nullptr); mv_camera->AddEnumItem(QObject::tr(""), QString::number(static_cast(AZ::EntityId::InvalidEntityId))); // Find all Component Entity Cameras diff --git a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp index 7b08b3e614..4a56b2389b 100644 --- a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp +++ b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp @@ -117,8 +117,7 @@ CSequenceBatchRenderDialog::CSequenceBatchRenderDialog(float fps, QWidget* pPare } CSequenceBatchRenderDialog::~CSequenceBatchRenderDialog() -{ -} += default; void CSequenceBatchRenderDialog::reject() { @@ -519,7 +518,7 @@ void CSequenceBatchRenderDialog::OnGo() InitializeContext(); // Trigger the first item. - OnMovieEvent(IMovieListener::eMovieEvent_Stopped, NULL); + OnMovieEvent(IMovieListener::eMovieEvent_Stopped, nullptr); } } @@ -728,7 +727,7 @@ bool CSequenceBatchRenderDialog::GetResolutionFromCustomResText(const char* cust bool CSequenceBatchRenderDialog::LoadOutputOptions(const QString& pathname) { XmlNodeRef batchRenderOptionsNode = XmlHelpers::LoadXmlFromFile(pathname.toStdString().c_str()); - if (batchRenderOptionsNode == NULL) + if (batchRenderOptionsNode == nullptr) { return true; } @@ -1391,7 +1390,7 @@ void CSequenceBatchRenderDialog::OnLoadBatch() Path::GetUserSandboxFolder(), loadPath)) { XmlNodeRef batchRenderListNode = XmlHelpers::LoadXmlFromFile(loadPath.toStdString().c_str()); - if (batchRenderListNode == NULL) + if (batchRenderListNode == nullptr) { return; } @@ -1414,7 +1413,7 @@ void CSequenceBatchRenderDialog::OnLoadBatch() // sequence const QString seqName = itemNode->getAttr("sequence"); item.pSequence = GetIEditor()->GetMovieSystem()->FindLegacySequenceByName(seqName.toUtf8().data()); - if (item.pSequence == NULL) + if (item.pSequence == nullptr) { QMessageBox::warning(this, tr("Sequence not found"), tr("A sequence of '%1' not found! This'll be skipped.").arg(seqName)); continue; @@ -1431,7 +1430,7 @@ void CSequenceBatchRenderDialog::OnLoadBatch() break; } } - if (item.pDirectorNode == NULL) + if (item.pDirectorNode == nullptr) { QMessageBox::warning(this, tr("Director node not found"), tr("A director node of '%1' not found in the sequence of '%2'! This'll be skipped.").arg(directorName).arg(seqName)); continue; @@ -1544,7 +1543,7 @@ bool CSequenceBatchRenderDialog::SetUpNewRenderItem(SRenderItem& item) break; } } - if (item.pDirectorNode == NULL) + if (item.pDirectorNode == nullptr) { return false; } diff --git a/Code/Editor/TrackView/SequenceBatchRenderDialog.h b/Code/Editor/TrackView/SequenceBatchRenderDialog.h index 2d2097fa7a..5d8934f783 100644 --- a/Code/Editor/TrackView/SequenceBatchRenderDialog.h +++ b/Code/Editor/TrackView/SequenceBatchRenderDialog.h @@ -81,8 +81,8 @@ protected: bool disableDebugInfo; bool bCreateVideo; SRenderItem() - : pSequence(NULL) - , pDirectorNode(NULL) + : pSequence(nullptr) + , pDirectorNode(nullptr) , disableDebugInfo(false) , bCreateVideo(false) {} bool operator==(const SRenderItem& item) @@ -155,7 +155,7 @@ protected: , expectedTotalTime(0) , spentTime(0) , flagBU(0) - , pActiveDirectorBU(NULL) + , pActiveDirectorBU(nullptr) , cvarCustomResWidthBU(0) , cvarCustomResHeightBU(0) , cvarDisplayInfoBU(0) diff --git a/Code/Editor/TrackView/SequenceKeyUIControls.cpp b/Code/Editor/TrackView/SequenceKeyUIControls.cpp index 5ef5a9c4ab..7889b30848 100644 --- a/Code/Editor/TrackView/SequenceKeyUIControls.cpp +++ b/Code/Editor/TrackView/SequenceKeyUIControls.cpp @@ -27,7 +27,7 @@ public: CSmartVariable mv_startTime; CSmartVariable mv_endTime; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_sequence, "Sequence"); @@ -35,14 +35,14 @@ public: AddVariable(mv_table, mv_startTime, "Start Time"); AddVariable(mv_table, mv_endTime, "End Time"); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return paramType == AnimParamType::Sequence; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { @@ -78,7 +78,7 @@ bool CSequenceKeyUIControls::OnKeySelectionChange(CTrackViewKeyBundle& selectedK ///////////////////////////////////////////////////////////////////////////////// // fill sequence comboBox with available sequences - mv_sequence.SetEnumList(NULL); + mv_sequence.SetEnumList(nullptr); // Insert '' empty enum mv_sequence->AddEnumItem(QObject::tr(""), CTrackViewDialog::GetEntityIdAsString(AZ::EntityId(AZ::EntityId::InvalidEntityId))); @@ -193,7 +193,7 @@ void CSequenceKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle& se IMovieSystem* pMovieSystem = GetIEditor()->GetSystem()->GetIMovieSystem(); - if (pMovieSystem != NULL) + if (pMovieSystem != nullptr) { pMovieSystem->SetStartEndTime(pSequence, sequenceKey.fStartTime, sequenceKey.fEndTime); } diff --git a/Code/Editor/TrackView/SoundKeyUIControls.cpp b/Code/Editor/TrackView/SoundKeyUIControls.cpp index ff6b558abf..8c18b58aed 100644 --- a/Code/Editor/TrackView/SoundKeyUIControls.cpp +++ b/Code/Editor/TrackView/SoundKeyUIControls.cpp @@ -29,7 +29,7 @@ public: CSmartVariable mv_duration; CSmartVariable mv_customColor; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_startTrigger, "StartTrigger", IVariable::DT_AUDIO_TRIGGER); @@ -38,14 +38,14 @@ public: AddVariable(mv_options, "Options"); AddVariable(mv_options, mv_customColor, "Custom Color", IVariable::DT_COLOR); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return paramType == AnimParamType::Sound; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp index e03b013720..e2f8a4f7a2 100644 --- a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp +++ b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp @@ -344,7 +344,7 @@ void CTVCustomizeTrackColorsDlg::Export(const QString& fullPath) const bool CTVCustomizeTrackColorsDlg::Import(const QString& fullPath) { XmlNodeRef customTrackColorsNode = XmlHelpers::LoadXmlFromFile(fullPath.toStdString().c_str()); - if (customTrackColorsNode == NULL) + if (customTrackColorsNode == nullptr) { return false; } diff --git a/Code/Editor/TrackView/TVEventsDialog.cpp b/Code/Editor/TrackView/TVEventsDialog.cpp index a89c0aac2a..c8221b38cd 100644 --- a/Code/Editor/TrackView/TVEventsDialog.cpp +++ b/Code/Editor/TrackView/TVEventsDialog.cpp @@ -211,7 +211,7 @@ public: int GetNumberOfUsageAndFirstTimeUsed(const char* eventName, float& timeFirstUsed) const; }; -CTVEventsDialog::CTVEventsDialog(QWidget* pParent /*=NULL*/) +CTVEventsDialog::CTVEventsDialog(QWidget* pParent /*=nullptr*/) : QDialog(pParent) , m_ui(new Ui::TVEventsDialog) { diff --git a/Code/Editor/TrackView/TVSequenceProps.cpp b/Code/Editor/TrackView/TVSequenceProps.cpp index 3a0fab2f2c..1ac31d7e2b 100644 --- a/Code/Editor/TrackView/TVSequenceProps.cpp +++ b/Code/Editor/TrackView/TVSequenceProps.cpp @@ -51,7 +51,7 @@ CTVSequenceProps::~CTVSequenceProps() } // CTVSequenceProps message handlers -BOOL CTVSequenceProps::OnInitDialog() +bool CTVSequenceProps::OnInitDialog() { ui->NAME->setText(m_pSequence->GetName()); int seqFlags = m_pSequence->GetFlags(); @@ -97,7 +97,7 @@ BOOL CTVSequenceProps::OnInitDialog() ui->ORT_ONCE->setChecked(true); } - return TRUE; // return TRUE unless you set the focus to a control + return true; // return true unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -259,7 +259,7 @@ void CTVSequenceProps::OnOK() void CTVSequenceProps::ToggleCutsceneOptions(bool bActivated) { - if (bActivated == FALSE) + if (bActivated == false) { ui->NOABORT->setChecked(false); ui->DISABLEPLAYER->setChecked(false); diff --git a/Code/Editor/TrackView/TVSequenceProps.h b/Code/Editor/TrackView/TVSequenceProps.h index f12c245c57..b54208e429 100644 --- a/Code/Editor/TrackView/TVSequenceProps.h +++ b/Code/Editor/TrackView/TVSequenceProps.h @@ -28,7 +28,7 @@ class CTVSequenceProps { Q_OBJECT public: - CTVSequenceProps(CTrackViewSequence* pSequence, float fps, QWidget* pParent = NULL); // standard constructor + CTVSequenceProps(CTrackViewSequence* pSequence, float fps, QWidget* pParent = nullptr); // standard constructor ~CTVSequenceProps(); private: @@ -39,7 +39,7 @@ private: }; CTrackViewSequence* m_pSequence; - virtual BOOL OnInitDialog(); + virtual bool OnInitDialog(); virtual void OnOK(); void MoveScaleKeys(); diff --git a/Code/Editor/TrackView/TimeRangeKeyUIControls.cpp b/Code/Editor/TrackView/TimeRangeKeyUIControls.cpp index bd771e3849..e35c18329b 100644 --- a/Code/Editor/TrackView/TimeRangeKeyUIControls.cpp +++ b/Code/Editor/TrackView/TimeRangeKeyUIControls.cpp @@ -27,7 +27,7 @@ public: CSmartVariable mv_timeScale; CSmartVariable mv_bLoop; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_startTime, "Start Time"); @@ -36,14 +36,14 @@ public: AddVariable(mv_table, mv_bLoop, "Loop"); mv_timeScale->SetLimits(0.001f, 100.f); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return paramType == AnimParamType::TimeRanges; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { diff --git a/Code/Editor/TrackView/TrackEventKeyUIControls.cpp b/Code/Editor/TrackView/TrackEventKeyUIControls.cpp index 934820ede1..035087733b 100644 --- a/Code/Editor/TrackView/TrackEventKeyUIControls.cpp +++ b/Code/Editor/TrackView/TrackEventKeyUIControls.cpp @@ -26,21 +26,21 @@ public: CSmartVariableEnum mv_event; CSmartVariable mv_value; - virtual void OnCreateVars() + void OnCreateVars() override { AddVariable(mv_table, "Key Properties"); AddVariable(mv_table, mv_event, "Track Event"); mv_event->SetFlags(mv_event->GetFlags() | IVariable::UI_UNSORTED); AddVariable(mv_table, mv_value, "Value"); } - bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const + bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override { return paramType == AnimParamType::TrackEvent; } - virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys); - virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys); + bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override; + void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override; - virtual unsigned int GetPriority() const { return 1; } + unsigned int GetPriority() const override { return 1; } static const GUID& GetClassID() { @@ -182,7 +182,7 @@ void CTrackEventKeyUIControls::BuildEventDropDown(QString& curEvent, const QStri { bool curEventExists = false; bool addedEventExists = false; - mv_event.SetEnumList(NULL); + mv_event.SetEnumList(nullptr); const int eventCount = sequence->GetTrackEventsCount(); // Need to check if event exists before adding all events diff --git a/Code/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Editor/TrackView/TrackViewAnimNode.cpp index c66ea5635c..9050808d3b 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Editor/TrackView/TrackViewAnimNode.cpp @@ -370,7 +370,7 @@ bool CTrackViewAnimNode::IsBoundToEditorObjects() const else { // check if bound to legacy entity - return (m_animNode->GetNodeOwner() != NULL); + return (m_animNode->GetNodeOwner() != nullptr); } } @@ -1468,7 +1468,7 @@ bool CTrackViewAnimNode::PasteNodesFromClipboard(QWidget* context) } XmlNodeRef animNodesRoot = clipboard.Get(); - if (animNodesRoot == NULL || strcmp(animNodesRoot->getTag(), "CopyAnimNodesRoot") != 0) + if (animNodesRoot == nullptr || strcmp(animNodesRoot->getTag(), "CopyAnimNodesRoot") != 0) { return false; } diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index 9a35f09911..331daf6730 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -130,10 +130,10 @@ const GUID& CTrackViewDialog::GetClassID() ////////////////////////////////////////////////////////////////////////// -CTrackViewDialog* CTrackViewDialog::s_pTrackViewDialog = NULL; +CTrackViewDialog* CTrackViewDialog::s_pTrackViewDialog = nullptr; ////////////////////////////////////////////////////////////////////////// -CTrackViewDialog::CTrackViewDialog(QWidget* pParent /*=NULL*/) +CTrackViewDialog::CTrackViewDialog(QWidget* pParent /*=nullptr*/) : QMainWindow(pParent) { s_pTrackViewDialog = this; @@ -152,7 +152,7 @@ CTrackViewDialog::CTrackViewDialog(QWidget* pParent /*=NULL*/) m_lazyInitDone = false; m_bEditLock = false; - m_pNodeForTracksToolBar = NULL; + m_pNodeForTracksToolBar = nullptr; m_currentToolBarParamTypeId = 0; @@ -181,7 +181,7 @@ CTrackViewDialog::~CTrackViewDialog() m_findDlg->deleteLater(); m_findDlg = nullptr; } - s_pTrackViewDialog = 0; + s_pTrackViewDialog = nullptr; const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager(); CTrackViewSequence* sequence = pSequenceManager->GetSequenceByEntityId(m_currentSequenceEntityId); @@ -210,7 +210,7 @@ void CTrackViewDialog::OnAddEntityNodeMenu() } ////////////////////////////////////////////////////////////////////////// -BOOL CTrackViewDialog::OnInitDialog() +bool CTrackViewDialog::OnInitDialog() { InitToolbar(); InitMenu(); @@ -270,7 +270,7 @@ BOOL CTrackViewDialog::OnInitDialog() QString cursorPosText = QString("0.000(%1fps)").arg(FloatToIntRet(m_wndCurveEditor->GetFPS())); m_cursorPos->setText(cursorPosText); - return TRUE; // return TRUE unless you set the focus to a control + return true; // return true unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -621,7 +621,7 @@ void CTrackViewDialog::InitToolbar() { qaction2->setCheckable(true); } - + m_actions[ID_TV_SNAP_NONE]->setChecked(true); m_tracksToolBar = addToolBar("Tracks Toolbar"); @@ -883,7 +883,7 @@ void CTrackViewDialog::Update() // The active camera node means two conditions: // 1. Sequence camera is currently active. // 2. The camera which owns this node has been set as the current camera by the director node. - bool bSequenceCamInUse = gEnv->pMovieSystem->GetCallback() == NULL || + bool bSequenceCamInUse = gEnv->pMovieSystem->GetCallback() == nullptr || gEnv->pMovieSystem->GetCallback()->IsSequenceCamUsed(); AZ::EntityId camId = gEnv->pMovieSystem->GetCameraParams().cameraEntityId; if (camId.IsValid() && bSequenceCamInUse) @@ -2049,7 +2049,7 @@ void CTrackViewDialog::ClearTracksToolBar() m_tracksToolBar->clear(); m_tracksToolBar->addWidget(new QLabel("Tracks:")); - m_pNodeForTracksToolBar = NULL; + m_pNodeForTracksToolBar = nullptr; m_toolBarParamTypes.clear(); m_currentToolBarParamTypeId = 0; } diff --git a/Code/Editor/TrackView/TrackViewDialog.h b/Code/Editor/TrackView/TrackViewDialog.h index f30d9a414f..f6c1126713 100644 --- a/Code/Editor/TrackView/TrackViewDialog.h +++ b/Code/Editor/TrackView/TrackViewDialog.h @@ -52,7 +52,7 @@ class CTrackViewDialog public: friend CMovieCallback; - CTrackViewDialog(QWidget* pParent = NULL); + CTrackViewDialog(QWidget* pParent = nullptr); ~CTrackViewDialog(); static void RegisterViewClass(); @@ -183,7 +183,7 @@ private: void OnAddEntityNodeMenu(); void OnEditorNotifyEvent(EEditorNotifyEvent event) override; - BOOL OnInitDialog(); + bool OnInitDialog(); void SaveLayouts(); void SaveMiscSettings() const; diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index 34ca2f062f..accba34422 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -88,7 +88,7 @@ CTrackViewDopeSheetBase::CTrackViewDopeSheetBase(QWidget* parent) m_currentTime = 0.0f; m_storedTime = m_currentTime; m_rcSelect = QRect(0, 0, 0, 0); - m_rubberBand = 0; + m_rubberBand = nullptr; m_scrollBar = new QScrollBar(Qt::Horizontal, this); connect(m_scrollBar, &QScrollBar::valueChanged, this, &CTrackViewDopeSheetBase::OnHScroll); m_keyTimeOffset = 0; @@ -113,7 +113,7 @@ CTrackViewDopeSheetBase::CTrackViewDopeSheetBase(QWidget* parent) m_bFastRedraw = false; - m_pLastTrackSelectedOnSpot = NULL; + m_pLastTrackSelectedOnSpot = nullptr; m_wndPropsOnSpot = nullptr; @@ -544,7 +544,7 @@ void CTrackViewDopeSheetBase::OnLButtonUp(Qt::KeyboardModifiers modifiers, const SelectKeys(m_rcSelect, modifiers & Qt::ControlModifier); m_rcSelect = QRect(); m_rubberBand->deleteLater(); - m_rubberBand = 0; + m_rubberBand = nullptr; } else if (m_mouseMode == eTVMouseMode_SelectWithinTime) { @@ -552,7 +552,7 @@ void CTrackViewDopeSheetBase::OnLButtonUp(Qt::KeyboardModifiers modifiers, const SelectAllKeysWithinTimeFrame(m_rcSelect, modifiers & Qt::ControlModifier); m_rcSelect = QRect(); m_rubberBand->deleteLater(); - m_rubberBand = 0; + m_rubberBand = nullptr; } else if (m_mouseMode == eTVMouseMode_DragTime) { @@ -744,7 +744,7 @@ void CTrackViewDopeSheetBase::OnRButtonDown(Qt::KeyboardModifiers modifiers, con } else { - m_pLastTrackSelectedOnSpot = NULL; + m_pLastTrackSelectedOnSpot = nullptr; } ShowKeyPropertyCtrlOnSpot(p.x(), p.y(), selectedKeys.GetKeyCount() > 1, bKeyChangeInSameTrack); @@ -783,7 +783,7 @@ void CTrackViewDopeSheetBase::OnRButtonUp([[maybe_unused]] Qt::KeyboardModifiers if (!m_bCursorWasInKey) { - const bool bHasCopiedKey = (GetKeysInClickboard() != NULL); + const bool bHasCopiedKey = (GetKeysInClickboard() != nullptr); if (bHasCopiedKey && m_bMouseMovedAfterRButtonDown == false) // Once moved, it means the user wanted to scroll, so no paste pop-up. { @@ -1230,24 +1230,24 @@ XmlNodeRef CTrackViewDopeSheetBase::GetKeysInClickboard() CClipboard clip(this); if (clip.IsEmpty()) { - return NULL; + return nullptr; } if (clip.GetTitle() != "Track view keys") { - return NULL; + return nullptr; } XmlNodeRef copyNode = clip.Get(); - if (copyNode == NULL || strcmp(copyNode->getTag(), "CopyKeysNode")) + if (copyNode == nullptr || strcmp(copyNode->getTag(), "CopyKeysNode")) { - return NULL; + return nullptr; } int nNumTracksToPaste = copyNode->getChildCount(); if (nNumTracksToPaste == 0) { - return NULL; + return nullptr; } return copyNode; @@ -1789,7 +1789,7 @@ float CTrackViewDopeSheetBase::FrameSnap(float time) const ////////////////////////////////////////////////////////////////////////// void CTrackViewDopeSheetBase::ShowKeyPropertyCtrlOnSpot(int x, int y, [[maybe_unused]] bool bMultipleKeysSelected, bool bKeyChangeInSameTrack) { - if (m_keyPropertiesDlg == NULL) + if (m_keyPropertiesDlg == nullptr) { return; } diff --git a/Code/Editor/TrackView/TrackViewFindDlg.cpp b/Code/Editor/TrackView/TrackViewFindDlg.cpp index 3d6e93fb05..014618a62a 100644 --- a/Code/Editor/TrackView/TrackViewFindDlg.cpp +++ b/Code/Editor/TrackView/TrackViewFindDlg.cpp @@ -24,13 +24,13 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING // CTrackViewFindDlg dialog -CTrackViewFindDlg::CTrackViewFindDlg(const char* title, QWidget* pParent /*=NULL*/) +CTrackViewFindDlg::CTrackViewFindDlg(const char* title, QWidget* pParent /*=nullptr*/) : QDialog(pParent) , ui(new Ui::TrackViewFindDlg) { setWindowTitle(title); - m_tvDlg = 0; + m_tvDlg = nullptr; m_numSeqs = 0; ui->setupUi(this); diff --git a/Code/Editor/TrackView/TrackViewFindDlg.h b/Code/Editor/TrackView/TrackViewFindDlg.h index 65723634e4..8a3239087d 100644 --- a/Code/Editor/TrackView/TrackViewFindDlg.h +++ b/Code/Editor/TrackView/TrackViewFindDlg.h @@ -32,7 +32,7 @@ class CTrackViewFindDlg Q_OBJECT // Construction public: - CTrackViewFindDlg(const char* title = NULL, QWidget* pParent = NULL); // standard constructor + CTrackViewFindDlg(const char* title = nullptr, QWidget* pParent = nullptr); // standard constructor ~CTrackViewFindDlg(); //Functions diff --git a/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.cpp b/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.cpp index 158052eb2a..6a5c5b6427 100644 --- a/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.cpp +++ b/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.cpp @@ -328,8 +328,8 @@ bool CTrackViewTrackPropsDlg::OnKeySelectionChange(CTrackViewKeyBundle& selected } else { - ui->PREVNEXT->setEnabled(FALSE); - ui->TIME->setEnabled(FALSE); + ui->PREVNEXT->setEnabled(false); + ui->TIME->setEnabled(false); } return true; } diff --git a/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.h b/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.h index d4670a95c8..9b9a933b49 100644 --- a/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.h +++ b/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.h @@ -74,7 +74,7 @@ protected: // Helper functions. ////////////////////////////////////////////////////////////////////////// template - void SyncValue(CSmartVariable& var, T& value, bool bCopyToUI, IVariable* pSrcVar = NULL) + void SyncValue(CSmartVariable& var, T& value, bool bCopyToUI, IVariable* pSrcVar = nullptr) { if (bCopyToUI) { diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index d69c256049..daf99990a8 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -69,7 +69,7 @@ public: : QStyledItemDelegate(parent) {} - void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const + void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override { bool enabled = index.data(CTrackViewNodesCtrl::CRecord::EnableRole).toBool(); QStyleOptionViewItem opt = option; @@ -106,7 +106,7 @@ protected: return Qt::CopyAction | Qt::MoveAction; } - void dragMoveEvent(QDragMoveEvent* event) + void dragMoveEvent(QDragMoveEvent* event) override { CTrackViewNodesCtrl::CRecord* record = (CTrackViewNodesCtrl::CRecord*) itemAt(event->pos()); if (!record) @@ -144,7 +144,7 @@ protected: } } - void dropEvent(QDropEvent* event) + void dropEvent(QDropEvent* event) override { CTrackViewNodesCtrl::CRecord* record = (CTrackViewNodesCtrl::CRecord*) itemAt(event->pos()); if (!record) @@ -200,7 +200,7 @@ protected: } } - void keyPressEvent(QKeyEvent* event) + void keyPressEvent(QKeyEvent* event) override { // HAVE TO INCLUDE CASES FOR THESE IN THE ShortcutOverride handler in ::event() below switch (event->key()) @@ -242,7 +242,7 @@ protected: } - bool focusNextPrevChild([[maybe_unused]] bool next) + bool focusNextPrevChild([[maybe_unused]] bool next) override { return false; // so we get the tab key } @@ -361,7 +361,7 @@ CTrackViewNodesCtrl::CTrackViewNodesCtrl(QWidget* hParentWnd, CTrackViewDialog* , m_pTrackViewDialog(parent) { ui->setupUi(this); - m_pDopeSheet = 0; + m_pDopeSheet = nullptr; m_currentMatchIndex = 0; m_matchCount = 0; @@ -954,7 +954,7 @@ void CTrackViewNodesCtrl::OnSelectionChanged() ////////////////////////////////////////////////////////////////////////// void CTrackViewNodesCtrl::OnNMRclick(QPoint point) { - CRecord* record = 0; + CRecord* record = nullptr; bool isOnAzEntity = false; CTrackViewSequence* sequence = GetIEditor()->GetAnimation()->GetSequence(); if (!sequence) @@ -1605,7 +1605,7 @@ CTrackViewTrack* CTrackViewNodesCtrl::GetTrackViewTrack(const Export::EntityAnim } } - return 0; + return nullptr; } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp index 19c8b2d4c2..c21403d1f5 100644 --- a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp +++ b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp @@ -56,10 +56,10 @@ protected: } } - virtual int GetSize() { return sizeof(*this); } - virtual QString GetDescription() { return "UndoTrackViewSplineCtrl"; }; + int GetSize() override { return sizeof(*this); } + QString GetDescription() override { return "UndoTrackViewSplineCtrl"; }; - virtual void Undo(bool bUndo) + void Undo(bool bUndo) override { CTrackViewSplineCtrl* pCtrl = FindControl(m_pCtrl); if (pCtrl) @@ -103,7 +103,7 @@ protected: } } - virtual void Redo() + void Redo() override { const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager(); CTrackViewSequence* sequence = pSequenceManager->GetSequenceByEntityId(m_sequenceEntityId); @@ -136,7 +136,7 @@ protected: sequence->OnKeySelectionChanged(); } - virtual bool IsSelectionChanged() const + bool IsSelectionChanged() const override { const CTrackViewSequenceManager* sequenceManager = GetIEditor()->GetSequenceManager(); CTrackViewSequence* sequence = sequenceManager->GetSequenceByEntityId(m_sequenceEntityId); @@ -151,19 +151,19 @@ protected: } public: - typedef std::list CTrackViewSplineCtrls; + using CTrackViewSplineCtrls = std::list; static CTrackViewSplineCtrl* FindControl(CTrackViewSplineCtrl* pCtrl) { if (!pCtrl) { - return 0; + return nullptr; } auto iter = std::find(s_activeCtrls.begin(), s_activeCtrls.end(), pCtrl); if (iter == s_activeCtrls.end()) { - return 0; + return nullptr; } return *iter; @@ -449,7 +449,7 @@ void CTrackViewSplineCtrl::AddSpline(ISplineInterpolator* pSpline, CTrackViewTra } si.pSpline = pSpline; - si.pDetailSpline = NULL; + si.pDetailSpline = nullptr; m_splines.push_back(si); m_tracks.push_back(pTrack); m_bKeyTimesDirty = true; @@ -896,7 +896,7 @@ bool CTrackViewSplineCtrl::IsUnifiedKeyCurrentlySelected() const { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; - if (pSpline == NULL) + if (pSpline == nullptr) { continue; } @@ -960,7 +960,7 @@ void CTrackViewSplineCtrl::mouseReleaseEvent(QMouseEvent* event) if (GetIEditor()->GetAnimation()->GetSequence()) { bool restoreRecordModeToTrue = (m_editMode == TimeMarkerMode && m_stashedRecordModeWhenDraggingTime); - + SplineWidget::mouseReleaseEvent(event); if (restoreRecordModeToTrue) From 1a80d313e58dbef0ac251ddeca40818050fdcbd6 Mon Sep 17 00:00:00 2001 From: Nemerle Date: Thu, 5 Aug 2021 16:49:02 +0200 Subject: [PATCH 63/75] Editor code: tidy up BOOLs,NULLs and overrides pt4. A few 'typedefs' replaced by 'using's This shouldn't have any functional changes at all, just c++17 modernization It's a part 4 of a split #2847 Signed-off-by: Nemerle --- Code/Editor/Undo/Undo.cpp | 24 +++++++------- Code/Editor/Undo/Undo.h | 4 +-- Code/Editor/Util/3DConnexionDriver.cpp | 10 +++--- Code/Editor/Util/DynamicArray2D.cpp | 2 +- Code/Editor/Util/EditorUtils.cpp | 6 ++-- Code/Editor/Util/EditorUtils.h | 12 +++---- Code/Editor/Util/FileChangeMonitor.cpp | 6 ++-- Code/Editor/Util/FileChangeMonitor.h | 2 +- Code/Editor/Util/FileEnum.cpp | 10 +++--- Code/Editor/Util/FileUtil.cpp | 34 ++++++++++---------- Code/Editor/Util/FileUtil.h | 2 +- Code/Editor/Util/FileUtil_impl.h | 4 +-- Code/Editor/Util/GdiUtil.h | 2 +- Code/Editor/Util/IXmlHistoryManager.h | 2 +- Code/Editor/Util/ImageASC.cpp | 28 ++++++++--------- Code/Editor/Util/ImageGif.cpp | 2 +- Code/Editor/Util/ImageTIF.cpp | 12 +++---- Code/Editor/Util/ImageUtil.cpp | 38 +++++++++++------------ Code/Editor/Util/IndexedFiles.cpp | 2 +- Code/Editor/Util/IndexedFiles.h | 2 +- Code/Editor/Util/KDTree.cpp | 24 +++++++------- Code/Editor/Util/Math.h | 2 +- Code/Editor/Util/MemoryBlock.cpp | 8 ++--- Code/Editor/Util/NamedData.cpp | 12 +++---- Code/Editor/Util/PakFile.cpp | 14 ++++----- Code/Editor/Util/PathUtil.cpp | 8 ++--- Code/Editor/Util/PathUtil.h | 12 +++---- Code/Editor/Util/StringHelpers.cpp | 20 ++++++------ Code/Editor/Util/UIEnumerations.cpp | 8 ++--- Code/Editor/Util/Variable.cpp | 10 +++--- Code/Editor/Util/Variable.h | 10 +++--- Code/Editor/Util/VariablePropertyType.cpp | 12 +++---- Code/Editor/Util/XmlHistoryManager.cpp | 34 ++++++++++---------- Code/Editor/Util/XmlHistoryManager.h | 20 ++++++------ Code/Editor/Util/XmlTemplate.cpp | 8 ++--- Code/Editor/Util/bitarray.h | 2 +- 36 files changed, 204 insertions(+), 204 deletions(-) diff --git a/Code/Editor/Undo/Undo.cpp b/Code/Editor/Undo/Undo.cpp index 5b3d2cd73a..6af141b9e7 100644 --- a/Code/Editor/Undo/Undo.cpp +++ b/Code/Editor/Undo/Undo.cpp @@ -34,7 +34,7 @@ public: { m_undoSteps.push_back(step); } - virtual int GetSize() const + int GetSize() const override { int size = 0; for (int i = 0; i < m_undoSteps.size(); i++) @@ -43,18 +43,18 @@ public: } return size; } - virtual bool IsEmpty() const + bool IsEmpty() const override { return m_undoSteps.empty(); } - virtual void Undo(bool bUndo) + void Undo(bool bUndo) override { for (int i = m_undoSteps.size() - 1; i >= 0; i--) { m_undoSteps[i]->Undo(bUndo); } } - virtual void Redo() + void Redo() override { for (int i = 0; i < m_undoSteps.size(); i++) { @@ -113,8 +113,8 @@ CUndoManager::CUndoManager() m_bRecording = false; m_bSuperRecording = false; - m_currentUndo = 0; - m_superUndo = 0; + m_currentUndo = nullptr; + m_superUndo = nullptr; m_assetManagerUndoInterruptor = new AssetManagerUndoInterruptor(); m_suspendCount = 0; @@ -270,7 +270,7 @@ void CUndoManager::Accept(const QString& name) } m_bRecording = false; - m_currentUndo = 0; + m_currentUndo = nullptr; SignalNumUndoRedoToListeners(); @@ -303,7 +303,7 @@ void CUndoManager::Cancel() } delete m_currentUndo; - m_currentUndo = 0; + m_currentUndo = nullptr; //CLogFile::WriteLine( " Cancel OK" ); } @@ -582,7 +582,7 @@ void CUndoManager::SuperAccept(const QString& name) //CLogFile::FormatLine( "Undo Object Accepted (Undo:%d,Redo:%d)",m_undoStack.size(),m_redoStack.size() ); m_bSuperRecording = false; - m_superUndo = 0; + m_superUndo = nullptr; //CLogFile::WriteLine( " SupperAccept OK" ); SignalNumUndoRedoToListeners(); @@ -616,7 +616,7 @@ void CUndoManager::SuperCancel() m_bSuperRecording = false; delete m_superUndo; - m_superUndo = 0; + m_superUndo = nullptr; //CLogFile::WriteLine( " SuperCancel OK" ); } @@ -708,8 +708,8 @@ void CUndoManager::Flush() delete m_superUndo; delete m_currentUndo; - m_superUndo = 0; - m_currentUndo = 0; + m_superUndo = nullptr; + m_currentUndo = nullptr; SignalUndoFlushedToListeners(); } diff --git a/Code/Editor/Undo/Undo.h b/Code/Editor/Undo/Undo.h index 3f943f7a82..e7b6c5b852 100644 --- a/Code/Editor/Undo/Undo.h +++ b/Code/Editor/Undo/Undo.h @@ -116,7 +116,7 @@ public: continue; } - if (m_undoObjects[i]->GetObjectName() == NULL) + if (m_undoObjects[i]->GetObjectName() == nullptr) { continue; } @@ -209,7 +209,7 @@ public: bool IsHaveUndo() const; bool IsHaveRedo() const; - + void SetMaxUndoStep(int steps); int GetMaxUndoStep() const; diff --git a/Code/Editor/Util/3DConnexionDriver.cpp b/Code/Editor/Util/3DConnexionDriver.cpp index 26f45a4912..c1c3b47c4b 100644 --- a/Code/Editor/Util/3DConnexionDriver.cpp +++ b/Code/Editor/Util/3DConnexionDriver.cpp @@ -34,12 +34,12 @@ bool C3DConnexionDriver::InitDevice() // Find the Raw Devices UINT nDevices; // Get Number of devices attached - if (GetRawInputDeviceList(NULL, &nDevices, sizeof(RAWINPUTDEVICELIST)) != 0) + if (GetRawInputDeviceList(nullptr, &nDevices, sizeof(RAWINPUTDEVICELIST)) != 0) { return false; } // Create list large enough to hold all RAWINPUTDEVICE structs - if ((m_pRawInputDeviceList = (PRAWINPUTDEVICELIST)malloc(sizeof(RAWINPUTDEVICELIST) * nDevices)) == NULL) + if ((m_pRawInputDeviceList = (PRAWINPUTDEVICELIST)malloc(sizeof(RAWINPUTDEVICELIST) * nDevices)) == nullptr) { return false; } @@ -85,7 +85,7 @@ bool C3DConnexionDriver::InitDevice() m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsagePage = phidInfo->usUsagePage; m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsage = phidInfo->usUsage; m_pRawInputDevices[m_nUsagePage1Usage8Devices].dwFlags = 0; - m_pRawInputDevices[m_nUsagePage1Usage8Devices].hwndTarget = NULL; + m_pRawInputDevices[m_nUsagePage1Usage8Devices].hwndTarget = nullptr; m_nUsagePage1Usage8Devices++; } } @@ -126,8 +126,8 @@ bool C3DConnexionDriver::GetInputMessageData(LPARAM lParam, S3DConnexionMessage& { if (event->header.dwType == RIM_TYPEHID) { - static BOOL bGotTranslation = FALSE, - bGotRotation = FALSE; + static bool bGotTranslation = false, + bGotRotation = false; static int all6DOFs[6] = {0}; LPRAWHID pRawHid = &event->data.hid; diff --git a/Code/Editor/Util/DynamicArray2D.cpp b/Code/Editor/Util/DynamicArray2D.cpp index 6d9b1683f2..6ac3edbb6b 100644 --- a/Code/Editor/Util/DynamicArray2D.cpp +++ b/Code/Editor/Util/DynamicArray2D.cpp @@ -58,7 +58,7 @@ CDynamicArray2D::~CDynamicArray2D() } delete [] m_Array; - m_Array = 0; + m_Array = nullptr; } diff --git a/Code/Editor/Util/EditorUtils.cpp b/Code/Editor/Util/EditorUtils.cpp index 8f56e4d956..33c311ed76 100644 --- a/Code/Editor/Util/EditorUtils.cpp +++ b/Code/Editor/Util/EditorUtils.cpp @@ -42,14 +42,14 @@ void HeapCheck::Check([[maybe_unused]] const char* file, [[maybe_unused]] int li { CString str; str.Format( "Bad Start of Heap, at file %s line:%d",file,line ); - MessageBox( NULL,str,"Heap Check",MB_OK ); + MessageBox( nullptr,str,"Heap Check",MB_OK ); } break; case _HEAPBADNODE: { CString str; str.Format( "Bad Node in Heap, at file %s line:%d",file,line ); - MessageBox( NULL,str,"Heap Check",MB_OK ); + MessageBox( nullptr,str,"Heap Check",MB_OK ); } break; } @@ -258,7 +258,7 @@ namespace EditorUtils AzWarningAbsorber::AzWarningAbsorber(const char* window) : m_window(window) AZ_POP_DISABLE_WARNING - { + { BusConnect(); } diff --git a/Code/Editor/Util/EditorUtils.h b/Code/Editor/Util/EditorUtils.h index fb767c98b3..355a1939c2 100644 --- a/Code/Editor/Util/EditorUtils.h +++ b/Code/Editor/Util/EditorUtils.h @@ -359,7 +359,7 @@ inline QString TokenizeString(const QString& s, LPCSTR pszTokens, int& iStart) QByteArray str = s.toUtf8(); - if (pszTokens == NULL) + if (pszTokens == nullptr) { return str; } @@ -472,7 +472,7 @@ inline const char* strstri(const char* pString, const char* pSubstring) } } - return NULL; + return nullptr; } @@ -542,7 +542,7 @@ public: // There is a bug in QT with writing files larger than 32MB. It separates // the write into 32MB blocks, but doesn't write the last block correctly. // To deal with this, we'll separate into blocks here so QT doesn't have to. - + // QT bug in qfileengine_win.cpp line 434. Block size is calculated once and always // used as the amount of data to write, but for the last block, unless there is exactly // block size left to write, the actual remaining amount needs to be written, not the @@ -658,14 +658,14 @@ inline CArchive& operator>>(CArchive& ar, QString& str) str = QString::fromUtf16(reinterpret_cast(raw), aznumeric_cast(length)); } } - + return ar; } inline CArchive& operator<<(CArchive& ar, const QString& str) { // This is written to mimic how MFC archiving worked, which was to - // write markers to indicate the size of the length - + // write markers to indicate the size of the length - // so a length that will fit into 8 bits takes 8 bits. // A length that requires more than 8 bits, puts an 8 bit marker (0xff) // to indicate that the length is greater, then 16 bits for the length. @@ -693,7 +693,7 @@ inline CArchive& operator<<(CArchive& ar, const QString& str) ar << static_cast(0xffff); ar << static_cast(length); } - + ar.device()->write(data); return ar; diff --git a/Code/Editor/Util/FileChangeMonitor.cpp b/Code/Editor/Util/FileChangeMonitor.cpp index c2448e5dac..8a1f961bb0 100644 --- a/Code/Editor/Util/FileChangeMonitor.cpp +++ b/Code/Editor/Util/FileChangeMonitor.cpp @@ -16,7 +16,7 @@ #include -CFileChangeMonitor* CFileChangeMonitor::s_pFileMonitorInstance = NULL; +CFileChangeMonitor* CFileChangeMonitor::s_pFileMonitorInstance = nullptr; ////////////////////////////////////////////////////////////////////////// CFileChangeMonitor::CFileChangeMonitor(QObject* parent) @@ -34,7 +34,7 @@ CFileChangeMonitor::~CFileChangeMonitor() if (pListener) { - pListener->SetMonitor(NULL); + pListener->SetMonitor(nullptr); } } @@ -143,7 +143,7 @@ void CFileChangeMonitor::Unsubscribe(CFileChangeMonitorListener* pListener) { assert(pListener); m_listeners.erase(pListener); - pListener->SetMonitor(NULL); + pListener->SetMonitor(nullptr); } void CFileChangeMonitor::OnDirectoryChange(const QString &path) diff --git a/Code/Editor/Util/FileChangeMonitor.h b/Code/Editor/Util/FileChangeMonitor.h index c2746dc30a..b32686bec4 100644 --- a/Code/Editor/Util/FileChangeMonitor.h +++ b/Code/Editor/Util/FileChangeMonitor.h @@ -111,7 +111,7 @@ class CFileChangeMonitorListener { public: CFileChangeMonitorListener() - : m_pMonitor(NULL) + : m_pMonitor(nullptr) { } diff --git a/Code/Editor/Util/FileEnum.cpp b/Code/Editor/Util/FileEnum.cpp index 1d13929889..98ff0f7f4e 100644 --- a/Code/Editor/Util/FileEnum.cpp +++ b/Code/Editor/Util/FileEnum.cpp @@ -12,7 +12,7 @@ #include "FileEnum.h" CFileEnum::CFileEnum() - : m_hEnumFile(0) + : m_hEnumFile(nullptr) { } @@ -21,7 +21,7 @@ CFileEnum::~CFileEnum() if (m_hEnumFile) { delete m_hEnumFile; - m_hEnumFile = 0; + m_hEnumFile = nullptr; } } @@ -53,7 +53,7 @@ bool CFileEnum::StartEnumeration(const QString& szEnumPathAndPattern, QFileInfo* if (m_hEnumFile) { delete m_hEnumFile; - m_hEnumFile = 0; + m_hEnumFile = nullptr; } QStringList parts = szEnumPathAndPattern.split(QRegularExpression(R"([\\/])")); @@ -66,7 +66,7 @@ bool CFileEnum::StartEnumeration(const QString& szEnumPathAndPattern, QFileInfo* { // No files found delete m_hEnumFile; - m_hEnumFile = 0; + m_hEnumFile = nullptr; return false; } @@ -84,7 +84,7 @@ bool CFileEnum::GetNextFile(QFileInfo* pFile) { // No more files left delete m_hEnumFile; - m_hEnumFile = 0; + m_hEnumFile = nullptr; return false; } diff --git a/Code/Editor/Util/FileUtil.cpp b/Code/Editor/Util/FileUtil.cpp index 9e4f688f69..32154ec66d 100644 --- a/Code/Editor/Util/FileUtil.cpp +++ b/Code/Editor/Util/FileUtil.cpp @@ -279,7 +279,7 @@ void CFileUtil::EditTextureFile(const char* textureFile, [[maybe_unused]] bool b // Qt does. QString fullTexturePathFixedForWindows = QString(fullTexturePath.data()).replace('/', '\\'); QByteArray fullTexturePathFixedForWindowsUtf8 = fullTexturePathFixedForWindows.toUtf8(); - HINSTANCE hInst = ShellExecute(NULL, "open", textureEditorPath.data(), fullTexturePathFixedForWindowsUtf8.data(), NULL, SW_SHOWNORMAL); + HINSTANCE hInst = ShellExecute(nullptr, "open", textureEditorPath.data(), fullTexturePathFixedForWindowsUtf8.data(), nullptr, SW_SHOWNORMAL); failedToLaunch = ((DWORD_PTR)hInst <= 32); #elif defined(AZ_PLATFORM_MAC) failedToLaunch = QProcess::execute(QString("/usr/bin/open"), {"-a", gSettings.textureEditor, QString(fullTexturePath.data()) }) != 0; @@ -332,7 +332,7 @@ bool CFileUtil::EditMayaFile(const char* filepath, const bool bExtractFromPak, c CryMessageBox("Can't open the file. You can specify a source editor in Sandbox Preferences or create an association in Windows.", "Cannot open file!", MB_OK | MB_ICONERROR); } } - return TRUE; + return true; } ////////////////////////////////////////////////////////////////////////// @@ -348,10 +348,10 @@ bool CFileUtil::EditFile(const char* filePath, const bool bExtrackFromPak, const else if ((extension.compare(".bspace") == 0) || (extension.compare(".comb") == 0)) { EditTextFile(filePath, 0, IFileUtil::FILE_TYPE_BSPACE); - return TRUE; + return true; } - return FALSE; + return false; } ////////////////////////////////////////////////////////////////////////// @@ -374,7 +374,7 @@ bool CFileUtil::CalculateDccFilename(const QString& assetFilename, QString& dccF ////////////////////////////////////////////////////////////////////////// bool CFileUtil::ExtractDccFilenameFromAssetDatabase(const QString& assetFilename, QString& dccFilename) { - IAssetItemDatabase* pCurrentDatabaseInterface = NULL; + IAssetItemDatabase* pCurrentDatabaseInterface = nullptr; std::vector assetDatabasePlugins; IEditorClassFactory* pClassFactory = GetIEditor()->GetClassFactory(); pClassFactory->GetClassesByCategory("Asset Item DB", assetDatabasePlugins); @@ -592,7 +592,7 @@ inline bool ScanDirectoryFiles(const QString& root, const QString& path, const Q /* CFileFind finder; - BOOL bWorking = finder.FindFile( Path::Make(dir,fileSpec) ); + bool bWorking = finder.FindFile( Path::Make(dir,fileSpec) ); while (bWorking) { bWorking = finder.FindNextFile(); @@ -663,7 +663,7 @@ inline int ScanDirectoryRecursive(const QString& root, const QString& path, cons { /* CFileFind finder; - BOOL bWorking = finder.FindFile( Path::Make(dir,"*.*") ); + bool bWorking = finder.FindFile( Path::Make(dir,"*.*") ); while (bWorking) { bWorking = finder.FindNextFile(); @@ -847,12 +847,12 @@ void BlockAndWait(const bool& opComplete, QWidget* parent, const char* message) { // note that 16ms below is not the amount of time to wait, its the maximum time that // processEvents is allowed to keep processing them if they just keep being emitted. - // adding a maximum time here means that we get an opportunity to pump the TickBus + // adding a maximum time here means that we get an opportunity to pump the TickBus // periodically even during a flood of events. QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 16); AZ::TickBus::ExecuteQueuedEvents(); } - + // if we are not the main thread then the above will be done by the main thread, and we can just wait for it to happen. // its fairly important we don't sleep for really long because this legacy code is often invoked in a blocking loop // for many items, and in the worst case, any time we spend sleeping here will be added to each item. @@ -1206,10 +1206,10 @@ bool CFileUtil::CreatePath(const QString& strPath) QString strFilename; QString strExtension; QString strCurrentDirectoryPath; - QStringList cstrDirectoryQueue; + QStringList cstrDirectoryQueue; size_t nCurrentPathQueue(0); size_t nTotalPathQueueElements(0); - BOOL bnLastDirectoryWasCreated(FALSE); + bool bnLastDirectoryWasCreated(false); if (PathExists(strPath)) { @@ -1361,7 +1361,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory nTotal = cFiles.size(); for (nCurrent = 0; nCurrent < nTotal; ++nCurrent) { - BOOL bnLastFileWasCopied(FALSE); + bool bnLastFileWasCopied(false); if (eCopyResult == IFileUtil::ETREECOPYUSERCANCELED) @@ -1447,7 +1447,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory return eCopyResult; } - BOOL bnLastDirectoryWasCreated(FALSE); + bool bnLastDirectoryWasCreated(false); QString sourceName = sourceDir.absoluteFilePath(cDirectories[nCurrent]); QString targetName = targetDir.absoluteFilePath(cDirectories[nCurrent]); @@ -1529,7 +1529,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyFile(const QString& strSourceFile, c CUserOptions oFileOptions; IFileUtil::ECopyTreeResult eCopyResult(IFileUtil::ETREECOPYOK); - BOOL bnLastFileWasCopied(FALSE); + bool bnLastFileWasCopied(false); QString name(strSourceFile); QString strQueryFilename; QString strFullStargetName; @@ -1658,7 +1658,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyFile(const QString& strSourceFile, c } if (pfnProgress) { - pfnProgress(source.size(), totalRead, 0, 0, 0, 0, 0, 0, 0); + pfnProgress(source.size(), totalRead, 0, 0, 0, 0, nullptr, nullptr, nullptr); } } if (totalRead != source.size()) @@ -1742,7 +1742,7 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto return eCopyResult; } - BOOL bnLastFileWasCopied(FALSE); + bool bnLastFileWasCopied(false); QString sourceName(sourceDir.absoluteFilePath(cFiles[nCurrent])); QString targetName(targetDir.absoluteFilePath(cFiles[nCurrent])); @@ -1816,7 +1816,7 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto nTotal = cDirectories.size(); for (nCurrent = 0; nCurrent < nTotal; ++nCurrent) { - BOOL bnLastDirectoryWasCreated(FALSE); + bool bnLastDirectoryWasCreated(false); if (eCopyResult == IFileUtil::ETREECOPYUSERCANCELED) { diff --git a/Code/Editor/Util/FileUtil.h b/Code/Editor/Util/FileUtil.h index 000215e98d..210d702f71 100644 --- a/Code/Editor/Util/FileUtil.h +++ b/Code/Editor/Util/FileUtil.h @@ -123,7 +123,7 @@ public: ////////////////////////////////////////////////////////////////////////// // @param LPPROGRESS_ROUTINE pfnProgress - called by the system to notify of file copy progress - // @param LPBOOL pbCancel - when the contents of this BOOL are set to TRUE, the system cancels the copy operation + // @param LPBOOL pbCancel - when the contents of this BOOL are set to true, the system cancels the copy operation static IFileUtil::ECopyTreeResult CopyFile(const QString& strSourceFile, const QString& strTargetFile, bool boConfirmOverwrite = false, ProgressRoutine pfnProgress = nullptr, bool* pbCancel = nullptr); diff --git a/Code/Editor/Util/FileUtil_impl.h b/Code/Editor/Util/FileUtil_impl.h index 2f2872ff6f..04d9e829b9 100644 --- a/Code/Editor/Util/FileUtil_impl.h +++ b/Code/Editor/Util/FileUtil_impl.h @@ -110,8 +110,8 @@ public: ////////////////////////////////////////////////////////////////////////// // @param LPPROGRESS_ROUTINE pfnProgress - called by the system to notify of file copy progress - // @param LPBOOL pbCancel - when the contents of this BOOL are set to TRUE, the system cancels the copy operation - ECopyTreeResult CopyFile(const QString& strSourceFile, const QString& strTargetFile, bool boConfirmOverwrite = false, ProgressRoutine pfnProgress = NULL, bool* pbCancel = NULL) override; + // @param LPBOOL pbCancel - when the contents of this BOOL are set to true, the system cancels the copy operation + ECopyTreeResult CopyFile(const QString& strSourceFile, const QString& strTargetFile, bool boConfirmOverwrite = false, ProgressRoutine pfnProgress = nullptr, bool* pbCancel = nullptr) override; // As we don't have a FileUtil interface here, we have to duplicate some code :-( in order to keep // function calls clean. diff --git a/Code/Editor/Util/GdiUtil.h b/Code/Editor/Util/GdiUtil.h index f61781f7d4..55165b5799 100644 --- a/Code/Editor/Util/GdiUtil.h +++ b/Code/Editor/Util/GdiUtil.h @@ -35,7 +35,7 @@ public: ~CAlphaBitmap(); //! creates the bitmap from raw 32bpp data - //! \param pData the 32bpp raw image data, RGBA, can be NULL and it would create just an empty bitmap + //! \param pData the 32bpp raw image data, RGBA, can be nullptr and it would create just an empty bitmap //! \param aWidth the bitmap width //! \param aHeight the bitmap height bool Create(void* pData, UINT aWidth, UINT aHeight, bool bVerticalFlip = false, bool bPremultiplyAlpha = false); diff --git a/Code/Editor/Util/IXmlHistoryManager.h b/Code/Editor/Util/IXmlHistoryManager.h index 78d849df7d..20f9dd4573 100644 --- a/Code/Editor/Util/IXmlHistoryManager.h +++ b/Code/Editor/Util/IXmlHistoryManager.h @@ -37,7 +37,7 @@ struct IXmlHistoryEventListener eHET_HistoryGroupAdded, eHET_HistoryGroupRemoved, }; - virtual void OnEvent(EHistoryEventType event, void* pData = NULL) = 0; + virtual void OnEvent(EHistoryEventType event, void* pData = nullptr) = 0; }; struct IXmlHistoryView diff --git a/Code/Editor/Util/ImageASC.cpp b/Code/Editor/Util/ImageASC.cpp index 69a6892c65..c018018196 100644 --- a/Code/Editor/Util/ImageASC.cpp +++ b/Code/Editor/Util/ImageASC.cpp @@ -105,34 +105,34 @@ bool CImageASC::Load(const QString& fileName, CFloatImage& image) // ncols = grid width validData = validData && (azstricmp(token, "ncols") == 0); - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); width = atoi(token); // nrows = grid height - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); validData = validData && (azstricmp(token, "nrows") == 0); - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); height = atoi(token); // xllcorner = leftmost coordinate. (Skip, we don't care about it) - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); validData = validData && (azstricmp(token, "xllcorner") == 0); - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); // yllcorner = bottommost coordinate. (Skip, we don't care about it) - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); validData = validData && (azstricmp(token, "yllcorner") == 0); - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); // cellsize = size of each grid cell. (Skip, we don't care about it) - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); validData = validData && (azstricmp(token, "cellsize") == 0); - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); // nodata_value = the value used for missing data. We'll replace these with 0 height. - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); validData = validData && (azstricmp(token, "nodata_value") == 0); - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); nodataValue = atof(token); if (!validData) @@ -152,10 +152,10 @@ bool CImageASC::Load(const QString& fileName, CFloatImage& image) int i = 0; float pixelValue; float maxPixel = 0.0f; - while (token != NULL && i < size) + while (token != nullptr && i < size) { - token = azstrtok(NULL, 0, seps, &nextToken); - if (token != NULL) + token = azstrtok(nullptr, 0, seps, &nextToken); + if (token != nullptr) { // Negative heights aren't supported, clamp to 0. pixelValue = max(0.0, atof(token)); diff --git a/Code/Editor/Util/ImageGif.cpp b/Code/Editor/Util/ImageGif.cpp index a0cd6c5650..2c07fc9acb 100644 --- a/Code/Editor/Util/ImageGif.cpp +++ b/Code/Editor/Util/ImageGif.cpp @@ -223,7 +223,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage) Pass = 0; OutCount = 0; - Palette = NULL; + Palette = nullptr; CHK (Raster = new uint8 [filesize]); if (strncmp((char*) ptr, id87, 6)) diff --git a/Code/Editor/Util/ImageTIF.cpp b/Code/Editor/Util/ImageTIF.cpp index 9040306a44..c4f21855a4 100644 --- a/Code/Editor/Util/ImageTIF.cpp +++ b/Code/Editor/Util/ImageTIF.cpp @@ -142,7 +142,7 @@ bool CImageTIF::Load(const QString& fileName, CImageEx& outImage) uint32 dwWidth, dwHeight; size_t npixels; uint32* raster; - char* dccfilename = NULL; + char* dccfilename = nullptr; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &dwWidth); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &dwHeight); @@ -232,7 +232,7 @@ bool CImageTIF::Load(const QString& fileName, CFloatImage& outImage) { uint32 width = 0, height = 0; uint16 spp = 0, bpp = 0, format = 0; - char* dccfilename = NULL; + char* dccfilename = nullptr; TIFFGetField(tif, TIFFTAG_IMAGEDESCRIPTION, &dccfilename); @@ -252,11 +252,11 @@ bool CImageTIF::Load(const QString& fileName, CFloatImage& outImage) // Check to see if it's a GeoTIFF, and if so, whether or not it has the ZScale parameter. uint32 tagCount = 0; - double *pixelScales = NULL; + double *pixelScales = nullptr; if (TIFFGetField(tif, GEOTIFF_MODELPIXELSCALE_TAG, &tagCount, &pixelScales) == 1) { // if there's an xyz scale, and the Z scale isn't 0, let's use it. - if ((tagCount == 3) && (pixelScales != NULL) && (pixelScales[2] != 0.0f)) + if ((tagCount == 3) && (pixelScales != nullptr) && (pixelScales[2] != 0.0f)) { pixelValueScale = static_cast(pixelScales[2]); } @@ -455,7 +455,7 @@ const char* CImageTIF::GetPreset(const QString& fileName) if (!file.Open(fileName.toUtf8().data(), "rb")) { CLogFile::FormatLine("File not found %s", fileName.toUtf8().data()); - return NULL; + return nullptr; } MemImage memImage; @@ -473,7 +473,7 @@ const char* CImageTIF::GetPreset(const QString& fileName) libtiffDummyCloseProc, libtiffDummySizeProc, libtiffDummyMapFileProc, libtiffDummyUnmapFileProc); string strReturn; - char* preset = NULL; + char* preset = nullptr; int size; if (tif) { diff --git a/Code/Editor/Util/ImageUtil.cpp b/Code/Editor/Util/ImageUtil.cpp index 1b985c82f9..3d121a1d47 100644 --- a/Code/Editor/Util/ImageUtil.cpp +++ b/Code/Editor/Util/ImageUtil.cpp @@ -149,13 +149,13 @@ bool CImageUtil::LoadPGM(const QString& fileName, CImageEx& image) char* nextToken = nullptr; token = azstrtok(str, 0, seps, &nextToken); - while (token != NULL && token[0] == '#') + while (token != nullptr && token[0] == '#') { - if (token != NULL && token[0] == '#') + if (token != nullptr && token[0] == '#') { - azstrtok(NULL, 0, "\n", &nextToken); + azstrtok(nullptr, 0, "\n", &nextToken); } - token = azstrtok(NULL, 0, seps, &nextToken); + token = azstrtok(nullptr, 0, seps, &nextToken); } if (azstricmp(token, "P2") != 0) { @@ -167,32 +167,32 @@ bool CImageUtil::LoadPGM(const QString& fileName, CImageEx& image) do { - token = azstrtok(NULL, 0, seps, &nextToken); - if (token != NULL && token[0] == '#') + token = azstrtok(nullptr, 0, seps, &nextToken); + if (token != nullptr && token[0] == '#') { - azstrtok(NULL, 0, "\n", &nextToken); + azstrtok(nullptr, 0, "\n", &nextToken); } - } while (token != NULL && token[0] == '#'); + } while (token != nullptr && token[0] == '#'); width = atoi(token); do { - token = azstrtok(NULL, 0, seps, &nextToken); - if (token != NULL && token[0] == '#') + token = azstrtok(nullptr, 0, seps, &nextToken); + if (token != nullptr && token[0] == '#') { - azstrtok(NULL, 0, "\n", &nextToken); + azstrtok(nullptr, 0, "\n", &nextToken); } - } while (token != NULL && token[0] == '#'); + } while (token != nullptr && token[0] == '#'); height = atoi(token); do { - token = azstrtok(NULL, 0, seps, &nextToken); - if (token != NULL && token[0] == '#') + token = azstrtok(nullptr, 0, seps, &nextToken); + if (token != nullptr && token[0] == '#') { - azstrtok(NULL, 0, "\n", &nextToken); + azstrtok(nullptr, 0, "\n", &nextToken); } - } while (token != NULL && token[0] == '#'); + } while (token != nullptr && token[0] == '#'); numColors = atoi(token); image.Allocate(width, height); @@ -200,12 +200,12 @@ bool CImageUtil::LoadPGM(const QString& fileName, CImageEx& image) uint32* p = image.GetData(); int size = width * height; int i = 0; - while (token != NULL && i < size) + while (token != nullptr && i < size) { do { - token = azstrtok(NULL, 0, seps, &nextToken); - } while (token != NULL && token[0] == '#'); + token = azstrtok(nullptr, 0, seps, &nextToken); + } while (token != nullptr && token[0] == '#'); *p++ = atoi(token); i++; } diff --git a/Code/Editor/Util/IndexedFiles.cpp b/Code/Editor/Util/IndexedFiles.cpp index c90b3c5f20..ae777abb49 100644 --- a/Code/Editor/Util/IndexedFiles.cpp +++ b/Code/Editor/Util/IndexedFiles.cpp @@ -14,7 +14,7 @@ #include "IndexedFiles.h" volatile TIntAtomic CIndexedFiles::s_bIndexingDone; -CIndexedFiles* CIndexedFiles::s_pIndexedFiles = NULL; +CIndexedFiles* CIndexedFiles::s_pIndexedFiles = nullptr; bool CIndexedFiles::m_startedFileIndexing = false; diff --git a/Code/Editor/Util/IndexedFiles.h b/Code/Editor/Util/IndexedFiles.h index 34554dbe37..e23c0ea827 100644 --- a/Code/Editor/Util/IndexedFiles.h +++ b/Code/Editor/Util/IndexedFiles.h @@ -88,7 +88,7 @@ public: } public: - void Initialize(const QString& path, IFileUtil::ScanDirectoryUpdateCallBack updateCB = NULL); + void Initialize(const QString& path, IFileUtil::ScanDirectoryUpdateCallBack updateCB = nullptr); // Adds a new file to the database. void AddFile(const IFileUtil::FileDesc& path); diff --git a/Code/Editor/Util/KDTree.cpp b/Code/Editor/Util/KDTree.cpp index c8fe742370..4547149e9b 100644 --- a/Code/Editor/Util/KDTree.cpp +++ b/Code/Editor/Util/KDTree.cpp @@ -17,9 +17,9 @@ class KDTreeNode public: KDTreeNode() { - pChildren[0] = NULL; - pChildren[1] = NULL; - pVertexIndices = NULL; + pChildren[0] = nullptr; + pChildren[1] = nullptr; + pVertexIndices = nullptr; } ~KDTreeNode() { @@ -76,13 +76,13 @@ public: } bool IsLeaf() const { - return pChildren[0] == NULL && pChildren[1] == NULL; + return pChildren[0] == nullptr && pChildren[1] == nullptr; } KDTreeNode* GetChild(uint32 nIndex) const { if (nIndex > 1) { - return NULL; + return nullptr; } return pChildren[nIndex]; } @@ -200,7 +200,7 @@ bool SearchForBestSplitPos(CKDTree::ESplitAxis axis, const std::vectorpStatObj->GetIndexedMesh(); - if (pMesh == NULL) + if (pMesh == nullptr) { continue; } @@ -256,7 +256,7 @@ bool SplitNode(const std::vector& statObjList, const AABB& bo const CKDTree::SStatObj* pObj = &statObjList[nObjIndex]; const IIndexedMesh* pMesh = pObj->pStatObj->GetIndexedMesh(); - if (pMesh == NULL) + if (pMesh == nullptr) { return false; } @@ -295,7 +295,7 @@ bool SplitNode(const std::vector& statObjList, const AABB& bo CKDTree::CKDTree() { - m_pRootNode = NULL; + m_pRootNode = nullptr; } CKDTree::~CKDTree() @@ -308,7 +308,7 @@ CKDTree::~CKDTree() bool CKDTree::Build(IStatObj* pStatObj) { - if (pStatObj == NULL) + if (pStatObj == nullptr) { return false; } @@ -332,7 +332,7 @@ bool CKDTree::Build(IStatObj* pStatObj) for (int i = 0, iStatObjSize(m_StatObjectList.size()); i < iStatObjSize; ++i) { IIndexedMesh* pMesh = m_StatObjectList[i].pStatObj->GetIndexedMesh(true); - if (pMesh == NULL) + if (pMesh == nullptr) { continue; } @@ -398,7 +398,7 @@ void CKDTree::BuildRecursively(KDTreeNode* pNode, const AABB& boundbox, std::vec void CKDTree::ConstructStatObjList(IStatObj* pStatObj, const Matrix34& matParent) { - if (pStatObj == NULL) + if (pStatObj == nullptr) { return; } @@ -472,7 +472,7 @@ bool CKDTree::FindNearestVertexRecursively(KDTreeNode* pNode, const Vec3& raySrc const SStatObj* pStatObjInfo = &(m_StatObjectList[nObjIndex]); IIndexedMesh* pMesh = m_StatObjectList[nObjIndex].pStatObj->GetIndexedMesh(); - if (pMesh == NULL) + if (pMesh == nullptr) { continue; } diff --git a/Code/Editor/Util/Math.h b/Code/Editor/Util/Math.h index 66bbf883e8..34fb77e434 100644 --- a/Code/Editor/Util/Math.h +++ b/Code/Editor/Util/Math.h @@ -128,7 +128,7 @@ inline float PointToLineDistance(const Vec3& p1, const Vec3& p2, const Vec3& p3, @param p2 Target point of first line. @param p3 Source point of second line. @param p4 Target point of second line. - @return FALSE if no solution exists. + @return false if no solution exists. */ inline bool LineLineIntersect(const Vec3& p1, const Vec3& p2, const Vec3& p3, const Vec3& p4, Vec3& pa, Vec3& pb, float& mua, float& mub) diff --git a/Code/Editor/Util/MemoryBlock.cpp b/Code/Editor/Util/MemoryBlock.cpp index 1368553511..03d432762d 100644 --- a/Code/Editor/Util/MemoryBlock.cpp +++ b/Code/Editor/Util/MemoryBlock.cpp @@ -18,7 +18,7 @@ ////////////////////////////////////////////////////////////////////////// CMemoryBlock::CMemoryBlock() - : m_buffer(0) + : m_buffer(nullptr) , m_size(0) , m_uncompressedSize(0) , m_owns(false) @@ -54,7 +54,7 @@ CMemoryBlock& CMemoryBlock::operator=(const CMemoryBlock& mem) } else { - m_buffer = 0; + m_buffer = nullptr; m_size = 0; m_owns = false; } @@ -104,7 +104,7 @@ bool CMemoryBlock::Allocate(int size, int uncompressedSize) m_size = size; m_uncompressedSize = uncompressedSize; // Check if allocation failed. - if (m_buffer == 0) + if (m_buffer == nullptr) { return false; } @@ -118,7 +118,7 @@ void CMemoryBlock::Free() { free(m_buffer); } - m_buffer = 0; + m_buffer = nullptr; m_owns = false; m_size = 0; m_uncompressedSize = 0; diff --git a/Code/Editor/Util/NamedData.cpp b/Code/Editor/Util/NamedData.cpp index 1f0d6c5a50..240d71f58d 100644 --- a/Code/Editor/Util/NamedData.cpp +++ b/Code/Editor/Util/NamedData.cpp @@ -36,7 +36,7 @@ void CNamedData::AddDataBlock(const QString& blockName, void* pData, int nSize assert(pData); assert(nSize > 0); - DataBlock* pBlock = stl::find_in_map(m_blocks, blockName, (DataBlock*)0); + DataBlock* pBlock = stl::find_in_map(m_blocks, blockName, (DataBlock*)nullptr); if (pBlock) { delete pBlock; @@ -66,7 +66,7 @@ void CNamedData::AddDataBlock(const QString& blockName, void* pData, int nSize void CNamedData::AddDataBlock(const QString& blockName, CMemoryBlock& mem) { - DataBlock* pBlock = stl::find_in_map(m_blocks, blockName, (DataBlock*)0); + DataBlock* pBlock = stl::find_in_map(m_blocks, blockName, (DataBlock*)nullptr); if (pBlock) { delete pBlock; @@ -102,7 +102,7 @@ void CNamedData::Clear() ////////////////////////////////////////////////////////////////////////// bool CNamedData::GetDataBlock(const QString& blockName, void*& pData, int& nSize) { - pData = 0; + pData = nullptr; nSize = 0; bool bUncompressed = false; @@ -119,10 +119,10 @@ bool CNamedData::GetDataBlock(const QString& blockName, void*& pData, int& nSize ////////////////////////////////////////////////////////////////////////// CMemoryBlock* CNamedData::GetDataBlock(const QString& blockName, bool& bCompressed) { - DataBlock* pBlock = stl::find_in_map(m_blocks, blockName, (DataBlock*)0); + DataBlock* pBlock = stl::find_in_map(m_blocks, blockName, (DataBlock*)nullptr); if (!pBlock) { - return 0; + return nullptr; } if (bCompressed) @@ -150,7 +150,7 @@ CMemoryBlock* CNamedData::GetDataBlock(const QString& blockName, bool& bCompress } } } - return 0; + return nullptr; } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Util/PakFile.cpp b/Code/Editor/Util/PakFile.cpp index 5c26b9a7a2..88d5598495 100644 --- a/Code/Editor/Util/PakFile.cpp +++ b/Code/Editor/Util/PakFile.cpp @@ -21,14 +21,14 @@ ////////////////////////////////////////////////////////////////////////// CPakFile::CPakFile() - : m_pArchive(NULL) - , m_pCryPak(NULL) + : m_pArchive(nullptr) + , m_pCryPak(nullptr) { } ////////////////////////////////////////////////////////////////////////// CPakFile::CPakFile(AZ::IO::IArchive* pCryPak) - : m_pArchive(NULL) + : m_pArchive(nullptr) , m_pCryPak(pCryPak) { } @@ -42,14 +42,14 @@ CPakFile::~CPakFile() ////////////////////////////////////////////////////////////////////////// CPakFile::CPakFile(const char* filename) { - m_pArchive = NULL; + m_pArchive = nullptr; Open(filename); } ////////////////////////////////////////////////////////////////////////// void CPakFile::Close() { - m_pArchive = NULL; + m_pArchive = nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -61,7 +61,7 @@ bool CPakFile::Open(const char* filename, bool bAbsolutePath) } auto pCryPak = m_pCryPak ? m_pCryPak : GetIEditor()->GetSystem()->GetIPak(); - if (pCryPak == NULL) + if (pCryPak == nullptr) { return false; } @@ -89,7 +89,7 @@ bool CPakFile::OpenForRead(const char* filename) Close(); } auto pCryPak = m_pCryPak ? m_pCryPak : GetIEditor()->GetSystem()->GetIPak(); - if (pCryPak == NULL) + if (pCryPak == nullptr) { return false; } diff --git a/Code/Editor/Util/PathUtil.cpp b/Code/Editor/Util/PathUtil.cpp index 4bb5c20ece..2be09da06f 100644 --- a/Code/Editor/Util/PathUtil.cpp +++ b/Code/Editor/Util/PathUtil.cpp @@ -42,7 +42,7 @@ namespace Path // Directory named filenames containing ":" are invalid, so we can assume if there is a : // it will be the drive name. pchCurrentPosition = strchr(pchLastPosition, ':'); - if (pchCurrentPosition == NULL) + if (pchCurrentPosition == nullptr) { rstrDriveLetter = ""; } @@ -54,7 +54,7 @@ namespace Path pchCurrentPosition = strrchr(pchLastPosition, '\\'); pchAuxPosition = strrchr(pchLastPosition, '/'); - if ((pchCurrentPosition == NULL) && (pchAuxPosition == NULL)) + if ((pchCurrentPosition == nullptr) && (pchAuxPosition == nullptr)) { rstrDirectory = ""; } @@ -70,7 +70,7 @@ namespace Path } pchCurrentPosition = strrchr(pchLastPosition, '.'); - if (pchCurrentPosition == NULL) + if (pchCurrentPosition == nullptr) { rstrExtension = ""; strFilename.assign(pchLastPosition); @@ -114,7 +114,7 @@ namespace Path do { pchCurrentPosition = strpbrk(pchLastPosition, "\\/"); - if (pchCurrentPosition == NULL) + if (pchCurrentPosition == nullptr) { break; } diff --git a/Code/Editor/Util/PathUtil.h b/Code/Editor/Util/PathUtil.h index 0f87df0d5c..868d9843ab 100644 --- a/Code/Editor/Util/PathUtil.h +++ b/Code/Editor/Util/PathUtil.h @@ -228,7 +228,7 @@ namespace Path { return (path.endsWith(QStringLiteral("\\")) || path.endsWith(QStringLiteral("/"))); } - + template inline bool EndsWithSlash(CryStackStringT* path) { @@ -236,15 +236,15 @@ namespace Path { return false; } - + if ( ((*path)[path->size() - 1] != '\\') || - ((*path)[path->size() - 1] != '/') + ((*path)[path->size() - 1] != '/') ) { return true; } - + return false; } @@ -336,9 +336,9 @@ namespace Path { char path_buffer[_MAX_PATH]; #ifdef AZ_COMPILER_MSVC - _makepath_s(path_buffer, AZ_ARRAY_SIZE(path_buffer), NULL, dir.toUtf8().data(), filename.toUtf8().data(), ext.toUtf8().data()); + _makepath_s(path_buffer, AZ_ARRAY_SIZE(path_buffer), nullptr, dir.toUtf8().data(), filename.toUtf8().data(), ext.toUtf8().data()); #else - _makepath(path_buffer, NULL, dir.toUtf8().data(), filename.toUtf8().data(), ext.toUtf8().data()); + _makepath(path_buffer, nullptr, dir.toUtf8().data(), filename.toUtf8().data(), ext.toUtf8().data()); #endif return CaselessPaths(path_buffer); } diff --git a/Code/Editor/Util/StringHelpers.cpp b/Code/Editor/Util/StringHelpers.cpp index 836090e923..5d37dfef77 100644 --- a/Code/Editor/Util/StringHelpers.cpp +++ b/Code/Editor/Util/StringHelpers.cpp @@ -48,7 +48,7 @@ static inline int Vscprintf(const char* format, va_list argList) int retval; va_list argcopy; va_copy(argcopy, argList); - retval = azvsnprintf(NULL, 0, format, argcopy); + retval = azvsnprintf(nullptr, 0, format, argcopy); va_end(argcopy); return retval; #else @@ -64,7 +64,7 @@ static inline int Vscprintf(const wchar_t* format, va_list argList) int retval; va_list argcopy; va_copy(argcopy, argList); - retval = azvsnwprintf(NULL, 0, format, argcopy); + retval = azvsnwprintf(nullptr, 0, format, argcopy); va_end(argcopy); return retval; #else @@ -408,9 +408,9 @@ bool StringHelpers::MatchesWildcardsIgnoreCase(const wstring& str, const wstring template static inline bool MatchesWildcardsIgnoreCaseExt_Tpl(const TS& str, const TS& wildcards, std::vector& wildcardMatches) { - const typename TS::value_type* savedStrBegin = 0; - const typename TS::value_type* savedStrEnd = 0; - const typename TS::value_type* savedWild = 0; + const typename TS::value_type* savedStrBegin = nullptr; + const typename TS::value_type* savedStrEnd = nullptr; + const typename TS::value_type* savedWild = nullptr; size_t savedWildCount = 0; const typename TS::value_type* pStr = str.c_str(); @@ -775,7 +775,7 @@ void StringHelpers::SplitByAnyOf(const wstring& str, const wstring& separators, template static inline TS FormatVA_Tpl(const typename TS::value_type* const format, va_list parg) { - if ((format == 0) || (format[0] == 0)) + if ((format == nullptr) || (format[0] == 0)) { return TS(); } @@ -935,8 +935,8 @@ static string ConvertUtf16ToMultibyte(const wchar_t* wstr, uint codePage, char b len, 0, 0, - ((badChar && codePage != CP_UTF8) ? &badChar : NULL), - NULL); + ((badChar && codePage != CP_UTF8) ? &badChar : nullptr), + nullptr); if (neededByteCount <= 0) { return string(); @@ -952,8 +952,8 @@ static string ConvertUtf16ToMultibyte(const wchar_t* wstr, uint codePage, char b len, &buffer[0], // output buffer neededByteCount - 1, // size of the output buffer in bytes - ((badChar && codePage != CP_UTF8) ? &badChar : NULL), - NULL); + ((badChar && codePage != CP_UTF8) ? &badChar : nullptr), + nullptr); if (byteCount != neededByteCount - 1) { return string(); diff --git a/Code/Editor/Util/UIEnumerations.cpp b/Code/Editor/Util/UIEnumerations.cpp index 8d9fc40377..2666a49f8e 100644 --- a/Code/Editor/Util/UIEnumerations.cpp +++ b/Code/Editor/Util/UIEnumerations.cpp @@ -55,15 +55,15 @@ CUIEnumerations::TDValuesContainer& CUIEnumerations::GetStandardNameContainer() { oEnumerationItem = oEnumaration->getChild(nCurrentEnumarationItem); - const char* szKey(NULL); - const char* szValue(NULL); + const char* szKey(nullptr); + const char* szValue(nullptr); oEnumerationItem->getAttributeByIndex(0, &szKey, &szValue); cValues.push_back(szValue); } - const char* szKey(NULL); - const char* szValue(NULL); + const char* szKey(nullptr); + const char* szValue(nullptr); oEnumaration->getAttributeByIndex(0, &szKey, &szValue); cValuesContainer.insert(TDValuesContainer::value_type(szValue, cValues)); diff --git a/Code/Editor/Util/Variable.cpp b/Code/Editor/Util/Variable.cpp index 5125032baf..ee5ccc9879 100644 --- a/Code/Editor/Util/Variable.cpp +++ b/Code/Editor/Util/Variable.cpp @@ -447,7 +447,7 @@ void CVarObject::AddVariable(CVariableArray& table, CVariableBase& var, const QS ////////////////////////////////////////////////////////////////////////// void CVarObject::RemoveVariable(IVariable* var) { - if (m_vars != NULL) + if (m_vars != nullptr) { m_vars->DeleteVariable(var); } @@ -455,7 +455,7 @@ void CVarObject::RemoveVariable(IVariable* var) ////////////////////////////////////////////////////////////////////////// void CVarObject::EnableUpdateCallbacks(bool boEnable) { - if (m_vars != NULL) + if (m_vars != nullptr) { m_vars->EnableUpdateCallbacks(boEnable); } @@ -463,7 +463,7 @@ void CVarObject::EnableUpdateCallbacks(bool boEnable) ////////////////////////////////////////////////////////////////////////// void CVarObject::OnSetValues() { - if (m_vars != NULL) + if (m_vars != nullptr) { m_vars->OnSetValues(); } @@ -471,7 +471,7 @@ void CVarObject::OnSetValues() ////////////////////////////////////////////////////////////////////////// void CVarObject::ReserveNumVariables(int numVars) { - if (m_vars != NULL) + if (m_vars != nullptr) { m_vars->ReserveNumVariables(numVars); } @@ -482,7 +482,7 @@ void CVarObject::CopyVariableValues(CVarObject* sourceObject) { // Check if compatible types. assert(metaObject() == sourceObject->metaObject()); - if (m_vars != NULL && sourceObject->m_vars != NULL) + if (m_vars != nullptr && sourceObject->m_vars != nullptr) { m_vars->CopyValues(sourceObject->m_vars); } diff --git a/Code/Editor/Util/Variable.h b/Code/Editor/Util/Variable.h index 0d1e7a9ef1..83afee0924 100644 --- a/Code/Editor/Util/Variable.h +++ b/Code/Editor/Util/Variable.h @@ -1411,7 +1411,7 @@ protected: struct IVarEnumList : public CRefCountBase { - //! Get the name of specified value in enumeration, or NULL if out of range. + //! Get the name of specified value in enumeration, or empty string if out of range. virtual QString GetItemName(uint index) = 0; }; typedef _smart_ptr IVarEnumListPtr; @@ -1498,7 +1498,7 @@ public: { if (index >= m_items.size()) { - return NULL; + return QString(); } return m_items[index].name; }; @@ -1869,9 +1869,9 @@ public: void Serialize(XmlNodeRef node, bool load); CVarBlock* GetVarBlock() const { return m_vars; }; - void AddVariable(CVariableBase& var, const QString& varName, VarOnSetCallback* cb = NULL, unsigned char dataType = IVariable::DT_SIMPLE); - void AddVariable(CVariableBase& var, const QString& varName, const QString& varHumanName, VarOnSetCallback* cb = NULL, unsigned char dataType = IVariable::DT_SIMPLE); - void AddVariable(CVariableArray& table, CVariableBase& var, const QString& varName, const QString& varHumanName, VarOnSetCallback* cb = NULL, unsigned char dataType = IVariable::DT_SIMPLE); + void AddVariable(CVariableBase& var, const QString& varName, VarOnSetCallback* cb = nullptr, unsigned char dataType = IVariable::DT_SIMPLE); + void AddVariable(CVariableBase& var, const QString& varName, const QString& varHumanName, VarOnSetCallback* cb = nullptr, unsigned char dataType = IVariable::DT_SIMPLE); + void AddVariable(CVariableArray& table, CVariableBase& var, const QString& varName, const QString& varHumanName, VarOnSetCallback* cb = nullptr, unsigned char dataType = IVariable::DT_SIMPLE); void ReserveNumVariables(int numVars); void RemoveVariable(IVariable* var); diff --git a/Code/Editor/Util/VariablePropertyType.cpp b/Code/Editor/Util/VariablePropertyType.cpp index c6d26b3470..014995467b 100644 --- a/Code/Editor/Util/VariablePropertyType.cpp +++ b/Code/Editor/Util/VariablePropertyType.cpp @@ -71,28 +71,28 @@ namespace Prop Description::Description() : m_type(ePropertyInvalid) , m_numImages(-1) - , m_enumList(NULL) + , m_enumList(nullptr) , m_rangeMin(0) , m_rangeMax(100) , m_step(0) , m_bHardMin(false) , m_bHardMax(false) , m_valueMultiplier(1) - , m_pEnumDBItem(NULL) + , m_pEnumDBItem(nullptr) { } Description::Description(IVariable* pVar) : m_type(ePropertyInvalid) , m_numImages(-1) - , m_enumList(NULL) + , m_enumList(nullptr) , m_rangeMin(0) , m_rangeMax(100) , m_step(0) , m_bHardMin(false) , m_bHardMax(false) , m_valueMultiplier(1) - , m_pEnumDBItem(NULL) + , m_pEnumDBItem(nullptr) { if (!pVar) { @@ -110,7 +110,7 @@ namespace Prop m_name = pVar->GetHumanName(); m_enumList = pVar->GetEnumList(); - if (m_enumList != NULL) + if (m_enumList != nullptr) { m_type = ePropertySelection; } @@ -325,7 +325,7 @@ namespace Prop case ePropertyAudioPreloadRequest: return "AudioPreloadRequest"; default: - return 0; + return nullptr; } } } diff --git a/Code/Editor/Util/XmlHistoryManager.cpp b/Code/Editor/Util/XmlHistoryManager.cpp index 3aea041d29..ed92700705 100644 --- a/Code/Editor/Util/XmlHistoryManager.cpp +++ b/Code/Editor/Util/XmlHistoryManager.cpp @@ -76,7 +76,7 @@ const XmlNodeRef& SXmlHistory::GetCurrentVersion(bool* bVersionExist, int* iVers bool SXmlHistory::IsModified() const { int currVersion; - GetCurrentVersion(NULL, &currVersion); + GetCurrentVersion(nullptr, &currVersion); return m_SavedVersion != currVersion; } @@ -94,7 +94,7 @@ void SXmlHistory::FlagAsSaved() if (Exist()) { int currVersion; - GetCurrentVersion(NULL, &currVersion); + GetCurrentVersion(nullptr, &currVersion); m_SavedVersion = currVersion; } } @@ -167,7 +167,7 @@ SXmlHistory* SXmlHistoryGroup::GetHistory(int index) const --index; } } - return it != m_List.end() ? *it : NULL; + return it != m_List.end() ? *it : nullptr; } //////////////////////////////////////////////////////////////////////////// @@ -199,7 +199,7 @@ SXmlHistory* SXmlHistoryGroup::GetHistoryByTypeId(uint32 typeId, int index /*= 0 return pHistory; } } - return NULL; + return nullptr; } //////////////////////////////////////////////////////////////////////////// @@ -246,9 +246,9 @@ int SXmlHistoryGroup::GetHistoryIndex(const SXmlHistory* pHistory) const CXmlHistoryManager::CXmlHistoryManager() : m_CurrentVersion(0) , m_LatestVersion(0) - , m_pExclusiveListener(NULL) + , m_pExclusiveListener(nullptr) , m_RecordNextVersion(false) - , m_pExActiveGroup(NULL) + , m_pExActiveGroup(nullptr) , m_bIsActiveGroupEx(false) { m_pNullGroup = new SXmlHistoryGroup(this, (uint32) - 1); @@ -376,7 +376,7 @@ void CXmlHistoryManager::PrepareForNextVersion() } ///////////////////////////////////////////////////////////////////////////// -void CXmlHistoryManager::RecordNextVersion(SXmlHistory* pHistory, XmlNodeRef newData, const char* undoDesc /*= NULL*/) +void CXmlHistoryManager::RecordNextVersion(SXmlHistory* pHistory, XmlNodeRef newData, const char* undoDesc /*= nullptr*/) { assert(m_RecordNextVersion); RegisterUndoEventHandler(this, pHistory); @@ -405,7 +405,7 @@ void CXmlHistoryManager::ClearHistory(bool flagAsSaved) it->ClearHistory(flagAsSaved); } - SetActiveGroup(NULL); + SetActiveGroup(nullptr); m_CurrentVersion = 0; m_LatestVersion = 0; @@ -451,14 +451,14 @@ SXmlHistoryGroup* CXmlHistoryManager::CreateXmlGroup(uint32 typeId) } ///////////////////////////////////////////////////////////////////////////// -void CXmlHistoryManager::AddXmlGroup(const SXmlHistoryGroup* pGroup, const char* undoDesc /*= NULL*/) +void CXmlHistoryManager::AddXmlGroup(const SXmlHistoryGroup* pGroup, const char* undoDesc /*= nullptr*/) { RecordUndoInternal(undoDesc ? undoDesc : "New XML Group added"); m_HistoryInfoMap[ m_CurrentVersion ].ActiveGroups.push_back(pGroup); NotifyUndoEventListener(IXmlHistoryEventListener::eHET_HistoryGroupAdded, (void*)pGroup); } ///////////////////////////////////////////////////////////////////////////// -void CXmlHistoryManager::RemoveXmlGroup(const SXmlHistoryGroup* pGroup, const char* undoDesc /*= NULL*/) +void CXmlHistoryManager::RemoveXmlGroup(const SXmlHistoryGroup* pGroup, const char* undoDesc /*= nullptr*/) { bool unload = m_HistoryInfoMap[ m_CurrentVersion ].CurrGroup == pGroup; RecordUndoInternal(undoDesc ? undoDesc : "XML Group deleted"); @@ -466,14 +466,14 @@ void CXmlHistoryManager::RemoveXmlGroup(const SXmlHistoryGroup* pGroup, const ch stl::find_and_erase(list, pGroup); if (unload) { - SetActiveGroupInt(NULL); + SetActiveGroupInt(nullptr); } m_HistoryInfoMap[ m_CurrentVersion ].CurrGroup = m_pNullGroup; NotifyUndoEventListener(IXmlHistoryEventListener::eHET_HistoryGroupRemoved, (void*)pGroup); } ///////////////////////////////////////////////////////////////////////////// -void CXmlHistoryManager::SetActiveGroup(const SXmlHistoryGroup* pGroup, const char* displayName /*= NULL*/, const TGroupIndexMap& groupIndex /*= TGroupIndexMap()*/, bool setExternal /*= false*/) +void CXmlHistoryManager::SetActiveGroup(const SXmlHistoryGroup* pGroup, const char* displayName /*= nullptr*/, const TGroupIndexMap& groupIndex /*= TGroupIndexMap()*/, bool setExternal /*= false*/) { TGroupIndexMap userIndex; const SXmlHistoryGroup* pActiveGroup = GetActiveGroup(userIndex); @@ -488,7 +488,7 @@ void CXmlHistoryManager::SetActiveGroup(const SXmlHistoryGroup* pGroup, const ch } } -void CXmlHistoryManager::SetActiveGroupInt(const SXmlHistoryGroup* pGroup, const char* displayName /*= NULL*/, bool bRecordNullUndo /*= false*/, const TGroupIndexMap& groupIndex /*= TGroupIndexMap()*/) +void CXmlHistoryManager::SetActiveGroupInt(const SXmlHistoryGroup* pGroup, const char* displayName /*= nullptr*/, bool bRecordNullUndo /*= false*/, const TGroupIndexMap& groupIndex /*= TGroupIndexMap()*/) { UnloadInt(); @@ -511,7 +511,7 @@ void CXmlHistoryManager::SetActiveGroupInt(const SXmlHistoryGroup* pGroup, const userIndexCount[ (*history)->GetTypeId() ] = 0; } uint32 userindex = userIndexCount[ (*history)->GetTypeId() ]; - IXmlUndoEventHandler* pEventHandler = NULL; + IXmlUndoEventHandler* pEventHandler = nullptr; TGroupIndexMap::const_iterator indexIter = groupIndex.find((*history)->GetTypeId()); if (indexIter == groupIndex.end() || indexIter->second == userindex) { @@ -581,12 +581,12 @@ const SXmlHistoryGroup* CXmlHistoryManager::GetActiveGroup(TGroupIndexMap& currU if (it != m_HistoryInfoMap.end() && pGroup) { currUserIndex = it->second.CurrUserIndex; - return pGroup == m_pNullGroup ? NULL : pGroup; + return pGroup == m_pNullGroup ? nullptr : pGroup; } } currVersion--; } while (currVersion >= 0); - return NULL; + return nullptr; } ///////////////////////////////////////////////////////////////////////////// @@ -796,7 +796,7 @@ SXmlHistory* CXmlHistoryManager::GetLatestHistory(SUndoEventHandlerData& eventHa } currVersion--; } while (currVersion >= 0); - return NULL; + return nullptr; } diff --git a/Code/Editor/Util/XmlHistoryManager.h b/Code/Editor/Util/XmlHistoryManager.h index d894bc7f00..d7aae71939 100644 --- a/Code/Editor/Util/XmlHistoryManager.h +++ b/Code/Editor/Util/XmlHistoryManager.h @@ -23,9 +23,9 @@ public: void AddToHistory(const XmlNodeRef& newXmlVersion); - const XmlNodeRef& Undo(bool* bVersionExist = NULL); + const XmlNodeRef& Undo(bool* bVersionExist = nullptr); const XmlNodeRef& Redo(); - const XmlNodeRef& GetCurrentVersion(bool* bVersionExist = NULL, int* iVersionNumber = NULL) const; + const XmlNodeRef& GetCurrentVersion(bool* bVersionExist = nullptr, int* iVersionNumber = nullptr) const; bool IsModified() const; uint32 GetTypeId() const {return m_typeId; } void FlagAsDeleted(); @@ -93,7 +93,7 @@ public: void RestoreUndoEventHandler(IXmlUndoEventHandler* pEventHandler, uint32 typeId); void PrepareForNextVersion(); - void RecordNextVersion(SXmlHistory* pHistory, XmlNodeRef newData, const char* undoDesc = NULL); + void RecordNextVersion(SXmlHistory* pHistory, XmlNodeRef newData, const char* undoDesc = nullptr); bool IsPreparedForNextVersion() const {return m_RecordNextVersion; } void RegisterEventListener(IXmlHistoryEventListener* pEventListener); @@ -112,11 +112,11 @@ public: // Xml History Groups SXmlHistoryGroup* CreateXmlGroup(uint32 typeId); - void SetActiveGroup(const SXmlHistoryGroup* pGroup, const char* displayName = NULL, const TGroupIndexMap& groupIndex = TGroupIndexMap(), bool setExternal = false); + void SetActiveGroup(const SXmlHistoryGroup* pGroup, const char* displayName = nullptr, const TGroupIndexMap& groupIndex = TGroupIndexMap(), bool setExternal = false); const SXmlHistoryGroup* GetActiveGroup() const; const SXmlHistoryGroup* GetActiveGroup(TGroupIndexMap& currUserIndex /*out*/) const; - void AddXmlGroup(const SXmlHistoryGroup* pGroup, const char* undoDesc = NULL); - void RemoveXmlGroup(const SXmlHistoryGroup* pGroup, const char* undoDesc = NULL); + void AddXmlGroup(const SXmlHistoryGroup* pGroup, const char* undoDesc = nullptr); + void RemoveXmlGroup(const SXmlHistoryGroup* pGroup, const char* undoDesc = nullptr); void DeleteAll(); @@ -156,7 +156,7 @@ private: { SHistoryInfo() : IsNullUndo(false) - , CurrGroup(NULL) + , CurrGroup(nullptr) , HistoryInvalidated(false) {} const SXmlHistoryGroup* CurrGroup; @@ -174,7 +174,7 @@ private: struct SUndoEventHandlerData { SUndoEventHandlerData() - : CurrentData(NULL) {} + : CurrentData(nullptr) {} SXmlHistory* CurrentData; THistoryVersionMap HistoryData; @@ -203,9 +203,9 @@ private: void RecordNullUndo(const TEventHandlerList& eventHandler, const char* desc, bool isNull = true); void ReloadCurrentVersion(const SXmlHistoryGroup* pPrevGroup, int prevVersion); SXmlHistory* GetLatestHistory(SUndoEventHandlerData& eventHandlerData); - void NotifyUndoEventListener(IXmlHistoryEventListener::EHistoryEventType event, void* pData = NULL); + void NotifyUndoEventListener(IXmlHistoryEventListener::EHistoryEventType event, void* pData = nullptr); - void SetActiveGroupInt(const SXmlHistoryGroup* pGroup, const char* displayName = NULL, bool bRecordNullUndo = false, const TGroupIndexMap& groupIndex = TGroupIndexMap()); + void SetActiveGroupInt(const SXmlHistoryGroup* pGroup, const char* displayName = nullptr, bool bRecordNullUndo = false, const TGroupIndexMap& groupIndex = TGroupIndexMap()); void UnloadInt(); void ClearRedo(); diff --git a/Code/Editor/Util/XmlTemplate.cpp b/Code/Editor/Util/XmlTemplate.cpp index 1b0cc6ff6f..8acdd4973f 100644 --- a/Code/Editor/Util/XmlTemplate.cpp +++ b/Code/Editor/Util/XmlTemplate.cpp @@ -89,7 +89,7 @@ void CXmlTemplate::SetValues(const XmlNodeRef& node, XmlNodeRef& toNode) } else { - assert(!"NULL returned from node->GetChild()"); + assert(!"nullptr returned from node->GetChild()"); } } } @@ -125,7 +125,7 @@ bool CXmlTemplate::SetValues(const XmlNodeRef& node, XmlNodeRef& toNode, const X } else { - assert(!"NULL returned from node->GetChild()"); + assert(!"nullptr returned from node->GetChild()"); } } return false; @@ -193,7 +193,7 @@ void CXmlTemplateRegistry::LoadTemplates(const QString& path) XmlNodeRef child; // Construct the full filepath of the current file XmlNodeRef node = XmlHelpers::LoadXmlFromFile((dir + files[k].filename).toUtf8().data()); - if (node != 0 && node->isTag("Templates")) + if (node != nullptr && node->isTag("Templates")) { QString name; for (int i = 0; i < node->getChildCount(); i++) @@ -220,5 +220,5 @@ XmlNodeRef CXmlTemplateRegistry::FindTemplate(const QString& name) { return node; } - return 0; + return nullptr; } diff --git a/Code/Editor/Util/bitarray.h b/Code/Editor/Util/bitarray.h index c7d7f2012a..f55d195fd1 100644 --- a/Code/Editor/Util/bitarray.h +++ b/Code/Editor/Util/bitarray.h @@ -74,7 +74,7 @@ public: void flip() {* p ^= mask; } }; - CBitArray() { m_base = NULL; m_bits = NULL; m_size = 0; m_numBits = 0; }; + CBitArray() { m_base = nullptr; m_bits = nullptr; m_size = 0; m_numBits = 0; }; CBitArray(int numBits) { resize(numBits); }; ~CBitArray() { From 769fd7818911a80b654984072386acb366a031fb Mon Sep 17 00:00:00 2001 From: Nemerle Date: Thu, 5 Aug 2021 16:52:43 +0200 Subject: [PATCH 64/75] Editor code: tidy up BOOLs,NULLs and overrides pt6. A few 'typedefs' replaced by 'using's This shouldn't have any functional changes at all, just c++17 modernization It's a part 6 of a split #2847 Signed-off-by: Nemerle --- Code/Editor/LayoutWnd.h | 2 +- Code/Editor/LevelInfo.cpp | 2 +- Code/Editor/LogFile.cpp | 2 +- Code/Editor/MainWindow.cpp | 38 +++++++------- Code/Editor/NewLevelDialog.cpp | 8 +-- Code/Editor/NewTerrainDialog.cpp | 2 +- Code/Editor/Plugin.cpp | 4 +- Code/Editor/PluginManager.cpp | 18 +++---- Code/Editor/PythonEditorFuncs.cpp | 2 +- Code/Editor/ResizeResolutionDialog.cpp | 2 +- Code/Editor/ResourceSelectorHost.cpp | 2 +- Code/Editor/SelectEAXPresetDlg.cpp | 2 +- Code/Editor/Settings.cpp | 8 +-- Code/Editor/SettingsManager.cpp | 72 +++++++++++++------------- Code/Editor/SettingsManagerDialog.cpp | 2 +- Code/Editor/StartupLogoDialog.cpp | 8 +-- Code/Editor/StringDlg.h | 2 +- Code/Editor/ToolBox.cpp | 14 ++--- Code/Editor/ToolBox.h | 2 +- Code/Editor/ToolsConfigPage.cpp | 6 +-- Code/Editor/UIEnumsDatabase.cpp | 4 +- Code/Editor/UndoDropDown.cpp | 4 +- Code/Editor/ViewManager.cpp | 12 ++--- Code/Editor/ViewManager.h | 2 +- Code/Editor/ViewPane.cpp | 8 +-- Code/Editor/Viewport.cpp | 4 +- Code/Editor/Viewport.h | 10 ++-- Code/Editor/ViewportTitleDlg.cpp | 2 +- Code/Editor/WipFeatureManager.cpp | 20 +++---- Code/Editor/WipFeatureManager.h | 4 +- Code/Editor/WipFeaturesDlg.cpp | 2 +- Code/Editor/WipFeaturesDlg.h | 2 +- 32 files changed, 136 insertions(+), 136 deletions(-) diff --git a/Code/Editor/LayoutWnd.h b/Code/Editor/LayoutWnd.h index 106c32d0a0..918734ebb9 100644 --- a/Code/Editor/LayoutWnd.h +++ b/Code/Editor/LayoutWnd.h @@ -103,7 +103,7 @@ public: static const char* GetConfigGroupName(); CLayoutViewPane* FindViewByClass(const QString& viewClassName); - void BindViewport(CLayoutViewPane* vp, const QString& viewClassName, QWidget* pViewport = NULL); + void BindViewport(CLayoutViewPane* vp, const QString& viewClassName, QWidget* pViewport = nullptr); QString ViewportTypeToClassName(EViewportType viewType); //! Switch 2D viewports. diff --git a/Code/Editor/LevelInfo.cpp b/Code/Editor/LevelInfo.cpp index 5821f9c933..5ad7a6593d 100644 --- a/Code/Editor/LevelInfo.cpp +++ b/Code/Editor/LevelInfo.cpp @@ -93,7 +93,7 @@ void CLevelInfo::ValidateObjects() pObject->Validate(m_pReport); - m_pReport->SetCurrentValidatorObject(NULL); + m_pReport->SetCurrentValidatorObject(nullptr); } CLogFile::WriteLine("Validating Duplicate Objects..."); diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 8c04eab58c..c768f5013b 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -380,7 +380,7 @@ AZ_POP_DISABLE_WARNING ////////////////////////////////////////////////////////////////////// #if defined(AZ_PLATFORM_WINDOWS) - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &DisplayConfig); + EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &DisplayConfig); GetPrivateProfileString("boot.description", "display.drv", "(Unknown graphics card)", szProfileBuffer, sizeof(szProfileBuffer), "system.ini"); diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp index ff322b79ac..3fba3fea6b 100644 --- a/Code/Editor/MainWindow.cpp +++ b/Code/Editor/MainWindow.cpp @@ -160,45 +160,45 @@ public: } } - ~EngineConnectionListener() + ~EngineConnectionListener() override { AzFramework::AssetSystemInfoBus::Handler::BusDisconnect(); AzFramework::EngineConnectionEvents::Bus::Handler::BusDisconnect(); } public: - virtual void Connected([[maybe_unused]] AzFramework::SocketConnection* connection) + void Connected([[maybe_unused]] AzFramework::SocketConnection* connection) override { m_state = EConnectionState::Connected; } - virtual void Connecting([[maybe_unused]] AzFramework::SocketConnection* connection) + void Connecting([[maybe_unused]] AzFramework::SocketConnection* connection) override { m_state = EConnectionState::Connecting; } - virtual void Listening([[maybe_unused]] AzFramework::SocketConnection* connection) + void Listening([[maybe_unused]] AzFramework::SocketConnection* connection) override { m_state = EConnectionState::Listening; } - virtual void Disconnecting([[maybe_unused]] AzFramework::SocketConnection* connection) + void Disconnecting([[maybe_unused]] AzFramework::SocketConnection* connection) override { m_state = EConnectionState::Disconnecting; } - virtual void Disconnected([[maybe_unused]] AzFramework::SocketConnection* connection) + void Disconnected([[maybe_unused]] AzFramework::SocketConnection* connection) override { m_state = EConnectionState::Disconnected; } - virtual void AssetCompilationSuccess(const AZStd::string& assetPath) override + void AssetCompilationSuccess(const AZStd::string& assetPath) override { m_lastAssetProcessorTask = assetPath; } - virtual void AssetCompilationFailed(const AZStd::string& assetPath) override + void AssetCompilationFailed(const AZStd::string& assetPath) override { m_failedJobs.insert(assetPath); } - virtual void CountOfAssetsInQueue(const int& count) override + void CountOfAssetsInQueue(const int& count) override { m_pendingJobsCount = count; } @@ -298,7 +298,7 @@ MainWindow::MainWindow(QWidget* parent) , m_undoStateAdapter(new UndoStackStateAdapter(this)) , m_keyboardCustomization(nullptr) , m_activeView(nullptr) - , m_settings("O3DE", "O3DE") + , m_settings("O3DE", "O3DE") , m_toolbarManager(new ToolbarManager(m_actionManager, this)) , m_assetImporterManager(new AssetImporterManager(this)) , m_levelEditorMenuHandler(new LevelEditorMenuHandler(this, m_viewPaneManager, m_settings)) @@ -573,7 +573,7 @@ void MainWindow::closeEvent(QCloseEvent* event) if (GetIEditor()->GetDocument()) { - GetIEditor()->GetDocument()->SetModifiedFlag(FALSE); + GetIEditor()->GetDocument()->SetModifiedFlag(false); GetIEditor()->GetDocument()->SetModifiedModules(eModifiedNothing); } // Close all edit panels. @@ -581,7 +581,7 @@ void MainWindow::closeEvent(QCloseEvent* event) GetIEditor()->GetObjectManager()->EndEditParams(); // force clean up of all deferred deletes, so that we don't have any issues with windows from plugins not being deleted yet - qApp->sendPostedEvents(0, QEvent::DeferredDelete); + qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete); QMainWindow::closeEvent(event); } @@ -1243,7 +1243,7 @@ void MainWindow::OnEditorNotifyEvent(EEditorNotifyEvent ev) auto cryEdit = CCryEditApp::instance(); if (cryEdit) { - cryEdit->SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName()); + cryEdit->SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName()); } } break; @@ -1252,7 +1252,7 @@ void MainWindow::OnEditorNotifyEvent(EEditorNotifyEvent ev) auto cryEdit = CCryEditApp::instance(); if (cryEdit) { - cryEdit->SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), 0); + cryEdit->SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), nullptr); } } break; @@ -1351,8 +1351,8 @@ void MainWindow::ResetAutoSaveTimers(bool bForceInit) { delete m_autoRemindTimer; } - m_autoSaveTimer = 0; - m_autoRemindTimer = 0; + m_autoSaveTimer = nullptr; + m_autoRemindTimer = nullptr; if (bForceInit) { @@ -1389,7 +1389,7 @@ void MainWindow::ResetBackgroundUpdateTimer() if (m_backgroundUpdateTimer) { delete m_backgroundUpdateTimer; - m_backgroundUpdateTimer = 0; + m_backgroundUpdateTimer = nullptr; } ICVar* pBackgroundUpdatePeriod = gEnv->pConsole->GetCVar("ed_backgroundUpdatePeriod"); @@ -1435,7 +1435,7 @@ void MainWindow::OnRefreshAudioSystem() if (QString::compare(sLevelName, "Untitled", Qt::CaseInsensitive) == 0) { - // Rather pass NULL to indicate that no level is loaded! + // Rather pass nullptr to indicate that no level is loaded! sLevelName = QString(); } @@ -1868,7 +1868,7 @@ QWidget* MainWindow::CreateToolbarWidget(int actionId) break; case ID_TOOLBAR_WIDGET_SPACER_RIGHT: w = CreateSpacerRightWidget(); - break; + break; default: qWarning() << Q_FUNC_INFO << "Unknown id " << actionId; return nullptr; diff --git a/Code/Editor/NewLevelDialog.cpp b/Code/Editor/NewLevelDialog.cpp index 7db795333b..29445cef2b 100644 --- a/Code/Editor/NewLevelDialog.cpp +++ b/Code/Editor/NewLevelDialog.cpp @@ -19,7 +19,7 @@ #include // Editor -#include "NewTerrainDialog.h" +#include "NewTerrainDialog.h" AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING #include @@ -54,7 +54,7 @@ private: // CNewLevelDialog dialog -CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/) +CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=nullptr*/) : QDialog(pParent) , m_bUpdate(false) , ui(new Ui::CNewLevelDialog) @@ -69,7 +69,7 @@ CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/) m_bIsResize = false; - + ui->TITLE->setText(tr("Assign a name and location to the new level.")); ui->STATIC1->setText(tr("Location:")); ui->STATIC2->setText(tr("Name:")); @@ -98,7 +98,7 @@ CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/) m_levelFolders = GetLevelsFolder(); m_level = ""; - // First of all, keyboard focus is related to widget tab order, and the default tab order is based on the order in which + // First of all, keyboard focus is related to widget tab order, and the default tab order is based on the order in which // widgets are constructed. Therefore, creating more widgets changes the keyboard focus. That is why setFocus() is called last. // Secondly, using singleShot() allows setFocus() slot of the QLineEdit instance to be invoked right after the event system // is ready to do so. Therefore, it is better to use singleShot() than directly call setFocus(). diff --git a/Code/Editor/NewTerrainDialog.cpp b/Code/Editor/NewTerrainDialog.cpp index 16641ee275..0e66482eb4 100644 --- a/Code/Editor/NewTerrainDialog.cpp +++ b/Code/Editor/NewTerrainDialog.cpp @@ -19,7 +19,7 @@ AZ_POP_DISABLE_WARNING -CNewTerrainDialog::CNewTerrainDialog(QWidget* pParent /*=NULL*/) +CNewTerrainDialog::CNewTerrainDialog(QWidget* pParent /*=nullptr*/) : QDialog(pParent) , m_terrainResolutionIndex(0) , m_terrainUnitsIndex(0) diff --git a/Code/Editor/Plugin.cpp b/Code/Editor/Plugin.cpp index 0fb37c96c7..e73b9daa2c 100644 --- a/Code/Editor/Plugin.cpp +++ b/Code/Editor/Plugin.cpp @@ -133,7 +133,7 @@ IClassDesc* CClassFactory::FindClass(const char* pClassName) const if (!pSubClassName) { - return NULL; + return nullptr; } QString name = QString(pClassName).left(pSubClassName - pClassName); @@ -169,7 +169,7 @@ void CClassFactory::UnregisterClass(const char* pClassName) { IClassDesc* pClassDesc = FindClass(pClassName); - if (pClassDesc == NULL) + if (pClassDesc == nullptr) { return; } diff --git a/Code/Editor/PluginManager.cpp b/Code/Editor/PluginManager.cpp index f03cb54fce..5efd52a97e 100644 --- a/Code/Editor/PluginManager.cpp +++ b/Code/Editor/PluginManager.cpp @@ -18,8 +18,8 @@ #include "Include/IPlugin.h" -typedef IPlugin* (* TPfnCreatePluginInstance)(PLUGIN_INIT_PARAM* pInitParam); -typedef void (* TPfnQueryPluginSettings)(SPluginSettings&); +using TPfnCreatePluginInstance = IPlugin *(*)(PLUGIN_INIT_PARAM *pInitParam); +using TPfnQueryPluginSettings = void (*)(SPluginSettings &); CPluginManager::CPluginManager() { @@ -210,7 +210,7 @@ bool CPluginManager::LoadPlugins(const char* pPathWithMask) continue; } - IPlugin* pPlugin = NULL; + IPlugin* pPlugin = nullptr; PLUGIN_INIT_PARAM sInitParam = { GetIEditor(), @@ -279,7 +279,7 @@ IPlugin* CPluginManager::GetPluginByGUID(const char* pGUID) } } - return NULL; + return nullptr; } IPlugin* CPluginManager::GetPluginByUIID(uint8 iUserInterfaceID) @@ -290,7 +290,7 @@ IPlugin* CPluginManager::GetPluginByUIID(uint8 iUserInterfaceID) if (it == m_uuidPluginMap.end()) { - return NULL; + return nullptr; } return (*it).second; @@ -302,7 +302,7 @@ IUIEvent* CPluginManager::GetEventByIDAndPluginID(uint8 aPluginID, uint8 aEventI // specified by its ID and the user interface ID of the plugin which // created the UI element - IPlugin* pPlugin = NULL; + IPlugin* pPlugin = nullptr; TEventHandlerIt eventIt; TPluginEventIt pluginIt; @@ -310,21 +310,21 @@ IUIEvent* CPluginManager::GetEventByIDAndPluginID(uint8 aPluginID, uint8 aEventI if (!pPlugin) { - return NULL; + return nullptr; } pluginIt = m_pluginEventMap.find(pPlugin); if (pluginIt == m_pluginEventMap.end()) { - return NULL; + return nullptr; } eventIt = (*pluginIt).second.find(aEventID); if (eventIt == (*pluginIt).second.end()) { - return NULL; + return nullptr; } return (*eventIt).second; diff --git a/Code/Editor/PythonEditorFuncs.cpp b/Code/Editor/PythonEditorFuncs.cpp index 93f5f8f10f..2b7bca3b0b 100644 --- a/Code/Editor/PythonEditorFuncs.cpp +++ b/Code/Editor/PythonEditorFuncs.cpp @@ -323,7 +323,7 @@ namespace ////////////////////////////////////////////////////////////////////////// void GetPythonArgumentsVector(const char* pArguments, QStringList& inputArguments) { - if (pArguments == NULL) + if (pArguments == nullptr) { return; } diff --git a/Code/Editor/ResizeResolutionDialog.cpp b/Code/Editor/ResizeResolutionDialog.cpp index ad57650afa..f2a03fb1b2 100644 --- a/Code/Editor/ResizeResolutionDialog.cpp +++ b/Code/Editor/ResizeResolutionDialog.cpp @@ -89,7 +89,7 @@ int ResizeResolutionModel::SizeRow(uint32 dwSize) const // CResizeResolutionDialog dialog -CResizeResolutionDialog::CResizeResolutionDialog(QWidget* pParent /*=NULL*/) +CResizeResolutionDialog::CResizeResolutionDialog(QWidget* pParent /*=nullptr*/) : QDialog(pParent) , m_model(new ResizeResolutionModel(this)) , ui(new Ui::CResizeResolutionDialog) diff --git a/Code/Editor/ResourceSelectorHost.cpp b/Code/Editor/ResourceSelectorHost.cpp index d265b3ffbe..af6c398fe7 100644 --- a/Code/Editor/ResourceSelectorHost.cpp +++ b/Code/Editor/ResourceSelectorHost.cpp @@ -101,7 +101,7 @@ public: } private: - typedef std::map > TTypeMap; + using TTypeMap = std::map>; TTypeMap m_typeMap; std::map m_globallySelectedResources; diff --git a/Code/Editor/SelectEAXPresetDlg.cpp b/Code/Editor/SelectEAXPresetDlg.cpp index 4a5ea9b66c..733de8b9cf 100644 --- a/Code/Editor/SelectEAXPresetDlg.cpp +++ b/Code/Editor/SelectEAXPresetDlg.cpp @@ -49,7 +49,7 @@ QString CSelectEAXPresetDlg::GetCurrPreset() const { return m_ui->listView->currentIndex().data().toString(); } - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return false return QString(); } diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp index 8f86c74b25..40d53a340c 100644 --- a/Code/Editor/Settings.cpp +++ b/Code/Editor/Settings.cpp @@ -243,7 +243,7 @@ SEditorSettings::SEditorSettings() gui.nToolbarIconSize = static_cast(AzQtComponents::ToolBar::ToolBarIconSize::Default); - int lfHeight = 8;// -MulDiv(8, GetDeviceCaps(GetDC(NULL), LOGPIXELSY), 72); + int lfHeight = 8;// -MulDiv(8, GetDeviceCaps(GetDC(nullptr), LOGPIXELSY), 72); gui.nDefaultFontHieght = lfHeight; gui.hSystemFont = QFont("Ms Shell Dlg 2", lfHeight, QFont::Normal); gui.hSystemFontBold = QFont("Ms Shell Dlg 2", lfHeight, QFont::Bold); @@ -530,7 +530,7 @@ void SEditorSettings::Save() SaveValue("Settings", "ShowTimeInConsole", bShowTimeInConsole); SaveValue("Settings", "EnableSceneInspector", enableSceneInspector); - + ////////////////////////////////////////////////////////////////////////// // Viewport settings. ////////////////////////////////////////////////////////////////////////// @@ -623,7 +623,7 @@ void SEditorSettings::Save() SaveValue("Settings\\AssetBrowser", "AutoFilterFromViewportSelection", sAssetBrowserSettings.bAutoFilterFromViewportSelection); SaveValue("Settings\\AssetBrowser", "VisibleColumnNames", sAssetBrowserSettings.sVisibleColumnNames); SaveValue("Settings\\AssetBrowser", "ColumnNames", sAssetBrowserSettings.sColumnNames); - + ////////////////////////////////////////////////////////////////////////// // Deep Selection Settings ////////////////////////////////////////////////////////////////////////// @@ -702,7 +702,7 @@ void SEditorSettings::Load() QString strPlaceholderString; // Load settings from registry. LoadValue("Settings", "UndoLevels", undoLevels); - LoadValue("Settings", "UndoSliceOverrideSaveValue", m_undoSliceOverrideSaveValue); + LoadValue("Settings", "UndoSliceOverrideSaveValue", m_undoSliceOverrideSaveValue); LoadValue("Settings", "ShowWelcomeScreenAtStartup", bShowDashboardAtStartup); LoadValue("Settings", "ShowCircularDependencyError", m_showCircularDependencyError); LoadValue("Settings", "LoadLastLevelAtStartup", bAutoloadLastLevelAtStartup); diff --git a/Code/Editor/SettingsManager.cpp b/Code/Editor/SettingsManager.cpp index 82e3eaf1e6..27031ca43e 100644 --- a/Code/Editor/SettingsManager.cpp +++ b/Code/Editor/SettingsManager.cpp @@ -105,7 +105,7 @@ bool CSettingsManager::CreateDefaultLayoutSettingsFile() AZStd::vector CSettingsManager::BuildSettingsList() { - XmlNodeRef root = NULL; + XmlNodeRef root = nullptr; root = m_pSettingsManagerMemoryNode; @@ -132,8 +132,8 @@ void CSettingsManager::BuildSettingsList_Helper(const XmlNodeRef& node, const AZ { for (int i = 0; i < node->getNumAttributes(); ++i) { - const char* key = NULL; - const char* value = NULL; + const char* key = nullptr; + const char* value = nullptr; node->getAttributeByIndex(i, &key, &value); if (!pathToNode.empty()) { @@ -163,7 +163,7 @@ void CSettingsManager::BuildSettingsList_Helper(const XmlNodeRef& node, const AZ result ); } - + } } } @@ -190,7 +190,7 @@ void CSettingsManager::SaveSetting(const QString& path, const QString& attr, con // Spaces in node names not allowed writeAttr.replace(" ", ""); - XmlNodeRef root = NULL; + XmlNodeRef root = nullptr; root = m_pSettingsManagerMemoryNode; @@ -276,11 +276,11 @@ XmlNodeRef CSettingsManager::LoadSetting(const QString& path, const QString& att // Spaces in node names not allowed readAttr.replace(" ", ""); - XmlNodeRef root = NULL; + XmlNodeRef root = nullptr; root = m_pSettingsManagerMemoryNode; - XmlNodeRef tmpNode = NULL; + XmlNodeRef tmpNode = nullptr; if (NeedSettingsNode(path)) { @@ -293,7 +293,7 @@ XmlNodeRef CSettingsManager::LoadSetting(const QString& path, const QString& att if (!tmpNode) { - return 0; + return nullptr; } for (int i = 0; i < strNodes.size(); ++i) @@ -304,13 +304,13 @@ XmlNodeRef CSettingsManager::LoadSetting(const QString& path, const QString& att } else { - return 0; + return nullptr; } } if (!tmpNode->findChild(readAttr.toUtf8().data())) { - return 0; + return nullptr; } else { @@ -360,7 +360,7 @@ void CSettingsManager::AddToolVersion(const QString& toolName, const QString& to return; } - if (stl::find_in_map(m_toolNames, toolName, NULL) == "") + if (stl::find_in_map(m_toolNames, toolName, nullptr) == "") { if (!toolVersion.isEmpty()) { @@ -380,7 +380,7 @@ void CSettingsManager::AddToolName(const QString& toolName, const QString& human return; } - if (stl::find_in_map(m_toolNames, toolName, NULL) == "") + if (stl::find_in_map(m_toolNames, toolName, nullptr) == "") { if (!humanReadableName.isEmpty()) { @@ -499,7 +499,7 @@ void CSettingsManager::GetMatchingLayoutNames(TToolNamesMap& foundTools, XmlNode return; } - TToolNamesMap* toolNames = NULL; + TToolNamesMap* toolNames = nullptr; if (!foundTools.empty()) { @@ -593,11 +593,11 @@ bool CSettingsManager::NeedSettingsNode(const QString& path) { if ((path != EDITOR_LAYOUT_ROOT_NODE) && (path != TOOLBOX_NODE) && (path != TOOLBOXMACROS_NODE)) { - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -605,13 +605,13 @@ void CSettingsManager::SerializeCVars(XmlNodeRef& node, bool bLoad) { int nNumberOfVariables(0); int nCurrentVariable(0); - IConsole* piConsole(NULL); - ICVar* piVariable(NULL); + IConsole* piConsole(nullptr); + ICVar* piVariable(nullptr); std::vector cszVariableNames; - char* szKey(NULL); - char* szValue(NULL); - ICVar* piCVar(NULL); + char* szKey(nullptr); + char* szValue(nullptr); + ICVar* piCVar(nullptr); piConsole = gEnv->pConsole; @@ -622,7 +622,7 @@ void CSettingsManager::SerializeCVars(XmlNodeRef& node, bool bLoad) if (bLoad) { - XmlNodeRef readNode = NULL; + XmlNodeRef readNode = nullptr; XmlNodeRef inputCVarsNode = node->findChild(CVARS_NODE); if (!inputCVarsNode) @@ -649,7 +649,7 @@ void CSettingsManager::SerializeCVars(XmlNodeRef& node, bool bLoad) } else { - XmlNodeRef newCVarNode = NULL; + XmlNodeRef newCVarNode = nullptr; XmlNodeRef oldCVarsNode = node->findChild(CVARS_NODE); if (oldCVarsNode) @@ -660,9 +660,9 @@ void CSettingsManager::SerializeCVars(XmlNodeRef& node, bool bLoad) XmlNodeRef cvarsNode = XmlHelpers::CreateXmlNode(CVARS_NODE); nNumberOfVariables = piConsole->GetNumVisibleVars(); - cszVariableNames.resize(nNumberOfVariables, NULL); + cszVariableNames.resize(nNumberOfVariables, nullptr); - if (piConsole->GetSortedVars((const char**)&cszVariableNames.front(), nNumberOfVariables, NULL) != nNumberOfVariables) + if (piConsole->GetSortedVars((const char**)&cszVariableNames.front(), nNumberOfVariables, nullptr) != nNumberOfVariables) { assert(false); return; @@ -711,8 +711,8 @@ void CSettingsManager::ReadValueStr(XmlNodeRef& sourceNode, const QString& path, // Spaces in node names not allowed readAttr.replace(" ", ""); - XmlNodeRef root = NULL; - XmlNodeRef tmpNode = NULL; + XmlNodeRef root = nullptr; + XmlNodeRef tmpNode = nullptr; if (NeedSettingsNode(path)) { @@ -809,7 +809,7 @@ bool CSettingsManager::IsEventSafe(const SEventLog& event) if (!root) { - return TRUE; + return true; } QString eventName = event.m_eventName; @@ -823,7 +823,7 @@ bool CSettingsManager::IsEventSafe(const SEventLog& event) // Log entry not found, so it is safe to start if (!resNode) { - return TRUE; + return true; } XmlNodeRef callerVersion = resNode->findChild(EVENT_LOG_CALLER_VERSION); @@ -841,15 +841,15 @@ bool CSettingsManager::IsEventSafe(const SEventLog& event) { if (callerVersionStr != GetToolVersion(eventName)) { - return TRUE; + return true; } } // The same version of tool/level found - return FALSE; + return false; } - return TRUE; + return true; } ////////////////////////////////////////////////////////////////////////// @@ -947,15 +947,15 @@ XmlNodeRef CSettingsManager::LoadLogEventSetting(const QString& path, const QStr if (!root) { - return 0; + return nullptr; } - XmlNodeRef tmpNode = NULL; + XmlNodeRef tmpNode = nullptr; tmpNode = root; if (!tmpNode) { - return 0; + return nullptr; } for (int i = 0; i < strNodes.size(); ++i) @@ -966,7 +966,7 @@ XmlNodeRef CSettingsManager::LoadLogEventSetting(const QString& path, const QStr } else { - return 0; + return nullptr; } } @@ -975,7 +975,7 @@ XmlNodeRef CSettingsManager::LoadLogEventSetting(const QString& path, const QStr return tmpNode; } - return 0; + return nullptr; } QString CSettingsManager::GenerateContentHash(XmlNodeRef& node, QString sourceName) diff --git a/Code/Editor/SettingsManagerDialog.cpp b/Code/Editor/SettingsManagerDialog.cpp index 3f1c718b38..f8b720ae55 100644 --- a/Code/Editor/SettingsManagerDialog.cpp +++ b/Code/Editor/SettingsManagerDialog.cpp @@ -84,7 +84,7 @@ void CSettingsManagerDialog::OnReadBtnClick() ui->m_layoutListBox->clear(); TToolNamesMap toolNames; - XmlNodeRef dummyNode = NULL; + XmlNodeRef dummyNode = nullptr; GetIEditor()->GetSettingsManager()->GetMatchingLayoutNames(toolNames, dummyNode, m_importFileStr); diff --git a/Code/Editor/StartupLogoDialog.cpp b/Code/Editor/StartupLogoDialog.cpp index 38d733f8df..d9625aff1a 100644 --- a/Code/Editor/StartupLogoDialog.cpp +++ b/Code/Editor/StartupLogoDialog.cpp @@ -27,14 +27,14 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING ///////////////////////////////////////////////////////////////////////////// // CStartupLogoDialog dialog -CStartupLogoDialog* CStartupLogoDialog::s_pLogoWindow = 0; +CStartupLogoDialog* CStartupLogoDialog::s_pLogoWindow = nullptr; -CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=NULL*/) +CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=nullptr*/) : QWidget(pParent, Qt::Dialog | Qt::FramelessWindowHint) , m_ui(new Ui::StartupLogoDialog) { m_ui->setupUi(this); - + s_pLogoWindow = this; m_backgroundImage = QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg")); @@ -61,7 +61,7 @@ CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopy CStartupLogoDialog::~CStartupLogoDialog() { - s_pLogoWindow = 0; + s_pLogoWindow = nullptr; } void CStartupLogoDialog::SetText(const char* text) diff --git a/Code/Editor/StringDlg.h b/Code/Editor/StringDlg.h index a1ee3908c7..e52cd207d1 100644 --- a/Code/Editor/StringDlg.h +++ b/Code/Editor/StringDlg.h @@ -25,7 +25,7 @@ typedef bool (StringDlgPredicate)(QString input); class StringDlg : public QInputDialog { public: - StringDlg(const QString &title, QWidget* pParent = NULL, bool bFileNameLimitation = false); + StringDlg(const QString &title, QWidget* pParent = nullptr, bool bFileNameLimitation = false); void SetCheckCallback(const std::function& Check) { m_Check = Check; diff --git a/Code/Editor/ToolBox.cpp b/Code/Editor/ToolBox.cpp index 82817e1ff7..bac02d7460 100644 --- a/Code/Editor/ToolBox.cpp +++ b/Code/Editor/ToolBox.cpp @@ -186,7 +186,7 @@ const CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox) const assert(0 <= iIndex && iIndex < m_shelveMacros.size()); return m_shelveMacros[iIndex]; } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -202,7 +202,7 @@ CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox) assert(0 <= iIndex && iIndex < m_shelveMacros.size()); return m_shelveMacros[iIndex]; } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -240,14 +240,14 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in const int macroCount = m_macros.size(); if (macroCount > ID_TOOL_LAST - ID_TOOL_FIRST + 1) { - return NULL; + return nullptr; } for (size_t i = 0; i < macroCount; ++i) { if (QString::compare(m_macros[i]->GetTitle(), title, Qt::CaseInsensitive) == 0) { - return NULL; + return nullptr; } } @@ -264,7 +264,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in const int shelveMacroCount = m_shelveMacros.size(); if (shelveMacroCount > ID_TOOL_SHELVE_LAST - ID_TOOL_SHELVE_FIRST + 1) { - return NULL; + return nullptr; } CToolBoxMacro* pNewTool = new CToolBoxMacro(title); @@ -275,7 +275,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in m_shelveMacros.push_back(pNewTool); return pNewTool; } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -333,7 +333,7 @@ void CToolBoxManager::Load([[maybe_unused]] ActionManager* actionManager) void CToolBoxManager::Load(QString xmlpath, AmazonToolbar* pToolbar, bool bToolbox, ActionManager* actionManager) { XmlNodeRef toolBoxNode = XmlHelpers::LoadXmlFromFile(xmlpath.toUtf8().data()); - if (toolBoxNode == NULL) + if (toolBoxNode == nullptr) { return; } diff --git a/Code/Editor/ToolBox.h b/Code/Editor/ToolBox.h index 0c91305c79..eefc74f791 100644 --- a/Code/Editor/ToolBox.h +++ b/Code/Editor/ToolBox.h @@ -137,7 +137,7 @@ public: CToolBoxMacro* GetMacro(int iIndex, bool bToolbox); //! Get the index of a macro from its title. int GetMacroIndex(const QString& title, bool bToolbox) const; - //! Creates a new macro in the manager. If the title is duplicate, this returns NULL. + //! Creates a new macro in the manager. If the title is duplicate, this returns nullptr. CToolBoxMacro* NewMacro(const QString& title, bool bToolbox, int* newIdx); //! Try to change the title of a macro. If the title is duplicate, the change is aborted and this returns false. bool SetMacroTitle(int index, const QString& title, bool bToolbox); diff --git a/Code/Editor/ToolsConfigPage.cpp b/Code/Editor/ToolsConfigPage.cpp index a2328550e0..bae70f0cfe 100644 --- a/Code/Editor/ToolsConfigPage.cpp +++ b/Code/Editor/ToolsConfigPage.cpp @@ -109,7 +109,7 @@ private: QStringList m_iconFiles; }; -CIconListDialog::CIconListDialog(QWidget* pParent /* = NULL */) +CIconListDialog::CIconListDialog(QWidget* pParent /* = nullptr */) : QDialog(pParent) , m_ui(new Ui::IconListDialog) { @@ -498,7 +498,7 @@ CToolsConfigPage::CToolsConfigPage(QWidget* parent) QKeySequence shortcut(value); m_ui->m_macroShortcutKey->setKeySequence(shortcut); } - + if (m_ui->m_macroShortcutKey->keySequence().count() >= 1) { m_ui->m_assignShortcut->setEnabled(true); @@ -703,7 +703,7 @@ void CToolsConfigPage::OnAssignMacroShortcut() { auto pShortcutMgr = MainWindow::instance()->GetShortcutManager(); - if (pShortcutMgr == NULL) + if (pShortcutMgr == nullptr) { return; } diff --git a/Code/Editor/UIEnumsDatabase.cpp b/Code/Editor/UIEnumsDatabase.cpp index f0496f64e3..b859f54ffa 100644 --- a/Code/Editor/UIEnumsDatabase.cpp +++ b/Code/Editor/UIEnumsDatabase.cpp @@ -59,7 +59,7 @@ void CUIEnumsDatabase::SetEnumStrings(const QString& enumName, const QStringList { int nStringCount = sStringsArray.size(); - CUIEnumsDatabase_SEnum* pEnum = stl::find_in_map(m_enums, enumName, 0); + CUIEnumsDatabase_SEnum* pEnum = stl::find_in_map(m_enums, enumName, nullptr); if (!pEnum) { pEnum = new CUIEnumsDatabase_SEnum; @@ -86,6 +86,6 @@ void CUIEnumsDatabase::SetEnumStrings(const QString& enumName, const QStringList ////////////////////////////////////////////////////////////////////////// CUIEnumsDatabase_SEnum* CUIEnumsDatabase::FindEnum(const QString& enumName) const { - CUIEnumsDatabase_SEnum* pEnum = stl::find_in_map(m_enums, enumName, 0); + CUIEnumsDatabase_SEnum* pEnum = stl::find_in_map(m_enums, enumName, nullptr); return pEnum; } diff --git a/Code/Editor/UndoDropDown.cpp b/Code/Editor/UndoDropDown.cpp index 669c05ecaa..fbe18d5d52 100644 --- a/Code/Editor/UndoDropDown.cpp +++ b/Code/Editor/UndoDropDown.cpp @@ -56,7 +56,7 @@ public: m_manager.AddListener(this); } - virtual ~UndoDropDownListModel() + ~UndoDropDownListModel() override { m_manager.RemoveListener(this); } @@ -81,7 +81,7 @@ public: return m_stackNames[index.row()]; } - void SignalNumUndoRedo(const unsigned int& numUndo, const unsigned int& numRedo) + void SignalNumUndoRedo(const unsigned int& numUndo, const unsigned int& numRedo) override { std::vector fresh; if (UndoRedoDirection::Undo == m_direction && m_stackNames.size() != numUndo) diff --git a/Code/Editor/ViewManager.cpp b/Code/Editor/ViewManager.cpp index 5a3e92a525..d5d932dae1 100644 --- a/Code/Editor/ViewManager.cpp +++ b/Code/Editor/ViewManager.cpp @@ -55,7 +55,7 @@ CViewManager::CViewManager() m_updateRegion.min = Vec3(-100000, -100000, -100000); m_updateRegion.max = Vec3(100000, 100000, 100000); - m_pSelectedView = NULL; + m_pSelectedView = nullptr; m_nGameViewports = 0; m_bGameViewportsUpdated = false; @@ -117,7 +117,7 @@ void CViewManager::UnregisterViewport(CViewport* pViewport) { if (m_pSelectedView == pViewport) { - m_pSelectedView = NULL; + m_pSelectedView = nullptr; } stl::find_and_erase(m_viewports, pViewport); m_bGameViewportsUpdated = false; @@ -137,7 +137,7 @@ CViewport* CViewManager::GetViewport(EViewportType type) const return m_viewports[i]; } } - return 0; + return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -150,7 +150,7 @@ CViewport* CViewManager::GetViewport(const QString& name) const return m_viewports[i]; } } - return 0; + return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -234,7 +234,7 @@ void CViewManager::SelectViewport(CViewport* pViewport) { // Audio: Handle viewport change for listeners - if (m_pSelectedView != NULL && m_pSelectedView != pViewport) + if (m_pSelectedView != nullptr && m_pSelectedView != pViewport) { m_pSelectedView->SetSelected(false); @@ -242,7 +242,7 @@ void CViewManager::SelectViewport(CViewport* pViewport) m_pSelectedView = pViewport; - if (m_pSelectedView != NULL) + if (m_pSelectedView != nullptr) { m_pSelectedView->SetSelected(true); } diff --git a/Code/Editor/ViewManager.h b/Code/Editor/ViewManager.h index 22f9f6804f..b62ece89ac 100644 --- a/Code/Editor/ViewManager.h +++ b/Code/Editor/ViewManager.h @@ -93,7 +93,7 @@ public: ////////////////////////////////////////////////////////////////////////// //! Get current layout window. - //! @return Pointer to the layout window, can be NULL. + //! @return Pointer to the layout window, can be nullptr. virtual CLayoutWnd* GetLayout() const; //! Cycle between different 2D viewports type on same view pane. diff --git a/Code/Editor/ViewPane.cpp b/Code/Editor/ViewPane.cpp index 19b653b865..1d530ece48 100644 --- a/Code/Editor/ViewPane.cpp +++ b/Code/Editor/ViewPane.cpp @@ -159,8 +159,8 @@ CLayoutViewPane::CLayoutViewPane(QWidget* parent) , m_viewportTitleDlg(this) , m_expanderWatcher(new ViewportTitleExpanderWatcher(this, &m_viewportTitleDlg)) { - m_viewport = 0; - m_active = 0; + m_viewport = nullptr; + m_active = false; m_nBorder = VIEW_BORDER; m_bFullscreen = false; @@ -338,7 +338,7 @@ void CLayoutViewPane::DetachViewport() { DisconnectRenderViewportInteractionRequestBus(); OnFOVChanged(gSettings.viewports.fDefaultFov); - m_viewport = 0; + m_viewport = nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -348,7 +348,7 @@ void CLayoutViewPane::ReleaseViewport() { DisconnectRenderViewportInteractionRequestBus(); m_viewport->deleteLater(); - m_viewport = 0; + m_viewport = nullptr; } } diff --git a/Code/Editor/Viewport.cpp b/Code/Editor/Viewport.cpp index 906a60ac47..2cc9c78e4b 100644 --- a/Code/Editor/Viewport.cpp +++ b/Code/Editor/Viewport.cpp @@ -192,7 +192,7 @@ QtViewport::QtViewport(QWidget* parent) m_viewTM.SetIdentity(); m_screenTM.SetIdentity(); - m_pMouseOverObject = 0; + m_pMouseOverObject = nullptr; m_bAdvancedSelectMode = false; @@ -398,7 +398,7 @@ void QtViewport::OnDeactivate() ////////////////////////////////////////////////////////////////////////// void QtViewport::ResetContent() { - m_pMouseOverObject = 0; + m_pMouseOverObject = nullptr; // Need to clear visual object cache. // Right after loading new level, some code(e.g. OnMouseMove) access invalid diff --git a/Code/Editor/Viewport.h b/Code/Editor/Viewport.h index c94a77b06e..0a23d93d0d 100644 --- a/Code/Editor/Viewport.h +++ b/Code/Editor/Viewport.h @@ -113,7 +113,7 @@ public: virtual void AddPostRenderer(IPostRenderer* pPostRenderer) = 0; virtual bool RemovePostRenderer(IPostRenderer* pPostRenderer) = 0; - virtual BOOL DestroyWindow() { return FALSE; } + virtual bool DestroyWindow() { return false; } /** Get type of this viewport. */ @@ -252,7 +252,7 @@ public: virtual void SetCursorString(const QString& str) = 0; virtual void SetFocus() = 0; - virtual void Invalidate(BOOL bErase = 1) = 0; + virtual void Invalidate(bool bErase = 1) = 0; // Is overridden by RenderViewport virtual void SetFOV([[maybe_unused]] float fov) {} @@ -266,8 +266,8 @@ public: void SetViewPane(CLayoutViewPane* viewPane) { m_viewPane = viewPane; } //Child classes can override these to provide extra logic that wraps - //widget rendering. Needed by the RenderViewport to handle raycasts - //from screen-space to world-space. + //widget rendering. Needed by the RenderViewport to handle raycasts + //from screen-space to world-space. virtual void PreWidgetRendering() {} virtual void PostWidgetRendering() {} @@ -346,7 +346,7 @@ public: QString GetName() const; virtual void SetFocus() { setFocus(); } - virtual void Invalidate([[maybe_unused]] BOOL bErase = 1) { update(); } + virtual void Invalidate([[maybe_unused]] bool bErase = 1) { update(); } // Is overridden by RenderViewport virtual void SetFOV([[maybe_unused]] float fov) {} diff --git a/Code/Editor/ViewportTitleDlg.cpp b/Code/Editor/ViewportTitleDlg.cpp index 4d27506929..acc6771e9f 100644 --- a/Code/Editor/ViewportTitleDlg.cpp +++ b/Code/Editor/ViewportTitleDlg.cpp @@ -91,7 +91,7 @@ namespace void ViewportInfoStatusUpdated(int newIndex); private: - void OnViewportInfoDisplayStateChanged(AZ::AtomBridge::ViewportInfoDisplayState state) + void OnViewportInfoDisplayStateChanged(AZ::AtomBridge::ViewportInfoDisplayState state) override { emit ViewportInfoStatusUpdated(static_cast(state)); } diff --git a/Code/Editor/WipFeatureManager.cpp b/Code/Editor/WipFeatureManager.cpp index 6777065c1c..f6fbc7ac93 100644 --- a/Code/Editor/WipFeatureManager.cpp +++ b/Code/Editor/WipFeatureManager.cpp @@ -19,7 +19,7 @@ const char* CWipFeatureManager::kWipFeaturesFilename = "@user@\\Editor\\UI\\WipF #else const char* CWipFeatureManager::kWipFeaturesFilename = "@user@/Editor/UI/WipFeatures.xml"; #endif -CWipFeatureManager* CWipFeatureManager::s_pInstance = NULL; +CWipFeatureManager* CWipFeatureManager::s_pInstance = nullptr; static void WipFeatureVarChange(ICVar* pVar) { @@ -162,7 +162,7 @@ void CWipFeatureManager::Shutdown() { CWipFeatureManager::Instance()->Save(); delete s_pInstance; - s_pInstance = NULL; + s_pInstance = nullptr; } bool CWipFeatureManager::Load(const char* pFilename, bool bClearExisting) @@ -350,7 +350,7 @@ void CWipFeatureManager::ShowFeature(int aFeatureId, bool bShow) if (m_features[aFeatureId].m_pfnUpdateFeature) { - m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, &bShow, NULL, NULL, NULL); + m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, &bShow, nullptr, nullptr, nullptr); } } @@ -360,7 +360,7 @@ void CWipFeatureManager::EnableFeature(int aFeatureId, bool bEnable) if (m_features[aFeatureId].m_pfnUpdateFeature) { - m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, NULL, &bEnable, NULL, NULL); + m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, nullptr, &bEnable, nullptr, nullptr); } } @@ -370,7 +370,7 @@ void CWipFeatureManager::SetFeatureSafeMode(int aFeatureId, bool bSafeMode) if (m_features[aFeatureId].m_pfnUpdateFeature) { - m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, NULL, NULL, &bSafeMode, NULL); + m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, nullptr, nullptr, &bSafeMode, nullptr); } } @@ -380,7 +380,7 @@ void CWipFeatureManager::SetFeatureParams(int aFeatureId, const char* pParams) if (m_features[aFeatureId].m_pfnUpdateFeature) { - m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, NULL, NULL, NULL, pParams); + m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, nullptr, nullptr, nullptr, pParams); } } @@ -392,7 +392,7 @@ void CWipFeatureManager::ShowAllFeatures(bool bShow) if (iter->second.m_pfnUpdateFeature) { - iter->second.m_pfnUpdateFeature(iter->first, &bShow, NULL, NULL, NULL); + iter->second.m_pfnUpdateFeature(iter->first, &bShow, nullptr, nullptr, nullptr); } } } @@ -405,7 +405,7 @@ void CWipFeatureManager::EnableAllFeatures(bool bEnable) if (iter->second.m_pfnUpdateFeature) { - iter->second.m_pfnUpdateFeature(iter->first, NULL, &bEnable, NULL, NULL); + iter->second.m_pfnUpdateFeature(iter->first, nullptr, &bEnable, nullptr, nullptr); } } } @@ -418,7 +418,7 @@ void CWipFeatureManager::SetAllFeaturesSafeMode(bool bSafeMode) if (iter->second.m_pfnUpdateFeature) { - iter->second.m_pfnUpdateFeature(iter->first, NULL, NULL, &bSafeMode, NULL); + iter->second.m_pfnUpdateFeature(iter->first, nullptr, nullptr, &bSafeMode, nullptr); } } } @@ -431,7 +431,7 @@ void CWipFeatureManager::SetAllFeaturesParams(const char* pParams) if (iter->second.m_pfnUpdateFeature) { - iter->second.m_pfnUpdateFeature(iter->first, NULL, NULL, NULL, pParams); + iter->second.m_pfnUpdateFeature(iter->first, nullptr, nullptr, nullptr, pParams); } } } diff --git a/Code/Editor/WipFeatureManager.h b/Code/Editor/WipFeatureManager.h index 52ed364524..cd20f6d591 100644 --- a/Code/Editor/WipFeatureManager.h +++ b/Code/Editor/WipFeatureManager.h @@ -48,7 +48,7 @@ public: static const char* kWipFeaturesFilename; // Used to register a callback function to update the state of features whitin the editor - // pbVisible, pbEnabled, pbSafeMode, pParams - if the pointer is NULL, then that attribute was not changed + // pbVisible, pbEnabled, pbSafeMode, pParams - if the pointer is nullptr, then that attribute was not changed typedef void (* TWipFeatureUpdateCallback)(int aFeatureId, const bool* const pbVisible, const bool* const pbEnabled, const bool* const pbSafeMode, const char* pParams); // wip feature registerer auto create object, used for static auto feature creation with the REGISTER_WIP_FEATURE macro @@ -71,7 +71,7 @@ public: , m_bVisible(true) , m_bEnabled(true) , m_bSafeMode(false) - , m_pfnUpdateFeature(NULL) + , m_pfnUpdateFeature(nullptr) , m_bLoadedFromXml(false) {} diff --git a/Code/Editor/WipFeaturesDlg.cpp b/Code/Editor/WipFeaturesDlg.cpp index 8a5c323fa5..0d0a179539 100644 --- a/Code/Editor/WipFeaturesDlg.cpp +++ b/Code/Editor/WipFeaturesDlg.cpp @@ -152,7 +152,7 @@ public: } }; -CWipFeaturesDlg::CWipFeaturesDlg(QWidget* pParent /*=NULL*/) +CWipFeaturesDlg::CWipFeaturesDlg(QWidget* pParent /*=nullptr*/) : QDialog(pParent) , m_ui(new Ui::WipFeaturesDlg) { diff --git a/Code/Editor/WipFeaturesDlg.h b/Code/Editor/WipFeaturesDlg.h index 03b3654a27..28f4f43958 100644 --- a/Code/Editor/WipFeaturesDlg.h +++ b/Code/Editor/WipFeaturesDlg.h @@ -29,7 +29,7 @@ class CWipFeaturesDlg { Q_OBJECT public: - CWipFeaturesDlg(QWidget* pParent = NULL); // standard constructor + CWipFeaturesDlg(QWidget* pParent = nullptr); // standard constructor virtual ~CWipFeaturesDlg(); private: From 96740ba74d351781d4e808a2c893b0d116629b84 Mon Sep 17 00:00:00 2001 From: Scott Romero <24445312+AMZN-ScottR@users.noreply.github.com> Date: Thu, 5 Aug 2021 13:41:30 -0700 Subject: [PATCH 65/75] [development] installer work - added 'files in use' page and fixed toolset path propagation (#2855) Enable files in use dialog in bootstrap installer to close running o3de tools during uninstall or repair Fixed installer toolset path propagation after variable name change Signed-off-by: AMZN-ScottR 24445312+AMZN-ScottR@users.noreply.github.com --- cmake/Platform/Windows/Packaging/Bootstrapper.wxs | 2 ++ .../Windows/Packaging/BootstrapperTheme.wxl.in | 8 ++++++++ .../Windows/Packaging/BootstrapperTheme.xml.in | 15 +++++++++++++++ cmake/Platform/Windows/Packaging_windows.cmake | 4 ++++ 4 files changed, 29 insertions(+) diff --git a/cmake/Platform/Windows/Packaging/Bootstrapper.wxs b/cmake/Platform/Windows/Packaging/Bootstrapper.wxs index 6971e32ca2..079c20e212 100644 --- a/cmake/Platform/Windows/Packaging/Bootstrapper.wxs +++ b/cmake/Platform/Windows/Packaging/Bootstrapper.wxs @@ -33,6 +33,7 @@ LogoFile="$(var.CPACK_WIX_PRODUCT_LOGO)" ThemeFile="$(var.CPACK_BOOTSTRAP_THEME_FILE).xml" LocalizationFile="$(var.CPACK_BOOTSTRAP_THEME_FILE).wxl" + ShowFilesInUse="yes" ShowVersion="yes" /> @@ -44,6 +45,7 @@ LogoFile="$(var.CPACK_WIX_PRODUCT_LOGO)" ThemeFile="$(var.CPACK_BOOTSTRAP_THEME_FILE).xml" LocalizationFile="$(var.CPACK_BOOTSTRAP_THEME_FILE).wxl" + ShowFilesInUse="yes" ShowVersion="yes" /> diff --git a/cmake/Platform/Windows/Packaging/BootstrapperTheme.wxl.in b/cmake/Platform/Windows/Packaging/BootstrapperTheme.wxl.in index 6c5d16fd49..7d221913d5 100644 --- a/cmake/Platform/Windows/Packaging/BootstrapperTheme.wxl.in +++ b/cmake/Platform/Windows/Packaging/BootstrapperTheme.wxl.in @@ -39,6 +39,14 @@ Setup will install [WixBundleName] on your computer. Click install to continue, Execution Progress &Cancel + + Files In Use + The following applications are using files that need to be modified: + Close the &applications + &Do not close applications, may cause unexpected side effects + &OK + &Cancel + Setup Successful Installation Successfully Completed diff --git a/cmake/Platform/Windows/Packaging/BootstrapperTheme.xml.in b/cmake/Platform/Windows/Packaging/BootstrapperTheme.xml.in index 8d8416539e..b340d23467 100644 --- a/cmake/Platform/Windows/Packaging/BootstrapperTheme.xml.in +++ b/cmake/Platform/Windows/Packaging/BootstrapperTheme.xml.in @@ -70,6 +70,21 @@ + + + #(loc.FilesInUseHeader) + + #(loc.FilesInUseLabel) + + + + + + + + + + #(loc.SuccessHeader) diff --git a/cmake/Platform/Windows/Packaging_windows.cmake b/cmake/Platform/Windows/Packaging_windows.cmake index 7c62a4984c..5bb9928b61 100644 --- a/cmake/Platform/Windows/Packaging_windows.cmake +++ b/cmake/Platform/Windows/Packaging_windows.cmake @@ -17,6 +17,10 @@ else() return() endif() +# IMPORTANT: CPACK_WIX_ROOT is a built-in variable that is required to propagate the path supplied +# via command line down to the cpack internals +set(CPACK_WIX_ROOT ${LY_INSTALLER_WIX_ROOT}) + set(CPACK_GENERATOR WIX) set(_cmake_package_name "cmake-${CPACK_DESIRED_CMAKE_VERSION}-windows-x86_64") From 08c85a40bc0ea2a70cac232fb48f84f445a81708 Mon Sep 17 00:00:00 2001 From: Artur K <96597+nemerle@users.noreply.github.com> Date: Thu, 5 Aug 2021 23:01:45 +0200 Subject: [PATCH 66/75] Fix logic in ReadConnectionSettingsFromSettingsRegistry (#2825) In case an asset platform setting is missing it was supposed to be set to a 'pc' value. Instead it was set to an empty string. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> --- .../AzFramework/Asset/AssetSystemComponentHelper.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp b/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp index 14ce16163a..f9411a1f8d 100644 --- a/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp +++ b/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp @@ -163,7 +163,11 @@ namespace AzFramework AZ_TracePrintfOnce("AssetSystemComponent", "Failed to find asset platform, setting 'pc'\n"); outputConnectionSettings.m_assetPlatform = "pc"; } - outputConnectionSettings.m_assetPlatform = assetsPlatform; + else + { + outputConnectionSettings.m_assetPlatform = assetsPlatform; + } + if (outputConnectionSettings.m_assetPlatform.empty()) { assetsPlatform = AzFramework::OSPlatformToDefaultAssetPlatform(AZ_TRAIT_OS_PLATFORM_CODENAME); From 4d82d9625cc20afcce0ab9fcebd6a7b0c97a683e Mon Sep 17 00:00:00 2001 From: Artur K <96597+nemerle@users.noreply.github.com> Date: Thu, 5 Aug 2021 23:04:19 +0200 Subject: [PATCH 67/75] Fix memory leak in ProcessLauncher::LaunchProcess (#2823) Inner scope numEnvironmentVars was shadowing the outer scope, and prevented env variable memory from being freed. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> --- .../Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp index 51c256a9b3..8deed820d3 100644 --- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp +++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp @@ -269,7 +269,7 @@ namespace AzFramework int numEnvironmentVars = 0; if (processLaunchInfo.m_environmentVariables) { - const int numEnvironmentVars = processLaunchInfo.m_environmentVariables->size(); + numEnvironmentVars = processLaunchInfo.m_environmentVariables->size(); // Adding one more as exec expects the array to have a nullptr as the last element environmentVariables = new char*[numEnvironmentVars + 1]; for (int i = 0; i < numEnvironmentVars; i++) From 7448bccea352b3a6150f9c62b11ff0b9fca836d4 Mon Sep 17 00:00:00 2001 From: Artur K <96597+nemerle@users.noreply.github.com> Date: Thu, 5 Aug 2021 23:10:08 +0200 Subject: [PATCH 68/75] Bunch of small bug fixes (#2813) * fix an error with addr_impl_ref assignment operator Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * chrono duration unary '+' was missing a return Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * HierarchyMenu constructor logic fix Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * at least assert in case of invalid arguments to ring_buffer::insert Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * EditorSettings using incorrect string_view::find result comparison Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> --- Code/Editor/Settings.cpp | 4 ++-- Code/Framework/AzCore/AzCore/std/chrono/types.h | 2 +- Code/Framework/AzCore/AzCore/std/containers/ring_buffer.h | 2 +- Code/Framework/AzCore/AzCore/std/utils.h | 2 +- Gems/LyShine/Code/Editor/HierarchyMenu.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp index ad9996adcd..eef2ca0461 100644 --- a/Code/Editor/Settings.cpp +++ b/Code/Editor/Settings.cpp @@ -1088,7 +1088,7 @@ void SEditorSettings::ConvertPath(const AZStd::string_view sourcePath, AZStd::st AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome SEditorSettings::GetValue(const AZStd::string_view path) { - if (path.find("|") < 0) + if (path.find("|") == AZStd::string_view::npos) { return { AZStd::string("Invalid Path - could not find separator \"|\"") }; } @@ -1106,7 +1106,7 @@ AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome SEditorSettings::Get AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome SEditorSettings::SetValue(const AZStd::string_view path, const AZStd::any& value) { - if (path.find("|") < 0) + if (path.find("|") == AZStd::string_view::npos) { return { AZStd::string("Invalid Path - could not find separator \"|\"") }; } diff --git a/Code/Framework/AzCore/AzCore/std/chrono/types.h b/Code/Framework/AzCore/AzCore/std/chrono/types.h index c86c684426..19ef2c8469 100644 --- a/Code/Framework/AzCore/AzCore/std/chrono/types.h +++ b/Code/Framework/AzCore/AzCore/std/chrono/types.h @@ -211,7 +211,7 @@ namespace AZStd // 20.9.3.2, observer: constexpr rep count() const { return m_rep; } // 20.9.3.3, arithmetic: - constexpr duration operator+() const { *this; } + constexpr duration operator+() const { return *this; } constexpr duration operator-() const { return duration(-m_rep); } constexpr duration& operator++() { ++m_rep; return *this; } constexpr duration operator++(int) { return duration(m_rep++); } diff --git a/Code/Framework/AzCore/AzCore/std/containers/ring_buffer.h b/Code/Framework/AzCore/AzCore/std/containers/ring_buffer.h index 746af8974e..31fbdd85e9 100644 --- a/Code/Framework/AzCore/AzCore/std/containers/ring_buffer.h +++ b/Code/Framework/AzCore/AzCore/std/containers/ring_buffer.h @@ -1056,7 +1056,7 @@ namespace AZStd inline void insert(const iterator& pos, ForwardIterator first, ForwardIterator last, const AZStd::forward_iterator_tag&) { size_type size = AZStd::distance(first, last); - AZSTD_CONTAINER_ASSERT(size >= 0, "AZStd::ring_buffer::insert - there are no elements to insert!"); + AZSTD_CONTAINER_ASSERT(first > last, "AZStd::ring_buffer::insert - there are no elements to insert!"); if (size == 0) { return; diff --git a/Code/Framework/AzCore/AzCore/std/utils.h b/Code/Framework/AzCore/AzCore/std/utils.h index 2d098af55e..0de56cedcb 100644 --- a/Code/Framework/AzCore/AzCore/std/utils.h +++ b/Code/Framework/AzCore/AzCore/std/utils.h @@ -294,7 +294,7 @@ namespace AZStd T& m_v; constexpr addr_impl_ref(T& v) : m_v(v) {} - constexpr addr_impl_ref& operator=(const addr_impl_ref& v) { m_v = v; } + constexpr addr_impl_ref& operator=(const addr_impl_ref& v) { m_v = v; return *this; } constexpr operator T& () const { return m_v; } }; diff --git a/Gems/LyShine/Code/Editor/HierarchyMenu.cpp b/Gems/LyShine/Code/Editor/HierarchyMenu.cpp index f4e1776440..ab0c250434 100644 --- a/Gems/LyShine/Code/Editor/HierarchyMenu.cpp +++ b/Gems/LyShine/Code/Editor/HierarchyMenu.cpp @@ -34,7 +34,7 @@ HierarchyMenu::HierarchyMenu(HierarchyWidget* hierarchy, New_EmptyElement(hierarchy, selectedItems, menu, (showMask & Show::kNew_EmptyElementAtRoot), optionalPos); } - if (showMask & Show::kNew_InstantiateSlice | Show::kNew_InstantiateSliceAtRoot) + if (showMask & (Show::kNew_InstantiateSlice | Show::kNew_InstantiateSliceAtRoot)) { New_ElementFromSlice(hierarchy, selectedItems, menu, (showMask & Show::kNew_InstantiateSliceAtRoot), optionalPos); } From a65b32655817ac6353357037c175e0119cb25d65 Mon Sep 17 00:00:00 2001 From: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Date: Thu, 5 Aug 2021 16:58:57 -0500 Subject: [PATCH 69/75] Fixed the enable-gem command unit test (#2880) * Fixed the enable-gem command unit test The enable-gem unit test would fail if there wasn't an o3de_manifest.json file in the users $HOME/.o3de directory The change now is to patch the call to load the o3de manifest Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Adjustments to the enable-gem command unit test to pass on Linux Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> --- scripts/o3de/tests/unit_test_enable_gem.py | 44 +++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/scripts/o3de/tests/unit_test_enable_gem.py b/scripts/o3de/tests/unit_test_enable_gem.py index 12896a51ba..9165fd5d08 100644 --- a/scripts/o3de/tests/unit_test_enable_gem.py +++ b/scripts/o3de/tests/unit_test_enable_gem.py @@ -57,6 +57,31 @@ TEST_GEM_JSON_PAYLOAD = ''' } ''' +TEST_O3DE_MANIFEST_JSON_PAYLOAD = ''' +{ + "o3de_manifest_name": "testuser", + "origin": "C:/Users/testuser/.o3de", + "default_engines_folder": "C:/Users/testuser/.o3de/Engines", + "default_projects_folder": "C:/Users/testuser/.o3de/Projects", + "default_gems_folder": "C:/Users/testuser/.o3de/Gems", + "default_templates_folder": "C:/Users/testuser/.o3de/Templates", + "default_restricted_folder": "C:/Users/testuser/.o3de/Restricted", + "default_third_party_folder": "C:/Users/testuser/.o3de/3rdParty", + "projects": [ + "D:/MinimalProject" + ], + "external_subdirectories": [], + "templates": [], + "restricted": [], + "repos": [], + "engines": [ + "D:/o3de/o3de" + ], + "engines_path": { + "o3de": "D:/o3de/o3de" + } +} +''' @pytest.fixture(scope='class') def init_enable_gem_data(request): @@ -71,9 +96,9 @@ def init_enable_gem_data(request): class TestEnableGemCommand: @pytest.mark.parametrize("gem_path, project_path, gem_registered_with_project, gem_registered_with_engine," "expected_result", [ - pytest.param(pathlib.PurePath('E:/TestGem'), pathlib.PurePath('E:/TestProject'), False, True, 0), - pytest.param(pathlib.PurePath('E:/TestGem'), pathlib.PurePath('E:/TestProject'), False, False, 0), - pytest.param(pathlib.PurePath('E:/TestGem'), pathlib.PurePath('E:/TestProject'), True, False, 0), + pytest.param(pathlib.PurePath('TestProject/TestGem'), pathlib.PurePath('TestProject'), False, True, 0), + pytest.param(pathlib.PurePath('TestProject/TestGem'), pathlib.PurePath('TestProject'), False, False, 0), + pytest.param(pathlib.PurePath('TestProject/TestGem'), pathlib.PurePath('TestProject'), True, False, 0), ] ) def test_enable_gem_registers_gem_as_well(self, gem_path, project_path, gem_registered_with_project, gem_registered_with_engine, @@ -94,6 +119,11 @@ class TestEnableGemCommand: self.enable_gem.project_data = new_project_data return True + def load_o3de_manifest(manifest_path: pathlib.Path = None) -> dict: + if not manifest_path: + return json.loads(TEST_O3DE_MANIFEST_JSON_PAYLOAD) + return None + def get_project_json_data(json_data: pathlib.Path, project_path: pathlib.Path): return self.enable_gem.project_data @@ -110,7 +140,8 @@ class TestEnableGemCommand: return 0 with patch('pathlib.Path.is_dir', return_value=True) as pathlib_is_dir_patch,\ - patch('pathlib.Path.is_file', return_value=True) as pathlib_is_file_patch,\ + patch('pathlib.Path.is_file', return_value=True) as pathlib_is_file_patch, \ + patch('o3de.manifest.load_o3de_manifest', side_effect=load_o3de_manifest) as load_o3de_manifest_patch, \ patch('o3de.manifest.save_o3de_manifest', side_effect=save_o3de_manifest) as save_o3de_manifest_patch,\ patch('o3de.manifest.get_registered', side_effect=get_registered_path) as get_registered_patch,\ patch('o3de.manifest.get_gem_json_data', side_effect=get_gem_json_data) as get_gem_json_data_patch,\ @@ -123,4 +154,7 @@ class TestEnableGemCommand: assert result == expected_result # If the gem isn't registered with the engine or project already it should now be registered with the project if not gem_registered_with_engine and gem_registered_with_project: - assert gem_path.as_posix() in self.enable_gem.project_data.get('external_subdirectories', []) + # Prepend the project path to each external subdirectory + project_relative_subdirs = map(lambda subdir: (pathlib.Path(project_path) / subdir).as_posix(), + self.enable_gem.project_data.get('external_subdirectories', [])) + assert gem_path.as_posix() in project_relative_subdirs From 72cecfaaae5130a8d0149b0f6f9d25acba2b6b94 Mon Sep 17 00:00:00 2001 From: Cynthia Lin <15116870+synicalsyntax@users.noreply.github.com> Date: Thu, 5 Aug 2021 14:59:09 -0700 Subject: [PATCH 70/75] performance metrics: Upload benchmark results to local index for locally-run builds. (#2816) Signed-off-by: Cynthia Lin --- Tools/LyTestTools/ly_test_tools/benchmark/data_aggregator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tools/LyTestTools/ly_test_tools/benchmark/data_aggregator.py b/Tools/LyTestTools/ly_test_tools/benchmark/data_aggregator.py index 8a62c2e150..b5b75508ec 100644 --- a/Tools/LyTestTools/ly_test_tools/benchmark/data_aggregator.py +++ b/Tools/LyTestTools/ly_test_tools/benchmark/data_aggregator.py @@ -10,6 +10,7 @@ import json from pathlib import Path import time import subprocess +import os from ly_test_tools.mars.filebeat_client import FilebeatClient @@ -21,7 +22,7 @@ class BenchmarkDataAggregator(object): def __init__(self, workspace, logger, test_suite): self.build_dir = workspace.paths.build_directory() self.results_dir = Path(workspace.paths.project(), 'user/Scripts/PerformanceBenchmarks') - self.test_suite = test_suite + self.test_suite = test_suite if os.environ.get('CI') else 'local' self.filebeat_client = FilebeatClient(logger) def _update_pass(self, pass_stats, entry): From 6c22e92db683325249e17a5d4ea6b086fa205dc0 Mon Sep 17 00:00:00 2001 From: Artur K <96597+nemerle@users.noreply.github.com> Date: Fri, 6 Aug 2021 03:10:26 +0200 Subject: [PATCH 71/75] Use lambda instead of AZStd::bind (#2658) Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> --- .../AssetManager/SourceFileRelocator.cpp | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Code/Tools/AssetProcessor/native/AssetManager/SourceFileRelocator.cpp b/Code/Tools/AssetProcessor/native/AssetManager/SourceFileRelocator.cpp index eb0416f125..64e176ffe4 100644 --- a/Code/Tools/AssetProcessor/native/AssetManager/SourceFileRelocator.cpp +++ b/Code/Tools/AssetProcessor/native/AssetManager/SourceFileRelocator.cpp @@ -88,7 +88,7 @@ Please note that only those seed files will get updated that are active for your { scanFolderInfo = nullptr; bool isRelative = AzFramework::StringFunc::Path::IsRelative(normalizedSource.c_str()); - + if (isRelative) { // Relative paths can match multiple files/folders, search each scan folder for a valid match @@ -264,7 +264,7 @@ Please note that only those seed files will get updated that are active for your metaDataFile.m_sourceFileIndex = sourceFileIndex.value(); metadataFiles.emplace_back(metaDataFile); metaDataFileEntries.insert(metadaFileCorrectCase); - } + } } } } @@ -601,7 +601,7 @@ Please note that only those seed files will get updated that are active for your AZ::StringFunc::Path::ReplaceFullName(newDestinationPath, fullFileName.c_str()); } - + if (!AzFramework::StringFunc::Path::IsRelative(newDestinationPath.c_str())) { @@ -1025,14 +1025,14 @@ Please note that only those seed files will get updated that are active for your AZStd::binary_semaphore waitSignal; int errorCount = 0; - AzToolsFramework::SourceControlResponseCallbackBulk callback = AZStd::bind(&HandleSourceControlResult, - AZStd::ref (relocationContainer), - AZStd::ref(waitSignal), - AZStd::ref(errorCount), - static_cast(SCF_OpenByUser), // If a file is moved from A -> B and then again from B -> A, the result is just an "edit", so we're just going to assume success if the file is checked out, regardless of state - true, - AZStd::placeholders::_1, - AZStd::placeholders::_2); + AzToolsFramework::SourceControlResponseCallbackBulk callback = [&](bool success, AZStd::vector info) + { + HandleSourceControlResult( + relocationContainer, waitSignal, errorCount, + SCF_OpenByUser, // If a file is moved from A -> B and then again from B -> A, the result is just an "edit", so we're just going + // to assume success if the file is checked out, regardless of state + true, success, info); + }; AzToolsFramework::SourceControlCommandBus::Broadcast(&AzToolsFramework::SourceControlCommandBus::Events::RequestRenameBulkExtended, @@ -1049,7 +1049,7 @@ Please note that only those seed files will get updated that are active for your { if (relocationInfo.m_operationStatus == SourceFileRelocationStatus::Succeeded || relocationInfo.m_sourceFileIndex == AssetProcessor::SourceFileRelocationInvalidIndex) { - // we do not want to retry if the move operation already succeeded or if it is a source file + // we do not want to retry if the move operation already succeeded or if it is a source file continue; } @@ -1108,7 +1108,7 @@ Please note that only those seed files will get updated that are active for your { if (entry.m_operationStatus == SourceFileRelocationStatus::Succeeded || entry.m_sourceFileIndex == AssetProcessor::SourceFileRelocationInvalidIndex) { - // we do not want to retry if the move operation already succeeded or if it is a source file + // we do not want to retry if the move operation already succeeded or if it is a source file continue; } @@ -1224,7 +1224,7 @@ Please note that only those seed files will get updated that are active for your m_stateData->QuerySourceByProductID(productDependency.m_productPK, [this, &sourceName, &scanPath](AzToolsFramework::AssetDatabase::SourceDatabaseEntry& entry) { sourceName = entry.m_sourceName; - + m_stateData->QueryScanFolderByScanFolderID(entry.m_scanFolderPK, [&scanPath](AzToolsFramework::AssetDatabase::ScanFolderDatabaseEntry& entry) { scanPath = entry.m_scanFolder; From e193e5b3538bc4c7eaade2ab1232f6502f7c9dc3 Mon Sep 17 00:00:00 2001 From: Artur K <96597+nemerle@users.noreply.github.com> Date: Fri, 6 Aug 2021 03:15:37 +0200 Subject: [PATCH 72/75] EnvironmentVariableHolder: reduce the size of template instantiation. (#2857) * EnvironmentVariableHolder: reduce the size of template instantiation. Move almost all destruction logic to EnvironmentVariableHolderBase::UnregisterAndDestroy. Specialized templates have DestructDispatchNoLock instead that can either destroy the held value, or the holder itself. UnregisterAndDestroy has been moved to the cpp file. All of these changes reduce the profile build time and size on linux Here, the size of bin/profile goes down by ~200MB. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Requested changes/fixups. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Use scoped_lock to simplify mutex management. Updated comments. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Hopefully a fix for env variables released at a wrong time Conditional was using incorrect variable Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Comment fixup Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Missing negation in conditional Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Cleanup the internal logic in UnregisterAndDestroy Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> --- .../AzCore/AzCore/Module/Environment.cpp | 39 +++++++- .../AzCore/AzCore/Module/Environment.h | 92 ++++++------------- 2 files changed, 67 insertions(+), 64 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Module/Environment.cpp b/Code/Framework/AzCore/AzCore/Module/Environment.cpp index f3a3533f4a..bec530e2d1 100644 --- a/Code/Framework/AzCore/AzCore/Module/Environment.cpp +++ b/Code/Framework/AzCore/AzCore/Module/Environment.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace AZ { @@ -75,6 +76,42 @@ namespace AZ bool operator==(const OSStdAllocator& a, const OSStdAllocator& b) { (void)a; (void)b; return true; } bool operator!=(const OSStdAllocator& a, const OSStdAllocator& b) { (void)a; (void)b; return false; } + void EnvironmentVariableHolderBase::UnregisterAndDestroy(DestructFunc destruct, bool moduleRelease) + { + const bool releaseByUseCount = (--m_useCount == 0); + // We take over the lock, and release it before potentially destroying/freeing ourselves + { + AZStd::scoped_lock envLockHolder(AZStd::adopt_lock, m_mutex); + const bool releaseByModule = (moduleRelease && !m_canTransferOwnership && m_moduleOwner == AZ::Environment::GetModuleId()); + + if (!releaseByModule && !releaseByUseCount) + { + return; + } + // if the environment that created us is gone the owner can be null + // which means (assuming intermodule allocator) that the variable is still alive + // but can't be found as it's not part of any environment. + if (m_environmentOwner) + { + m_environmentOwner->RemoveVariable(m_guid); + m_environmentOwner = nullptr; + } + if (m_isConstructed) + { + destruct(this, DestroyTarget::Member); // destruct the value + } + } + // m_mutex is no longer held here, envLockHolder has released it above. + if (releaseByUseCount) + { + // m_mutex is unlocked before this is deleted + Environment::AllocatorInterface* allocator = m_allocator; + // Call child class dtor and clear the memory + destruct(this, DestroyTarget::Self); + allocator->DeAllocate(this); + } + } + // instance of the environment EnvironmentInterface* EnvironmentInterface::s_environment = nullptr; @@ -110,7 +147,7 @@ namespace AZ #ifdef AZ_ENVIRONMENT_VALIDATE_ON_EXIT AZ_Assert(m_numAttached == 0, "We should not delete an environment while there are %d modules attached! Unload all DLLs first!", m_numAttached); #endif - + for (auto variableIt : m_variableMap) { EnvironmentVariableHolderBase* holder = reinterpret_cast(variableIt.second); diff --git a/Code/Framework/AzCore/AzCore/Module/Environment.h b/Code/Framework/AzCore/AzCore/Module/Environment.h index b0711b1bbe..e87ff81446 100644 --- a/Code/Framework/AzCore/AzCore/Module/Environment.h +++ b/Code/Framework/AzCore/AzCore/Module/Environment.h @@ -200,6 +200,11 @@ namespace AZ class EnvironmentVariableHolderBase { friend class EnvironmentImpl; + protected: + enum class DestroyTarget { + Member, + Self + }; public: EnvironmentVariableHolderBase(u32 guid, AZ::Internal::EnvironmentInterface* environmentOwner, bool canOwnershipTransfer, Environment::AllocatorInterface* allocator) : m_environmentOwner(environmentOwner) @@ -217,12 +222,21 @@ namespace AZ return m_isConstructed; } + bool IsOwner() const + { + return m_moduleOwner == Environment::GetModuleId(); + } + u32 GetId() const { return m_guid; } - protected: + using DestructFunc = void (*)(EnvironmentVariableHolderBase *, DestroyTarget); + // Assumes the m_mutex is already locked. + // On return m_mutex is in an unlocked state. + void UnregisterAndDestroy(DestructFunc destruct, bool moduleRelease); + AZ::Internal::EnvironmentInterface* m_environmentOwner; ///< Used to know which environment we should use to free the variable if we can't transfer ownership void* m_moduleOwner; ///< Used when the variable can't transfered across module and we need to destruct the variable when the module is going away bool m_canTransferOwnership; ///< True if variable can be allocated in one module and freed in other. Usually true for POD types when they share allocator. @@ -242,41 +256,29 @@ namespace AZ memset(&m_value, 0, sizeof(T)); } - template + template void ConstructImpl(const AZStd::false_type& /* AZStd::has_trivial_constructor */, Args&&... args) { // Construction of non-trivial types is left up to the type's constructor. new(&m_value) T(AZStd::forward(args)...); } - - void DestructImpl(const AZStd::true_type& /* AZStd::is_trivially_destructible */) + static void DestructDispatchNoLock(EnvironmentVariableHolderBase *base, DestroyTarget selfDestruct) { - // do nothing - } - - void DestructImpl(const AZStd::false_type& /* AZStd::is_trivially_destructible */) - { - reinterpret_cast(&m_value)->~T(); - } - - // Assumes the lock is already held - void UnregisterAndDestruct() - { - // if the environment that created us is gone the owner can be null - // which means (assuming intermodule allocator) that the variable is still alive - // but can't be found as it's not part of any environment. - if (m_environmentOwner) + auto *self = reinterpret_cast(base); + if (selfDestruct == DestroyTarget::Self) { - m_environmentOwner->RemoveVariable(m_guid); - m_environmentOwner = nullptr; + self->~EnvironmentVariableHolder(); + return; } - if (m_isConstructed) + AZ_Assert(self->m_isConstructed, "Variable is not constructed. Please check your logic and guard if needed!"); + self->m_isConstructed = false; + self->m_moduleOwner = nullptr; + if constexpr(!AZStd::is_trivially_destructible_v) { - DestructNoLock(); + reinterpret_cast(&self->m_value)->~T(); } } - public: EnvironmentVariableHolder(u32 guid, bool isOwnershipTransfer, Environment::AllocatorInterface* allocator) : EnvironmentVariableHolderBase(guid, Environment::GetInstance(), isOwnershipTransfer, allocator) @@ -287,12 +289,6 @@ namespace AZ { AZ_Assert(!m_isConstructed, "To get the destructor we should have already destructed the variable!"); } - - bool IsOwner() const - { - return m_moduleOwner == Environment::GetModuleId(); - } - void AddRef() { AZStd::lock_guard lock(m_mutex); @@ -303,30 +299,8 @@ namespace AZ void Release() { m_mutex.lock(); - - if (--s_moduleUseCount == 0) - { - if (!m_canTransferOwnership && m_moduleOwner == AZ::Environment::GetModuleId()) - { - UnregisterAndDestruct(); - } - } - - if (--m_useCount == 0) - { - UnregisterAndDestruct(); - - // unlock before this is deleted - m_mutex.unlock(); - - Environment::AllocatorInterface* allocator = m_allocator; - // Call dtor and clear the memory - this->~EnvironmentVariableHolder(); - allocator->DeAllocate(this); - return; - } - - m_mutex.unlock(); + const bool moduleRelease = (--s_moduleUseCount == 0); + UnregisterAndDestroy(DestructDispatchNoLock, moduleRelease); } void Construct() @@ -352,18 +326,10 @@ namespace AZ } } - void DestructNoLock() - { - AZ_Assert(m_isConstructed, "Variable is not constructed. Please check your logic and guard if needed!"); - m_isConstructed = false; - m_moduleOwner = nullptr; - DestructImpl(typename AZStd::is_trivially_destructible::type()); - } - void Destruct() { AZStd::lock_guard lock(m_mutex); - DestructNoLock(); + DestructDispatchNoLock(this, DestroyTarget::Member); } // variable storage From 6b2452379f4807fe6abab60eda76fbb539b77f0a Mon Sep 17 00:00:00 2001 From: "Tom \"spot\" Callaway" <72474383+spotaws@users.noreply.github.com> Date: Thu, 5 Aug 2021 21:18:31 -0400 Subject: [PATCH 73/75] pull CryCommon/ISystem.h include out of _RELEASE conditional (#2633) Signed-off-by: Tom spot Callaway --- Gems/LyShine/Code/Source/LyShineDebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/LyShine/Code/Source/LyShineDebug.h b/Gems/LyShine/Code/Source/LyShineDebug.h index 11f48a1e32..84b4d1b4a5 100644 --- a/Gems/LyShine/Code/Source/LyShineDebug.h +++ b/Gems/LyShine/Code/Source/LyShineDebug.h @@ -12,9 +12,9 @@ #include #include +#endif #include -#endif //////////////////////////////////////////////////////////////////////////////////////////////////// //! Class for drawing test displays for testing the LyShine functionality From 0f58d7394eaf8402b322663c2993062b9c23b393 Mon Sep 17 00:00:00 2001 From: greerdv Date: Fri, 6 Aug 2021 11:05:31 +0100 Subject: [PATCH 74/75] fixes #2544, fixes all doc links for physx, cloth, blast and white box Signed-off-by: greerdv --- Gems/Blast/Code/Source/Editor/EditorBlastFamilyComponent.cpp | 2 +- Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp | 2 +- Gems/NvCloth/Code/Source/Components/EditorClothComponent.cpp | 2 +- Gems/PhysX/Code/Editor/CollisionFilteringWidget.cpp | 2 +- Gems/PhysX/Code/Editor/PvdWidget.cpp | 2 +- Gems/PhysX/Code/Editor/SettingsWidget.cpp | 2 +- Gems/PhysX/Code/Source/EditorBallJointComponent.cpp | 1 + Gems/PhysX/Code/Source/EditorColliderComponent.cpp | 2 +- Gems/PhysX/Code/Source/EditorFixedJointComponent.cpp | 1 + Gems/PhysX/Code/Source/EditorForceRegionComponent.cpp | 2 +- Gems/PhysX/Code/Source/EditorHingeJointComponent.cpp | 1 + Gems/PhysX/Code/Source/EditorRigidBodyComponent.cpp | 2 +- Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp | 1 + Gems/PhysX/Code/Source/NameConstants.cpp | 2 +- .../Components/EditorCharacterControllerComponent.cpp | 1 + .../Components/EditorCharacterGameplayComponent.cpp | 1 + .../Code/Source/PhysXCharacters/Components/RagdollComponent.cpp | 1 + .../Code/Source/Components/EditorWhiteBoxColliderComponent.cpp | 2 +- Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp | 2 +- 19 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Gems/Blast/Code/Source/Editor/EditorBlastFamilyComponent.cpp b/Gems/Blast/Code/Source/Editor/EditorBlastFamilyComponent.cpp index 76a40db66e..58f28ed32a 100644 --- a/Gems/Blast/Code/Source/Editor/EditorBlastFamilyComponent.cpp +++ b/Gems/Blast/Code/Source/Editor/EditorBlastFamilyComponent.cpp @@ -38,7 +38,7 @@ namespace Blast ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) ->Attribute( AZ::Edit::Attributes::HelpPageURL, - "https://o3de.org/docs/user-guide/components/reference/blast-family/") + "https://o3de.org/docs/user-guide/components/reference/destruction/blast-family/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement( AZ::Edit::UIHandlers::Default, &EditorBlastFamilyComponent::m_blastAsset, "Blast asset", diff --git a/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp b/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp index 27e57a569e..23ec5ae524 100644 --- a/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp +++ b/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp @@ -61,7 +61,7 @@ namespace Blast ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) ->Attribute( AZ::Edit::Attributes::HelpPageURL, - "https://o3de.org/docs/user-guide/components/reference/blast-family-mesh-data/") + "https://o3de.org/docs/user-guide/components/reference/destruction/blast-family-mesh-data/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement( AZ::Edit::UIHandlers::CheckBox, &EditorBlastMeshDataComponent::m_showMeshAssets, diff --git a/Gems/NvCloth/Code/Source/Components/EditorClothComponent.cpp b/Gems/NvCloth/Code/Source/Components/EditorClothComponent.cpp index f57cc0d171..113d660b32 100644 --- a/Gems/NvCloth/Code/Source/Components/EditorClothComponent.cpp +++ b/Gems/NvCloth/Code/Source/Components/EditorClothComponent.cpp @@ -48,7 +48,7 @@ namespace NvCloth ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Cloth.svg") ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Cloth.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) - ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/cloth/") + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/cloth/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->UIElement(AZ::Edit::UIHandlers::CheckBox, "Simulate in editor", diff --git a/Gems/PhysX/Code/Editor/CollisionFilteringWidget.cpp b/Gems/PhysX/Code/Editor/CollisionFilteringWidget.cpp index f9de067007..4d581622ed 100644 --- a/Gems/PhysX/Code/Editor/CollisionFilteringWidget.cpp +++ b/Gems/PhysX/Code/Editor/CollisionFilteringWidget.cpp @@ -18,7 +18,7 @@ namespace PhysX namespace Editor { static const char* const s_collisionFilteringLink = "Learn more about configuring collision filtering."; - static const char* const s_collisionFilteringAddress = "configuration/collision"; + static const char* const s_collisionFilteringAddress = "configuring/configuration-collision-layers"; CollisionFilteringWidget::CollisionFilteringWidget(QWidget* parent) : QWidget(parent) diff --git a/Gems/PhysX/Code/Editor/PvdWidget.cpp b/Gems/PhysX/Code/Editor/PvdWidget.cpp index 41af8f08d8..27f1410ce5 100644 --- a/Gems/PhysX/Code/Editor/PvdWidget.cpp +++ b/Gems/PhysX/Code/Editor/PvdWidget.cpp @@ -19,7 +19,7 @@ namespace PhysX namespace Editor { static const char* const s_pvdDocumentationLink = "Learn more about the PhysX Visual Debugger (PVD)."; - static const char* const s_pvdDocumentationAddress = "configuration/debugger"; + static const char* const s_pvdDocumentationAddress = "configuring/configuration-debugger"; PvdWidget::PvdWidget(QWidget* parent) : QWidget(parent) diff --git a/Gems/PhysX/Code/Editor/SettingsWidget.cpp b/Gems/PhysX/Code/Editor/SettingsWidget.cpp index 01ee273260..39eb6ae9d8 100644 --- a/Gems/PhysX/Code/Editor/SettingsWidget.cpp +++ b/Gems/PhysX/Code/Editor/SettingsWidget.cpp @@ -19,7 +19,7 @@ namespace PhysX namespace Editor { static const char* const s_settingsDocumentationLink = "Learn more about configuring PhysX"; - static const char* const s_settingsDocumentationAddress = "configuration/global"; + static const char* const s_settingsDocumentationAddress = "configuring/configuration-global"; SettingsWidget::SettingsWidget(QWidget* parent) : QWidget(parent) diff --git a/Gems/PhysX/Code/Source/EditorBallJointComponent.cpp b/Gems/PhysX/Code/Source/EditorBallJointComponent.cpp index 737f06a62b..d196b4644d 100644 --- a/Gems/PhysX/Code/Source/EditorBallJointComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorBallJointComponent.cpp @@ -36,6 +36,7 @@ namespace PhysX ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Category, "PhysX") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/ball-joint/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement(0, &EditorBallJointComponent::m_swingLimit, "Swing Limit", "Limitations for the swing (Y and Z axis) about joint") ->DataElement(AZ::Edit::UIHandlers::Default, &EditorBallJointComponent::m_componentModeDelegate, "Component Mode", "Ball Joint Component Mode") diff --git a/Gems/PhysX/Code/Source/EditorColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorColliderComponent.cpp index 1409760742..41db7d71ec 100644 --- a/Gems/PhysX/Code/Source/EditorColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorColliderComponent.cpp @@ -188,7 +188,7 @@ namespace PhysX ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/PhysXCollider.svg") ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/PhysXCollider.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) - ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx-collider/") + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/collider/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement(AZ::Edit::UIHandlers::Default, &EditorColliderComponent::m_configuration, "Collider Configuration", "Configuration of the collider") ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) diff --git a/Gems/PhysX/Code/Source/EditorFixedJointComponent.cpp b/Gems/PhysX/Code/Source/EditorFixedJointComponent.cpp index 24ae6dbf6a..bf5af6b78d 100644 --- a/Gems/PhysX/Code/Source/EditorFixedJointComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorFixedJointComponent.cpp @@ -34,6 +34,7 @@ namespace PhysX ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Category, "PhysX") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/fixed-joint/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement(AZ::Edit::UIHandlers::Default, &EditorFixedJointComponent::m_componentModeDelegate, "Component Mode", "Fixed Joint Component Mode") ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) diff --git a/Gems/PhysX/Code/Source/EditorForceRegionComponent.cpp b/Gems/PhysX/Code/Source/EditorForceRegionComponent.cpp index d2c6e64633..610a0a9b2e 100644 --- a/Gems/PhysX/Code/Source/EditorForceRegionComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorForceRegionComponent.cpp @@ -170,7 +170,7 @@ namespace PhysX ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/ForceVolume.svg") ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/ForceVolume.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) - ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx-force-region/") + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/force-region/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->Attribute(AZ::Edit::Attributes::RequiredService, AZ_CRC("PhysXTriggerService", 0x3a117d7b)) ->DataElement(AZ::Edit::UIHandlers::Default, &EditorForceRegionComponent::m_visibleInEditor, "Visible", "Always show the component in viewport") diff --git a/Gems/PhysX/Code/Source/EditorHingeJointComponent.cpp b/Gems/PhysX/Code/Source/EditorHingeJointComponent.cpp index f82cb8bb47..6676b9865e 100644 --- a/Gems/PhysX/Code/Source/EditorHingeJointComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorHingeJointComponent.cpp @@ -36,6 +36,7 @@ namespace PhysX ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Category, "PhysX") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/hinge-joint/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement(0, &EditorHingeJointComponent::m_angularLimit, "Angular Limit", "Limitations for the rotation about hinge axis") ->DataElement(AZ::Edit::UIHandlers::Default, &EditorHingeJointComponent::m_componentModeDelegate, "Component Mode", "Hinge Joint Component Mode") diff --git a/Gems/PhysX/Code/Source/EditorRigidBodyComponent.cpp b/Gems/PhysX/Code/Source/EditorRigidBodyComponent.cpp index bd7c49a0a7..ce812a9f31 100644 --- a/Gems/PhysX/Code/Source/EditorRigidBodyComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorRigidBodyComponent.cpp @@ -330,7 +330,7 @@ namespace PhysX ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/PhysXRigidBody.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx-rigid-body-physics/") + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/rigid-body-physics/") ->DataElement(0, &EditorRigidBodyComponent::m_config, "Configuration", "Configuration for rigid body physics.") ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorRigidBodyComponent::CreateEditorWorldRigidBody) diff --git a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp index 0e9a1ab8ee..7ff62e0fc6 100644 --- a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp @@ -85,6 +85,7 @@ namespace PhysX ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/PhysXCollider.svg") ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/PhysXCollider.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/shape-collider/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement(AZ::Edit::UIHandlers::Default, &EditorShapeColliderComponent::m_colliderConfig, "Collider configuration", "Configuration of the collider") diff --git a/Gems/PhysX/Code/Source/NameConstants.cpp b/Gems/PhysX/Code/Source/NameConstants.cpp index 285271edf7..5f311769b8 100644 --- a/Gems/PhysX/Code/Source/NameConstants.cpp +++ b/Gems/PhysX/Code/Source/NameConstants.cpp @@ -14,7 +14,7 @@ namespace PhysX { const AZStd::string& GetPhysXDocsRoot() { - static const AZStd::string val = "https://o3de.org/docs/user-guide/interactivity/physics/"; + static const AZStd::string val = "https://o3de.org/docs/user-guide/interactivity/physics/nvidia-physx/"; return val; } } // namespace UXNameConstants diff --git a/Gems/PhysX/Code/Source/PhysXCharacters/Components/EditorCharacterControllerComponent.cpp b/Gems/PhysX/Code/Source/PhysXCharacters/Components/EditorCharacterControllerComponent.cpp index d58952858d..4e24067dbf 100644 --- a/Gems/PhysX/Code/Source/PhysXCharacters/Components/EditorCharacterControllerComponent.cpp +++ b/Gems/PhysX/Code/Source/PhysXCharacters/Components/EditorCharacterControllerComponent.cpp @@ -99,6 +99,7 @@ namespace PhysX ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/PhysXCharacter.svg") ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/PhysXCharacter.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/character-controller/") ->DataElement(AZ::Edit::UIHandlers::Default, &EditorCharacterControllerComponent::m_configuration, "Configuration", "Configuration for the character controller") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) diff --git a/Gems/PhysX/Code/Source/PhysXCharacters/Components/EditorCharacterGameplayComponent.cpp b/Gems/PhysX/Code/Source/PhysXCharacters/Components/EditorCharacterGameplayComponent.cpp index 3bc2b39ebf..81d158d81c 100644 --- a/Gems/PhysX/Code/Source/PhysXCharacters/Components/EditorCharacterGameplayComponent.cpp +++ b/Gems/PhysX/Code/Source/PhysXCharacters/Components/EditorCharacterGameplayComponent.cpp @@ -49,6 +49,7 @@ namespace PhysX ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/PhysXCharacter.svg") ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/PhysXCharacter.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/character-gameplay/") ->DataElement(AZ::Edit::UIHandlers::Default, &EditorCharacterGameplayComponent::m_gameplayConfig, "Gameplay Configuration", "Gameplay Configuration") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) diff --git a/Gems/PhysX/Code/Source/PhysXCharacters/Components/RagdollComponent.cpp b/Gems/PhysX/Code/Source/PhysXCharacters/Components/RagdollComponent.cpp index 844cf65707..6fa3bdbffd 100644 --- a/Gems/PhysX/Code/Source/PhysXCharacters/Components/RagdollComponent.cpp +++ b/Gems/PhysX/Code/Source/PhysXCharacters/Components/RagdollComponent.cpp @@ -88,6 +88,7 @@ namespace PhysX ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/PhysXRagdoll.svg") ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/PhysXRagdoll.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) + ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/physx/ragdoll/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement(AZ::Edit::UIHandlers::Default, &RagdollComponent::m_positionIterations, "Position Iteration Count", "A higher iteration count generally improves fidelity at the cost of performance, but note that very high " diff --git a/Gems/WhiteBox/Code/Source/Components/EditorWhiteBoxColliderComponent.cpp b/Gems/WhiteBox/Code/Source/Components/EditorWhiteBoxColliderComponent.cpp index d502194126..c22be6f072 100644 --- a/Gems/WhiteBox/Code/Source/Components/EditorWhiteBoxColliderComponent.cpp +++ b/Gems/WhiteBox/Code/Source/Components/EditorWhiteBoxColliderComponent.cpp @@ -44,7 +44,7 @@ namespace WhiteBox ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) ->Attribute( AZ::Edit::Attributes::HelpPageURL, - "https://o3de.org/docs/user-guide/components/reference/white-box-collider/") + "https://o3de.org/docs/user-guide/components/reference/shape/white-box-collider/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement( AZ::Edit::UIHandlers::Default, &EditorWhiteBoxColliderComponent::m_physicsColliderConfiguration, diff --git a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp index 5448c5c123..ad59da63d5 100644 --- a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp +++ b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp @@ -196,7 +196,7 @@ namespace WhiteBox ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/WhiteBox.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c)) ->Attribute( - AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/white-box/") + AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/shape/white-box/") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->DataElement( AZ::Edit::UIHandlers::ComboBox, &EditorWhiteBoxComponent::m_defaultShape, "Default Shape", From ff8c4dce00f77d78875380ceeeb037d45bbb3b76 Mon Sep 17 00:00:00 2001 From: hultonha <82228511+hultonha@users.noreply.github.com> Date: Fri, 6 Aug 2021 12:50:31 +0100 Subject: [PATCH 75/75] Ensure we disconnect from EditorInteractionSystemViewportSelectionRequestBus while recreating m_interactionRequests (#2884) Fixes a crash while selecting an entity in the viewport while in 'pick' mode. --- .../EditorInteractionSystemComponent.cpp | 16 ++++++++++++---- .../ViewportUi/ViewportUiDisplay.cpp | 2 -- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.cpp index 3af1672ecb..696cf6b184 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.cpp @@ -50,11 +50,19 @@ namespace AzToolsFramework AzFramework::ViewportDebugDisplayEventBus::Handler::BusConnect(GetEntityContextId()); } - m_entityDataCache = AZStd::make_unique(); + // temporarily disconnect from EditorInteractionSystemViewportSelectionRequestBus in case during the creation of + // m_interactionRequests (see interactionRequestsBuilder below) an event is propagated to the handler, if this happens then + // m_interactionRequests will be null as it will not have finished being created yet so we ensure no events are forwarded to it + EditorInteractionSystemViewportSelectionRequestBus::Handler::BusDisconnect(); - m_interactionRequests.reset(); // BusConnect/Disconnect in constructor/destructor, - // so have to reset before assigning the new one - m_interactionRequests = interactionRequestsBuilder(m_entityDataCache.get()); + { + m_entityDataCache = AZStd::make_unique(); + m_interactionRequests.reset(); // BusConnect/Disconnect in constructor/destructor, + // so have to reset before assigning the new one + m_interactionRequests = interactionRequestsBuilder(m_entityDataCache.get()); + } + + EditorInteractionSystemViewportSelectionRequestBus::Handler::BusConnect(GetEntityContextId()); } void EditorInteractionSystemComponent::SetDefaultHandler() diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplay.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplay.cpp index 3b2c26114d..80cc7941b0 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplay.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplay.cpp @@ -380,7 +380,6 @@ namespace AzToolsFramework::ViewportUi::Internal } PrepareWidgetForViewportUi(widget); - m_renderOverlay->setFocus(); } void ViewportUiDisplay::SetUiOverlayContentsAnchored(QPointer widget, const Qt::Alignment alignment) @@ -392,7 +391,6 @@ namespace AzToolsFramework::ViewportUi::Internal PrepareWidgetForViewportUi(widget); m_uiOverlayLayout.AddAnchoredWidget(widget, alignment); - m_renderOverlay->setFocus(); } void ViewportUiDisplay::UpdateUiOverlayGeometry()