diff --git a/.github/ISSUE_TEMPLATE/nightly_build_failure_bug_template.md b/.github/ISSUE_TEMPLATE/nightly_build_failure_bug_template.md new file mode 100644 index 0000000000..40f6f0dbbc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/nightly_build_failure_bug_template.md @@ -0,0 +1,36 @@ +--- +name: Nightly Build Error bug report +about: Create a report when the nightly build process fails +title: 'Nightly Build Failure' +labels: 'needs-triage,needs-sig,kind/bug,kind/nightlybuildfailure' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Failure type** +Build | Asset Processing | Test Tools | Infrastructure | Test + +**To Reproduce Test Failures** + - Paste the command line that reproduces the test failure + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Logs** +Attach the Jenkins logs that are relevant to the failure + +**Desktop/Device (please complete the following information):** + - Device: [e.g. PC, Mac, iPhone, Samsung] + - OS: [e.g. Windows, macOS, iOS, Android] + - Version [e.g. 10, Bug Sur, Oreo] + - CPU [e.g. Intel I9-9900k , Ryzen 5900x, ] + - GPU [AMD 6800 XT, NVidia RTX 3090] + - Memory [e.g. 16GB] + +**Additional context** +Add any other context about the problem here. \ No newline at end of file diff --git a/AutomatedTesting/Gem/Code/CMakeLists.txt b/AutomatedTesting/Gem/Code/CMakeLists.txt index 58ffd957d6..6f55cc2764 100644 --- a/AutomatedTesting/Gem/Code/CMakeLists.txt +++ b/AutomatedTesting/Gem/Code/CMakeLists.txt @@ -35,37 +35,11 @@ ly_create_alias(NAME AutomatedTesting.Servers NAMESPACE Gem TARGETS Gem::Automa # Gem dependencies ################################################################################ -# The GameLauncher uses "Clients" gem variants: -ly_enable_gems(PROJECT_NAME AutomatedTesting GEM_FILE enabled_gems.cmake - TARGETS AutomatedTesting.GameLauncher - VARIANTS Clients) +# Enable the enabled_gems for the Project: +ly_enable_gems(PROJECT_NAME AutomatedTesting GEM_FILE enabled_gems.cmake) -# If we build a server, then apply the gems to the server +# Add project to the list server projects to create the AutomatedTesting.ServerLauncher if(PAL_TRAIT_BUILD_SERVER_SUPPORTED) - # if we're making a server, then add the "Server" gem variants to it: - ly_enable_gems(PROJECT_NAME AutomatedTesting GEM_FILE enabled_gems.cmake - TARGETS AutomatedTesting.ServerLauncher - VARIANTS Servers) - set_property(GLOBAL APPEND PROPERTY LY_LAUNCHER_SERVER_PROJECTS AutomatedTesting) endif() -if (PAL_TRAIT_BUILD_HOST_TOOLS) - # The Editor uses "Tools" gem variants: - ly_enable_gems( - PROJECT_NAME AutomatedTesting GEM_FILE enabled_gems.cmake - TARGETS Editor - VARIANTS Tools) - - # The Material Editor needs the Lyshine "Tools" gem variant for the custom LyShine pass - ly_enable_gems( - PROJECT_NAME AutomatedTesting GEMS LyShine - TARGETS MaterialEditor - VARIANTS Tools) - - # The pipeline tools use "Builders" gem variants: - ly_enable_gems( - PROJECT_NAME AutomatedTesting GEM_FILE enabled_gems.cmake - TARGETS AssetBuilder AssetProcessor AssetProcessorBatch - VARIANTS Builders) -endif() diff --git a/AutomatedTesting/Gem/PythonTests/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh.py b/AutomatedTesting/Gem/PythonTests/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh.py index 6009c2aca7..0ed9da1405 100755 --- a/AutomatedTesting/Gem/PythonTests/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh.py +++ b/AutomatedTesting/Gem/PythonTests/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh.py @@ -45,10 +45,6 @@ def C18977329_NvCloth_AddClothSimulationToMesh(): from editor_python_test_tools.editor_entity_utils import EditorEntity from editor_python_test_tools.utils import Report - # Helper file Imports - import ImportPathHelper as imports - - imports.init() from editor_python_test_tools.utils import TestHelper as helper from editor_python_test_tools.utils import Tracer @@ -84,7 +80,5 @@ def C18977329_NvCloth_AddClothSimulationToMesh(): helper.close_editor() if __name__ == "__main__": - import ImportPathHelper as imports - imports.init() from editor_python_test_tools.utils import Report Report.start_test(C18977329_NvCloth_AddClothSimulationToMesh) diff --git a/AutomatedTesting/Gem/PythonTests/NvCloth/C18977330_NvCloth_AddClothSimulationToActor.py b/AutomatedTesting/Gem/PythonTests/NvCloth/C18977330_NvCloth_AddClothSimulationToActor.py index 2eaed04f41..4d84a33dd2 100755 --- a/AutomatedTesting/Gem/PythonTests/NvCloth/C18977330_NvCloth_AddClothSimulationToActor.py +++ b/AutomatedTesting/Gem/PythonTests/NvCloth/C18977330_NvCloth_AddClothSimulationToActor.py @@ -44,11 +44,7 @@ def C18977330_NvCloth_AddClothSimulationToActor(): from editor_python_test_tools.editor_entity_utils import EditorEntity from editor_python_test_tools.utils import Report - - # Helper file Imports - import ImportPathHelper as imports - imports.init() from editor_python_test_tools.utils import TestHelper as helper from editor_python_test_tools.utils import Tracer @@ -84,7 +80,5 @@ def C18977330_NvCloth_AddClothSimulationToActor(): helper.close_editor() if __name__ == "__main__": - import ImportPathHelper as imports - imports.init() from editor_python_test_tools.utils import Report Report.start_test(C18977330_NvCloth_AddClothSimulationToActor) diff --git a/AutomatedTesting/Gem/PythonTests/NvCloth/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/NvCloth/CMakeLists.txt index 3913041f88..4343be3194 100644 --- a/AutomatedTesting/Gem/PythonTests/NvCloth/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/NvCloth/CMakeLists.txt @@ -12,7 +12,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) TEST_SUITE main TEST_REQUIRES gpu TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Active.py + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py RUNTIME_DEPENDENCIES Legacy::Editor AZ::AssetProcessor diff --git a/AutomatedTesting/Gem/PythonTests/NvCloth/ImportPathHelper.py b/AutomatedTesting/Gem/PythonTests/NvCloth/ImportPathHelper.py deleted file mode 100755 index 0e395664ad..0000000000 --- a/AutomatedTesting/Gem/PythonTests/NvCloth/ImportPathHelper.py +++ /dev/null @@ -1,11 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -def init(): - import os - import sys - sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared') diff --git a/AutomatedTesting/Gem/PythonTests/NvCloth/TestSuite_Active.py b/AutomatedTesting/Gem/PythonTests/NvCloth/TestSuite_Main.py old mode 100755 new mode 100644 similarity index 90% rename from AutomatedTesting/Gem/PythonTests/NvCloth/TestSuite_Active.py rename to AutomatedTesting/Gem/PythonTests/NvCloth/TestSuite_Main.py index 9302054d33..2ddcc58f12 --- a/AutomatedTesting/Gem/PythonTests/NvCloth/TestSuite_Active.py +++ b/AutomatedTesting/Gem/PythonTests/NvCloth/TestSuite_Main.py @@ -22,12 +22,11 @@ from base import TestAutomationBase class TestAutomation(TestAutomationBase): use_null_renderer = False # Use default renderer (needs gpu) - extra_cmdline_args = [] def test_C18977329_NvCloth_AddClothSimulationToMesh(self, request, workspace, editor, launcher_platform): from . import C18977329_NvCloth_AddClothSimulationToMesh as test_module - self._run_test(request, workspace, editor, test_module, self.extra_cmdline_args, self.use_null_renderer) + self._run_test(request, workspace, editor, test_module, use_null_renderer = self.use_null_renderer) def test_C18977330_NvCloth_AddClothSimulationToActor(self, request, workspace, editor, launcher_platform): from . import C18977330_NvCloth_AddClothSimulationToActor as test_module - self._run_test(request, workspace, editor, test_module, self.extra_cmdline_args, self.use_null_renderer) + self._run_test(request, workspace, editor, test_module, use_null_renderer = self.use_null_renderer) diff --git a/AutomatedTesting/Gem/PythonTests/physics/TestSuite_Main.py b/AutomatedTesting/Gem/PythonTests/physics/TestSuite_Main.py index de4828e36a..c3f41b158f 100644 --- a/AutomatedTesting/Gem/PythonTests/physics/TestSuite_Main.py +++ b/AutomatedTesting/Gem/PythonTests/physics/TestSuite_Main.py @@ -84,3 +84,8 @@ class TestAutomation(TestAutomationBase): def test_C24308873_CylinderShapeCollider_CollidesWithPhysXTerrain(self, request, workspace, editor, launcher_platform): from .collider import C24308873_CylinderShapeCollider_CollidesWithPhysXTerrain as test_module self._run_test(request, workspace, editor, test_module) + + @revert_physics_config + def test_C15425929_Undo_Redo(self, request, workspace, editor, launcher_platform): + from .general import C15425929_Undo_Redo as test_module + self._run_test(request, workspace, editor, test_module) \ No newline at end of file diff --git a/AutomatedTesting/Gem/PythonTests/physics/TestSuite_Sandbox.py b/AutomatedTesting/Gem/PythonTests/physics/TestSuite_Sandbox.py index 0346df2ebd..1d26e2e40c 100755 --- a/AutomatedTesting/Gem/PythonTests/physics/TestSuite_Sandbox.py +++ b/AutomatedTesting/Gem/PythonTests/physics/TestSuite_Sandbox.py @@ -43,11 +43,3 @@ class TestAutomation(TestAutomationBase): # Fixme: unexpected_lines.append(f"GroupName: {group}") # Fixme: expected_lines=["GroupName: "] self._run_test(request, workspace, editor, test_module) - - ## Seems to be flaky, need to investigate - @pytest.mark.xfail( - reason="Editor crashes and errors about files accessed by multiple processes appear in the log.") - @revert_physics_config - def test_C15425929_Undo_Redo(self, request, workspace, editor, launcher_platform): - from .general import C15425929_Undo_Redo as test_module - self._run_test(request, workspace, editor, test_module) diff --git a/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/C18977329_NvCloth_AddClothSimulationToMesh.ly b/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/C18977329_NvCloth_AddClothSimulationToMesh.ly index 9a1b1fe59a..861626993e 100644 --- a/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/C18977329_NvCloth_AddClothSimulationToMesh.ly +++ b/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/C18977329_NvCloth_AddClothSimulationToMesh.ly @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6517300fb1ce70c4696286e14715c547cfd175eabbb2042f7f2a456b15054224 -size 5253 +oid sha256:bedd2adc60f244a8595e64619069046d5036dd762f61b5393f9b759d69281362 +size 5276 diff --git a/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/filelist.xml b/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/filelist.xml index 2cf4d55bf0..d3492ca7b6 100644 --- a/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/filelist.xml +++ b/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/filelist.xml @@ -1,6 +1,6 @@ - + diff --git a/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/level.pak b/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/level.pak index 954bb1912f..7fa23ea67f 100644 --- a/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/level.pak +++ b/AutomatedTesting/Levels/NvCloth/C18977329_NvCloth_AddClothSimulationToMesh/level.pak @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce32a7cdf3ed37751385b3bb18f05206702978363f325d06727b5eb20d40b7eb -size 38563 +oid sha256:81fc98854424d55e594a3983da53d2f5a4d7a7cf60e52e12366e4800d1d3f080 +size 38559 diff --git a/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/C18977330_NvCloth_AddClothSimulationToActor.ly b/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/C18977330_NvCloth_AddClothSimulationToActor.ly index 9ef8bc0525..23397bf18d 100644 --- a/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/C18977330_NvCloth_AddClothSimulationToActor.ly +++ b/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/C18977330_NvCloth_AddClothSimulationToActor.ly @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:89dbcec013cb819e52ec0f8fed0a9e417fd32eac8aeb67d3958266bb6089ec21 -size 5505 +oid sha256:b59cbe84cb77090d723d120597f9d11817aa67a267a7f495f8b012fdd8a9dd86 +size 5536 diff --git a/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/filelist.xml b/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/filelist.xml index a7de99a91c..20952a47ce 100644 --- a/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/filelist.xml +++ b/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/filelist.xml @@ -1,6 +1,6 @@ - + diff --git a/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/level.pak b/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/level.pak index ad10c72b31..4259131c4f 100644 --- a/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/level.pak +++ b/AutomatedTesting/Levels/NvCloth/C18977330_NvCloth_AddClothSimulationToActor/level.pak @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:622c2624b04e07b704520f32c458b50d5a50de1ef116b7bc9c3c0ccb6f4a4ecc -size 3606 +oid sha256:46051f4116003e1a2d13855bea92a1b15501166b1379a11d02c4d2239ccd2530 +size 3648 diff --git a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp index c54fe60c4d..18946c7874 100644 --- a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp +++ b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp @@ -90,6 +90,7 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent) m_tableModel->setFilterRole(Qt::DisplayRole); m_tableModel->setSourceModel(m_filterModel.data()); + m_tableModel->setDynamicSortFilter(true); m_ui->m_assetBrowserTableViewWidget->setModel(m_tableModel.data()); connect( diff --git a/Code/Editor/CMakeLists.txt b/Code/Editor/CMakeLists.txt index 9256fd041f..5158ebc6d5 100644 --- a/Code/Editor/CMakeLists.txt +++ b/Code/Editor/CMakeLists.txt @@ -174,6 +174,8 @@ ly_add_target( Legacy::EditorLib ProjectManager ) + +ly_set_gem_variant_to_load(TARGETS Editor VARIANTS Tools) set_property(SOURCE CryEdit.cpp APPEND PROPERTY diff --git a/Code/Editor/IEditorImpl.cpp b/Code/Editor/IEditorImpl.cpp index 8f4abae9dd..880773966b 100644 --- a/Code/Editor/IEditorImpl.cpp +++ b/Code/Editor/IEditorImpl.cpp @@ -84,12 +84,6 @@ AZ_POP_DISABLE_WARNING #include "IEditorPanelUtils.h" #include "EditorPanelUtils.h" - -// even in Release mode, the editor will return its heap, because there's no Profile build configuration for the editor -#ifdef _RELEASE -#undef _RELEASE -#endif - #include "Core/QtEditorApplication.h" // for Editor::EditorQtApplication static CCryEditDoc * theDocument; @@ -104,8 +98,6 @@ static CCryEditDoc * theDocument; #define VERIFY(EXPRESSION) { auto e = EXPRESSION; assert(e); } #endif -#undef GetCommandLine - const char* CEditorImpl::m_crashLogFileName = "SessionStatus/editor_statuses.json"; CEditorImpl::CEditorImpl() diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/Contents.json b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/Contents.json index 603aec57a5..2b63c0ee15 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/Contents.json @@ -33,7 +33,7 @@ { "size" : "128x128", "idiom" : "mac", - "filename" : "icon_128 _2x.png", + "filename" : "icon_128_2x.png", "scale" : "2x" }, { @@ -45,7 +45,7 @@ { "size" : "256x256", "idiom" : "mac", - "filename" : "icon_256 _2x.png", + "filename" : "icon_256_2x.png", "scale" : "2x" }, { @@ -65,4 +65,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128 _2x.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128 _2x.png deleted file mode 100644 index 5970ea34ba..0000000000 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128 _2x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2 -size 32037 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128.png index 9e30e09547..192a862967 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f41a37d2347a617e93bd97adaf6d4c161c471ca3ef7e04b98c65ddda52396dc -size 27833 +oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da +size 5980 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128_2x.png new file mode 100644 index 0000000000..192a862967 --- /dev/null +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_128_2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da +size 5980 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_16.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_16.png index aeb29abd0a..9780d8a7af 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_16.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_16.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b07984494059bf827bc485cbea06d12e0283811face1a18799495f9ba7ae8af1 -size 20779 +oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7 +size 644 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_16_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_16_2x.png index 445a389d61..9780d8a7af 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_16_2x.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_16_2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926 -size 21857 +oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7 +size 644 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256 _2x.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256 _2x.png deleted file mode 100644 index 0904cf7ce8..0000000000 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256 _2x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:07631f41b8dea80713d2463f81a713a9a93798975b6fb50afbeeb13d26c57fa2 -size 48899 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256.png index 5970ea34ba..0b53991930 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2 -size 32037 +oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6 +size 12600 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256_2x.png new file mode 100644 index 0000000000..0b53991930 --- /dev/null +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256_2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6 +size 12600 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_32.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_32.png index 445a389d61..1d8cdef173 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_32.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_32.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926 -size 21857 +oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6 +size 1295 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_32_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_32_2x.png index 1fad9bda96..1d8cdef173 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_32_2x.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_32_2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad83faf98b49f4e37112baedeae726f4f8d71bcdd1961d9cdad31f043f8ca666 -size 24003 +oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6 +size 1295 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512.png index e1517dddb6..464f10910b 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68529a6c11d5ffa7ecd9d5bbb11ceea28e6852bd45946b525af09602c9a1e1bf -size 48899 +oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542 +size 19204 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512_2x.png index b425cb685f..464f10910b 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512_2x.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512_2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a70003840b418848b2ce6c18ed7cbbfcd6fcf76598a6601dca8b98d9b6c1a2f -size 114706 +oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542 +size 19204 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/Contents.json b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/Contents.json index 603aec57a5..2b63c0ee15 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/Contents.json +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/Contents.json @@ -33,7 +33,7 @@ { "size" : "128x128", "idiom" : "mac", - "filename" : "icon_128 _2x.png", + "filename" : "icon_128_2x.png", "scale" : "2x" }, { @@ -45,7 +45,7 @@ { "size" : "256x256", "idiom" : "mac", - "filename" : "icon_256 _2x.png", + "filename" : "icon_256_2x.png", "scale" : "2x" }, { @@ -65,4 +65,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128 _2x.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128 _2x.png deleted file mode 100644 index 5970ea34ba..0000000000 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128 _2x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2 -size 32037 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128.png index 9e30e09547..192a862967 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f41a37d2347a617e93bd97adaf6d4c161c471ca3ef7e04b98c65ddda52396dc -size 27833 +oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da +size 5980 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128_2x.png new file mode 100644 index 0000000000..192a862967 --- /dev/null +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_128_2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da +size 5980 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_16.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_16.png index aeb29abd0a..9780d8a7af 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_16.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_16.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b07984494059bf827bc485cbea06d12e0283811face1a18799495f9ba7ae8af1 -size 20779 +oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7 +size 644 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_16_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_16_2x.png index 445a389d61..9780d8a7af 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_16_2x.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_16_2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926 -size 21857 +oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7 +size 644 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256 _2x.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256 _2x.png deleted file mode 100644 index 0904cf7ce8..0000000000 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256 _2x.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:07631f41b8dea80713d2463f81a713a9a93798975b6fb50afbeeb13d26c57fa2 -size 48899 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256.png index 5970ea34ba..0b53991930 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2 -size 32037 +oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6 +size 12600 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256_2x.png new file mode 100644 index 0000000000..0b53991930 --- /dev/null +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_256_2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6 +size 12600 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_32.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_32.png index 445a389d61..1d8cdef173 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_32.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_32.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926 -size 21857 +oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6 +size 1295 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_32_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_32_2x.png index 1fad9bda96..1d8cdef173 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_32_2x.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_32_2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad83faf98b49f4e37112baedeae726f4f8d71bcdd1961d9cdad31f043f8ca666 -size 24003 +oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6 +size 1295 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_512.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_512.png index e1517dddb6..464f10910b 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_512.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_512.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68529a6c11d5ffa7ecd9d5bbb11ceea28e6852bd45946b525af09602c9a1e1bf -size 48899 +oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542 +size 19204 diff --git a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_512_2x.png b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_512_2x.png index b425cb685f..464f10910b 100644 --- a/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_512_2x.png +++ b/Code/Editor/Platform/Mac/Images.xcassets/EditorAppIcon.appiconset/icon_512_2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a70003840b418848b2ce6c18ed7cbbfcd6fcf76598a6601dca8b98d9b6c1a2f -size 114706 +oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542 +size 19204 diff --git a/Code/Editor/Platform/Mac/main_dummy.cpp b/Code/Editor/Platform/Mac/main_dummy.cpp index 814cbfde66..348a32ab47 100644 --- a/Code/Editor/Platform/Mac/main_dummy.cpp +++ b/Code/Editor/Platform/Mac/main_dummy.cpp @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) processLaunchInfo.m_environmentVariables = &envVars; processLaunchInfo.m_showWindow = true; - AZStd::unique_ptr processWatcher(AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE)); + AzFramework::ProcessLauncher::LaunchUnwatchedProcess(processLaunchInfo); application.Destroy(); diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetCommon.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetCommon.cpp index 0c197e5354..af3aba49a3 100644 --- a/Code/Framework/AzCore/AzCore/Asset/AssetCommon.cpp +++ b/Code/Framework/AzCore/AzCore/Asset/AssetCommon.cpp @@ -456,7 +456,7 @@ namespace AZ { if (loadBehavior & (1 << thisFlag)) { - returnFlags[thisFlag] = 1; + returnFlags[thisFlag] = true; } } return returnFlags; diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp index 3df751fb02..6ba69cffd5 100644 --- a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp +++ b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp @@ -71,8 +71,8 @@ namespace AZ ////////////////////////////////////////////////////////////////////////// // EBusTraits overrides static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById; - typedef AssetId BusIdType; - typedef AZStd::recursive_mutex MutexType; + using BusIdType = AssetId; + using MutexType = AZStd::recursive_mutex; template struct AssetJobConnectionPolicy @@ -107,7 +107,7 @@ namespace AZ virtual void OnLoadCanceled(AssetId assetId) = 0; }; - typedef EBus BlockingAssetLoadBus; + using BlockingAssetLoadBus = EBus; /* * This class processes async AssetDatabase load jobs diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index eda08401a2..c76156c006 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -644,7 +644,7 @@ namespace AZ NameDictionary::Create(); // Call this and child class's reflects - ReflectionEnvironment::GetReflectionManager()->Reflect(azrtti_typeid(this), AZStd::bind(&ComponentApplication::Reflect, this, AZStd::placeholders::_1)); + ReflectionEnvironment::GetReflectionManager()->Reflect(azrtti_typeid(this), [this](ReflectContext* context) {Reflect(context); }); RegisterCoreComponents(); TickBus::AllowFunctionQueuing(true); @@ -970,7 +970,12 @@ namespace AZ { if (ReflectionEnvironment::GetReflectionManager()) { - ReflectionEnvironment::GetReflectionManager()->Reflect(descriptor->GetUuid(), AZStd::bind(&ComponentDescriptor::Reflect, descriptor, AZStd::placeholders::_1)); + ReflectionEnvironment::GetReflectionManager()->Reflect( + descriptor->GetUuid(), + [descriptor](ReflectContext* context) + { + descriptor->Reflect(context); + }); } } diff --git a/Code/Framework/AzCore/AzCore/Compression/compression.cpp b/Code/Framework/AzCore/AzCore/Compression/compression.cpp index 60351b0f7c..8b6f270b00 100644 --- a/Code/Framework/AzCore/AzCore/Compression/compression.cpp +++ b/Code/Framework/AzCore/AzCore/Compression/compression.cpp @@ -23,8 +23,8 @@ using namespace AZ; // [3/21/2011] //========================================================================= ZLib::ZLib(IAllocator* workMemAllocator) - : m_strDeflate(NULL) - , m_strInflate(NULL) + : m_strDeflate(nullptr) + , m_strInflate(nullptr) { m_workMemoryAllocator = workMemAllocator ? workMemAllocator->GetAllocationSource() : nullptr; if (!m_workMemoryAllocator) @@ -75,7 +75,7 @@ void ZLib::FreeMem(void* userData, void* address) //========================================================================= void ZLib::StartCompressor(unsigned int compressionLevel) { - AZ_Assert(m_strDeflate == NULL, "Compressor already started!"); + AZ_Assert(m_strDeflate == nullptr, "Compressor already started!"); m_strDeflate = reinterpret_cast< z_stream* >(AllocateMem(m_workMemoryAllocator, 1, sizeof(z_stream))); m_strDeflate->zalloc = &ZLib::AllocateMem; m_strDeflate->zfree = &ZLib::FreeMem; @@ -91,10 +91,10 @@ void ZLib::StartCompressor(unsigned int compressionLevel) //========================================================================= void ZLib::StopCompressor() { - AZ_Assert(m_strDeflate != NULL, "Compressor not started!"); + AZ_Assert(m_strDeflate != nullptr, "Compressor not started!"); deflateEnd(m_strDeflate); FreeMem(m_workMemoryAllocator, m_strDeflate); - m_strDeflate = NULL; + m_strDeflate = nullptr; } //========================================================================= @@ -103,7 +103,7 @@ void ZLib::StopCompressor() //========================================================================= void ZLib::ResetCompressor() { - AZ_Assert(m_strDeflate != NULL, "Compressor not started!"); + AZ_Assert(m_strDeflate != nullptr, "Compressor not started!"); int r = deflateReset(m_strDeflate); (void)r; AZ_Assert(r == Z_OK, "ZLib inconsistent state - deflateReset() failed !!!\n"); @@ -115,7 +115,7 @@ void ZLib::ResetCompressor() //========================================================================= unsigned int ZLib::Compress(const void* data, unsigned int& dataSize, void* compressedData, unsigned int compressedDataSize, FlushType flushType) { - AZ_Assert(m_strDeflate != NULL, "Compressor not started!"); + AZ_Assert(m_strDeflate != nullptr, "Compressor not started!"); m_strDeflate->avail_in = dataSize; m_strDeflate->next_in = (unsigned char*)data; m_strDeflate->avail_out = compressedDataSize; @@ -158,7 +158,7 @@ unsigned int ZLib::Compress(const void* data, unsigned int& dataSize, void* comp //========================================================================= unsigned int ZLib::GetMinCompressedBufferSize(unsigned int sourceDataSize) { - AZ_Assert(m_strDeflate != NULL, "Compressor not started!"); + AZ_Assert(m_strDeflate != nullptr, "Compressor not started!"); return static_cast(deflateBound(m_strDeflate, sourceDataSize)); } @@ -168,7 +168,7 @@ unsigned int ZLib::GetMinCompressedBufferSize(unsigned int sourceDataSize) //========================================================================= void ZLib::StartDecompressor(Header* header) { - AZ_Assert(m_strInflate == NULL, "Decompressor already started!"); + AZ_Assert(m_strInflate == nullptr, "Decompressor already started!"); m_strInflate = reinterpret_cast< z_stream* >(AllocateMem(m_workMemoryAllocator, 1, sizeof(z_stream))); m_strInflate->zalloc = &ZLib::AllocateMem; m_strInflate->zfree = &ZLib::FreeMem; @@ -188,10 +188,10 @@ void ZLib::StartDecompressor(Header* header) //========================================================================= void ZLib::StopDecompressor() { - AZ_Assert(m_strInflate != NULL, "Decompressor not started!"); + AZ_Assert(m_strInflate != nullptr, "Decompressor not started!"); inflateEnd(m_strInflate); FreeMem(m_workMemoryAllocator, m_strInflate); - m_strInflate = NULL; + m_strInflate = nullptr; } //========================================================================= @@ -200,7 +200,7 @@ void ZLib::StopDecompressor() //========================================================================= void ZLib::ResetDecompressor(Header* header) { - AZ_Assert(m_strInflate != NULL, "Decompressor not started!"); + AZ_Assert(m_strInflate != nullptr, "Decompressor not started!"); int r = inflateReset(m_strInflate); (void)r; AZ_Assert(r == Z_OK, "ZLib inconsistent state - inflateReset() failed !!!\n"); @@ -229,7 +229,7 @@ void ZLib::SetupDecompressHeader(Header header) //========================================================================= unsigned int ZLib::Decompress(const void* compressedData, unsigned int compressedDataSize, void* data, unsigned int& dataSize, FlushType flushType) { - AZ_Assert(m_strInflate != NULL, "Decompressor not started!"); + AZ_Assert(m_strInflate != nullptr, "Decompressor not started!"); m_strInflate->avail_in = compressedDataSize; m_strInflate->next_in = (unsigned char*)compressedData; m_strInflate->avail_out = dataSize; diff --git a/Code/Framework/AzCore/AzCore/Debug/LocalFileEventLogger.cpp b/Code/Framework/AzCore/AzCore/Debug/LocalFileEventLogger.cpp index 049ac2e8a1..0009ec83b3 100644 --- a/Code/Framework/AzCore/AzCore/Debug/LocalFileEventLogger.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/LocalFileEventLogger.cpp @@ -242,7 +242,9 @@ namespace AZ::Debug ThreadData* threadData = threadStorage.m_data; // Set to nullptr so other threads doing a flush can't pick this up. - while (!threadStorage.m_data.compare_exchange_strong(threadData, nullptr)); + while (!threadStorage.m_data.compare_exchange_strong(threadData, nullptr)) + { + } uint32_t writeSize = AZ_SIZE_ALIGN_UP(sizeof(EventHeader) + size, EventBoundary); if (threadData->m_usedBytes + writeSize >= ThreadData::BufferSize) @@ -270,7 +272,9 @@ namespace AZ::Debug // swap the pending data to commit the event ThreadStorage& threadStorage = GetThreadStorage(); ThreadData* expectedData = nullptr; - while (!threadStorage.m_data.compare_exchange_strong(expectedData, threadStorage.m_pendingData)); + while (!threadStorage.m_data.compare_exchange_strong(expectedData, threadStorage.m_pendingData)) + { + } threadStorage.m_pendingData = nullptr; } diff --git a/Code/Framework/AzCore/AzCore/Debug/Trace.cpp b/Code/Framework/AzCore/AzCore/Debug/Trace.cpp index 26c702c13a..14504cc282 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Trace.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Trace.cpp @@ -154,7 +154,7 @@ namespace AZ } bool - Trace::WaitForDebugger(float timeoutSeconds/*=-1.f*/) + Trace::WaitForDebugger([[maybe_unused]] float timeoutSeconds/*=-1.f*/) { #if defined(AZ_ENABLE_DEBUG_TOOLS) using AZStd::chrono::system_clock; @@ -174,6 +174,8 @@ namespace AZ AZStd::this_thread::sleep_for(milliseconds(1)); } return AZ::Debug::Trace::IsDebuggerPresent(); +#else + return false; #endif } @@ -216,7 +218,7 @@ namespace AZ void Debug::Trace::Crash() { - int* p = 0; + int* p = nullptr; *p = 1; } diff --git a/Code/Framework/AzCore/AzCore/Debug/Trace.h b/Code/Framework/AzCore/AzCore/Debug/Trace.h index b00a1cd921..26c331e1e4 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Trace.h +++ b/Code/Framework/AzCore/AzCore/Debug/Trace.h @@ -19,7 +19,7 @@ namespace AZ { void OutputToDebugger(const char* window, const char* message); } - + /// Global instance to the tracer. extern class Trace g_tracer; @@ -41,7 +41,7 @@ namespace AZ static void Destroy(); static int GetAssertVerbosityLevel(); static void SetAssertVerbosityLevel(int level); - + /** * Returns the default string used for a system window. * It can be useful for Trace message handlers to easily validate if the window they received is the fallback window used by this class, @@ -109,7 +109,7 @@ namespace AZ * Correct usage: * AZ_Assert(false, "Fail always"); */ - + namespace AZ { namespace TraceInternal @@ -121,7 +121,7 @@ namespace AZ static constexpr ExpressionValidResult value = ExpressionValidResult::Valid; }; template<> - struct ExpressionIsValid + struct ExpressionIsValid { static constexpr ExpressionValidResult value = ExpressionValidResult::Valid; }; @@ -228,7 +228,7 @@ namespace AZ { \ AZ::Debug::Trace::Instance().Printf(window, __VA_ARGS__); \ } - + //! The AZ_TrancePrintfOnce macro output the result of the format string only once for each use of the macro //! It does not take into account the result of the format string to determine whether to output the string or not diff --git a/Code/Framework/AzCore/AzCore/Driller/Driller.cpp b/Code/Framework/AzCore/AzCore/Driller/Driller.cpp index 84f0fe3158..41abd7793e 100644 --- a/Code/Framework/AzCore/AzCore/Driller/Driller.cpp +++ b/Code/Framework/AzCore/AzCore/Driller/Driller.cpp @@ -208,7 +208,7 @@ namespace AZ { if (drillerList.empty()) { - return NULL; + return nullptr; } m_sessions.push_back(); @@ -246,21 +246,21 @@ namespace AZ AZStd::lock_guard lock(DrillerEBusMutex::GetMutex()); ///< Make sure no driller is writing to the stream for (DrillerListType::const_iterator iDriller = drillerList.begin(); iDriller != drillerList.end(); ++iDriller) { - Driller* driller = NULL; + Driller* driller = nullptr; const DrillerInfo& di = *iDriller; for (size_t iDesc = 0; iDesc < m_drillers.size(); ++iDesc) { if (m_drillers[iDesc]->GetId() == di.id) { driller = m_drillers[iDesc]; - AZ_Assert(driller->m_output == NULL, "Driller with id %08x is already have an output stream %p (currently we support only 1 at a time)", di.id, driller->m_output); + AZ_Assert(driller->m_output == nullptr, "Driller with id %08x is already have an output stream %p (currently we support only 1 at a time)", di.id, driller->m_output); driller->m_output = &output; driller->Start(di.params.data(), static_cast(di.params.size())); s.drillers.push_back(driller); break; } } - AZ_Warning("Driller", driller != NULL, "We can't start a driller with id %d!", di.id); + AZ_Warning("Driller", driller != nullptr, "We can't start a driller with id %d!", di.id); } } return &s; @@ -293,7 +293,7 @@ namespace AZ for (size_t i = 0; i < s.drillers.size(); ++i) { s.drillers[i]->Stop(); - s.drillers[i]->m_output = NULL; + s.drillers[i]->m_output = nullptr; } } s.output->EndTag(AZ_CRC("Frame", 0xb5f83ccd)); diff --git a/Code/Framework/AzCore/AzCore/Driller/Stream.cpp b/Code/Framework/AzCore/AzCore/Driller/Stream.cpp index f43e337bb8..761f964561 100644 --- a/Code/Framework/AzCore/AzCore/Driller/Stream.cpp +++ b/Code/Framework/AzCore/AzCore/Driller/Stream.cpp @@ -677,7 +677,7 @@ namespace AZ AZStd::endian_swap(crc32); } stringPtr = m_stringPool->Find(crc32); - AZ_Assert(stringPtr != NULL, "Failed to find string with id 0x%08x in the string pool, proper stream read is impossible!", crc32); + AZ_Assert(stringPtr != nullptr, "Failed to find string with id 0x%08x in the string pool, proper stream read is impossible!", crc32); stringLength = static_cast(strlen(stringPtr)); } else if (m_isPooledString) @@ -710,7 +710,7 @@ namespace AZ //========================================================================= const DrillerDOMParser::Node* DrillerDOMParser::Node::GetTag(u32 tagName) const { - const Node* tagNode = NULL; + const Node* tagNode = nullptr; for (Node::NodeListType::const_iterator i = m_tags.begin(); i != m_tags.end(); ++i) { if ((*i).m_name == tagName) @@ -728,7 +728,7 @@ namespace AZ //========================================================================= const DrillerDOMParser::Data* DrillerDOMParser::Node::GetData(u32 dataName) const { - const Data* dataNode = NULL; + const Data* dataNode = nullptr; for (Node::DataListType::const_iterator i = m_data.begin(); i != m_data.end(); ++i) { if (i->m_name == dataName) @@ -749,7 +749,7 @@ namespace AZ , m_isPersistentInputData(isPersistentInputData) { m_root.m_name = 0; - m_root.m_parent = NULL; + m_root.m_parent = nullptr; m_topNode = &m_root; } static int g_numFree = 0; @@ -850,14 +850,14 @@ namespace AZ return; } - DrillerHandlerParser* childHandler = NULL; + DrillerHandlerParser* childHandler = nullptr; DrillerHandlerParser* currentHandler = m_stack.back(); if (isOpen) { - if (currentHandler != NULL) + if (currentHandler != nullptr) { childHandler = currentHandler->OnEnterTag(name); - AZ_Warning("Driller", !currentHandler->IsWarnOnUnsupportedTags() || childHandler != NULL, "Could not find handler for tag 0x%08x", name); + AZ_Warning("Driller", !currentHandler->IsWarnOnUnsupportedTags() || childHandler != nullptr, "Could not find handler for tag 0x%08x", name); } m_stack.push_back(childHandler); } diff --git a/Code/Framework/AzCore/AzCore/IO/CompressorZLib.cpp b/Code/Framework/AzCore/AzCore/IO/CompressorZLib.cpp index a61cdb1133..f973c0e95a 100644 --- a/Code/Framework/AzCore/AzCore/IO/CompressorZLib.cpp +++ b/Code/Framework/AzCore/AzCore/IO/CompressorZLib.cpp @@ -22,10 +22,10 @@ namespace AZ // [12/13/2012] //========================================================================= CompressorZLib::CompressorZLib(unsigned int decompressionCachePerStream, unsigned int dataBufferSize) - : m_lastReadStream(NULL) + : m_lastReadStream(nullptr) , m_lastReadStreamOffset(0) , m_lastReadStreamSize(0) - , m_compressedDataBuffer(NULL) + , m_compressedDataBuffer(nullptr) , m_compressedDataBufferSize(dataBufferSize) , m_compressedDataBufferUseCount(0) , m_decompressionCachePerStream(decompressionCachePerStream) @@ -63,7 +63,7 @@ namespace AZ //========================================================================= bool CompressorZLib::ReadHeaderAndData(CompressorStream* stream, AZ::u8* data, unsigned int dataSize) { - if (stream->GetCompressorData() != NULL) // we already have compressor data + if (stream->GetCompressorData() != nullptr) // we already have compressor data { return false; } @@ -347,7 +347,7 @@ namespace AZ AZ_Assert(stream && stream->GetCompressorData(), "This stream doesn't have compression enabled! Call Stream::WriteCompressed after you create the file!"); AZ_Assert(offset == SizeType(-1) || offset == stream->GetCurPos(), "We can write compressed data only at the end of the stream!"); - m_lastReadStream = NULL; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). + m_lastReadStream = nullptr; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). CompressorZLibData* zlibData = static_cast(stream->GetCompressorData()); AZ_Assert(!zlibData->m_zlib.IsDecompressorStarted(), "You can't write while reading/decompressing a compressed stream!"); @@ -398,13 +398,13 @@ namespace AZ AZ_Assert(stream && stream->GetCompressorData(), "This stream doesn't have compression enabled! Call Stream::WriteCompressed after you create the file!"); CompressorZLibData* zlibData = static_cast(stream->GetCompressorData()); - m_lastReadStream = NULL; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). + m_lastReadStream = nullptr; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). unsigned int compressedSize; unsigned int dataToCompress = 0; do { - compressedSize = zlibData->m_zlib.Compress(NULL, dataToCompress, m_compressedDataBuffer, m_compressedDataBufferSize, ZLib::FT_FULL_FLUSH); + compressedSize = zlibData->m_zlib.Compress(nullptr, dataToCompress, m_compressedDataBuffer, m_compressedDataBufferSize, ZLib::FT_FULL_FLUSH); if (compressedSize) { GenericStream* baseStream = stream->GetWrappedStream(); @@ -429,7 +429,7 @@ namespace AZ //========================================================================= bool CompressorZLib::StartCompressor(CompressorStream* stream, int compressionLevel, SizeType autoSeekDataSize) { - AZ_Assert(stream && stream->GetCompressorData() == NULL, "Stream has compressor already enabled!"); + AZ_Assert(stream && stream->GetCompressorData() == nullptr, "Stream has compressor already enabled!"); AcquireDataBuffer(); @@ -470,14 +470,14 @@ namespace AZ bool result = true; if (zlibData->m_zlib.IsCompressorStarted()) { - m_lastReadStream = NULL; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). + m_lastReadStream = nullptr; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). // flush all compressed data unsigned int compressedSize; unsigned int dataToCompress = 0; do { - compressedSize = zlibData->m_zlib.Compress(NULL, dataToCompress, m_compressedDataBuffer, m_compressedDataBufferSize, ZLib::FT_FINISH); + compressedSize = zlibData->m_zlib.Compress(nullptr, dataToCompress, m_compressedDataBuffer, m_compressedDataBufferSize, ZLib::FT_FINISH); if (compressedSize) { baseStream->Write(compressedSize, m_compressedDataBuffer); @@ -502,7 +502,7 @@ namespace AZ { if (m_lastReadStream == stream) { - m_lastReadStream = NULL; // invalidate the data in m_dataBuffer if it was from the current stream. + m_lastReadStream = nullptr; // invalidate the data in m_dataBuffer if it was from the current stream. } } @@ -525,11 +525,11 @@ namespace AZ //========================================================================= void CompressorZLib::AcquireDataBuffer() { - if (m_compressedDataBuffer == NULL) + if (m_compressedDataBuffer == nullptr) { AZ_Assert(m_compressedDataBufferUseCount == 0, "Buffer usecount should be 0 if the buffer is NULL"); m_compressedDataBuffer = reinterpret_cast(azmalloc(m_compressedDataBufferSize, m_CompressedDataBufferAlignment, AZ::SystemAllocator, "CompressorZLib")); - m_lastReadStream = NULL; // reset the cache info in the m_dataBuffer + m_lastReadStream = nullptr; // reset the cache info in the m_dataBuffer } ++m_compressedDataBufferUseCount; } @@ -543,10 +543,10 @@ namespace AZ --m_compressedDataBufferUseCount; if (m_compressedDataBufferUseCount == 0) { - AZ_Assert(m_compressedDataBuffer != NULL, "Invalid data buffer! We should have a non null pointer!"); + AZ_Assert(m_compressedDataBuffer != nullptr, "Invalid data buffer! We should have a non null pointer!"); azfree(m_compressedDataBuffer, AZ::SystemAllocator, m_compressedDataBufferSize, m_CompressedDataBufferAlignment); - m_compressedDataBuffer = NULL; - m_lastReadStream = NULL; // reset the cache info in the m_dataBuffer + m_compressedDataBuffer = nullptr; + m_lastReadStream = nullptr; // reset the cache info in the m_dataBuffer } } } // namespace IO diff --git a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl index 309a4fa050..6354324136 100644 --- a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl +++ b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl @@ -11,6 +11,7 @@ #include #include #include +#include // extern instantiations of Path templates to prevent implicit instantiations namespace AZ::IO @@ -92,11 +93,23 @@ namespace AZ::IO::Internal constexpr auto ConsumeRootName(InputIt entryBeginIter, InputIt entryEndIter, const char preferredSeparator) -> AZStd::enable_if_t, InputIt> { - if (preferredSeparator == '/') + if (preferredSeparator == PosixPathSeparator) { // If the preferred separator is forward slash the parser is in posix path - // parsing mode, which doesn't have a root name + // parsing mode, which doesn't have a root name, + // unless we're on a posix platform that uses a custom path root separator + #if defined(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR) + const AZStd::string_view path{ entryBeginIter, entryEndIter }; + const auto positionOfPathSeparator = path.find(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR); + if (positionOfPathSeparator == AZStd::string_view::npos) + { + return entryBeginIter; + } + const AZStd::string_view rootName{ path.substr(0, positionOfPathSeparator + 1) }; + return AZStd::next(entryBeginIter, rootName.size()); + #else return entryBeginIter; + #endif } else { @@ -185,13 +198,18 @@ namespace AZ::IO::Internal template >> static constexpr bool IsAbsolute(InputIt first, EndIt last, const char preferredSeparator) { - size_t pathSize = AZStd::distance(first, last); - // If the preferred separator is a forward slash - // than an absolute path is simply one that starts with a forward slash - if (preferredSeparator == '/') - { + // than an absolute path is simply one that starts with a forward slash, + // unless we're on a posix platform that uses a custom path root separator + if (preferredSeparator == PosixPathSeparator) + { + #if defined(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR) + const AZStd::string_view path{ first, last }; + return path.find(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR) != AZStd::string_view::npos; + #else + const size_t pathSize = AZStd::distance(first, last); return pathSize > 0 && IsSeparator(*first); + #endif } else { @@ -199,6 +217,7 @@ namespace AZ::IO::Internal { // If a windows path ends starts with C:foo it is a root relative path // A path is absolute root absolute on windows if it starts with + const size_t pathSize = AZStd::distance(first, last); return pathSize > 2 && Internal::IsSeparator(*AZStd::next(first, 2)); } diff --git a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp index 8de8b6b70f..5bff79b422 100644 --- a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp +++ b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp @@ -127,7 +127,7 @@ bool SystemFile::Open(const char* fileName, int mode, int platformFlags) bool SystemFile::ReOpen(int mode, int platformFlags) { AZ_Assert(!m_fileName.empty(), "Missing filename. You must call open first!"); - return Open(0, mode, platformFlags); + return Open(nullptr, mode, platformFlags); } void SystemFile::Close() diff --git a/Code/Framework/AzCore/AzCore/IPC/SharedMemory.cpp b/Code/Framework/AzCore/AzCore/IPC/SharedMemory.cpp index 37c88e34fc..af73ab4936 100644 --- a/Code/Framework/AzCore/AzCore/IPC/SharedMemory.cpp +++ b/Code/Framework/AzCore/AzCore/IPC/SharedMemory.cpp @@ -125,7 +125,7 @@ SharedMemory::Close() bool SharedMemory::Map(AccessMode mode, unsigned int size) { - AZ_Assert(m_mappedBase == NULL, "We already have data mapped"); + AZ_Assert(m_mappedBase == nullptr, "We already have data mapped"); AZ_Assert(Platform::IsMapHandleValid(), "You must call Map() first!"); bool result = Platform::Map(mode, size); @@ -232,7 +232,7 @@ bool SharedMemory::CheckMappedBaseValid() // [4/29/2011] //========================================================================= SharedMemoryRingBuffer::SharedMemoryRingBuffer() - : m_info(NULL) + : m_info(nullptr) {} //========================================================================= @@ -279,7 +279,7 @@ SharedMemoryRingBuffer::Map(AccessMode mode, unsigned int size) bool SharedMemoryRingBuffer::UnMap() { - m_info = NULL; + m_info = nullptr; return SharedMemory::UnMap(); } @@ -291,7 +291,7 @@ bool SharedMemoryRingBuffer::Write(const void* data, unsigned int dataSize) { AZ_Warning("AZSystem", !Platform::IsWaitFailed(), "You are writing the ring buffer %s while the Global lock is NOT locked! This can lead to data corruption!", m_name); - AZ_Assert(m_info != NULL, "You need to Create and Map the buffer first!"); + AZ_Assert(m_info != nullptr, "You need to Create and Map the buffer first!"); if (m_info->m_writeOffset >= m_info->m_readOffset) { unsigned int freeSpace = m_dataSize - (m_info->m_writeOffset - m_info->m_readOffset); @@ -346,7 +346,7 @@ SharedMemoryRingBuffer::Read(void* data, unsigned int maxDataSize) return 0; } - AZ_Assert(m_info != NULL, "You need to Create and Map the buffer first!"); + AZ_Assert(m_info != nullptr, "You need to Create and Map the buffer first!"); unsigned int dataRead; if (m_info->m_writeOffset > m_info->m_readOffset) { diff --git a/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp b/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp index 73fb4ecfe8..f76946a667 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp +++ b/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp @@ -192,15 +192,15 @@ void JobManagerWorkStealing::SuspendJobUntilReady(Job* job) ThreadInfo* info = GetCurrentOrCreateThreadInfo(); AZ_Assert(info->m_currentJob == job, ("Can't suspend a job which isn't currently running")); - info->m_currentJob = NULL; //clear current job + info->m_currentJob = nullptr; //clear current job if (IsAsynchronous()) { - ProcessJobsAssist(info, job, NULL); + ProcessJobsAssist(info, job, nullptr); } else { - ProcessJobsSynchronous(info, job, NULL); + ProcessJobsSynchronous(info, job, nullptr); } info->m_currentJob = job; //restore current job @@ -223,11 +223,11 @@ void JobManagerWorkStealing::StartJobAndAssistUntilComplete(Job* job) //the processing functions will return when the empty job dependent count has reached 1 if (IsAsynchronous()) { - ProcessJobsAssist(info, NULL, ¬ifyFlag); + ProcessJobsAssist(info, nullptr, ¬ifyFlag); } else { - ProcessJobsSynchronous(info, NULL, ¬ifyFlag); + ProcessJobsSynchronous(info, nullptr, ¬ifyFlag); } AZ_Assert(!m_currentThreadInfo, ""); @@ -306,9 +306,9 @@ void JobManagerWorkStealing::ProcessJobsWorker(ThreadInfo* info) //setup thread-local storage m_currentThreadInfo = info; - ProcessJobsInternal(info, NULL, NULL); + ProcessJobsInternal(info, nullptr, nullptr); - m_currentThreadInfo = NULL; + m_currentThreadInfo = nullptr; } void JobManagerWorkStealing::ProcessJobsAssist(ThreadInfo* info, Job* suspendedJob, AZStd::atomic* notifyFlag) @@ -529,7 +529,7 @@ void JobManagerWorkStealing::ProcessJobsSynchronous(ThreadInfo* info, Job* suspe info->m_currentJob = job; Process(job); - info->m_currentJob = NULL; + info->m_currentJob = nullptr; //...after calling Process we cannot use the job pointer again, the job has completed and may not exist anymore #ifdef JOBMANAGER_ENABLE_STATS diff --git a/Code/Framework/AzCore/AzCore/Jobs/Job.cpp b/Code/Framework/AzCore/AzCore/Jobs/Job.cpp index d3a2a77d92..8462cf47e8 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/Job.cpp +++ b/Code/Framework/AzCore/AzCore/Jobs/Job.cpp @@ -36,7 +36,7 @@ namespace AZ } countAndFlags |= (unsigned int)((priority << FLAG_PRIORITY_START_BIT) & FLAG_PRIORITY_MASK); SetDependentCountAndFlags(countAndFlags); - StoreDependent(NULL); + StoreDependent(nullptr); #ifdef AZ_DEBUG_JOB_STATE SetState(STATE_SETUP); @@ -66,7 +66,7 @@ namespace AZ SetDependentCountAndFlags(countAndFlags); if (isClearDependent) { - StoreDependent(NULL); + StoreDependent(nullptr); } else { diff --git a/Code/Framework/AzCore/AzCore/Math/Uuid.cpp b/Code/Framework/AzCore/AzCore/Math/Uuid.cpp index 6e71ffc3bd..d875e28a1e 100644 --- a/Code/Framework/AzCore/AzCore/Math/Uuid.cpp +++ b/Code/Framework/AzCore/AzCore/Math/Uuid.cpp @@ -56,7 +56,7 @@ namespace AZ Uuid Uuid::CreateStringSkipWarnings(const char* string, size_t stringLength, [[maybe_unused]] bool skipWarnings) { - if (string == NULL) + if (string == nullptr) { return Uuid::CreateNull(); } @@ -71,7 +71,7 @@ namespace AZ if (len < 32 || len > 38) { - AZ_Warning("Math", skipWarnings, "Invalid UUID format %s (must be) {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (or without dashes and braces)", string != NULL ? string : "null"); + AZ_Warning("Math", skipWarnings, "Invalid UUID format %s (must be) {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (or without dashes and braces)", string != nullptr ? string : "null"); return Uuid::CreateNull(); } diff --git a/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp b/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp index 7d644c6917..b55b2db768 100644 --- a/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp @@ -169,7 +169,7 @@ AllocationRecords::RegisterAllocation(void* address, size_t byteSize, size_t ali ai.m_timeStamp = AZStd::GetTimeNowMicroSecond(); // if we don't have a fileName,lineNum record the stack or if the user requested it. - if ((fileName == 0 && m_mode == RECORD_STACK_IF_NO_FILE_LINE) || m_mode == RECORD_FULL) + if ((fileName == nullptr && m_mode == RECORD_STACK_IF_NO_FILE_LINE) || m_mode == RECORD_FULL) { ai.m_stackFrames = m_numStackLevels ? reinterpret_cast(m_records.get_allocator().allocate(sizeof(AZ::Debug::StackFrame)*m_numStackLevels, 1)) : nullptr; if (ai.m_stackFrames) diff --git a/Code/Framework/AzCore/AzCore/Memory/AllocatorManager.cpp b/Code/Framework/AzCore/AzCore/Memory/AllocatorManager.cpp index b34a88669c..3c09b4cae6 100644 --- a/Code/Framework/AzCore/AzCore/Memory/AllocatorManager.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/AllocatorManager.cpp @@ -39,9 +39,9 @@ namespace AZ return AZStd::hash{}(key); } }; - typedef AZStd::basic_string, AZStdIAllocator> AMString; - typedef AZStd::unordered_map, AZStdIAllocator> AllocatorNameMap; - typedef AZStd::unordered_map, AZStdIAllocator> AllocatorRemappings; + using AMString = AZStd::basic_string, AZStdIAllocator>; + using AllocatorNameMap = AZStd::unordered_map, AZStdIAllocator>; + using AllocatorRemappings = AZStd::unordered_map, AZStdIAllocator>; // For allocators that are created before we have an environment, we keep some module-local data for them so that we can register them // properly once the environment is attached. @@ -403,7 +403,7 @@ AllocatorManager::AddOutOfMemoryListener(const OutOfMemoryCBType& cb) void AllocatorManager::RemoveOutOfMemoryListener() { - m_outOfMemoryListener = 0; + m_outOfMemoryListener = nullptr; } //========================================================================= @@ -660,13 +660,13 @@ void AllocatorManager::GetAllocatorStats(size_t& allocatedBytes, size_t& capacit //========================================================================= AllocatorManager::MemoryBreak::MemoryBreak() { - addressStart = NULL; - addressEnd = NULL; + addressStart = nullptr; + addressEnd = nullptr; byteSize = 0; alignment = static_cast(0xffffffff); - name = NULL; + name = nullptr; - fileName = NULL; + fileName = nullptr; lineNum = -1; } @@ -729,14 +729,14 @@ AllocatorManager::DebugBreak(void* address, const Debug::AllocationInfo& info) AZ_Assert(!(m_memoryBreak[i].alignment == info.m_alignment), "User triggered breakpoint - alignment (%d)", info.m_alignment); AZ_Assert(!(m_memoryBreak[i].byteSize == info.m_byteSize), "User triggered breakpoint - allocation size (%d)", info.m_byteSize); - AZ_Assert(!(info.m_name != NULL && m_memoryBreak[i].name != NULL && strcmp(m_memoryBreak[i].name, info.m_name) == 0), "User triggered breakpoint - name \"%s\"", info.m_name); + AZ_Assert(!(info.m_name != nullptr && m_memoryBreak[i].name != nullptr && strcmp(m_memoryBreak[i].name, info.m_name) == 0), "User triggered breakpoint - name \"%s\"", info.m_name); if (m_memoryBreak[i].lineNum != 0) { - AZ_Assert(!(info.m_fileName != NULL && m_memoryBreak[i].fileName != NULL && strcmp(m_memoryBreak[i].fileName, info.m_fileName) == 0 && m_memoryBreak[i].lineNum == info.m_lineNum), "User triggered breakpoint - file/line number : %s(%d)", info.m_fileName, info.m_lineNum); + AZ_Assert(!(info.m_fileName != nullptr && m_memoryBreak[i].fileName != nullptr && strcmp(m_memoryBreak[i].fileName, info.m_fileName) == 0 && m_memoryBreak[i].lineNum == info.m_lineNum), "User triggered breakpoint - file/line number : %s(%d)", info.m_fileName, info.m_lineNum); } else { - AZ_Assert(!(info.m_fileName != NULL && m_memoryBreak[i].fileName != NULL && strcmp(m_memoryBreak[i].fileName, info.m_fileName) == 0), "User triggered breakpoint - file name \"%s\"", info.m_fileName); + AZ_Assert(!(info.m_fileName != nullptr && m_memoryBreak[i].fileName != nullptr && strcmp(m_memoryBreak[i].fileName, info.m_fileName) == 0), "User triggered breakpoint - file name \"%s\"", info.m_fileName); } } } diff --git a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp index a9b0ec92c3..cf26c8f723 100644 --- a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp @@ -22,7 +22,7 @@ using namespace AZ; //========================================================================= BestFitExternalMapAllocator::BestFitExternalMapAllocator() : AllocatorBase(this, "BestFitExternalMapAllocator", "Best fit allocator with external tracking storage!") - , m_schema(NULL) + , m_schema(nullptr) {} //========================================================================= @@ -47,7 +47,7 @@ BestFitExternalMapAllocator::Create(const Descriptor& desc) schemaDesc.m_memoryBlockByteSize = desc.m_memoryBlockByteSize; m_schema = azcreate(BestFitExternalMapSchema, (schemaDesc), SystemAllocator); - if (m_schema == NULL) + if (m_schema == nullptr) { isReady = false; } @@ -63,7 +63,7 @@ void BestFitExternalMapAllocator::Destroy() { azdestroy(m_schema, SystemAllocator); - m_schema = NULL; + m_schema = nullptr; } AllocatorDebugConfig BestFitExternalMapAllocator::GetDebugConfig() @@ -89,7 +89,7 @@ BestFitExternalMapAllocator::Allocate(size_type byteSize, size_type alignment, i byteSize = MemorySizeAdjustedUp(byteSize); BestFitExternalMapAllocator::pointer_type address = m_schema->Allocate(byteSize, alignment, flags); - if (address == 0) + if (address == nullptr) { if (!OnOutOfMemory(byteSize, alignment, flags, name, fileName, lineNum)) { @@ -100,7 +100,7 @@ BestFitExternalMapAllocator::Allocate(size_type byteSize, size_type alignment, i } } - AZ_Assert(address != 0, "BestFitExternalMapAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); + AZ_Assert(address != nullptr, "BestFitExternalMapAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); AZ_MEMORY_PROFILE(ProfileAllocation(address, byteSize, alignment, name, fileName, lineNum, suppressStackRecord + 1)); return address; @@ -145,7 +145,7 @@ BestFitExternalMapAllocator::ReAllocate(pointer_type ptr, size_type newSize, siz (void)newSize; (void)newAlignment; AZ_Assert(false, "Not supported!"); - return NULL; + return nullptr; } //========================================================================= diff --git a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapSchema.cpp b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapSchema.cpp index 1cd7f156d1..d94d1dfe35 100644 --- a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapSchema.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapSchema.cpp @@ -18,15 +18,15 @@ using namespace AZ; BestFitExternalMapSchema::BestFitExternalMapSchema(const Descriptor& desc) : m_desc(desc) , m_used(0) - , m_freeChunksMap(FreeMapType::key_compare(), AZStdIAllocator(desc.m_mapAllocator != NULL ? desc.m_mapAllocator : &AllocatorInstance::Get())) - , m_allocChunksMap(AllocMapType::hasher(), AllocMapType::key_eq(), AZStdIAllocator(desc.m_mapAllocator != NULL ? desc.m_mapAllocator : &AllocatorInstance::Get())) + , m_freeChunksMap(FreeMapType::key_compare(), AZStdIAllocator(desc.m_mapAllocator != nullptr ? desc.m_mapAllocator : &AllocatorInstance::Get())) + , m_allocChunksMap(AllocMapType::hasher(), AllocMapType::key_eq(), AZStdIAllocator(desc.m_mapAllocator != nullptr ? desc.m_mapAllocator : &AllocatorInstance::Get())) { - if (m_desc.m_mapAllocator == NULL) + if (m_desc.m_mapAllocator == nullptr) { m_desc.m_mapAllocator = &AllocatorInstance::Get(); // used as our sub allocator } AZ_Assert(m_desc.m_memoryBlockByteSize > 0, "You must provide memory block size!"); - AZ_Assert(m_desc.m_memoryBlock != NULL, "You must provide memory block allocated as you with!"); + AZ_Assert(m_desc.m_memoryBlock != nullptr, "You must provide memory block allocated as you with!"); //if( m_desc.m_memoryBlock == NULL) there is no point to automate this cause we need to flag this memory special, otherwise there is no point to use this allocator at all // m_desc.m_memoryBlock = azmalloc(SystemAllocator,m_desc.m_memoryBlockByteSize,16); m_freeChunksMap.insert(AZStd::make_pair(m_desc.m_memoryBlockByteSize, reinterpret_cast(m_desc.m_memoryBlock))); @@ -40,13 +40,13 @@ BestFitExternalMapSchema::pointer_type BestFitExternalMapSchema::Allocate(size_type byteSize, size_type alignment, int flags) { (void)flags; - char* address = NULL; + char* address = nullptr; AZ_Assert(alignment > 0 && (alignment & (alignment - 1)) == 0, "Alignment must be >0 and power of 2!"); for (int i = 0; i < 2; ++i) // max 2 attempts to allocate { FreeMapType::iterator iter = m_freeChunksMap.find(byteSize); size_t blockSize = 0; - char* blockAddress = NULL; + char* blockAddress = nullptr; size_t preAllocBlockSize = 0; while (iter != m_freeChunksMap.end()) { @@ -64,7 +64,7 @@ BestFitExternalMapSchema::Allocate(size_type byteSize, size_type alignment, int } ++iter; } - if (address != NULL) + if (address != nullptr) { // split blocks if (preAllocBlockSize) // if we have a block before the alignment @@ -94,7 +94,7 @@ BestFitExternalMapSchema::Allocate(size_type byteSize, size_type alignment, int void BestFitExternalMapSchema::DeAllocate(pointer_type ptr) { - if (ptr == 0) + if (ptr == nullptr) { return; } diff --git a/Code/Framework/AzCore/AzCore/Memory/HeapSchema.cpp b/Code/Framework/AzCore/AzCore/Memory/HeapSchema.cpp index 1c67a95d51..50e6a47630 100644 --- a/Code/Framework/AzCore/AzCore/Memory/HeapSchema.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/HeapSchema.cpp @@ -107,17 +107,17 @@ namespace AZ m_used = 0; m_desc = desc; - m_subAllocator = 0; + m_subAllocator = nullptr; for (int i = 0; i < Descriptor::m_maxNumBlocks; ++i) { - m_memSpaces[i] = 0; + m_memSpaces[i] = nullptr; m_ownMemoryBlock[i] = false; } for (int i = 0; i < m_desc.m_numMemoryBlocks; ++i) { - if (m_desc.m_memoryBlocks[i] == 0) // Allocate memory block if requested! + if (m_desc.m_memoryBlocks[i] == nullptr) // Allocate memory block if requested! { AZ_Assert(AllocatorInstance::IsReady(), "You requested to allocate memory using the system allocator, but it's not created yet!"); m_subAllocator = &AllocatorInstance::Get(); @@ -152,7 +152,7 @@ namespace AZ if (m_memSpaces[i]) { AZDLMalloc::destroy_mspace(m_memSpaces[i]); - m_memSpaces[i] = 0; + m_memSpaces[i] = nullptr; if (m_ownMemoryBlock[i]) { @@ -172,7 +172,7 @@ namespace AZ AZ_UNUSED(lineNum); AZ_UNUSED(suppressStackRecord); int blockId = flags; - AZ_Assert(m_memSpaces[blockId]!=0, "Invalid block id!"); + AZ_Assert(m_memSpaces[blockId]!=nullptr, "Invalid block id!"); HeapSchema::pointer_type address = AZDLMalloc::mspace_memalign(m_memSpaces[blockId], alignment, byteSize); if (address) { @@ -186,7 +186,7 @@ namespace AZ { AZ_UNUSED(byteSize); AZ_UNUSED(alignment); - if (ptr==0) + if (ptr==nullptr) { return; } @@ -194,7 +194,7 @@ namespace AZ // if we use m_spaces just count the chunk sizes. m_used -= ChunckSize(ptr); #ifdef FOOTERS - AZDLMalloc::mspace_free(0, ptr); ///< We use footers so we know which memspace the pointer belongs to. + AZDLMalloc::mspace_free(nullptr, ptr); ///< We use footers so we know which memspace the pointer belongs to. #else int i = 0; for (; i < m_desc.m_numMemoryBlocks; ++i) @@ -248,7 +248,7 @@ namespace AZ HeapSchema::ChunckSize(pointer_type ptr) { // based on azmalloc_usable_size + the overhead - if (ptr != 0) + if (ptr != nullptr) { mchunkptr p = mem2chunk(ptr); //if (is_inuse(p)) // we can even skip this check since we track for double free and so on anyway diff --git a/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp b/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp index 5b7ca194cf..f5df0dfe96 100644 --- a/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp @@ -784,17 +784,17 @@ namespace AZ { // size == 0 acts as free void* realloc(void* ptr, size_t size) { - if (ptr == NULL) + if (ptr == nullptr) { return alloc(size); } if (size == 0) { free(ptr); - return NULL; + return nullptr; } debug_check(ptr); - void* newPtr = NULL; + void* newPtr = nullptr; if (ptr_in_bucket(ptr)) { if (is_small_allocation(size)) // no point to check m_isPoolAllocations as if it's false pointer can't be in a bucket. @@ -853,21 +853,21 @@ namespace AZ { { return realloc(ptr, size); } - if (ptr == NULL) + if (ptr == nullptr) { return alloc(size, alignment); } if (size == 0) { free(ptr); - return NULL; + return nullptr; } if ((size_t)ptr & (alignment - 1)) { void* newPtr = alloc(size, alignment); if (!newPtr) { - return NULL; + return nullptr; } size_t count = this->size(ptr); if (count > size) @@ -879,7 +879,7 @@ namespace AZ { return newPtr; } debug_check(ptr); - void* newPtr = NULL; + void* newPtr = nullptr; if (ptr_in_bucket(ptr)) { if (is_small_allocation(size) && alignment <= MAX_SMALL_ALLOCATION) // no point to check m_isPoolAllocations as if it was false, pointer can't be in a bucket @@ -931,7 +931,7 @@ namespace AZ { // returns the size of the resulting memory block inline size_t resize(void* ptr, size_t size) { - if (ptr == NULL) + if (ptr == nullptr) { return 0; } @@ -957,7 +957,7 @@ namespace AZ { // query the size of the memory block inline size_t size(void* ptr) const { - if (ptr == NULL) + if (ptr == nullptr) { return 0; } @@ -993,7 +993,7 @@ namespace AZ { // free the memory block inline void free(void* ptr) { - if (ptr == NULL) + if (ptr == nullptr) { return; } @@ -1009,7 +1009,7 @@ namespace AZ { // free the memory block supplying the original size with DEFAULT_ALIGNMENT inline void free(void* ptr, size_t origSize) { - if (ptr == NULL) + if (ptr == nullptr) { return; } @@ -1027,7 +1027,7 @@ namespace AZ { // free the memory block supplying the original size and alignment inline void free(void* ptr, size_t origSize, size_t oldAlignment) { - if (ptr == NULL) + if (ptr == nullptr) { return; } @@ -1134,10 +1134,10 @@ namespace AZ { // If m_systemChunkSize is specified, use that size for allocating tree blocks from the OS // m_treePageAlignment should be OS_VIRTUAL_PAGE_SIZE in all cases with this trait as we work // with virtual memory addresses when the tree grows and we cannot specify an alignment in all cases - : m_treePageSize(desc.m_fixedMemoryBlock != NULL ? desc.m_pageSize : + : m_treePageSize(desc.m_fixedMemoryBlock != nullptr ? desc.m_pageSize : desc.m_systemChunkSize != 0 ? desc.m_systemChunkSize : OS_VIRTUAL_PAGE_SIZE) , m_treePageAlignment(desc.m_pageSize) - , m_poolPageSize(desc.m_fixedMemoryBlock != NULL ? desc.m_poolPageSize : OS_VIRTUAL_PAGE_SIZE) + , m_poolPageSize(desc.m_fixedMemoryBlock != nullptr ? desc.m_poolPageSize : OS_VIRTUAL_PAGE_SIZE) , m_subAllocator(desc.m_subAllocator) { #ifdef DEBUG_ALLOCATOR @@ -1246,7 +1246,7 @@ namespace AZ { return p; } } - return NULL; + return nullptr; } const HpAllocator::page* HpAllocator::bucket::get_free_page() const @@ -1259,7 +1259,7 @@ namespace AZ { return p; } } - return NULL; + return nullptr; } void* HpAllocator::bucket::alloc(page* p) @@ -1359,7 +1359,7 @@ namespace AZ { p = bucket_grow(bsize, mBuckets[bi].marker()); if (!p) { - return NULL; + return nullptr; } mBuckets[bi].add_free_page(p); } @@ -1385,7 +1385,7 @@ namespace AZ { p = bucket_grow(bsize, mBuckets[bi].marker()); if (!p) { - return NULL; + return nullptr; } mBuckets[bi].add_free_page(p); } @@ -1406,7 +1406,7 @@ namespace AZ { void* newPtr = bucket_alloc(size); if (!newPtr) { - return NULL; + return nullptr; } memcpy(newPtr, ptr, AZStd::GetMin(elemSize - MEMORY_GUARD_SIZE, size - MEMORY_GUARD_SIZE)); bucket_free(ptr); @@ -1426,7 +1426,7 @@ namespace AZ { void* newPtr = bucket_alloc_direct(bucket_spacing_function(AZ::SizeAlignUp(size, alignment))); if (!newPtr) { - return NULL; + return nullptr; } memcpy(newPtr, ptr, AZStd::GetMin(elemSize - MEMORY_GUARD_SIZE, size - MEMORY_GUARD_SIZE)); bucket_free(ptr); @@ -1638,7 +1638,7 @@ namespace AZ { // create a dummy block to avoid prev() NULL checks and allow easy block shifts // potentially this dummy block might grow (due to shift_block) but not more than sizeof(free_node) block_header* front = (block_header*)mem; - front->prev(0); + front->prev(nullptr); front->size(0); front->set_used(); block_header* back = (block_header*)front->mem(); @@ -1777,7 +1777,7 @@ namespace AZ { newBl = tree_grow(size); if (!newBl) { - return NULL; + return nullptr; } } HPPA_ASSERT(!newBl->used()); @@ -1956,7 +1956,7 @@ namespace AZ { tree_free(ptr); return newPtr; } - return NULL; + return nullptr; } void* HpAllocator::tree_realloc_aligned(void* ptr, size_t size, size_t alignment) @@ -2044,7 +2044,7 @@ namespace AZ { tree_free(ptr); return newPtr; } - return NULL; + return nullptr; } size_t HpAllocator::tree_resize(void* ptr, size_t size) @@ -2121,7 +2121,7 @@ namespace AZ { HPPA_ASSERT(!bl->used()); HPPA_ASSERT(bl->prev() && bl->prev()->used()); HPPA_ASSERT(bl->next() && bl->next()->used()); - if (bl->prev()->prev() == NULL && bl->next()->size() == 0) + if (bl->prev()->prev() == nullptr && bl->next()->size() == 0) { tree_detach(bl); char* memStart = (char*)bl->prev(); @@ -2539,11 +2539,11 @@ namespace AZ { if (m_desc.m_fixedMemoryBlockByteSize > 0) { AZ_Assert((m_desc.m_fixedMemoryBlockByteSize & (m_desc.m_pageSize - 1)) == 0, "Memory block size %d MUST be multiples of the of the page size %d!", m_desc.m_fixedMemoryBlockByteSize, m_desc.m_pageSize); - if (m_desc.m_fixedMemoryBlock == NULL) + if (m_desc.m_fixedMemoryBlock == nullptr) { - AZ_Assert(m_desc.m_subAllocator != NULL, "Sub allocator must point to a valid allocator if m_fixedMemoryBlock is NOT allocated (NULL)!"); + AZ_Assert(m_desc.m_subAllocator != nullptr, "Sub allocator must point to a valid allocator if m_fixedMemoryBlock is NOT allocated (NULL)!"); m_desc.m_fixedMemoryBlock = m_desc.m_subAllocator->Allocate(m_desc.m_fixedMemoryBlockByteSize, m_desc.m_fixedMemoryBlockAlignment, 0, "HphaSchema", __FILE__, __LINE__, 1); - AZ_Assert(m_desc.m_fixedMemoryBlock != NULL, "Failed to allocate %d bytes!", m_desc.m_fixedMemoryBlockByteSize); + AZ_Assert(m_desc.m_fixedMemoryBlock != nullptr, "Failed to allocate %d bytes!", m_desc.m_fixedMemoryBlockByteSize); m_ownMemoryBlock = true; } AZ_Assert((reinterpret_cast(m_desc.m_fixedMemoryBlock) & static_cast(desc.m_fixedMemoryBlockAlignment - 1)) == 0, "Memory block must be page size (%d bytes) aligned!", desc.m_fixedMemoryBlockAlignment); @@ -2570,7 +2570,7 @@ namespace AZ { if (m_ownMemoryBlock) { m_desc.m_subAllocator->DeAllocate(m_desc.m_fixedMemoryBlock, m_desc.m_fixedMemoryBlockByteSize, m_desc.m_fixedMemoryBlockAlignment); - m_desc.m_fixedMemoryBlock = NULL; + m_desc.m_fixedMemoryBlock = nullptr; } } @@ -2587,7 +2587,7 @@ namespace AZ { (void)lineNum; (void)suppressStackRecord; pointer_type address = m_allocator->alloc(byteSize, alignment); - if (address == NULL) + if (address == nullptr) { GarbageCollect(); address = m_allocator->alloc(byteSize, alignment); @@ -2603,7 +2603,7 @@ namespace AZ { HphaSchema::ReAllocate(pointer_type ptr, size_type newSize, size_type newAlignment) { pointer_type address = m_allocator->realloc(ptr, newSize, newAlignment); - if (address == NULL && newSize > 0) + if (address == nullptr && newSize > 0) { GarbageCollect(); address = m_allocator->realloc(ptr, newSize, newAlignment); @@ -2618,7 +2618,7 @@ namespace AZ { void HphaSchema::DeAllocate(pointer_type ptr, size_type size, size_type alignment) { - if (ptr == 0) + if (ptr == nullptr) { return; } diff --git a/Code/Framework/AzCore/AzCore/Memory/MemoryDriller.cpp b/Code/Framework/AzCore/AzCore/Memory/MemoryDriller.cpp index 934efeef1b..2ea25c3397 100644 --- a/Code/Framework/AzCore/AzCore/Memory/MemoryDriller.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/MemoryDriller.cpp @@ -106,7 +106,7 @@ namespace AZ m_allAllocatorRecords.push_back(allocator->GetRecords()); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } @@ -154,7 +154,7 @@ namespace AZ delete allocatorRecords; allocator->SetRecords(nullptr); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } @@ -173,7 +173,7 @@ namespace AZ if (records) { const AllocationInfo* info = records->RegisterAllocation(address, byteSize, alignment, name, fileName, lineNum, stackSuppressCount + 1); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } @@ -226,7 +226,7 @@ namespace AZ { records->UnregisterAllocation(address, byteSize, alignment, info); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } @@ -261,7 +261,7 @@ namespace AZ { records->ResizeAllocation(address, newSize); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } diff --git a/Code/Framework/AzCore/AzCore/Memory/OSAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/OSAllocator.cpp index 5637fcc646..317df214d6 100644 --- a/Code/Framework/AzCore/AzCore/Memory/OSAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/OSAllocator.cpp @@ -75,7 +75,7 @@ namespace AZ address = AZ_OS_MALLOC(byteSize, alignment); } - if (address == 0 && byteSize > 0) + if (address == nullptr && byteSize > 0) { AZ_Printf("Memory", "======================================================\n"); AZ_Printf("Memory", "OSAllocator run out of system memory!\nWe can't track the debug allocator, since it's used for tracking and pipes trought the OS... here are the other allocator status:\n"); diff --git a/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp index e59e304c54..35ad19dd9e 100644 --- a/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp @@ -216,9 +216,9 @@ namespace AZ class OverrunDetectionSchemaImpl { public: - typedef void* pointer_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; + using pointer_type = void *; + using size_type = size_t; + using difference_type = ptrdiff_t; OverrunDetectionSchemaImpl(const OverrunDetectionSchema::Descriptor& desc); ~OverrunDetectionSchemaImpl(); @@ -241,8 +241,8 @@ namespace AZ Internal::AllocationRecord* CreateAllocationRecord(void* p, size_t size) const; private: - typedef AZStd::mutex mutex_type; - typedef AZStd::lock_guard lock_type; + using mutex_type = AZStd::mutex; + using lock_type = AZStd::lock_guard; AZStd::unique_ptr m_platformAllocator; mutex_type m_mutex; diff --git a/Code/Framework/AzCore/AzCore/Memory/PoolSchema.cpp b/Code/Framework/AzCore/AzCore/Memory/PoolSchema.cpp index b251774d77..3e71f530a0 100644 --- a/Code/Framework/AzCore/AzCore/Memory/PoolSchema.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/PoolSchema.cpp @@ -278,7 +278,7 @@ namespace AZ Page* page = reinterpret_cast(memBlock); if (!page->m_magic.Validate()) { - return NULL; + return nullptr; } return page; } @@ -403,7 +403,7 @@ PoolAllocation::Allocate(size_t byteSize, size_t alignment) u32 bucketIndex = static_cast((byteSize >> m_minAllocationShift)-1); BucketType& bucket = m_buckets[bucketIndex]; - PageType* page = 0; + PageType* page = nullptr; if (!bucket.m_pages.empty()) { page = &bucket.m_pages.front(); @@ -411,7 +411,7 @@ PoolAllocation::Allocate(size_t byteSize, size_t alignment) // check if we have free slot in the page if (page->m_freeList.empty()) { - page = 0; + page = nullptr; } else if (page->m_freeList.size()==1) { @@ -464,7 +464,7 @@ AZ_INLINE void PoolAllocation::DeAllocate(void* ptr) { PageType* page = m_allocator->PageFromAddress(ptr); - if (page==NULL) + if (page==nullptr) { AZ_Error("Memory", false, "Address 0x%08x is not in the ThreadPool!", ptr); return; @@ -503,7 +503,7 @@ PoolAllocation::DeAllocate(void* ptr) m_allocator->PushFreePage(page); } } - else if (frontPage->m_next != 0) + else if (frontPage->m_next != nullptr) { // if the next page has free slots free the current page if (frontPage->m_next->m_freeList.size() < maxElementsPerBucket) @@ -584,7 +584,7 @@ PoolAllocation::GarbageCollect(bool isForceFreeAllPages) // [9/15/2009] //========================================================================= PoolSchema::PoolSchema(const Descriptor& desc) - : m_impl(NULL) + : m_impl(nullptr) { (void)desc; // ignored here, applied in Create() } @@ -595,7 +595,7 @@ PoolSchema::PoolSchema(const Descriptor& desc) //========================================================================= PoolSchema::~PoolSchema() { - AZ_Assert(m_impl==NULL, "You did not destroy the pool schema!"); + AZ_Assert(m_impl==nullptr, "You did not destroy the pool schema!"); delete m_impl; } @@ -605,12 +605,12 @@ PoolSchema::~PoolSchema() //========================================================================= bool PoolSchema::Create(const Descriptor& desc) { - AZ_Assert(m_impl==NULL, "PoolSchema already created!"); - if (m_impl == NULL) + AZ_Assert(m_impl==nullptr, "PoolSchema already created!"); + if (m_impl == nullptr) { m_impl = aznew PoolSchemaImpl(desc); } - return (m_impl!=NULL); + return (m_impl!=nullptr); } //========================================================================= @@ -620,7 +620,7 @@ bool PoolSchema::Create(const Descriptor& desc) bool PoolSchema::Destroy() { delete m_impl; - m_impl = NULL; + m_impl = nullptr; return true; } @@ -751,7 +751,7 @@ PoolSchema::GetSubAllocator() PoolSchemaImpl::PoolSchemaImpl(const PoolSchema::Descriptor& desc) : m_pageAllocator(desc.m_pageAllocator ? desc.m_pageAllocator : &AllocatorInstance::Get()) , m_allocator(this, desc.m_pageSize, desc.m_minAllocationSize, desc.m_maxAllocationSize) - , m_staticDataBlock(0) + , m_staticDataBlock(nullptr) , m_numStaticPages(desc.m_numStaticPages) , m_isDynamic(desc.m_isDynamic) , m_pageSize(desc.m_pageSize) @@ -851,7 +851,7 @@ PoolSchemaImpl::AllocationSize(PoolSchema::pointer_type ptr) AZ_FORCE_INLINE PoolSchemaImpl::Page* PoolSchemaImpl::PopFreePage() { - Page* page = 0; + Page* page = nullptr; if (!m_freePages.empty()) { page = &m_freePages.front(); @@ -938,7 +938,7 @@ PoolSchemaImpl::Page::SetupFreeList(size_t elementSize, size_t pageDataBlockSize // [9/15/2009] //========================================================================= ThreadPoolSchema::ThreadPoolSchema(GetThreadPoolData getThreadPoolData, SetThreadPoolData setThreadPoolData) - : m_impl(NULL) + : m_impl(nullptr) , m_threadPoolGetter(getThreadPoolData) , m_threadPoolSetter(setThreadPoolData) { @@ -950,7 +950,7 @@ ThreadPoolSchema::ThreadPoolSchema(GetThreadPoolData getThreadPoolData, SetThrea //========================================================================= ThreadPoolSchema::~ThreadPoolSchema() { - AZ_Assert(m_impl==NULL, "You did not destroy the thread pool schema!"); + AZ_Assert(m_impl==nullptr, "You did not destroy the thread pool schema!"); delete m_impl; } @@ -960,12 +960,12 @@ ThreadPoolSchema::~ThreadPoolSchema() //========================================================================= bool ThreadPoolSchema::Create(const Descriptor& desc) { - AZ_Assert(m_impl==NULL, "PoolSchema already created!"); - if (m_impl == NULL) + AZ_Assert(m_impl==nullptr, "PoolSchema already created!"); + if (m_impl == nullptr) { m_impl = aznew ThreadPoolSchemaImpl(desc, m_threadPoolGetter, m_threadPoolSetter); } - return (m_impl!=NULL); + return (m_impl!=nullptr); } //========================================================================= @@ -975,7 +975,7 @@ bool ThreadPoolSchema::Create(const Descriptor& desc) bool ThreadPoolSchema::Destroy() { delete m_impl; - m_impl = NULL; + m_impl = nullptr; return true; } //========================================================================= @@ -1099,7 +1099,7 @@ ThreadPoolSchemaImpl::ThreadPoolSchemaImpl(const ThreadPoolSchema::Descriptor& d : m_threadPoolGetter(threadPoolGetter) , m_threadPoolSetter(threadPoolSetter) , m_pageAllocator(desc.m_pageAllocator) - , m_staticDataBlock(0) + , m_staticDataBlock(nullptr) , m_numStaticPages(desc.m_numStaticPages) , m_pageSize(desc.m_pageSize) , m_minAllocationSize(desc.m_minAllocationSize) @@ -1112,7 +1112,7 @@ ThreadPoolSchemaImpl::ThreadPoolSchemaImpl(const ThreadPoolSchema::Descriptor& d SetCriticalSectionSpinCount(m_mutex.native_handle(), 4000); # endif - if (m_pageAllocator == 0) + if (m_pageAllocator == nullptr) { m_pageAllocator = &AllocatorInstance::Get(); // use the SystemAllocator if no page allocator is provided } @@ -1211,7 +1211,7 @@ ThreadPoolSchemaImpl::Allocate(ThreadPoolSchema::size_type byteSize, ThreadPoolS { // deallocate elements if they were freed from other threads Page::FakeNodeLF* fakeLFNode; - while ((fakeLFNode = threadData->m_freedElements.pop())!=0) + while ((fakeLFNode = threadData->m_freedElements.pop())!=nullptr) { threadData->m_allocator.DeAllocate(fakeLFNode); } @@ -1228,12 +1228,12 @@ void ThreadPoolSchemaImpl::DeAllocate(ThreadPoolSchema::pointer_type ptr) { Page* page = PageFromAddress(ptr); - if (page==NULL) + if (page==nullptr) { AZ_Error("Memory", false, "Address 0x%08x is not in the ThreadPool!", ptr); return; } - AZ_Assert(page->m_threadData!=0, ("We must have valid page thread data for the page!")); + AZ_Assert(page->m_threadData!=nullptr, ("We must have valid page thread data for the page!")); ThreadPoolData* threadData = m_threadPoolGetter(); if (threadData == page->m_threadData) { @@ -1262,11 +1262,11 @@ ThreadPoolSchema::size_type ThreadPoolSchemaImpl::AllocationSize(ThreadPoolSchema::pointer_type ptr) { Page* page = PageFromAddress(ptr); - if (page==NULL) + if (page==nullptr) { return 0; } - AZ_Assert(page->m_threadData!=0, ("We must have valid page thread data for the page!")); + AZ_Assert(page->m_threadData!=nullptr, ("We must have valid page thread data for the page!")); return page->m_threadData->m_allocator.AllocationSize(ptr); } @@ -1282,7 +1282,7 @@ ThreadPoolSchemaImpl::PopFreePage() AZStd::lock_guard lock(m_mutex); if (m_freePages.empty()) { - page = NULL; + page = nullptr; } else { @@ -1387,7 +1387,7 @@ ThreadPoolData::~ThreadPoolData() { // deallocate elements if they were freed from other threads ThreadPoolSchemaImpl::Page::FakeNodeLF* fakeLFNode; - while ((fakeLFNode = m_freedElements.pop())!=0) + while ((fakeLFNode = m_freedElements.pop())!=nullptr) { m_allocator.DeAllocate(fakeLFNode); } diff --git a/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp index 0fb64915dc..8c84338fd0 100644 --- a/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp @@ -153,7 +153,7 @@ SystemAllocator::Create(const Descriptor& desc) #elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP m_allocator = azcreate(HeapSchema, (heapDesc), SystemAllocator); #endif - if (m_allocator == NULL) + if (m_allocator == nullptr) { isReady = false; } @@ -237,7 +237,7 @@ SystemAllocator::Allocate(size_type byteSize, size_type alignment, int flags, co byteSize = MemorySizeAdjustedUp(byteSize); SystemAllocator::pointer_type address = m_allocator->Allocate(byteSize, alignment, flags, name, fileName, lineNum, suppressStackRecord + 1); - if (address == 0) + if (address == nullptr) { // Free all memory we can and try again! AllocatorManager::Instance().GarbageCollect(); @@ -245,7 +245,7 @@ SystemAllocator::Allocate(size_type byteSize, size_type alignment, int flags, co address = m_allocator->Allocate(byteSize, alignment, flags, name, fileName, lineNum, suppressStackRecord + 1); } - if (address == 0) + if (address == nullptr) { byteSize = MemorySizeAdjustedDown(byteSize); // restore original size @@ -258,7 +258,7 @@ SystemAllocator::Allocate(size_type byteSize, size_type alignment, int flags, co } } - AZ_Assert(address != 0, "SystemAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); + AZ_Assert(address != nullptr, "SystemAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, fileName, lineNum, address, byteSize, name); AZ_MEMORY_PROFILE(ProfileAllocation(address, byteSize, alignment, name, fileName, lineNum, suppressStackRecord + 1)); diff --git a/Code/Framework/AzCore/AzCore/Module/Environment.cpp b/Code/Framework/AzCore/AzCore/Module/Environment.cpp index bec530e2d1..c07b7444d4 100644 --- a/Code/Framework/AzCore/AzCore/Module/Environment.cpp +++ b/Code/Framework/AzCore/AzCore/Module/Environment.cpp @@ -148,7 +148,7 @@ namespace AZ 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) + for (const auto &variableIt : m_variableMap) { EnvironmentVariableHolderBase* holder = reinterpret_cast(variableIt.second); if (holder) diff --git a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp index 7e1adb93b9..a75e1803eb 100644 --- a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp +++ b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp @@ -41,11 +41,17 @@ namespace AZ::NativeUI AZStd::string result = DisplayBlockingDialog("Assert Failed!", message, options); if (result.compare(buttonNames[0]) == 0) + { return AssertAction::IGNORE_ASSERT; + } else if (result.compare(buttonNames[1]) == 0) + { return AssertAction::IGNORE_ALL_ASSERTS; + } else if (result.compare(buttonNames[2]) == 0) + { return AssertAction::BREAK; + } return AssertAction::NONE; } diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.cpp b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.cpp index e621ab412e..a44aa61aca 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.cpp +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.cpp @@ -121,12 +121,12 @@ namespace AZ { delete attrIt.second; } - + if (m_overload) { delete m_overload; } - + m_attributes.clear(); } @@ -180,7 +180,7 @@ namespace AZ if (GetNumArguments() == overload->GetNumArguments()) { bool anyDifference = false; - + for (size_t i(0), sentinel(GetNumArguments()); !anyDifference && i < sentinel; ++i) { const BehaviorParameter* thisArg = GetArgument(i); @@ -273,7 +273,7 @@ namespace AZ auto attributes = AZStd::move(m_attributes); // Actually delete everything - for (auto propertyIt : events) + for (const auto &propertyIt : events) { delete propertyIt.second.m_broadcast; delete propertyIt.second.m_event; @@ -519,20 +519,20 @@ namespace AZ AZStd::vector BehaviorClass::GetOverloads(const AZStd::string& name) const { AZStd::vector overloads; - + auto methodIter = m_methods.find(name); if (methodIter != m_methods.end()) { overloads = GetOverloadsIncludeMethod(methodIter->second); - } - + } + return overloads; } AZStd::vector BehaviorClass::GetOverloadsIncludeMethod(BehaviorMethod* method) const { AZStd::vector overloads; - + auto iter = method; while (iter) { @@ -546,7 +546,7 @@ namespace AZ AZStd::vector BehaviorClass::GetOverloadsExcludeMethod(BehaviorMethod* method) const { AZStd::vector overloads; - + auto iter = method->m_overload; while (iter) { @@ -972,5 +972,5 @@ namespace AZ return enumRttiHelper.GetTypeId(); } } - + } // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h index f02c37492b..ba8808d4d2 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h @@ -36,7 +36,7 @@ namespace AZ constexpr const char* k_PropertyNameGetterSuffix = "::Getter"; constexpr const char* k_PropertyNameSetterSuffix = "::Setter"; - + /// Typedef for class unwrapping callback (i.e. used for things like smart_ptr to unwrap for T) using BehaviorClassUnwrapperFunction = void(*)(void* /*classPtr*/, void*& /*unwrappedClass*/, AZ::Uuid& /*unwrappedClassTypeId*/, void* /*userData*/); @@ -53,7 +53,7 @@ namespace AZ IfPresent, }; - struct BehaviorObject // same as DynamicSerializableField, make sure we merge them... so we can store the object easily + struct BehaviorObject // same as DynamicSerializableField, make sure we merge them... so we can store the object easily { AZ_TYPE_INFO(BehaviorObject, "{2813cdfb-0a4a-411c-9216-72a7b644d1dd}"); @@ -165,7 +165,7 @@ namespace AZ /// Convert to BehaviorObject implicitly for passing generic parameters (usually not known at compile time) operator BehaviorObject() const; - /// Converts internally the value to a specific type known at compile time. \returns true if conversion was successful. + /// Converts internally the value to a specific type known at compile time. \returns true if conversion was successful. template bool ConvertTo(); @@ -452,7 +452,7 @@ namespace AZ namespace Internal { const AZ::TypeId& GetUnderlyingTypeId(const IRttiHelper& enumRttiHelper); - + // Converts sourceAddress to targetType inline bool ConvertValueTo(void* sourceAddress, const IRttiHelper* sourceRtti, const AZ::Uuid& targetType, void*& targetAddress, BehaviorParameter::TempValueParameterAllocator& tempAllocator) { @@ -520,7 +520,7 @@ namespace AZ static const int s_startNamedArgumentIndex = s_startArgumentIndex; // +1 for result type BehaviorMethodImpl(FunctionPointer functionPointer, BehaviorContext* context, const AZStd::string& name = AZStd::string()); - + bool Call(BehaviorValueParameter* arguments, unsigned int numArguments, BehaviorValueParameter* result) const override; bool HasResult() const override; @@ -548,7 +548,7 @@ namespace AZ BehaviorParameter m_parameters[sizeof...(Args)+s_startNamedArgumentIndex]; AZStd::array m_metadataParameters; ///< Stores the per parameter metadata which is used to add names, tooltips, trait, default values, etc... to the parameters }; - + #if __cpp_noexcept_function_type // C++17 makes exception specifications as part of the type in paper P0012R1 // Therefore noexcept overloads must be distinguished from non-noexcept overloads @@ -732,7 +732,7 @@ namespace AZ BehaviorEBusEvent(FunctionPointer functionPointer, BehaviorContext* context); BehaviorEBusEvent(FunctionPointerConst functionPointer, BehaviorContext* context); - + template inline AZStd::enable_if_t SetBusIdType(); @@ -813,7 +813,7 @@ namespace AZ : SetFunctionParameters {}; #endif - + template struct BehaviorOnDemandReflectHelper; template @@ -997,14 +997,14 @@ namespace AZ } // namespace Internal /** - * Behavior representation of reflected class. + * Behavior representation of reflected class. */ class BehaviorClass { public: AZ_CLASS_ALLOCATOR(BehaviorClass, SystemAllocator, 0); - BehaviorClass(); + BehaviorClass(); ~BehaviorClass(); /// Hooks to override default memory allocation for the class (AZ_CLASS_ALLOCATOR is used by default) @@ -1065,7 +1065,7 @@ namespace AZ void* m_userData; AZStd::string m_name; - AZStd::vector m_baseClasses; + AZStd::vector m_baseClasses; AZStd::unordered_map m_methods; AZStd::unordered_map m_properties; AttributeArray m_attributes; @@ -1081,7 +1081,7 @@ namespace AZ AZ::Uuid m_wrappedTypeId; // Store all owned instances for unload verification? }; - + // Helper macros to generate getter and setter function from a pointer to value or member value // Syntax BehaviorValueGetter(&globalValue) BehaviorValueGetter(&Class::MemberValue) # define BehaviorValueGetter(valueAddress) &AZ::Internal::BehaviorValuePropertyHelper::Get @@ -1095,7 +1095,7 @@ namespace AZ * Property representation, a property has getter and setter. A read only property will have a "nullptr" for a setter. * You can use lambdas, global of member function. If you want to just expose a variable (not write the function and handle changes) * you can use \ref BehaviorValueProperty macros (or BehaviorValueGetter/Setter to control read/write functionality) - * Member constants are a property too, use \ref BehaviorConstant for it. Everything is either a property or a method, the main reason + * Member constants are a property too, use \ref BehaviorConstant for it. Everything is either a property or a method, the main reason * why we "push" people to use functions is that in most cases when we manipulate an object, you will need to do more than just set a value * to a new value. */ @@ -1163,7 +1163,7 @@ namespace AZ }; /** - * RAII class which keeps track of functions reflected to the BehaviorContext + * RAII class which keeps track of functions reflected to the BehaviorContext * when it is supplied as an OnDemandReflectionOwner */ class ScopedBehaviorOnDemandReflector @@ -1182,7 +1182,7 @@ namespace AZ AZ_CLASS_ALLOCATOR(BehaviorEBus, SystemAllocator, 0); typedef void(*QueueFunctionType)(void* /*userData1*/, void* /*userData2*/); - + struct VirtualProperty { VirtualProperty(BehaviorEBusEventSender* getter, BehaviorEBusEventSender* setter) @@ -1294,7 +1294,7 @@ namespace AZ AZStd::string m_scriptPath; #endif - AZStd::string GetScriptPath() const + AZStd::string GetScriptPath() const { #if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) // m_scriptPath is only available in non-Release mode return m_scriptPath; @@ -1303,8 +1303,8 @@ namespace AZ #endif } - void SetScriptPath(const char* scriptPath) - { + void SetScriptPath(const char* scriptPath) + { #if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) // m_scriptPath is only available in non-Release mode m_scriptPath = scriptPath; #else @@ -1346,7 +1346,7 @@ namespace AZ virtual void OnAddGlobalProperty(const char* propertyName, BehaviorProperty* prop) { (void)propertyName; (void)prop; } virtual void OnRemoveGlobalProperty(const char* propertyName, BehaviorProperty* prop) { (void)propertyName; (void)prop; } - /// Called when a class is added or removed + /// Called when a class is added or removed virtual void OnAddClass(const char* className, BehaviorClass* behaviorClass) { (void)className; (void)behaviorClass; } virtual void OnRemoveClass(const char* className, BehaviorClass* behaviorClass) { (void)className; (void)behaviorClass; } @@ -1358,10 +1358,10 @@ namespace AZ using BehaviorContextBus = AZ::EBus; /** - * BehaviorContext is used to reflect classes, methods and EBuses for runtime interaction. A typical consumer of this context and different + * BehaviorContext is used to reflect classes, methods and EBuses for runtime interaction. A typical consumer of this context and different * scripting systems (i.e. Lua, Visual Script, etc.). Even though (as designed) there are overlaps between some context they have very different * purpose and set of rules. For example SerializeContext, doesn't reflect any methods, it just reflects data fields that will be stored for initial object - * setup, it handles version conversion and so thing, this related to storing the object to a persistent storage. Behavior context, doesn't need to deal with versions as + * setup, it handles version conversion and so thing, this related to storing the object to a persistent storage. Behavior context, doesn't need to deal with versions as * no data is stored, just methods for manipulating the object state. */ class BehaviorContext : public ReflectContext @@ -1379,7 +1379,7 @@ namespace AZ } template - static void QueueFunction(BehaviorEBus::QueueFunctionType f, void* userData1, void* userData2) + static void QueueFunction(BehaviorEBus::QueueFunctionType f, void* userData1, void* userData2) { Bus::QueueFunction(f, userData1, userData2); } @@ -1484,8 +1484,8 @@ namespace AZ } template - static void SetClassDefaultAllocator(BehaviorClass* behaviorClass, const AZStd::false_type& /*HasAZClassAllocator*/) - { + static void SetClassDefaultAllocator(BehaviorClass* behaviorClass, const AZStd::false_type& /*HasAZClassAllocator*/) + { behaviorClass->m_allocate = &DefaultSystemAllocator::Allocate; behaviorClass->m_deallocate = &DefaultSystemAllocator::DeAllocate; } @@ -1522,20 +1522,20 @@ namespace AZ } template - static void SetClassDefaultConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_constructible*/) + static void SetClassDefaultConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_constructible*/) { behaviorClass->m_defaultConstructor = &DefaultConstruct; } template - static void SetClassDefaultDestructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_destructible*/) + static void SetClassDefaultDestructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_destructible*/) { behaviorClass->m_destructor = &DefaultDestruct; } template - static void SetClassDefaultCopyConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_copy_constructible*/) - { + static void SetClassDefaultCopyConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_copy_constructible*/) + { behaviorClass->m_cloner = &DefaultCopyConstruct; } @@ -1585,7 +1585,7 @@ namespace AZ const char* m_name; BehaviorMethod* m_method; }; - + struct GlobalPropertyBuilder : public AZ::Internal::GenericAttributes { typedef AZ::Internal::GenericAttributes Base; @@ -1608,7 +1608,7 @@ namespace AZ ClassBuilder(BehaviorContext* context, BehaviorClass* behaviorClass); ~ClassBuilder(); ClassBuilder* operator->(); - + /** * Sets custom allocator for a class, this function will error if this not inside a class. * This is only for very specific cases when you want to override AZ_CLASS_ALLOCATOR or you are dealing with 3rd party classes, otherwise @@ -1659,9 +1659,9 @@ namespace AZ ClassBuilder* Constant(const char* name, Getter getter); /** - * You can describe buses that this class uses to communicate. Those buses will be used by tools when + * You can describe buses that this class uses to communicate. Those buses will be used by tools when * you need to give developers hints as to what buses this class interacts with. - * You don't need to reflect all buses that your class uses, just the ones related to + * You don't need to reflect all buses that your class uses, just the ones related to * class behavior. Please refer to component documentation for more information on * the pattern of Request and Notification buses. * {@ @@ -1717,10 +1717,10 @@ namespace AZ /** * With request buses (please refer to component communication patterns documentation) we ofter have EBus events - * that represent a getter and a setter for a value. To allow our tools to take advantage of it, you can reflect + * that represent a getter and a setter for a value. To allow our tools to take advantage of it, you can reflect * VirtualProperty to indicate which event is the getter and which is the setter. * This function validates that getter event has no argument and a result and setter function has no results and only - * one argument which is the same type as the result of the getter. + * one argument which is the same type as the result of the getter. * \note Make sure you call this function after you have reflected the getter and setter events as it will report an error * if we can't find the function */ @@ -1731,7 +1731,7 @@ namespace AZ BehaviorContext(); ~BehaviorContext(); - + ///< \deprecated Use "Method(const char*, Function, const AZStd::array::num_args>&, const char*)" instead ///< This method does not support passing in argument names and tooltips nor does it support overriding specific parameter Behavior traits template @@ -1741,7 +1741,7 @@ namespace AZ ///< This method does not support passing in argument names and tooltips nor does it support overriding specific parameter Behavior traits template GlobalMethodBuilder Method(const char* name, Function f, const char* deprecatedName, BehaviorValues* defaultValues = nullptr, const char* dbgDesc = nullptr); - + template GlobalMethodBuilder Method(const char* name, Function f, const AZStd::array::num_args>& args, const char* dbgDesc = nullptr); @@ -1836,13 +1836,13 @@ namespace AZ /** * Helper MACRO to help you write the EBus handler that you want to reflect to behavior. This is not required, but generally we recommend reflecting all useful - * buses as this enable people to "script" complex behaviors. + * buses as this enable people to "script" complex behaviors. * You don't have to use this macro to write a Handler, but some people find it useful * Here is an example how to use it: * class MyEBusBehaviorHandler : public MyEBus::Handler, public AZ::BehaviorEBusHandler * { * public: - * AZ_EBUS_BEHAVIOR_BINDER(MyEBusBehaviorHandler, "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX}",Allocator, OnEvent1, OnEvent2 and so on); + * AZ_EBUS_BEHAVIOR_BINDER(MyEBusBehaviorHandler, "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX}",Allocator, OnEvent1, OnEvent2 and so on); * // now you need implementations for those event * * @@ -1854,7 +1854,7 @@ namespace AZ * // The AZ_EBUS_BEHAVIOR_BINDER defines FN_EventName for each index. You can also cache it yourself (but it's slower), static int cacheIndex = GetFunctionIndex("OnEvent1"); and use that . * CallResult(result, FN_OnEvent1, data); // forward to the binding (there can be none, this is why we need to always have properly set result, when there is one) * return result; // return the result like you will in any normal EBus even with result - * } * + * } * * // handle the other events here * }; * @@ -1922,7 +1922,7 @@ namespace AZ /** * Provides the same functionality of the AZ_EBUS_BEHAVIOR_BINDER macro above with the additional ability to specify the names and a tooltips of handler methods * after listing the handler method in the macro. - * An example Usage is + * An example Usage is * class MyEBusBehaviorHandler : public MyEBus::Handler, public AZ::BehaviorEBusHandler * { * public: @@ -1930,7 +1930,7 @@ namespace AZ * OnEvent2, ({#OnEvent2 first parameter name(float), #OnEvent2 first parameter tooltip(float)}, {#OnEvent2 second parameter name(bool), {#OnEvent2 second parameter tooltip(bool)}), * OnEvent3, ()); * // The reason for needing parenthesis around the parameter name and tooltip object(AZ::BehaviorParameterOverrides) is to prevent the macro from parsing the comma in the intializer as seperate parameters - * // When using this macro, the BehaviorParameterOverrides objects must be placed after every listing a function as a handler. Furthermore the number of BehaviorParameterOverrides objects for each function must match the number of parameters + * // When using this macro, the BehaviorParameterOverrides objects must be placed after every listing a function as a handler. Furthermore the number of BehaviorParameterOverrides objects for each function must match the number of parameters * // to that function * // Ex. for a function called HugeEvent with a signature of void HugeEvent(int, float, double, char, short), two arguments must be supplied to the macro. * // 1. HugeEvent @@ -2181,7 +2181,7 @@ namespace AZ // Template implementations ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - + ////////////////////////////////////////////////////////////////////////// inline BehaviorObject::BehaviorObject() : m_address(nullptr) @@ -2569,7 +2569,7 @@ namespace AZ m_getter = nullptr; return false; } - + // assure that TR_THIS_PTR is set on the first parameter m_getter->OverrideParameterTraits(0, AZ::BehaviorParameter::TR_THIS_PTR, 0); } @@ -2847,7 +2847,7 @@ namespace AZ } ////////////////////////////////////////////////////////////////////////// - + template void BehaviorEBusHandler::CallResult(R& result, int index, Args&&... args) const { @@ -2904,7 +2904,7 @@ namespace AZ { return ClassBuilder(this, static_cast(nullptr)); } - + auto classTypeIt = m_typeToClassMap.find(typeUuid); if (IsRemovingReflection()) { @@ -2933,7 +2933,7 @@ namespace AZ // class already reflected, display name and uuid char uuidName[AZ::Uuid::MaxStringBuffer]; classTypeIt->first.ToString(uuidName, AZ::Uuid::MaxStringBuffer); - + AZ_Error("Reflection", false, "Class '%s' is already registered using Uuid: %s!", name, uuidName); return ClassBuilder(this, static_cast(nullptr)); } @@ -3002,7 +3002,7 @@ namespace AZ if (m_class && (!Base::m_context->IsRemovingReflection())) { - for (auto method : m_class->m_methods) + for (const auto &method : m_class->m_methods) { m_class->PostProcessMethod(Base::m_context, *method.second); if (MethodReturnsAzEventByReferenceOrPointer(*method.second)) @@ -3485,7 +3485,7 @@ namespace AZ return this; } - + ////////////////////////////////////////////////////////////////////////// template BehaviorContext::EBusBuilder BehaviorContext::EBus(const char* name, const char* deprecatedName /*=nullptr*/, const char* toolTip /*=nullptr*/) @@ -3748,9 +3748,9 @@ namespace AZ return this; } } - + m_ebus->m_virtualProperties.insert(AZStd::make_pair(name, BehaviorEBus::VirtualProperty(getter, setter))); - } + } return this; } @@ -3868,7 +3868,7 @@ namespace AZ SetParameters(m_parameters, this); SetParameters(&m_parameters[s_startNamedArgumentIndex], this); } - + ////////////////////////////////////////////////////////////////////////// template bool BehaviorMethodImpl::Call(BehaviorValueParameter* arguments, unsigned int numArguments, BehaviorValueParameter* result) const @@ -3876,7 +3876,7 @@ namespace AZ size_t totalArguments = GetNumArguments(); if (numArguments < totalArguments) { - // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array + // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array // that can always handle all parameters. So far the don't use default values that ofter, so we will optimize for the common case first. BehaviorValueParameter* newArguments = reinterpret_cast(alloca(sizeof(BehaviorValueParameter)* totalArguments)); // clone the input parameters (we don't need to clone temp buffers, etc. as they will be still on the stack) @@ -4072,7 +4072,7 @@ namespace AZ { m_isConst = true; } - + ////////////////////////////////////////////////////////////////////////// template bool BehaviorMethodImpl::Call(BehaviorValueParameter* arguments, unsigned int numArguments, BehaviorValueParameter* result) const @@ -4080,7 +4080,7 @@ namespace AZ size_t totalArguments = GetNumArguments(); if (numArguments < totalArguments) { - // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array + // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array // that can always handle all parameters. So far the don't use default values that ofter, so we will optimize for the common case first. BehaviorValueParameter* newArguments = reinterpret_cast(alloca(sizeof(BehaviorValueParameter)* totalArguments)); // clone the input parameters (we don't need to clone temp buffers, etc. as they will be still on the stack) @@ -4284,7 +4284,7 @@ namespace AZ { m_isConst = true; } - + ////////////////////////////////////////////////////////////////////////// template template @@ -4307,7 +4307,7 @@ namespace AZ size_t totalArguments = GetNumArguments(); if (numArguments < totalArguments) { - // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array + // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array // that can always handle all parameters. So far the don't use default values that ofter, so we will optimize for the common case first. BehaviorValueParameter* newArguments = reinterpret_cast(alloca(sizeof(BehaviorValueParameter)* totalArguments)); // clone the input parameters (we don't need to clone temp buffers, etc. as they will be still on the stack) @@ -4497,7 +4497,7 @@ namespace AZ template void SetFunctionParameters::Set(AZStd::vector& params) { - // result, userdata, arguments + // result, userdata, arguments params.resize(sizeof...(Args) + eBehaviorBusForwarderEventIndices::ParameterFirst); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::Result], nullptr); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::UserData], nullptr); diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp index 531c91bcf4..fb0d12f552 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp @@ -1463,9 +1463,9 @@ static void* LuaMemoryHook(void* userData, void* ptr, size_t osize, size_t nsize { allocator->DeAllocate(ptr); } - return NULL; + return nullptr; } - else if (ptr == NULL) + else if (ptr == nullptr) { return allocator->Allocate(nsize, LUA_DEFAULT_ALIGNMENT, 0, "Script", __FILE__, __LINE__, 1); } @@ -1708,7 +1708,7 @@ LUA_API const Node* lua_getDummyNode() "Invalid stack!"); lua_pop(m_nativeContext, (currentTop - m_startVariableIndex) + 1); - m_nativeContext = NULL; + m_nativeContext = nullptr; m_startVariableIndex = 0; m_numArguments = 0; m_numResults = 0; @@ -2038,7 +2038,7 @@ LUA_API const Node* lua_getDummyNode() LSV_BEGIN_VARIABLE(m_nativeContext); valueIndex = 0; - name = NULL; + name = nullptr; index = -1; if (m_mode == MD_INSPECT) { diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp index 63f44a2469..e28a289c9e 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp @@ -43,7 +43,7 @@ public: , m_numErrors(0) { using namespace AZStd::placeholders; - m_context->SetErrorHook(AZStd::bind(&ScriptErrorCatcher::ErrorCB, this, _1, _2, _3)); + m_context->SetErrorHook([this](ScriptContext* a, ScriptContext::ErrorType b, const char* c) { ErrorCB(a,b,c); }); } ~ScriptErrorCatcher() { @@ -66,7 +66,7 @@ public: // [6/29/2012] //========================================================================= ScriptContextDebug::ScriptContextDebug(ScriptContext& scriptContext, bool isEnableStackRecord) - : m_luaDebug(NULL) + : m_luaDebug(nullptr) , m_currentStackLevel(-1) , m_stepStackLevel(-1) , m_isRecordCallstack(isEnableStackRecord) @@ -104,7 +104,7 @@ void ScriptContextDebug::ConnectHook() //========================================================================= void ScriptContextDebug::DisconnectHook() { - lua_sethook(m_context.NativeContext(), 0, 0, 0); + lua_sethook(m_context.NativeContext(), nullptr, 0, 0); } //========================================================================= @@ -149,7 +149,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe lua_rawgeti(l, -2, AZ_LUA_CLASS_METATABLE_NAME_INDEX); // load class name AZ_Assert(lua_isstring(l, -1), "Internal scipt error: class without a classname at index %d", AZ_LUA_CLASS_METATABLE_NAME_INDEX); - + if (!enumClass(lua_tostring(l, -1), behaviorClass->m_typeId, userData)) { lua_pop(l, 5); @@ -199,7 +199,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe // for any non-built in methods if (strncmp(name, "__", 2) != 0) { - const char* dbgParamInfo = NULL; + const char* dbgParamInfo = nullptr; // attempt to get the name bool popDebugName = lua_getupvalue(l, -1, 2) != nullptr; @@ -278,7 +278,7 @@ ScriptContextDebug::EnumRegisteredGlobals(EnumMethod enumMethod, EnumProperty en { if (strncmp(name, "__", 2) != 0) { - const char* dbgParamInfo = NULL; + const char* dbgParamInfo = nullptr; lua_getupvalue(l, -1, 2); if (lua_isstring(l, -1)) { @@ -606,7 +606,7 @@ void AZ::LuaHook(lua_State* l, lua_Debug* ar) lua_pop(l, 1); // bool doBreak = false; - ScriptContextDebug::Breakpoint* bp = NULL; + ScriptContextDebug::Breakpoint* bp = nullptr; ScriptContextDebug::Breakpoint localBreakPoint; lua_getinfo(l, "Sunl", ar); @@ -735,7 +735,7 @@ void AZ::LuaHook(lua_State* l, lua_Debug* ar) { context->m_luaDebug = ar; context->m_breakCallback(context, bp); - context->m_luaDebug = NULL; + context->m_luaDebug = nullptr; } } @@ -752,7 +752,7 @@ ScriptContextDebug::EnumLocals(EnumLocalCallback& cb) int local = 1; const char* name; ScriptDataContext dc; - while ((name = lua_getlocal(l, m_luaDebug, local)) != NULL) + while ((name = lua_getlocal(l, m_luaDebug, local)) != nullptr) { if (name[0] != '(') // skip temporary variables { @@ -846,7 +846,7 @@ ScriptContextDebug::EnableBreakpoints(BreakpointCallback& cb) void ScriptContextDebug::DisableBreakpoints() { - m_breakCallback = NULL; + m_breakCallback = nullptr; } //========================================================================= @@ -1079,7 +1079,7 @@ ScriptContextDebug::WriteValue(const DebugValue& value, const char* valueName, i int valueTableIndex = -1; if (valueName[0] == '[') { - valueTableIndex = static_cast(strtol(valueName + 1, NULL, 10)); + valueTableIndex = static_cast(strtol(valueName + 1, nullptr, 10)); } if (strcmp(valueName, "__metatable__") == 0) // metatable are read only { @@ -1114,7 +1114,7 @@ ScriptContextDebug::WriteValue(const DebugValue& value, const char* valueName, i } break; case LUA_TNUMBER: { - lua_pushnumber(l, static_cast(strtod(value.m_value.c_str(), NULL))); + lua_pushnumber(l, static_cast(strtod(value.m_value.c_str(), nullptr))); if (localIndex != -1) { lua_setlocal(l, m_luaDebug, localIndex); @@ -1256,7 +1256,7 @@ ScriptContextDebug::WriteValue(const DebugValue& value, const char* valueName, i else { lua_pushvalue(l, -5); // copy the user data (this pointer) - lua_pushnumber(l, static_cast(strtod(subElement.m_value.c_str(), NULL))); + lua_pushnumber(l, static_cast(strtod(subElement.m_value.c_str(), nullptr))); lua_call(l, 2, 0); // call the setter } break; @@ -1375,7 +1375,7 @@ ScriptContextDebug::GetValue(DebugValue& value) { int iLocal = 1; const char* localName; - while ((localName = lua_getlocal(l, m_luaDebug, iLocal)) != NULL) + while ((localName = lua_getlocal(l, m_luaDebug, iLocal)) != nullptr) { if (localName[0] != '(' && strcmp(name, localName) == 0) { @@ -1460,7 +1460,7 @@ ScriptContextDebug::SetValue(const DebugValue& sourceValue) // create hierarchy from tokens const DebugValue* value = &sourceValue; DebugValue untokenizedValue; - + if (tokens.size() > 1) { untokenizedValue.m_name = tokens[0]; @@ -1519,7 +1519,7 @@ ScriptContextDebug::SetValue(const DebugValue& sourceValue) { int iLocal = 1; const char* localName; - while ((localName = lua_getlocal(l, m_luaDebug, iLocal)) != NULL) + while ((localName = lua_getlocal(l, m_luaDebug, iLocal)) != nullptr) { lua_pop(l, 1); if (localName[0] != '(' && strcmp(name, localName) == 0) diff --git a/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp b/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp index c8e6c28679..37eacd940e 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp @@ -42,7 +42,7 @@ namespace AZ AZ_Assert(targetPointer, "You must provide a target pointer"); bool foundSuccess = false; - typedef AZStd::function CreationCallback; + using CreationCallback = AZStd::function; auto handler = [&targetPointer, objectClassData, &foundSuccess](void** instance, const SerializeContext::ClassData** classData, const Uuid& classId, SerializeContext* context) { void* convertibleInstance{}; diff --git a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp index cea4b795d7..f326b021e7 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp @@ -91,7 +91,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown char, short, int version!"); (void)textVersion; - long value = strtol(text, NULL, 10); + long value = strtol(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(T), reinterpret_cast(&value))); } @@ -124,7 +124,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - unsigned long value = strtoul(text, NULL, 10); + unsigned long value = strtoul(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(T), reinterpret_cast(&value))); } @@ -158,7 +158,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - long value = strtol(text, NULL, 10); + long value = strtol(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(T), reinterpret_cast(&value))); } @@ -192,7 +192,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - unsigned long value = strtoul(text, NULL, 10); + unsigned long value = strtoul(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(T), reinterpret_cast(&value))); } @@ -225,7 +225,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - AZ::s64 value = strtoll(text, NULL, 10); + AZ::s64 value = strtoll(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(AZ::s64), reinterpret_cast(&value))); } @@ -258,7 +258,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - unsigned long long value = strtoull(text, NULL, 10); + unsigned long long value = strtoull(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(AZ::u64), reinterpret_cast(&value))); } @@ -292,7 +292,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown float/double version!"); (void)textVersion; - double value = strtod(text, NULL); + double value = strtod(text, nullptr); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); T data = static_cast(value); @@ -815,7 +815,7 @@ namespace AZ const ClassData* fromClass = FindClassData(fromClassId); if (!fromClass) { - return NULL; + return nullptr; } for (size_t i = 0; i < fromClass->m_elements.size(); ++i) @@ -831,7 +831,7 @@ namespace AZ if (!fromClass->m_azRtti) { - return NULL; // Reflection info failed to cast and we can't find rtti info + return nullptr; // Reflection info failed to cast and we can't find rtti info } fromClassHelper = fromClass->m_azRtti; } @@ -841,7 +841,7 @@ namespace AZ const ClassData* toClass = FindClassData(toClassId); if (!toClass || !toClass->m_azRtti) { - return NULL; // We can't cast without class data or rtti helper + return nullptr; // We can't cast without class data or rtti helper } toClassHelper = toClass->m_azRtti; } @@ -855,7 +855,7 @@ namespace AZ // [5/22/2012] //========================================================================= SerializeContext::DataElement::DataElement() - : m_name(0) + : m_name(nullptr) , m_nameCrc(0) , m_dataSize(0) , m_byteStream(&m_buffer) @@ -1045,7 +1045,7 @@ namespace AZ //========================================================================= bool SerializeContext::DataElementNode::Convert(SerializeContext& sc, const char* name, const Uuid& id) { - AZ_Assert(name != NULL && strlen(name) > 0, "Empty name is an INVALID element name!"); + AZ_Assert(name != nullptr && strlen(name) > 0, "Empty name is an INVALID element name!"); u32 nameCrc = Crc32(name); #if defined(AZ_ENABLE_TRACING) @@ -1165,7 +1165,7 @@ namespace AZ int SerializeContext::DataElementNode::AddElement(SerializeContext& sc, const char* name, const ClassData& classData) { (void)sc; - AZ_Assert(name != NULL && strlen(name) > 0, "Empty name is an INVALID element name!"); + AZ_Assert(name != nullptr && strlen(name) > 0, "Empty name is an INVALID element name!"); u32 nameCrc = Crc32(name); #if defined(AZ_ENABLE_TRACING) @@ -1703,7 +1703,7 @@ namespace AZ m_classData->second.m_serializer = AZStd::move(serializer); return this; - + } //========================================================================= @@ -1801,7 +1801,7 @@ namespace AZ void* objectPtr = ptr; const AZ::Uuid* classIdPtr = &classId; const SerializeContext::ClassData* dataClassInfo = classData; - + if (classElement) { // if we are a pointer, then we may be pointing to a derived type. @@ -1854,14 +1854,14 @@ namespace AZ DbgStackEntry de; de.m_dataPtr = objectPtr; de.m_uuidPtr = classIdPtr; - de.m_elementName = classElement ? classElement->m_name : NULL; + de.m_elementName = classElement ? classElement->m_name : nullptr; de.m_classData = dataClassInfo; de.m_classElement = classElement; callContext->m_errorHandler->Push(de); } #endif // AZ_ENABLE_SERIALIZER_DEBUG - if (dataClassInfo == NULL) + if (dataClassInfo == nullptr) { #if defined (AZ_ENABLE_SERIALIZER_DEBUG) AZStd::string error; @@ -2182,9 +2182,9 @@ namespace AZ AZ::SerializeContext::DataPatchUpgradeHandler::~DataPatchUpgradeHandler() { - for (auto fieldUpgrades : m_upgrades) + for (const auto& fieldUpgrades : m_upgrades) { - for (auto versionUpgrades : fieldUpgrades.second) + for (const auto& versionUpgrades : fieldUpgrades.second) { for (auto* upgrade : versionUpgrades.second) { @@ -2192,8 +2192,8 @@ namespace AZ } } } - } - + } + void AZ::SerializeContext::DataPatchUpgradeHandler::AddFieldUpgrade(DataPatchUpgrade* upgrade) { // Find the field @@ -2448,7 +2448,7 @@ namespace AZ classData->m_eventHandler->OnWriteEnd(dataPtr); classData->m_eventHandler->OnObjectCloned(dataPtr); } - + if (classData->m_serializer) { classData->m_serializer->PostClone(dataPtr); @@ -2489,7 +2489,7 @@ namespace AZ { if (cd.m_azRtti->IsTypeOf(typeId)) { - if (!callback(&cd, 0)) + if (!callback(&cd, nullptr)) { return; } @@ -2507,7 +2507,7 @@ namespace AZ // if both classes have azRtti they will be enumerated already by the code above (azrtti) if (cd.m_azRtti == nullptr || cd.m_elements[i].m_azRtti == nullptr) { - if (!callback(&cd, 0)) + if (!callback(&cd, nullptr)) { return; } @@ -2539,7 +2539,7 @@ namespace AZ if (baseClassData) { callbackData.m_reportedTypes.push_back(baseClassData->m_typeId); - if (!callback(baseClassData, 0)) + if (!callback(baseClassData, nullptr)) { return; } @@ -2586,8 +2586,8 @@ namespace AZ void SerializeContext::RegisterDataContainer(AZStd::unique_ptr dataContainer) { m_dataContainers.push_back(AZStd::move(dataContainer)); - } - + } + //========================================================================= // EnumerateBaseRTTIEnumCallback // [11/13/2012] @@ -2731,10 +2731,10 @@ namespace AZ //========================================================================= void SerializeContext::IDataContainer::DeletePointerData(SerializeContext* context, const ClassElement* classElement, const void* element) { - AZ_Assert(context != NULL && classElement != NULL && element != NULL, "Invalid input"); + AZ_Assert(context != nullptr && classElement != nullptr && element != nullptr, "Invalid input"); const AZ::Uuid* elemUuid = &classElement->m_typeId; // find the class data for the specific element - const SerializeContext::ClassData* classData = classElement->m_genericClassInfo ? classElement->m_genericClassInfo->GetClassData() : context->FindClassData(*elemUuid, NULL, 0); + const SerializeContext::ClassData* classData = classElement->m_genericClassInfo ? classElement->m_genericClassInfo->GetClassData() : context->FindClassData(*elemUuid, nullptr, 0); if (classElement->m_flags & SerializeContext::ClassElement::FLG_POINTER) { const void* dataPtr = *reinterpret_cast(element); @@ -2745,7 +2745,7 @@ namespace AZ if (*actualClassId != *elemUuid) { // we are pointing to derived type, adjust class data, uuid and pointer. - classData = context->FindClassData(*actualClassId, NULL, 0); + classData = context->FindClassData(*actualClassId, nullptr, 0); elemUuid = actualClassId; if (classData) { @@ -2754,7 +2754,7 @@ namespace AZ } } } - if (classData == NULL) + if (classData == nullptr) { if ((classElement->m_flags & ClassElement::FLG_POINTER) != 0) { @@ -3250,7 +3250,7 @@ namespace AZ return m_moduleOSAllocator; } - // Take advantage of static variables being unique per dll module to clean up module specific registered classes when the module unloads + // Take advantage of static variables being unique per dll module to clean up module specific registered classes when the module unloads SerializeContext::PerModuleGenericClassInfo& GetCurrentSerializeContextModule() { static SerializeContext::PerModuleGenericClassInfo s_ModuleCleanupInstance; diff --git a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.h b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.h index d48e9df665..3d7f3c00f8 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.h +++ b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.h @@ -602,7 +602,7 @@ namespace AZ ///< @param resultPtr output parameter that is populated with the memory address that can be used to store an element of the convertible type ///< @param convertibleTypeId type to check to determine if it can converted to an element of class represent by this Class Data ///< @param classPtr memory address of the class represented by the ClassData - ///< @return true if a non-null memory address has been returned that can store the convertible type + ///< @return true if a non-null memory address has been returned that can store the convertible type bool ConvertFromType(void*& convertibleTypePtr, const TypeId& convertibleTypeId, void* classPtr, AZ::SerializeContext& serializeContext) const; /// Find the persistence id (check base classes) \todo this is a TEMP fix, analyze and cache that information in the class @@ -797,8 +797,8 @@ namespace AZ virtual void* ReserveElement(void* instance, const ClassElement* classElement) = 0; /// Free an element that was reserved using ReserveElement, but was not stored by calling StoreElement. virtual void FreeReservedElement(void* instance, void* element, SerializeContext* deletePointerDataContext) - { - RemoveElement(instance, element, deletePointerDataContext); + { + RemoveElement(instance, element, deletePointerDataContext); } /// Get an element's address by its index (called before the element is loaded). virtual void* GetElementByIndex(void* instance, const ClassElement* classElement, size_t index) = 0; @@ -858,7 +858,7 @@ namespace AZ /** * Data Converter interface which can be used to provide a conversion operation from to unrelated C++ types - * derived class to base class casting is taken care of through the RTTI system so those relations should not be + * derived class to base class casting is taken care of through the RTTI system so those relations should not be * check within this class */ class IDataConverter @@ -879,7 +879,7 @@ namespace AZ ///< @param convertibleTypeId type to check to determine if it can converted to an element of class represent by this Class Data ///< @param classPtr memory address of the class represented by the @classData type ///< @param classData reference to the metadata representing the type stored in classPtr - ///< @return true if a non-null memory address has been returned that can store the convertible type + ///< @return true if a non-null memory address has been returned that can store the convertible type virtual bool ConvertFromType(void*& convertibleTypePtr, const TypeId& convertibleTypeId, void* classPtr, const SerializeContext::ClassData& classData, SerializeContext& /*serializeContext*/) { if (classData.m_typeId == convertibleTypeId) @@ -1054,7 +1054,7 @@ namespace AZ AZStd::vector FindClassId(const AZ::Crc32& classNameCrc) const; /// Find GenericClassData data based on the supplied class ID - GenericClassInfo* FindGenericClassInfo(const Uuid& classId) const; + GenericClassInfo* FindGenericClassInfo(const Uuid& classId) const; /// Creates an AZStd::any based on the provided class Uuid, or returns an empty AZStd::any if no class data is found or the class is virtual AZStd::any CreateAny(const Uuid& classId); @@ -1161,7 +1161,7 @@ namespace AZ /* Declare a name change of a serialized field * These are used by the serializer to repair old data patches - * + * */ ClassBuilder* NameChange(unsigned int fromVersion, unsigned int toVersion, AZStd::string_view oldFieldName, AZStd::string_view newFieldName); @@ -1403,7 +1403,7 @@ namespace AZ template struct SerializeGenericTypeInfo { - // Provides a specific type alias that can be used to create GenericClassInfo of the + // Provides a specific type alias that can be used to create GenericClassInfo of the // specified type. By default this is GenericClassInfo class which is abstract using ClassInfoType = GenericClassInfo; @@ -1938,7 +1938,7 @@ namespace AZ if (m_context->IsRemovingReflection()) { // Delete any attributes allocated for this call. - for (auto attributePair : attributes) + for (auto& attributePair : attributes) { delete attributePair.second; } @@ -1955,7 +1955,7 @@ namespace AZ m_classData->second.m_name, AzTypeInfo::Name()); - // SerializeGenericTypeInfo::GetClassTypeId() is needed solely because + // SerializeGenericTypeInfo::GetClassTypeId() is needed solely because // the SerializeGenericTypeInfo specialization for AZ::Data::Asset returns the GetAssetClassId() value // and not the AzTypeInfo>::Uuid() // Therefore in order to remain backwards compatible the SerializeGenericTypeInfo::GetClassTypeId specialization diff --git a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp index 6b89b8c044..cb666a7c02 100644 --- a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp @@ -550,7 +550,7 @@ namespace AZ::SettingsRegistryMergeUtils } registry.Set(FilePathKey_ProjectUserPath, projectUserPath.Native()); - // Set the user directory with the provided path or using project/user as default + // Set the log directory with the provided path or using project/user/log as default auto projectLogPathKey = FixedValueString::format("%s/project_log_path", BootstrapSettingsRootKey); AZ::IO::FixedMaxPath projectLogPath; if (!registry.Get(projectLogPath.Native(), projectLogPathKey)) @@ -640,7 +640,7 @@ namespace AZ::SettingsRegistryMergeUtils } #if !AZ_TRAIT_OS_IS_HOST_OS_PLATFORM - // Setup the cache and user paths when to platform specific locations when running on non-host platforms + // Setup the cache, user, and log paths to platform specific locations when running on non-host platforms path = engineRoot; if (AZStd::optional nonHostCacheRoot = Utils::GetDefaultAppRootPath(); nonHostCacheRoot) @@ -656,13 +656,16 @@ namespace AZ::SettingsRegistryMergeUtils if (AZStd::optional devWriteStorage = Utils::GetDevWriteStoragePath(); devWriteStorage) { - registry.Set(FilePathKey_DevWriteStorage, *devWriteStorage); - registry.Set(FilePathKey_ProjectUserPath, *devWriteStorage); + const AZ::IO::FixedMaxPath devWriteStoragePath(*devWriteStorage); + registry.Set(FilePathKey_DevWriteStorage, devWriteStoragePath.LexicallyNormal().Native()); + registry.Set(FilePathKey_ProjectUserPath, (devWriteStoragePath / "user").LexicallyNormal().Native()); + registry.Set(FilePathKey_ProjectLogPath, (devWriteStoragePath / "user/log").LexicallyNormal().Native()); } else { registry.Set(FilePathKey_DevWriteStorage, path.LexicallyNormal().Native()); registry.Set(FilePathKey_ProjectUserPath, (path / "user").LexicallyNormal().Native()); + registry.Set(FilePathKey_ProjectLogPath, (path / "user/log").LexicallyNormal().Native()); } #endif // AZ_TRAIT_OS_IS_HOST_OS_PLATFORM } @@ -1001,7 +1004,7 @@ namespace AZ::SettingsRegistryMergeUtils } AZ::SettingsRegistryInterface::VisitResponse Traverse( AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::VisitAction action, - AZ::SettingsRegistryInterface::Type type) + AZ::SettingsRegistryInterface::Type type) override { // Pass the pointer path to the inclusion filter if available if (m_dumperSettings.m_includeFilter && !m_dumperSettings.m_includeFilter(path)) @@ -1055,7 +1058,7 @@ namespace AZ::SettingsRegistryMergeUtils AZ::SettingsRegistryInterface::VisitResponse::Done; } - void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, bool value) + void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, bool value) override { m_result = m_result && WriteName(valueName) && m_writer.Bool(value); } @@ -1070,12 +1073,12 @@ namespace AZ::SettingsRegistryMergeUtils m_result = m_result && WriteName(valueName) && m_writer.Uint64(value); } - void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, double value) + void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, double value) override { m_result = m_result && WriteName(valueName) && m_writer.Double(value); } - void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value) + void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value) override { m_result = m_result && WriteName(valueName) && m_writer.String(value.data(), aznumeric_caster(value.size())); } diff --git a/Code/Framework/AzCore/AzCore/State/HSM.cpp b/Code/Framework/AzCore/AzCore/State/HSM.cpp index e9e069cf9a..56a7e9a27a 100644 --- a/Code/Framework/AzCore/AzCore/State/HSM.cpp +++ b/Code/Framework/AzCore/AzCore/State/HSM.cpp @@ -187,7 +187,7 @@ void HSM::ClearStateHandler(StateId id) { m_states[id].handler.clear(); - m_states[id].name = NULL; + m_states[id].name = nullptr; m_states[id].superId = InvalidStateId; } diff --git a/Code/Framework/AzCore/AzCore/State/HSM.h b/Code/Framework/AzCore/AzCore/State/HSM.h index 042843cb7d..4004ca4341 100644 --- a/Code/Framework/AzCore/AzCore/State/HSM.h +++ b/Code/Framework/AzCore/AzCore/State/HSM.h @@ -103,13 +103,10 @@ namespace AZ struct State { - State() - : superId(InvalidStateId) - , name(NULL) {} StateHandler handler; - StateId superId; ///< State id of the super state, InvalidStateId if this is a top state InvalidStateId. - StateId subId; ///< If != InvalidStateId it will enter the sub ID after the state Enter event is called. - const char* name; + StateId superId = InvalidStateId; ///< State id of the super state, InvalidStateId if this is a top state InvalidStateId. + StateId subId = InvalidStateId; ///< If != InvalidStateId it will enter the sub ID after the state Enter event is called. + const char* name = nullptr; }; AZStd::array m_states; }; diff --git a/Code/Framework/AzCore/AzCore/UserSettings/UserSettingsProvider.cpp b/Code/Framework/AzCore/AzCore/UserSettings/UserSettingsProvider.cpp index 6c92803ac4..d56fc9a5d6 100644 --- a/Code/Framework/AzCore/AzCore/UserSettings/UserSettingsProvider.cpp +++ b/Code/Framework/AzCore/AzCore/UserSettings/UserSettingsProvider.cpp @@ -81,8 +81,12 @@ namespace AZ if (settingsFile.IsOpen()) { IO::SystemFileStream settingsFileStream(&settingsFile, false); - ObjectStream::ClassReadyCB readyCB(AZStd::bind(&UserSettingsProvider::OnSettingLoaded, this, AZStd::placeholders::_1, AZStd::placeholders::_2, AZStd::placeholders::_3)); - + ObjectStream::ClassReadyCB readyCB( + [this](void* classPtr, const Uuid& classId, const SerializeContext* sc) + { + OnSettingLoaded(classPtr, classId, sc); + }); + // do not try to load assets during User Settings Provider bootup - we are still initializing the application! // in addition, the file may contain settings we don't understand, from other applications - don't error on those. settingsLoaded = ObjectStream::LoadBlocking(&settingsFileStream, *sc, readyCB, ObjectStream::FilterDescriptor(&AZ::Data::AssetFilterNoAssetLoading, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES)); @@ -104,7 +108,7 @@ namespace AZ { AZStd::vector saveBuffer; AZ::IO::ByteContainerStream> byteStream(&saveBuffer); - + ObjectStream* objStream = ObjectStream::Create(&byteStream, *sc, ObjectStream::ST_XML); bool writtenOk = objStream->WriteClass(&m_settings); bool streamOk = objStream->Finalize(); diff --git a/Code/Framework/AzCore/AzCore/std/function/function_base.h b/Code/Framework/AzCore/AzCore/std/function/function_base.h index 8ceba11239..6aa8a8ebc5 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_base.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_base.h @@ -23,7 +23,7 @@ #include #define AZSTD_FUNCTION_TARGET_FIX(x) -#define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t, Type> +#define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t && !std::is_null_pointer_v, Type> diff --git a/Code/Framework/AzCore/AzCore/std/function/function_template.h b/Code/Framework/AzCore/AzCore/std/function/function_template.h index 8e389cb53d..a9c24ca75f 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_template.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_template.h @@ -531,7 +531,7 @@ namespace AZStd //! A static vtable is used to avoid the need to dynamically allocate a vtable //! whose purpose is to contain a function ptr that can the manage the function buffer //! i.e performs the copy, move and destruction operations for the function buffer - //! as well as to validate if a the stored function can be type_cast to the type supplied in + //! as well as to validate if a the stored function can be type_cast to the type supplied in //! std::function::target //! The vtable other purpose is to store a function ptr that is used to wrap the invocation of the underlying function static vtable_type stored_vtable = get_invoker::template create_vtable>(); @@ -556,7 +556,7 @@ namespace AZStd //! A static vtable is used to avoid the need to dynamically allocate a vtable //! whose purpose is to contain a function ptr that can the manage the function buffer //! i.e performs the copy, move and destruction operations for the function buffer - //! as well as to validate if a the stored function can be type_cast to the type supplied in + //! as well as to validate if a the stored function can be type_cast to the type supplied in //! std::function::target //! The vtable other purpose is to store a function ptr that is used to wrap the invocation of the underlying function static vtable_type stored_vtable = get_invoker::template create_vtable>(); @@ -633,7 +633,7 @@ namespace AZStd {} function(nullptr_t) - : base_type() {} + : base_type(nullptr) {} function(const self_type& f) : base_type(static_cast(f)){} function(const base_type& f) @@ -678,7 +678,7 @@ namespace AZStd return *this; } - R operator()(Args... args) const + R operator()(Args... args) const { return base_type::operator()(AZStd::forward(args)...); } diff --git a/Code/Framework/AzCore/AzCore/std/string/regex.cpp b/Code/Framework/AzCore/AzCore/std/string/regex.cpp index 65f6bc732e..a8604130fe 100644 --- a/Code/Framework/AzCore/AzCore/std/string/regex.cpp +++ b/Code/Framework/AzCore/AzCore/std/string/regex.cpp @@ -31,7 +31,7 @@ namespace AZStd AZ_REGEX_CHAR_CLASS_NAME("upper", RegexTraits::Ch_upper), AZ_REGEX_CHAR_CLASS_NAME("w", RegexTraits::Ch_invalid), AZ_REGEX_CHAR_CLASS_NAME("xdigit", RegexTraits::Ch_xdigit), - {0, 0, 0}, + {nullptr, 0, 0}, }; template<> @@ -52,7 +52,7 @@ namespace AZStd AZ_REGEX_CHAR_CLASS_NAME(L"upper", RegexTraits::Ch_upper), AZ_REGEX_CHAR_CLASS_NAME(L"w", RegexTraits::Ch_invalid), AZ_REGEX_CHAR_CLASS_NAME(L"xdigit", RegexTraits::Ch_xdigit), - {0, 0, 0}, + {nullptr, 0, 0}, }; #undef AZ_REGEX_CHAR_CLASS_NAME } // namespace AZStd diff --git a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Module/DynamicModuleHandle_UnixLike.cpp b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Module/DynamicModuleHandle_UnixLike.cpp index bfc69a05a3..5cf854d49f 100644 --- a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Module/DynamicModuleHandle_UnixLike.cpp +++ b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Module/DynamicModuleHandle_UnixLike.cpp @@ -139,7 +139,7 @@ namespace AZ if (m_handle) { result = dlclose(m_handle) == 0 ? true : false; - m_handle = 0; + m_handle = nullptr; } return result; } diff --git a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/std/parallel/internal/condition_variable_WinAPI.h b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/std/parallel/internal/condition_variable_WinAPI.h index 4ac95139db..b0ed025a36 100644 --- a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/std/parallel/internal/condition_variable_WinAPI.h +++ b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/std/parallel/internal/condition_variable_WinAPI.h @@ -198,7 +198,7 @@ namespace AZStd AZ_FORCE_INLINE cv_status condition_variable_any::wait_for(Lock& lock, const chrono::duration& rel_time) { chrono::milliseconds toWait = rel_time; - EnterCriticalSection(static_cast(&m_mutex)); + EnterCriticalSection(AZ_STD_MUTEX_CAST(m_mutex)); lock.unlock(); // We need to make sure we use CriticalSection based mutex. @@ -217,7 +217,7 @@ namespace AZStd returnCode = cv_status::timeout; } } - LeaveCriticalSection(static_cast(&m_mutex)); + LeaveCriticalSection(AZ_STD_MUTEX_CAST(m_mutex)); lock.lock(); return returnCode; } diff --git a/Code/Framework/AzCore/Tests/AZStd/Allocators.cpp b/Code/Framework/AzCore/Tests/AZStd/Allocators.cpp index 8f34c7f31f..6b82c642d5 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Allocators.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Allocators.cpp @@ -41,12 +41,12 @@ namespace UnitTest AZ_TEST_ASSERT(strcmp(myalloc.get_name(), newName) == 0); AZStd::allocator::pointer_type data = myalloc.allocate(100, 1); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); myalloc.deallocate(data, 100, 1); data = myalloc.allocate(50, 128); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); myalloc.deallocate(data, 50, 128); @@ -153,7 +153,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); buffer_alloc_type::pointer_type data = myalloc.allocate(100, 1); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 100); AZ_TEST_ASSERT(myalloc.get_allocated_size() == 100); @@ -172,7 +172,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); data = myalloc.allocate(50, 64); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(((AZStd::size_t)data & 63) == 0); AZ_TEST_ASSERT(myalloc.get_max_size() <= bufferSize - 50); AZ_TEST_ASSERT(myalloc.get_allocated_size() >= 50); @@ -198,7 +198,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); int* data = reinterpret_cast(myalloc.allocate(sizeof(int), 1)); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(myalloc.get_max_size() == (numNodes - 1) * sizeof(int)); AZ_TEST_ASSERT(myalloc.get_allocated_size() == sizeof(int)); @@ -209,7 +209,7 @@ namespace UnitTest for (int i = 0; i < numNodes; ++i) { data = reinterpret_cast(myalloc.allocate(sizeof(int), 1)); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(myalloc.get_max_size() == (numNodes - (i + 1)) * sizeof(int)); AZ_TEST_ASSERT(myalloc.get_allocated_size() == (i + 1) * sizeof(int)); } @@ -231,7 +231,7 @@ namespace UnitTest aligned_int_node_pool_type myaligned_pool; aligned_int_type* aligned_data = reinterpret_cast(myaligned_pool.allocate(sizeof(aligned_int_type), dataAlignment)); - AZ_TEST_ASSERT(aligned_data != 0); + AZ_TEST_ASSERT(aligned_data != nullptr); AZ_TEST_ASSERT(((AZStd::size_t)aligned_data & (dataAlignment - 1)) == 0); AZ_TEST_ASSERT(myaligned_pool.get_max_size() == (numNodes - 1) * sizeof(aligned_int_type)); AZ_TEST_ASSERT(myaligned_pool.get_allocated_size() == sizeof(aligned_int_type)); @@ -267,14 +267,14 @@ namespace UnitTest AZ_TEST_ASSERT(ref_allocator2.get_allocator() == ref_allocator1.get_allocator()); ref_allocator_type::pointer_type data1 = ref_allocator1.allocate(10, 1); - AZ_TEST_ASSERT(data1 != 0); + AZ_TEST_ASSERT(data1 != nullptr); AZ_TEST_ASSERT(ref_allocator1.get_max_size() == bufferSize - 10); AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() == 10); AZ_TEST_ASSERT(shared_allocator.get_max_size() == bufferSize - 10); AZ_TEST_ASSERT(shared_allocator.get_allocated_size() == 10); ref_allocator_type::pointer_type data2 = ref_allocator2.allocate(10, 1); - AZ_TEST_ASSERT(data2 != 0); + AZ_TEST_ASSERT(data2 != nullptr); AZ_TEST_ASSERT(ref_allocator2.get_max_size() <= bufferSize - 20); AZ_TEST_ASSERT(ref_allocator2.get_allocated_size() >= 20); AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 20); @@ -283,14 +283,14 @@ namespace UnitTest shared_allocator.reset(); data1 = ref_allocator1.allocate(10, 32); - AZ_TEST_ASSERT(data1 != 0); + AZ_TEST_ASSERT(data1 != nullptr); AZ_TEST_ASSERT(ref_allocator1.get_max_size() <= bufferSize - 10); AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() >= 10); AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 10); AZ_TEST_ASSERT(shared_allocator.get_allocated_size() >= 10); data2 = ref_allocator2.allocate(10, 32); - AZ_TEST_ASSERT(data2 != 0); + AZ_TEST_ASSERT(data2 != nullptr); AZ_TEST_ASSERT(ref_allocator1.get_max_size() <= bufferSize - 20); AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() >= 20); AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 20); @@ -316,7 +316,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); stack_allocator::pointer_type data = myalloc.allocate(100, 1); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 100); AZ_TEST_ASSERT(myalloc.get_allocated_size() == 100); @@ -329,7 +329,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); data = myalloc.allocate(50, 64); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(((AZStd::size_t)data & 63) == 0); AZ_TEST_ASSERT(myalloc.get_max_size() <= bufferSize - 50); AZ_TEST_ASSERT(myalloc.get_allocated_size() >= 50); diff --git a/Code/Framework/AzCore/Tests/AZStd/Atomics.cpp b/Code/Framework/AzCore/Tests/AZStd/Atomics.cpp index 57975ad09b..a5da293057 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Atomics.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Atomics.cpp @@ -975,13 +975,13 @@ namespace UnitTest A obj(T(0)); bool b0 = obj.is_lock_free(); ((void)b0); // mark as unused - EXPECT_TRUE(obj == T(0)); + EXPECT_TRUE(obj == T(nullptr)); AZStd::atomic_init(&obj, T(1)); EXPECT_TRUE(obj == T(1)); AZStd::atomic_init(&obj, T(2)); EXPECT_TRUE(obj == T(2)); obj.store(T(0)); - EXPECT_TRUE(obj == T(0)); + EXPECT_TRUE(obj == T(nullptr)); obj.store(T(1), AZStd::memory_order_release); EXPECT_TRUE(obj == T(1)); EXPECT_TRUE(obj.load() == T(1)); @@ -1001,11 +1001,11 @@ namespace UnitTest EXPECT_TRUE(obj.compare_exchange_strong(x, T(1)) == true); EXPECT_TRUE(obj == T(1)); EXPECT_TRUE(x == T(2)); - EXPECT_TRUE(obj.compare_exchange_strong(x, T(0)) == false); + EXPECT_TRUE(obj.compare_exchange_strong(x, T(nullptr)) == false); EXPECT_TRUE(obj == T(1)); EXPECT_TRUE(x == T(1)); - EXPECT_TRUE((obj = T(0)) == T(0)); - EXPECT_TRUE(obj == T(0)); + EXPECT_TRUE((obj = T(nullptr)) == T(nullptr)); + EXPECT_TRUE(obj == T(nullptr)); obj = T(2 * sizeof(X)); EXPECT_TRUE((obj += AZStd::ptrdiff_t(3)) == T(5 * sizeof(X))); EXPECT_TRUE(obj == T(5 * sizeof(X))); @@ -1015,7 +1015,7 @@ namespace UnitTest { alignas(A) char storage[sizeof(A)] = { 23 }; A& zero = *new (storage) A(); - EXPECT_TRUE(zero == T(0)); + EXPECT_TRUE(zero == T(nullptr)); zero.~A(); } } diff --git a/Code/Framework/AzCore/Tests/AZStd/Bitset.cpp b/Code/Framework/AzCore/Tests/AZStd/Bitset.cpp index ed1d59906b..7279e4015a 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Bitset.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Bitset.cpp @@ -127,7 +127,7 @@ namespace UnitTest AZStd::bitset<32> m_bitset1; AZStd::bitset<32> m_bitset2; }; - + TEST_P(BitsetUnsignedLongPairTests, BitwiseANDOperator_MatchesUnsignedLongAND) { EXPECT_EQ((m_bitset1 & m_bitset2).to_ulong(), m_unsignedLong1 & m_unsignedLong2); @@ -316,7 +316,7 @@ namespace UnitTest { for (unsigned long value2 : testCases) { - testCasePairs.push_back(AZStd::pair(value1, value2)); + testCasePairs.emplace_back(value1, value2); } } return testCasePairs; diff --git a/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp b/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp index 6bfda10ddc..2a4c598218 100644 --- a/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp @@ -219,7 +219,7 @@ class OtherClass double rubbish; // to ensure this class has non-zero size. public: virtual ~OtherClass() {} - virtual void UnusedVirtualFunction(void) { (void)rubbish; } + virtual void UnusedVirtualFunction() { (void)rubbish; } virtual void TrickyVirtualFunction(int num, char* str) = 0; }; @@ -268,7 +268,7 @@ namespace UnitTest // Assignment to an empty function v1 = five; - AZ_TEST_ASSERT(v1 != 0); + AZ_TEST_ASSERT(v1 != nullptr); // Invocation of a function global_int = 0; @@ -277,7 +277,7 @@ namespace UnitTest // clear() method v1.clear(); - AZ_TEST_ASSERT(v1 == 0); + AZ_TEST_ASSERT(v1 == nullptr); // Assignment to an empty function v1 = three; @@ -303,12 +303,12 @@ namespace UnitTest AZ_TEST_ASSERT(global_int == 5); // clear - v1 = 0; - AZ_TEST_ASSERT(0 == v1); + v1 = nullptr; + AZ_TEST_ASSERT(nullptr == v1); // Assignment to an empty function from a free function v1 = AZSTD_FUNCTION_TARGET_FIX(&) write_five; - AZ_TEST_ASSERT(0 != v1); + AZ_TEST_ASSERT(nullptr != v1); // Invocation global_int = 0; @@ -697,9 +697,9 @@ namespace UnitTest AZ_TEST_ASSERT(global_int == 2); // Test construction from 0 and comparison to 0 - func_void_type v9(0); - AZ_TEST_ASSERT(v9 == 0); - AZ_TEST_ASSERT(0 == v9); + func_void_type v9(nullptr); + AZ_TEST_ASSERT(v9 == nullptr); + AZ_TEST_ASSERT(nullptr == v9); // Test return values typedef function func_int_type; @@ -941,7 +941,7 @@ namespace UnitTest TEST_F(Function, FunctionWithNonAZStdAllocatorDestructsSuccessfully) { - // 64 Byte buffer is used to prevent AZStd::function for storing the + // 64 Byte buffer is used to prevent AZStd::function for storing the // lambda internal storage using the small buffer optimization // Therefore causing the supplied allocator to be used [[maybe_unused]] AZStd::aligned_storage_t<64, 1> bufferToAvoidSmallBufferOptimization; @@ -994,7 +994,7 @@ namespace UnitTest return static_cast(lhs) + rhs; } - // Make sure the functor have a specific size so + // Make sure the functor have a specific size so // that it can be used to test both the AZStd::function small_object_optimization path // and the heap allocated function object path AZStd::aligned_storage_t m_functorPadding; @@ -1044,7 +1044,7 @@ namespace UnitTest TestFunctor testFunctor; AZStd::function testFunction2(AZStd::move(testFunctor)); EXPECT_GT(s_functorMoveConstructorCount, 0); - + double testFunc2Result = testFunction2(16, 4.0); EXPECT_DOUBLE_EQ(20, testFunc2Result); @@ -1068,7 +1068,7 @@ namespace UnitTest AZStd::function testFunction2; testFunction2 = AZStd::move(testFunctor); EXPECT_GT(s_functorMoveConstructorCount + s_functorMoveAssignmentCount, 0); - + double testFunc2Result = testFunction2(16, 4.0); EXPECT_DOUBLE_EQ(20, testFunc2Result); @@ -1643,7 +1643,7 @@ namespace UnitTest AZStd::reference_wrapper refTimeStamp(timeStamp); double result = nestedFunc(32, refTimeStamp, 64.0); EXPECT_EQ(512, timeStamp); - + constexpr double expectedResult = static_cast(32 + 16 + 128.0 + 512); EXPECT_DOUBLE_EQ(expectedResult, result); } diff --git a/Code/Framework/AzCore/Tests/AZStd/Parallel.cpp b/Code/Framework/AzCore/Tests/AZStd/Parallel.cpp index 2743d5e323..f3d4f58250 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Parallel.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Parallel.cpp @@ -195,7 +195,7 @@ namespace UnitTest void test_thread_id_for_running_thread_is_not_default_constructed_id() { - const thread_desc* desc = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc = m_numThreadDesc ? &m_desc[0] : nullptr; AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc); AZ_TEST_ASSERT(t.get_id() != AZStd::thread::id()); t.join(); @@ -203,8 +203,8 @@ namespace UnitTest void test_different_threads_have_different_ids() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; - const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; + const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr; AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc1); AZStd::thread t2(AZStd::bind(&Parallel_Thread::do_nothing, this), desc2); AZ_TEST_ASSERT(t.get_id() != t2.get_id()); @@ -214,9 +214,9 @@ namespace UnitTest void test_thread_ids_have_a_total_order() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; - const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : 0; - const thread_desc* desc3 = m_numThreadDesc ? &m_desc[2] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; + const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr; + const thread_desc* desc3 = m_numThreadDesc ? &m_desc[2] : nullptr; AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc1); AZStd::thread t2(AZStd::bind(&Parallel_Thread::do_nothing, this), desc2); @@ -313,7 +313,7 @@ namespace UnitTest void test_thread_id_of_running_thread_returned_by_this_thread_get_id() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; AZStd::thread::id id; AZStd::thread t(AZStd::bind(&Parallel_Thread::get_thread_id, this, &id), desc1); @@ -366,7 +366,7 @@ namespace UnitTest void test_move_on_construction() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; AZStd::thread::id the_id; AZStd::thread x; x = AZStd::thread(AZStd::bind(&Parallel_Thread::do_nothing_id, this, &the_id), desc1); @@ -377,7 +377,7 @@ namespace UnitTest AZStd::thread make_thread(AZStd::thread::id* the_id) { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; return AZStd::thread(AZStd::bind(&Parallel_Thread::do_nothing_id, this, the_id), desc1); } @@ -430,7 +430,7 @@ namespace UnitTest void do_test_creation() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; m_data = 0; AZStd::thread t(AZStd::bind(&Parallel_Thread::simple_thread, this), desc1); t.join(); @@ -445,7 +445,7 @@ namespace UnitTest void do_test_id_comparison() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; AZStd::thread::id self = this_thread::get_id(); AZStd::thread thrd(AZStd::bind(&Parallel_Thread::comparison_thread, this, self), desc1); thrd.join(); @@ -476,7 +476,7 @@ namespace UnitTest void do_test_creation_through_reference_wrapper() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; non_copyable_functor f; AZStd::thread thrd(AZStd::ref(f), desc1); @@ -491,8 +491,8 @@ namespace UnitTest void test_swap() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; - const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; + const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr; AZStd::thread t(AZStd::bind(&Parallel_Thread::simple_thread, this), desc1); AZStd::thread t2(AZStd::bind(&Parallel_Thread::simple_thread, this), desc2); AZStd::thread::id id1 = t.get_id(); @@ -512,7 +512,7 @@ namespace UnitTest void run() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; // We need to have at least one processor AZ_TEST_ASSERT(AZStd::thread::hardware_concurrency() >= 1); diff --git a/Code/Framework/AzCore/Tests/AZStd/SmartPtr.cpp b/Code/Framework/AzCore/Tests/AZStd/SmartPtr.cpp index f50da28b1f..b6a5a62c05 100644 --- a/Code/Framework/AzCore/Tests/AZStd/SmartPtr.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/SmartPtr.cpp @@ -137,7 +137,7 @@ namespace UnitTest static void deleter(int* p) { - EXPECT_TRUE(p == 0); + EXPECT_TRUE(p == nullptr); } struct deleter2 @@ -158,7 +158,7 @@ namespace UnitTest { void operator()(incomplete* p) { - EXPECT_TRUE(p == 0); + EXPECT_TRUE(p == nullptr); } }; @@ -331,7 +331,7 @@ namespace UnitTest AZStd::shared_ptr pv; EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_EQ(0, pv.get()); + EXPECT_EQ(nullptr, pv.get()); EXPECT_EQ(0, pv.use_count()); } @@ -355,35 +355,35 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrCtorIntPtr) { - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); } TEST_F(SmartPtr, SharedPtrCtorConstIntPtr) { - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); } TEST_F(SmartPtr, SharedPtrCtorX) { - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); } TEST_F(SmartPtr, SharedPtrCtorXConvert) { - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); } TEST_F(SmartPtr, SharedPtrCtorIntValue) @@ -518,15 +518,15 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrCtorNullDeleter) { { - AZStd::shared_ptr pi(static_cast(0), &SharedPtr::test::deleter); + AZStd::shared_ptr pi(static_cast(nullptr), &SharedPtr::test::deleter); m_sharedPtr->TestPtr(pi, nullptr); } { - AZStd::shared_ptr pv(static_cast(0), &SharedPtr::test::deleter); + AZStd::shared_ptr pv(static_cast(nullptr), &SharedPtr::test::deleter); m_sharedPtr->TestPtr(pv, nullptr); } { - AZStd::shared_ptr pv(static_cast(0), &SharedPtr::test::deleter); + AZStd::shared_ptr pv(static_cast(nullptr), &SharedPtr::test::deleter); m_sharedPtr->TestPtr(pv, nullptr); } } @@ -589,21 +589,21 @@ namespace UnitTest EXPECT_EQ(pi2, pi); EXPECT_FALSE(pi2); EXPECT_TRUE(!pi2); - EXPECT_EQ(0, pi2.get()); + EXPECT_EQ(nullptr, pi2.get()); EXPECT_EQ(pi2.use_count(), pi.use_count()); AZStd::shared_ptr pi3(pi); EXPECT_EQ(pi3, pi); EXPECT_FALSE(pi3); EXPECT_TRUE(!pi3); - EXPECT_EQ(0, pi3.get()); + EXPECT_EQ(nullptr, pi3.get()); EXPECT_EQ(pi3.use_count(), pi.use_count()); AZStd::shared_ptr pi4(pi3); EXPECT_EQ(pi4, pi3); EXPECT_FALSE(pi4); EXPECT_TRUE(!pi4); - EXPECT_EQ(0, pi4.get()); + EXPECT_EQ(nullptr, pi4.get()); EXPECT_EQ(pi4.use_count(), pi3.use_count()); } @@ -615,7 +615,7 @@ namespace UnitTest EXPECT_EQ(pv2, pv); EXPECT_FALSE(pv2); EXPECT_TRUE(!pv2); - EXPECT_EQ(0, pv2.get()); + EXPECT_EQ(nullptr, pv2.get()); EXPECT_EQ(pv2.use_count(), pv.use_count()); } @@ -628,26 +628,26 @@ namespace UnitTest EXPECT_EQ(px, px2); EXPECT_FALSE(px2); EXPECT_TRUE(!px2); - EXPECT_EQ(0, px2.get()); + EXPECT_EQ(nullptr, px2.get()); EXPECT_EQ(px.use_count(), px2.use_count()); AZStd::shared_ptr px3(px); EXPECT_EQ(px, px3); EXPECT_FALSE(px3); EXPECT_TRUE(!px3); - EXPECT_EQ(0, px3.get()); + EXPECT_EQ(nullptr, px3.get()); EXPECT_EQ(px.use_count(), px3.use_count()); } TEST_F(SmartPtr, SharedPtrCopyCtorIntVoidSharedOwnershipTest) { - AZStd::shared_ptr pi(static_cast(0)); + AZStd::shared_ptr pi(static_cast(nullptr)); AZStd::shared_ptr pi2(pi); EXPECT_EQ(pi, pi2); EXPECT_FALSE(pi2); EXPECT_TRUE(!pi2); - EXPECT_EQ(0, pi2.get()); + EXPECT_EQ(nullptr, pi2.get()); EXPECT_EQ(2, pi2.use_count()); EXPECT_FALSE(pi2.unique()); EXPECT_EQ(pi.use_count(), pi2.use_count()); @@ -657,7 +657,7 @@ namespace UnitTest EXPECT_EQ(pi, pi3); EXPECT_FALSE(pi3); EXPECT_TRUE(!pi3); - EXPECT_EQ(0, pi3.get()); + EXPECT_EQ(nullptr, pi3.get()); EXPECT_EQ(3, pi3.use_count()); EXPECT_FALSE(pi3.unique()); EXPECT_EQ(pi.use_count(), pi3.use_count()); @@ -667,7 +667,7 @@ namespace UnitTest EXPECT_EQ(pi2, pi4); EXPECT_FALSE(pi4); EXPECT_TRUE(!pi4); - EXPECT_EQ(0, pi4.get()); + EXPECT_EQ(nullptr, pi4.get()); EXPECT_EQ(4, pi4.use_count()); EXPECT_FALSE(pi4.unique()); EXPECT_EQ(pi2.use_count(), pi4.use_count()); @@ -680,13 +680,13 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrCopyCtorClassSharedOwnershipTest) { using X = SharedPtr::test::X; - AZStd::shared_ptr px(static_cast(0)); + AZStd::shared_ptr px(static_cast(nullptr)); AZStd::shared_ptr px2(px); EXPECT_EQ(px, px2); EXPECT_FALSE(px2); EXPECT_TRUE(!px2); - EXPECT_EQ(0, px2.get()); + EXPECT_EQ(nullptr, px2.get()); EXPECT_EQ(2, px2.use_count()); EXPECT_FALSE(px2.unique()); EXPECT_EQ(px.use_count(), px2.use_count()); @@ -696,7 +696,7 @@ namespace UnitTest EXPECT_EQ(px, px3); EXPECT_FALSE(px3); EXPECT_TRUE(!px3); - EXPECT_EQ(0, px3.get()); + EXPECT_EQ(nullptr, px3.get()); EXPECT_EQ(3, px3.use_count()); EXPECT_FALSE(px3.unique()); EXPECT_EQ(px.use_count(), px3.use_count()); @@ -706,7 +706,7 @@ namespace UnitTest EXPECT_EQ(px2, px4); EXPECT_FALSE(px4); EXPECT_TRUE(!px4); - EXPECT_EQ(0, px4.get()); + EXPECT_EQ(nullptr, px4.get()); EXPECT_EQ(4, px4.use_count()); EXPECT_FALSE(px4.unique()); EXPECT_EQ(px2.use_count(), px4.use_count()); @@ -871,11 +871,11 @@ namespace UnitTest { AZStd::shared_ptr p2(wp); EXPECT_EQ(wp.use_count(), p2.use_count()); - EXPECT_EQ(0, p2.get()); + EXPECT_EQ(nullptr, p2.get()); AZStd::shared_ptr p3(wp); EXPECT_EQ(wp.use_count(), p3.use_count()); - EXPECT_EQ(0, p3.get()); + EXPECT_EQ(nullptr, p3.get()); } } @@ -927,7 +927,7 @@ namespace UnitTest EXPECT_EQ(p1, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p2; @@ -936,7 +936,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p3(p1); @@ -945,7 +945,7 @@ namespace UnitTest EXPECT_EQ(p3, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); } TEST_F(SmartPtr, SharedPtrCopyAssignVoid) @@ -959,7 +959,7 @@ namespace UnitTest EXPECT_EQ(p1, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p2; @@ -968,7 +968,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p3(p1); @@ -977,7 +977,7 @@ namespace UnitTest EXPECT_EQ(p3, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p4(new int); EXPECT_EQ(1, p4.use_count()); @@ -1007,7 +1007,7 @@ namespace UnitTest EXPECT_EQ(p1, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p2; @@ -1016,7 +1016,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p3(p1); @@ -1025,7 +1025,7 @@ namespace UnitTest EXPECT_EQ(p3, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1065,7 +1065,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p4(new int); EXPECT_EQ(1, p4.use_count()); @@ -1098,7 +1098,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); EXPECT_EQ(0, m_sharedPtr->m_test.m_yInstances); @@ -1144,17 +1144,17 @@ namespace UnitTest pi.reset(); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 0); } TEST_F(SmartPtr, SharedPtrResetNullInt) { - AZStd::shared_ptr pi(static_cast(0)); + AZStd::shared_ptr pi(static_cast(nullptr)); pi.reset(); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 0); } @@ -1164,7 +1164,7 @@ namespace UnitTest pi.reset(); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 0); } @@ -1175,7 +1175,7 @@ namespace UnitTest px.reset(); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 0); } @@ -1187,7 +1187,7 @@ namespace UnitTest px.reset(); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 0); } @@ -1198,7 +1198,7 @@ namespace UnitTest px.reset(); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 0); } @@ -1211,7 +1211,7 @@ namespace UnitTest px.reset(); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 0); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); } @@ -1222,7 +1222,7 @@ namespace UnitTest pv.reset(); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 0); } @@ -1235,7 +1235,7 @@ namespace UnitTest pv.reset(); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 0); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); } @@ -1244,10 +1244,10 @@ namespace UnitTest { AZStd::shared_ptr pi; - pi.reset(static_cast(0)); + pi.reset(static_cast(nullptr)); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); @@ -1259,10 +1259,10 @@ namespace UnitTest EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); - pi.reset(static_cast(0)); + pi.reset(static_cast(nullptr)); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); } @@ -1273,10 +1273,10 @@ namespace UnitTest using Y = SharedPtr::test::Y; AZStd::shared_ptr px; - px.reset(static_cast(0)); + px.reset(static_cast(nullptr)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1290,10 +1290,10 @@ namespace UnitTest EXPECT_TRUE(px.unique()); EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances); - px.reset(static_cast(0)); + px.reset(static_cast(nullptr)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1309,10 +1309,10 @@ namespace UnitTest EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances); EXPECT_EQ(1, m_sharedPtr->m_test.m_yInstances); - px.reset(static_cast(0)); + px.reset(static_cast(nullptr)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1325,10 +1325,10 @@ namespace UnitTest using Y = SharedPtr::test::Y; AZStd::shared_ptr pv; - pv.reset(static_cast(0)); + pv.reset(static_cast(nullptr)); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1342,10 +1342,10 @@ namespace UnitTest EXPECT_TRUE(pv.unique()); EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances); - pv.reset(static_cast(0)); + pv.reset(static_cast(nullptr)); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1361,10 +1361,10 @@ namespace UnitTest EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances); EXPECT_EQ(1, m_sharedPtr->m_test.m_yInstances); - pv.reset(static_cast(0)); + pv.reset(static_cast(nullptr)); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1375,10 +1375,10 @@ namespace UnitTest { AZStd::shared_ptr pi; - pi.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pi.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); @@ -1386,23 +1386,23 @@ namespace UnitTest int m = 0; pi.reset(&m, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(pi ? true : false); EXPECT_TRUE(!!pi); EXPECT_TRUE(pi.get() == &m); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); - pi.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pi.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &m); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); pi.reset(); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); } TEST_F(SmartPtr, SharedPtrResetClassWithDeleter) @@ -1411,10 +1411,10 @@ namespace UnitTest using Y = SharedPtr::test::Y; AZStd::shared_ptr px; - px.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + px.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); @@ -1422,40 +1422,40 @@ namespace UnitTest X x(m_sharedPtr->m_test); px.reset(&x, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(px ? true : false); EXPECT_TRUE(!!px); EXPECT_TRUE(px.get() == &x); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); - px.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + px.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &x); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); Y y(m_sharedPtr->m_test); px.reset(&y, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(px ? true : false); EXPECT_TRUE(!!px); EXPECT_TRUE(px.get() == &y); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); - px.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + px.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &y); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); px.reset(); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); } TEST_F(SmartPtr, SharedPtrResetVoidClassWithDeleter) @@ -1464,10 +1464,10 @@ namespace UnitTest using Y = SharedPtr::test::Y; AZStd::shared_ptr pv; - pv.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pv.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); @@ -1475,40 +1475,40 @@ namespace UnitTest X x(m_sharedPtr->m_test); pv.reset(&x, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(pv ? true : false); EXPECT_TRUE(!!pv); EXPECT_TRUE(pv.get() == &x); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); - pv.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pv.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &x); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); Y y(m_sharedPtr->m_test); pv.reset(&y, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(pv ? true : false); EXPECT_TRUE(!!pv); EXPECT_TRUE(pv.get() == &y); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); - pv.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pv.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &y); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); pv.reset(); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); } TEST_F(SmartPtr, SharedPtrResetIncompleteNullWithDeleter) @@ -1521,20 +1521,20 @@ namespace UnitTest px.reset(p0, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); m_sharedPtr->m_test.deleted = &px; px.reset(p0, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); } TEST_F(SmartPtr, SharedPtrGetPointerEmpty) { struct X {}; AZStd::shared_ptr px; - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_FALSE(px); EXPECT_TRUE(!px); @@ -1544,8 +1544,8 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrGetPointerNull) { struct X {}; - AZStd::shared_ptr px(static_cast(0)); - EXPECT_TRUE(px.get() == 0); + AZStd::shared_ptr px(static_cast(nullptr)); + EXPECT_TRUE(px.get() == nullptr); EXPECT_FALSE(px); EXPECT_TRUE(!px); @@ -1555,8 +1555,8 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrGetPointerCheckedDeleterNull) { struct X {}; - AZStd::shared_ptr px(static_cast(0), AZStd::checked_deleter()); - EXPECT_TRUE(px.get() == 0); + AZStd::shared_ptr px(static_cast(nullptr), AZStd::checked_deleter()); + EXPECT_TRUE(px.get() == nullptr); EXPECT_FALSE(px); EXPECT_TRUE(!px); @@ -1594,7 +1594,7 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrUseCountNullClass) { struct X {}; - AZStd::shared_ptr px(static_cast(0)); + AZStd::shared_ptr px(static_cast(nullptr)); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); @@ -1641,14 +1641,14 @@ namespace UnitTest px.swap(px2); - EXPECT_TRUE(px.get() == 0); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px.get() == nullptr); + EXPECT_TRUE(px2.get() == nullptr); using std::swap; swap(px, px2); - EXPECT_TRUE(px.get() == 0); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px.get() == nullptr); + EXPECT_TRUE(px2.get() == nullptr); } TEST_F(SmartPtr, SharedPtrSwapNewClass) @@ -1663,14 +1663,14 @@ namespace UnitTest EXPECT_TRUE(px.get() == p); EXPECT_TRUE(px.use_count() == 2); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px2.get() == nullptr); EXPECT_TRUE(px3.get() == p); EXPECT_TRUE(px3.use_count() == 2); using std::swap; swap(px, px2); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px2.get() == p); EXPECT_TRUE(px2.use_count() == 2); EXPECT_TRUE(px3.get() == p); @@ -1876,10 +1876,10 @@ namespace UnitTest AZStd::shared_ptr pv; AZStd::shared_ptr pi = AZStd::static_pointer_cast(pv); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); AZStd::shared_ptr px = AZStd::static_pointer_cast(pv); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); } TEST_F(SmartPtr, SharedPtrStaticPointerCastNewIntToVoid) @@ -1946,7 +1946,7 @@ namespace UnitTest AZStd::shared_ptr px; AZStd::shared_ptr px2 = AZStd::const_pointer_cast(px); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px2.get() == nullptr); } TEST_F(SmartPtr, SharedPtrIntConstPointerCastInt) @@ -1954,7 +1954,7 @@ namespace UnitTest AZStd::shared_ptr px; AZStd::shared_ptr px2 = AZStd::const_pointer_cast(px); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px2.get() == nullptr); } TEST_F(SmartPtr, SharedPtrClassConstPointerCastClass) @@ -1963,7 +1963,7 @@ namespace UnitTest AZStd::shared_ptr px; AZStd::shared_ptr px2 = AZStd::const_pointer_cast(px); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px2.get() == nullptr); } TEST_F(SmartPtr, SharedPtrVoidVolatileConstPointerCastVoid) diff --git a/Code/Framework/AzCore/Tests/AZStd/String.cpp b/Code/Framework/AzCore/Tests/AZStd/String.cpp index 4c6687b00d..91d2237ca2 100644 --- a/Code/Framework/AzCore/Tests/AZStd/String.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/String.cpp @@ -444,7 +444,7 @@ namespace UnitTest str2.back() = 'p'; AZ_TEST_ASSERT(str2.back() == 'p'); - AZ_TEST_ASSERT(str2.c_str() != 0); + AZ_TEST_ASSERT(str2.c_str() != nullptr); AZ_TEST_ASSERT(::strlen(str2.c_str()) == str2.length()); str2.resize(30, 'm'); @@ -793,7 +793,7 @@ namespace UnitTest AZ_TEST_ASSERT(alphanum_comp(strdup("Alpha 2 B"), strA) > 0); // show usage of the comparison functor with a set - typedef set > StringSetType; + using StringSetType = set>; StringSetType s; s.insert("Xiph Xlater 58"); s.insert("Xiph Xlater 5000"); @@ -879,7 +879,7 @@ namespace UnitTest AZ_TEST_ASSERT(*setIt++ == "Xiph Xlater 10000"); // show usage of comparison functor with a map - typedef map > StringIntMapType; + using StringIntMapType = map>; StringIntMapType m; m["z1.doc"] = 1; m["z10.doc"] = 2; @@ -1441,7 +1441,7 @@ namespace UnitTest TEST_F(String, String_FormatOnlyAllowsValidArgs) { - constexpr bool v1 = 0; + constexpr bool v1 = false; constexpr char v2 = 0; constexpr unsigned char v3 = 0; constexpr signed char v4 = 0; diff --git a/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp b/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp index 933db73c3f..47c3630091 100644 --- a/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp @@ -824,7 +824,7 @@ namespace UnitTest {1, 2, 3, 4} }; AZ_TEST_ASSERT(myArr.empty() == false); - AZ_TEST_ASSERT(myArr.data() != 0); + AZ_TEST_ASSERT(myArr.data() != nullptr); AZ_TEST_ASSERT(myArr.size() == 10); AZ_TEST_ASSERT(myArr.front() == 1); AZ_TEST_ASSERT(myArr.back() == 0); diff --git a/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp b/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp index e25c3dbcf7..8ce3747620 100644 --- a/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp +++ b/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp @@ -52,7 +52,7 @@ namespace UnitTest AssetLoadBus::Handler::BusConnect(m_assetId); } } - ~OnAssetReadyListener() + ~OnAssetReadyListener() override { m_assetId.SetInvalid(); m_latest = {}; @@ -109,7 +109,7 @@ namespace UnitTest { BusConnect(assetId); } - ~ContainerReadyListener() + ~ContainerReadyListener() override { BusDisconnect(); } @@ -2658,7 +2658,7 @@ namespace UnitTest m_canceled = true; } - ~CancelListener() + ~CancelListener() override { BusDisconnect(); } diff --git a/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp b/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp index 46ff4ff3e7..a683f9630e 100644 --- a/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp +++ b/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp @@ -420,7 +420,7 @@ namespace UnitTest AZ::Data::AssetHandler::LoadResult LoadAssetData( [[maybe_unused]] const AZ::Data::Asset& asset, [[maybe_unused]] AZStd::shared_ptr stream, - [[maybe_unused]] const AZ::Data::AssetFilterCB& assetLoadFilterCB) + [[maybe_unused]] const AZ::Data::AssetFilterCB& assetLoadFilterCB) override { return AZ::Data::AssetHandler::LoadResult::LoadComplete; } diff --git a/Code/Framework/AzCore/Tests/EventTests.cpp b/Code/Framework/AzCore/Tests/EventTests.cpp index aaa70344e7..cb86ef0c17 100644 --- a/Code/Framework/AzCore/Tests/EventTests.cpp +++ b/Code/Framework/AzCore/Tests/EventTests.cpp @@ -398,7 +398,7 @@ namespace Benchmark { public: EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusConnect(); } - ~EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusDisconnect(); } + ~EBusPerfBaselineImplEmpty() override { EBusPerfBaselineBus::Handler::BusDisconnect(); } void OnSignal(int32_t) override {} }; @@ -418,7 +418,7 @@ namespace Benchmark { public: EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusConnect(); } - ~EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusDisconnect(); } + ~EBusPerfBaselineImplIncrement() override { EBusPerfBaselineBus::Handler::BusDisconnect(); } void SetIncrementCounter(int32_t* incrementCounter) { m_incrementCounter = incrementCounter; } void OnSignal(int32_t) override { ++(*m_incrementCounter); } int32_t* m_incrementCounter; diff --git a/Code/Framework/AzCore/Tests/IO/Path/PathTests.cpp b/Code/Framework/AzCore/Tests/IO/Path/PathTests.cpp index 41e0ac3f09..2fca03bc59 100644 --- a/Code/Framework/AzCore/Tests/IO/Path/PathTests.cpp +++ b/Code/Framework/AzCore/Tests/IO/Path/PathTests.cpp @@ -870,11 +870,11 @@ namespace Benchmark , public ::UnitTest::AllocatorsBase { public: - void SetUp([[maybe_unused]] const ::benchmark::State& state) + void SetUp([[maybe_unused]] const ::benchmark::State& state) override { ::UnitTest::AllocatorsBase::SetupAllocator(); } - void TearDown([[maybe_unused]] const ::benchmark::State& state) + void TearDown([[maybe_unused]] const ::benchmark::State& state) override { ::UnitTest::AllocatorsBase::TeardownAllocator(); } diff --git a/Code/Framework/AzCore/Tests/Jobs.cpp b/Code/Framework/AzCore/Tests/Jobs.cpp index b88e1f5b32..b63e139dd0 100644 --- a/Code/Framework/AzCore/Tests/Jobs.cpp +++ b/Code/Framework/AzCore/Tests/Jobs.cpp @@ -184,7 +184,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(Vector3SumJob, ThreadPoolAllocator, 0) - Vector3SumJob(const Vector3* array, unsigned int size, Vector3* result, JobContext* context = NULL) + Vector3SumJob(const Vector3* array, unsigned int size, Vector3* result, JobContext* context = nullptr) : Job(true, context) , m_array(array) , m_size(size) @@ -284,7 +284,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(FibonacciJobJoin, ThreadPoolAllocator, 0) - FibonacciJobJoin(int* result, JobContext* context = NULL) + FibonacciJobJoin(int* result, JobContext* context = nullptr) : Job(true, context) , m_result(result) { @@ -304,7 +304,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(FibonacciJobFork, ThreadPoolAllocator, 0) - FibonacciJobFork(int n, int* result, JobContext* context = NULL) + FibonacciJobFork(int n, int* result, JobContext* context = nullptr) : Job(true, context) , m_n(n) , m_result(result) @@ -374,7 +374,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(FibonacciJob2, ThreadPoolAllocator, 0) - FibonacciJob2(int n, int* result, JobContext* context = NULL) + FibonacciJob2(int n, int* result, JobContext* context = nullptr) : Job(true, context) , m_n(n) , m_result(result) @@ -441,7 +441,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(MergeSortJobJoin, ThreadPoolAllocator, 0) - MergeSortJobJoin(int* array, int* tempArray, int size1, int size2, JobContext* context = NULL) + MergeSortJobJoin(int* array, int* tempArray, int size1, int size2, JobContext* context = nullptr) : Job(true, context) , m_array(array) , m_tempArray(tempArray) @@ -496,7 +496,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(MergeSortJobFork, ThreadPoolAllocator, 0) - MergeSortJobFork(int* array, int* tempArray, int size, JobContext* context = NULL) + MergeSortJobFork(int* array, int* tempArray, int size, JobContext* context = nullptr) : Job(true, context) , m_array(array) , m_tempArray(tempArray) @@ -585,7 +585,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(QuickSortJob, ThreadPoolAllocator, 0) - QuickSortJob(int* array, int left, int right, JobContext* context = NULL) + QuickSortJob(int* array, int left, int right, JobContext* context = nullptr) : Job(true, context) , m_array(array) , m_left(left) diff --git a/Code/Framework/AzCore/Tests/Math/Matrix3x4PerformanceTests.cpp b/Code/Framework/AzCore/Tests/Math/Matrix3x4PerformanceTests.cpp index e4314f9cfb..9aed29005d 100644 --- a/Code/Framework/AzCore/Tests/Math/Matrix3x4PerformanceTests.cpp +++ b/Code/Framework/AzCore/Tests/Math/Matrix3x4PerformanceTests.cpp @@ -22,7 +22,7 @@ namespace Benchmark : public benchmark::Fixture { public: - void SetUp([[maybe_unused]] const::benchmark::State& state) + void SetUp([[maybe_unused]] const::benchmark::State& state) override { m_testDataArray.resize(1000); diff --git a/Code/Framework/AzCore/Tests/Memory.cpp b/Code/Framework/AzCore/Tests/Memory.cpp index ea6495755e..611af827d2 100644 --- a/Code/Framework/AzCore/Tests/Memory.cpp +++ b/Code/Framework/AzCore/Tests/Memory.cpp @@ -90,7 +90,7 @@ namespace UnitTest #else static const int numAllocations = 10000; #endif - void* addresses[numAllocations] = {0}; + void* addresses[numAllocations] = {nullptr}; IAllocatorAllocate& sysAlloc = AllocatorInstance::Get(); @@ -242,7 +242,7 @@ namespace UnitTest ////////////////////////////////////////////////////////////////////////// // realloc test - address[0] = NULL; + address[0] = nullptr; static const unsigned int checkValue = 0x0badbabe; // create tree (non pool) allocation (we usually pool < 256 bytes) address[0] = sysAlloc.Allocate(2048, 16); @@ -372,7 +372,7 @@ namespace UnitTest poolAllocator.GetRecords()->unlock(); } - for (i = 0; address[i] != 0; ++i) + for (i = 0; address[i] != nullptr; ++i) { poolAlloc.DeAllocate(address[i]); } @@ -544,7 +544,7 @@ namespace UnitTest #else static const int numAllocations = 10000; #endif - void* addresses[numAllocations] = {0}; + void* addresses[numAllocations] = {nullptr}; IAllocatorAllocate& poolAlloc = AllocatorInstance::Get(); @@ -665,7 +665,7 @@ namespace UnitTest poolAllocator.GetRecords()->unlock(); } - for (int i = 0; address[i] != 0; ++i) + for (int i = 0; address[i] != nullptr; ++i) { poolAlloc.DeAllocate(address[i]); } @@ -820,7 +820,7 @@ namespace UnitTest AllocatorInstance::Create(sysDesc); BestFitExternalMapAllocator::Descriptor desc; - desc.m_mapAllocator = NULL; // use the system allocator + desc.m_mapAllocator = nullptr; // use the system allocator desc.m_memoryBlockByteSize = 4 * 1024 * 1024; desc.m_memoryBlock = azmalloc(desc.m_memoryBlockByteSize, desc.m_memoryBlockAlignment); diff --git a/Code/Framework/AzCore/Tests/Memory/HphaSchema.cpp b/Code/Framework/AzCore/Tests/Memory/HphaSchema.cpp index cb2b32e212..aaf4ce1811 100644 --- a/Code/Framework/AzCore/Tests/Memory/HphaSchema.cpp +++ b/Code/Framework/AzCore/Tests/Memory/HphaSchema.cpp @@ -121,13 +121,13 @@ namespace Benchmark : public ::benchmark::Fixture { public: - void SetUp(const ::benchmark::State& state) + void SetUp(const ::benchmark::State& state) override { AZ_UNUSED(state); AZ::AllocatorInstance::Create(); } - void TearDown(const ::benchmark::State& state) + void TearDown(const ::benchmark::State& state) override { AZ_UNUSED(state); AZ::AllocatorInstance::Destroy(); diff --git a/Code/Framework/AzCore/Tests/Name/NameJsonSerializerTests.cpp b/Code/Framework/AzCore/Tests/Name/NameJsonSerializerTests.cpp index 2bca8b5970..7801059535 100644 --- a/Code/Framework/AzCore/Tests/Name/NameJsonSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Name/NameJsonSerializerTests.cpp @@ -28,12 +28,12 @@ namespace JsonSerializationTests AZ::NameDictionary::Destroy(); } - void Reflect(AZStd::unique_ptr& context) + void Reflect(AZStd::unique_ptr& context) override { AZ::Name::Reflect(context.get()); } - void Reflect(AZStd::unique_ptr& context) + void Reflect(AZStd::unique_ptr& context) override { AZ::Name::Reflect(context.get()); } diff --git a/Code/Framework/AzCore/Tests/OrderedEventBenchmarks.cpp b/Code/Framework/AzCore/Tests/OrderedEventBenchmarks.cpp index 7cada35d19..25b2007bea 100644 --- a/Code/Framework/AzCore/Tests/OrderedEventBenchmarks.cpp +++ b/Code/Framework/AzCore/Tests/OrderedEventBenchmarks.cpp @@ -74,7 +74,7 @@ namespace Benchmark { public: EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusConnect(); } - ~EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusDisconnect(); } + ~EBusPerfBaselineImplEmpty() override { EBusPerfBaselineBus::Handler::BusDisconnect(); } void OnSignal(int32_t) override {} }; @@ -94,7 +94,7 @@ namespace Benchmark { public: EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusConnect(); } - ~EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusDisconnect(); } + ~EBusPerfBaselineImplIncrement() override { EBusPerfBaselineBus::Handler::BusDisconnect(); } void SetIncrementCounter(int32_t* incrementCounter) { m_incrementCounter = incrementCounter; } void OnSignal(int32_t) override { ++(*m_incrementCounter); } int32_t* m_incrementCounter; diff --git a/Code/Framework/AzCore/Tests/Script.cpp b/Code/Framework/AzCore/Tests/Script.cpp index e0301f8974..336e4e5dd0 100644 --- a/Code/Framework/AzCore/Tests/Script.cpp +++ b/Code/Framework/AzCore/Tests/Script.cpp @@ -1382,7 +1382,7 @@ namespace UnitTest static int s_errorCount = 0; IncompleteType* s_globalIncompletePtr = static_cast(AZ_INVALID_POINTER); - IncompleteType* s_globalIncompletePtr1 = 0; + IncompleteType* s_globalIncompletePtr1 = nullptr; void GlobalVarSet(int v) { @@ -2234,7 +2234,7 @@ namespace UnitTest // incomplete types passed by a light-user data (pointer reference) AZ_TEST_ASSERT(s_globalIncompletePtr == reinterpret_cast(AZ_INVALID_POINTER)); - AZ_TEST_ASSERT(s_globalIncompletePtr1 == 0); + AZ_TEST_ASSERT(s_globalIncompletePtr1 == nullptr); script.Execute("globalIncomplete1 = globalIncomplete"); AZ_TEST_ASSERT(s_globalIncompletePtr1 == s_globalIncompletePtr); @@ -3157,7 +3157,7 @@ namespace UnitTest char stackOutput[2048]; debugContext->StackTrace(stackOutput, AZ_ARRAY_SIZE(stackOutput)); AZ_Printf("Script", "%s", stackOutput); - AZ_TEST_ASSERT(strstr(stackOutput, "GlobalFunction") != 0); + AZ_TEST_ASSERT(strstr(stackOutput, "GlobalFunction") != nullptr); AZ_TEST_ASSERT(breakpoint->m_lineNumber == 20); } else if (m_numBreakpointHits == 2) @@ -3193,7 +3193,7 @@ namespace UnitTest char stackOutput[2048]; debugContext->StackTrace(stackOutput, AZ_ARRAY_SIZE(stackOutput)); AZ_Printf("Script", "%s", stackOutput); - AZ_TEST_ASSERT(strstr(stackOutput, "GlobalMult") != 0); + AZ_TEST_ASSERT(strstr(stackOutput, "GlobalMult") != nullptr); AZ_TEST_ASSERT(breakpoint->m_lineNumber == 23); } diff --git a/Code/Framework/AzCore/Tests/Serialization.cpp b/Code/Framework/AzCore/Tests/Serialization.cpp index 9ff2925472..e554945b55 100644 --- a/Code/Framework/AzCore/Tests/Serialization.cpp +++ b/Code/Framework/AzCore/Tests/Serialization.cpp @@ -2231,7 +2231,7 @@ TEST_F(SerializeBasicTest, BasicTypeTest_Succeed) (void)classId; DeprecationTestClass* obj = reinterpret_cast(classPtr); EXPECT_EQ( 0, obj->m_deprecated.m_data ); - EXPECT_EQ( NULL, obj->m_deprecatedPtr ); + EXPECT_EQ( nullptr, obj->m_deprecatedPtr ); EXPECT_EQ( 0, obj->m_oldClassData ); EXPECT_EQ( 0.f, obj->m_newClassData ); EXPECT_EQ( 0, obj->m_missingMember ); @@ -4057,7 +4057,7 @@ namespace UnitTest if (strcmp(classData->m_name, "MyEditStruct") == 0) { - EXPECT_TRUE(classData->m_editData != NULL); + EXPECT_TRUE(classData->m_editData != nullptr); EXPECT_EQ( 0, strcmp(classData->m_editData->m_name, "MyEditStruct") ); EXPECT_EQ( 0, strcmp(classData->m_editData->m_description, "My edit struct class used for ...") ); EXPECT_EQ( 2, classData->m_editData->m_elements.size() ); @@ -4071,12 +4071,12 @@ namespace UnitTest // Number of options attribute EXPECT_EQ(classElement->m_editData->m_attributes[0].first, AZ_CRC("NumOptions", 0x90274abc)); Edit::AttributeData* intData = azrtti_cast*>(classElement->m_editData->m_attributes[0].second); - EXPECT_TRUE(intData != NULL); + EXPECT_TRUE(intData != nullptr); EXPECT_EQ( 3, intData->Get(instance) ); // Get options attribute EXPECT_EQ( classElement->m_editData->m_attributes[1].first, AZ_CRC("Options", 0xd035fa87)); Edit::AttributeFunction* funcData = azrtti_cast*>(classElement->m_editData->m_attributes[1].second); - EXPECT_TRUE(funcData != NULL); + EXPECT_TRUE(funcData != nullptr); EXPECT_EQ( 20, funcData->Invoke(instance, 10) ); } return true; diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/ArraySerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/ArraySerializerTests.cpp index 4dc74779f2..e410ba9ca4 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/ArraySerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/ArraySerializerTests.cpp @@ -58,7 +58,7 @@ namespace JsonSerializationTests return array; } - AZStd::shared_ptr CreatePartialDefaultInstance() + AZStd::shared_ptr CreatePartialDefaultInstance() override { auto array = AZStd::make_shared(); (*array)[0] = 10; @@ -128,7 +128,7 @@ namespace JsonSerializationTests return array; } - AZStd::shared_ptr CreatePartialDefaultInstance() + AZStd::shared_ptr CreatePartialDefaultInstance() override { auto partialInstance = aznew MultipleInheritence(); partialInstance->m_var1 = 142; diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/MapSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/MapSerializerTests.cpp index 41b17f9ade..4979df04be 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/MapSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/MapSerializerTests.cpp @@ -169,7 +169,7 @@ namespace JsonSerializationTests return AZStd::shared_ptr(new Map{}, &Delete); } - AZStd::shared_ptr CreatePartialDefaultInstance() + AZStd::shared_ptr CreatePartialDefaultInstance() override { auto instance = AZStd::shared_ptr(new Map{}, &Delete); instance->emplace(AZStd::make_pair(aznew SimpleClass(), aznew SimpleClass(188, 188.0))); diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/StringSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/StringSerializerTests.cpp index a2a3d42ebb..af6dedb51b 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/StringSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/StringSerializerTests.cpp @@ -33,7 +33,7 @@ namespace JsonSerializationTests return AZStd::make_shared("Hello"); } - AZStd::string_view GetJsonForFullySetInstance() + AZStd::string_view GetJsonForFullySetInstance() override { return R"("Hello")"; } @@ -48,7 +48,7 @@ namespace JsonSerializationTests features.m_supportsInjection = false; } - bool AreEqual(const String& lhs, const String& rhs) + bool AreEqual(const String& lhs, const String& rhs) override { return lhs.compare(rhs) == 0; } diff --git a/Code/Framework/AzCore/Tests/Settings/SettingsRegistryConsoleUtilsTests.cpp b/Code/Framework/AzCore/Tests/Settings/SettingsRegistryConsoleUtilsTests.cpp index 5b18faa3d1..6bcd57f849 100644 --- a/Code/Framework/AzCore/Tests/Settings/SettingsRegistryConsoleUtilsTests.cpp +++ b/Code/Framework/AzCore/Tests/Settings/SettingsRegistryConsoleUtilsTests.cpp @@ -147,7 +147,7 @@ namespace SettingsRegistryConsoleUtilsTests struct SettingsRegistryDumpCommandHandler : public AZ::Debug::TraceMessageBus::Handler { - bool OnOutput(const char* window, const char* message) + bool OnOutput(const char* window, const char* message) override { if (window == AZStd::string_view("SettingsRegistry")) { @@ -218,7 +218,7 @@ namespace SettingsRegistryConsoleUtilsTests , m_expectedValue2{ expectedValue2 } { } - bool OnOutput(const char* window, const char* message) + bool OnOutput(const char* window, const char* message) override { if (window == AZStd::string_view("SettingsRegistry")) { diff --git a/Code/Framework/AzCore/Tests/Statistics.cpp b/Code/Framework/AzCore/Tests/Statistics.cpp index 941c2eff0b..4577618d5a 100644 --- a/Code/Framework/AzCore/Tests/Statistics.cpp +++ b/Code/Framework/AzCore/Tests/Statistics.cpp @@ -40,7 +40,7 @@ namespace UnitTest } } - ~StatisticsTest() + ~StatisticsTest() override { } diff --git a/Code/Framework/AzCore/Tests/Streamer/BlockCacheTests.cpp b/Code/Framework/AzCore/Tests/Streamer/BlockCacheTests.cpp index f770af57be..3a107da61d 100644 --- a/Code/Framework/AzCore/Tests/Streamer/BlockCacheTests.cpp +++ b/Code/Framework/AzCore/Tests/Streamer/BlockCacheTests.cpp @@ -184,7 +184,7 @@ namespace AZ::IO size = size >> 2; for (u64 i = 0; i < size; ++i) { - // Using assert here because in case of a problem EXPECT would + // Using assert here because in case of a problem EXPECT would // cause a large amount of log noise. ASSERT_EQ(buffer[i], offset + (i << 2)); } @@ -203,7 +203,9 @@ namespace AZ::IO { do { - while (m_context->FinalizeCompletedRequests()); + while (m_context->FinalizeCompletedRequests()) + { + } } while (m_cache->ExecuteRequests()); } @@ -269,7 +271,7 @@ namespace AZ::IO RedirectReadCalls(); EXPECT_CALL(*this, ReadFile(_, _, 0, m_fakeFileLength)); - + ProcessRead(m_buffer, m_path, 0, m_fakeFileLength, IStreamerTypes::RequestStatus::Completed); VerifyReadBuffer(0, m_fakeFileLength); } @@ -519,8 +521,8 @@ namespace AZ::IO using ::testing::_; using ::testing::Return; - CreateTestEnvironment(); - + CreateTestEnvironment(); + EXPECT_CALL(*m_mock, ExecuteRequests()) .WillOnce(Return(true)) .WillRepeatedly(Return(false)); @@ -553,7 +555,7 @@ namespace AZ::IO RunProcessLoop(); EXPECT_TRUE(allRequestsCompleted); - + VerifyReadBuffer(256, m_fakeFileLength - 512); VerifyReadBuffer(buffer1, m_fakeFileLength - 768, secondReadSize); } @@ -622,7 +624,7 @@ namespace AZ::IO m_fakeFileFound = false; m_fakeFileLength = 0; - + ProcessRead(m_buffer, m_path, 0, m_blockSize, IStreamerTypes::RequestStatus::Failed); } @@ -650,18 +652,18 @@ namespace AZ::IO status.m_isIdle = false; })); EXPECT_CALL(*this, ReadFile(_, _, _, _)).Times(count); - + constexpr size_t scratchBufferSize = 128_kib; using ScratchBuffer = char[scratchBufferSize]; ScratchBuffer buffers[count]; - + bool allRequestsCompleted = true; auto completed = [&allRequestsCompleted](const FileRequest& request) { // Capture result before request is recycled. allRequestsCompleted = allRequestsCompleted && request.GetStatus() == IStreamerTypes::RequestStatus::Completed; }; - + for (size_t i = 0; i < count; ++i) { StreamStackEntry::Status status; @@ -738,7 +740,7 @@ namespace AZ::IO RedirectReadCalls(); EXPECT_CALL(*this, ReadFile(_, _, 256, m_fakeFileLength - 256)); - + ProcessRead(m_buffer, m_path, 256, m_fakeFileLength - 256, IStreamerTypes::RequestStatus::Completed); VerifyReadBuffer(256, m_fakeFileLength - 256); } @@ -1062,7 +1064,7 @@ namespace AZ::IO .WillRepeatedly(Return(false)); EXPECT_CALL(*m_mock, QueueRequest(_)) .WillRepeatedly(Invoke(this, &BlockCacheTest::QueueReadRequest)); - + size_t firstReadSize = m_fakeFileLength - (2 * m_blockSize) - 512; FileRequest* request0 = m_context->GetNewInternalRequest(); request0->CreateRead(nullptr, m_buffer, m_bufferSize, m_path, 256, firstReadSize); @@ -1097,7 +1099,7 @@ namespace AZ::IO VerifyReadBuffer(buffer1.get(), secondReadOffset, secondReadSize); } - + @@ -1146,7 +1148,7 @@ namespace AZ::IO FileRequest* request = m_context->GetNewInternalRequest(); request->CreateFlush(m_path); RunAndCompleteRequest(request, IStreamerTypes::RequestStatus::Completed); - + // The partial read would normally be serviced from the cache, but now triggers another read. EXPECT_CALL(*this, ReadFile(_, _, _, _)).Times(1); ProcessRead(m_buffer, m_path, 512, m_blockSize - 1024, IStreamerTypes::RequestStatus::Completed); @@ -1170,7 +1172,7 @@ namespace AZ::IO FileRequest* request = m_context->GetNewInternalRequest(); request->CreateFlushAll(); RunAndCompleteRequest(request, IStreamerTypes::RequestStatus::Completed); - + // The partial read would normally be serviced from the cache, but now triggers another read. EXPECT_CALL(*this, ReadFile(_, _, _, _)).Times(1); ProcessRead(m_buffer, m_path, 512, m_blockSize - 1024, IStreamerTypes::RequestStatus::Completed); diff --git a/Code/Framework/AzCore/Tests/StringFunc.cpp b/Code/Framework/AzCore/Tests/StringFunc.cpp index 2b6f19736a..68821ba3f9 100644 --- a/Code/Framework/AzCore/Tests/StringFunc.cpp +++ b/Code/Framework/AzCore/Tests/StringFunc.cpp @@ -966,7 +966,7 @@ namespace AZ { public: StringPathFuncTest() = default; - virtual ~StringPathFuncTest() = default; + ~StringPathFuncTest() override = default; }; diff --git a/Code/Framework/AzFramework/AzFramework/API/ApplicationAPI.h b/Code/Framework/AzFramework/AzFramework/API/ApplicationAPI.h index 11778b9239..dbbf443656 100644 --- a/Code/Framework/AzFramework/AzFramework/API/ApplicationAPI.h +++ b/Code/Framework/AzFramework/AzFramework/API/ApplicationAPI.h @@ -72,11 +72,8 @@ namespace AzFramework /// Retrieves the app root path for the application. virtual const char* GetAppRoot() const { return nullptr; } -#pragma push_macro("GetCommandLine") -#undef GetCommandLine /// Get the Command Line arguments passed in. virtual const CommandLine* GetCommandLine() { return nullptr; } -#pragma pop_macro("GetCommandLine") /// Get the Command Line arguments passed in. (Avoids collisions with platform specific macros.) virtual const CommandLine* GetApplicationCommandLine() { return nullptr; } diff --git a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp index 8688f6b878..ce0cc23a4e 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp @@ -374,8 +374,8 @@ namespace AZ::IO { public: AZ_CLASS_ALLOCATOR(CResourceList, AZ::SystemAllocator, 0); - CResourceList() { m_iter = m_set.end(); }; - ~CResourceList() {}; + CResourceList() { m_iter = m_set.end(); } + ~CResourceList() override {} void Add(AZStd::string_view sResourceFile) override { @@ -2571,7 +2571,7 @@ namespace AZ::IO return aznumeric_cast(pFileEntry->nFileDataOffset); } - EStreamSourceMediaType Archive::GetFileMediaType(AZStd::string_view szName) const + EStreamSourceMediaType Archive::GetFileMediaType(AZStd::string_view szName) const { auto szFullPath = AZ::IO::FileIOBase::GetDirectInstance()->ResolvePath(szName); if (!szFullPath) diff --git a/Code/Framework/AzFramework/AzFramework/IO/FileOperations.cpp b/Code/Framework/AzFramework/AzFramework/IO/FileOperations.cpp index db36a91448..9703e4a993 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/FileOperations.cpp +++ b/Code/Framework/AzFramework/AzFramework/IO/FileOperations.cpp @@ -114,7 +114,7 @@ namespace AZ AZ_Warning("AZ::IO::SmartMove", false, "Unable to move/copy the source file (%s)", sourceFilePath); if (destFileMoved) { - // if we were unable to move/copy the source file to the dest file, + // if we were unable to move/copy the source file to the dest file, // we will try to revert back the destination file from the temp file. if (!fileIO->Rename(tmpDestFile.c_str(), destinationFilePath)) { @@ -124,7 +124,7 @@ namespace AZ return ResultCode::Error; } - // removing the source file if copy succeeds + // removing the source file if copy succeeds if (!fileIO->Remove(sourceFilePath)) { AZ_Warning("AZ::IO::SmartMove", false, "Unable to delete the source file (%s)", sourceFilePath); @@ -140,7 +140,7 @@ namespace AZ return ResultCode::Error; } } - + return ResultCode::Success; } @@ -158,7 +158,7 @@ namespace AZ const int s_MaxCreateTempFileTries = 16; AZStd::string fullPath, fileName; tempFile.clear(); - + if (!AzFramework::StringFunc::Path::GetFullPath(file, fullPath)) { AZ_Warning("AZ::IO::CreateTempFileName", false, " Filepath needs to be an absolute path: '%s'", file); @@ -170,7 +170,7 @@ namespace AZ AZ_Warning("AZ::IO::CreateTempFileName", false, " Filepath needs to be an absolute path: '%s'", file); return false; } - + for (int idx = 0; idx < s_MaxCreateTempFileTries; idx++) { AzFramework::StringFunc::Path::ConstructFull(fullPath.c_str(), AZStd::string::format("$tmp%d_%s", rand(), fileName.c_str()).c_str(), tempFile, true); @@ -235,7 +235,7 @@ namespace AZ fileIO->Read(fileHandle, buffer, bufferSize - 1, false, &bytesRead); if (!bytesRead) { - return 0; + return nullptr; } char* currentPosition = buffer; diff --git a/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp b/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp index aca7a41950..55e4f06db0 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp +++ b/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp @@ -707,6 +707,7 @@ namespace AZ resolvedPathLen += postAliasView.size(); // Null-Terminated the resolved path resolvedPath[resolvedPathLen] = '\0'; + // If the path started with one of the "asset cache" path aliases, lowercase the path const char* assetAliasPath = GetAlias("@assets@"); const char* rootAliasPath = GetAlias("@root@"); @@ -714,10 +715,13 @@ namespace AZ const bool lowercasePath = (assetAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, assetAliasPath)) || (rootAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, rootAliasPath)) || (projectPlatformCacheAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, projectPlatformCacheAliasPath)); + if (lowercasePath) { - AZStd::to_lower(resolvedPath, resolvedPath + resolvedPathLen); + // Lowercase only the relative part after the replaced alias. + AZStd::to_lower(resolvedPath + aliasValue.size(), resolvedPath + resolvedPathLen); } + // Replace any backslashes with posix slashes AZStd::replace(resolvedPath, resolvedPath + resolvedPathLen, AZ::IO::WindowsPathSeparator, AZ::IO::PosixPathSeparator); return true; diff --git a/Code/Framework/AzFramework/AzFramework/Input/Devices/InputDevice.cpp b/Code/Framework/AzFramework/AzFramework/Input/Devices/InputDevice.cpp index f1b4e02b2d..2f44f80eba 100644 --- a/Code/Framework/AzFramework/AzFramework/Input/Devices/InputDevice.cpp +++ b/Code/Framework/AzFramework/AzFramework/Input/Devices/InputDevice.cpp @@ -39,7 +39,7 @@ namespace AzFramework } //////////////////////////////////////////////////////////////////////////////////////////// - void OnInputDeviceDisconnectedEvent(const InputDevice& inputDevice) + void OnInputDeviceDisconnectedEvent(const InputDevice& inputDevice) override { Call(FN_OnInputDeviceDisconnectedEvent, &inputDevice); } diff --git a/Code/Framework/AzFramework/AzFramework/Logging/LoggingComponent.cpp b/Code/Framework/AzFramework/AzFramework/Logging/LoggingComponent.cpp index aa1344fa4f..d5ba65425c 100644 --- a/Code/Framework/AzFramework/AzFramework/Logging/LoggingComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Logging/LoggingComponent.cpp @@ -101,7 +101,7 @@ namespace AzFramework if (m_logFile) { delete m_logFile; - m_logFile = NULL; + m_logFile = nullptr; } } diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp b/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp index 994d93d99e..4ac97cf041 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp +++ b/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp @@ -28,7 +28,7 @@ namespace Physics class MaterialLibraryAssetEventHandler : public AZ::SerializeContext::IEventHandler { - void OnReadBegin(void* classPtr) + void OnReadBegin(void* classPtr) override { auto matAsset = static_cast(classPtr); matAsset->GenerateMissingIds(); @@ -38,7 +38,7 @@ namespace Physics class MaterialSelectionEventHandler : public AZ::SerializeContext::IEventHandler { - void OnReadEnd(void* classPtr) + void OnReadEnd(void* classPtr) override { auto materialSelection = static_cast(classPtr); if (materialSelection->GetMaterialIdsAssignedToSlots().empty()) @@ -362,8 +362,8 @@ namespace Physics MaterialId MaterialId::Create() { - MaterialId id; - id.m_id = AZ::Uuid::Create(); + MaterialId id; + id.m_id = AZ::Uuid::Create(); return id; } @@ -425,7 +425,7 @@ namespace Physics } else { - // If there is more than one material slot + // If there is more than one material slot // the caller must use SetMaterialSlots function return ""; } diff --git a/Code/Framework/AzFramework/AzFramework/Script/ScriptRemoteDebugging.cpp b/Code/Framework/AzFramework/AzFramework/Script/ScriptRemoteDebugging.cpp index 06fd8acd79..011d967631 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptRemoteDebugging.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptRemoteDebugging.cpp @@ -174,25 +174,25 @@ namespace AzFramework ScriptDebugAgent() = default; ////////////////////////////////////////////////////////////////////////// // Component base - virtual void Init(); - virtual void Activate(); - virtual void Deactivate(); + void Init() override; + void Activate() override; + void Deactivate() override; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // AZ::SystemTickBus - virtual void OnSystemTick(); + void OnSystemTick() override; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // ScriptDebugAgentBus - virtual void RegisterContext(AZ::ScriptContext* sc, const char* name); - virtual void UnregisterContext(AZ::ScriptContext* sc); + void RegisterContext(AZ::ScriptContext* sc, const char* name) override; + void UnregisterContext(AZ::ScriptContext* sc) override; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // TmMsgBus - virtual void OnReceivedMsg(TmMsgPtr msg); + void OnReceivedMsg(TmMsgPtr msg) override; ////////////////////////////////////////////////////////////////////////// protected: @@ -241,10 +241,10 @@ namespace AzFramework void ScriptDebugAgent::Activate() { m_executionState = SDA_STATE_DETACHED; - m_curContext = NULL; + m_curContext = nullptr; // register default app script context if there is one - AZ::ScriptContext* defaultScriptContext = NULL; + AZ::ScriptContext* defaultScriptContext = nullptr; EBUS_EVENT_RESULT(defaultScriptContext, AZ::ScriptSystemRequestBus, GetContext, AZ::ScriptContextIds::DefaultScriptContextId); if (defaultScriptContext) { @@ -379,7 +379,7 @@ namespace AzFramework AZ_TracePrintf("LUA", "Remote debugger %s has detached from context 0x%p.\n", m_debugger.GetDisplayName(), m_curContext); m_debugger = TargetInfo(); - m_curContext = NULL; + m_curContext = nullptr; m_executionState = SDA_STATE_DETACHED; } //------------------------------------------------------------------------- @@ -435,7 +435,7 @@ namespace AzFramework void ScriptDebugAgent::Process() { // Process messages - AZ::ScriptContextDebug* dbgContext = m_curContext ? m_curContext->GetDebugContext() : NULL; + AZ::ScriptContextDebug* dbgContext = m_curContext ? m_curContext->GetDebugContext() : nullptr; while (!m_msgQueue.empty()) { m_msgMutex.lock(); diff --git a/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp b/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp index c1ce31613c..1c26cbc744 100644 --- a/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp @@ -562,7 +562,7 @@ namespace AzFramework void TargetManagementComponent::SetMyPersistentName(const char* name) { - AZ_Assert(m_networkImpl->m_session == NULL, "We cannot change our neighborhood while connected!"); + AZ_Assert(m_networkImpl->m_session == nullptr, "We cannot change our neighborhood while connected!"); m_settings->m_persistentName = name; } @@ -585,7 +585,7 @@ namespace AzFramework void TargetManagementComponent::SetNeighborhood(const char* name) { - AZ_Assert(m_networkImpl->m_session == NULL, "We cannot change our neighborhood while connected!"); + AZ_Assert(m_networkImpl->m_session == nullptr, "We cannot change our neighborhood while connected!"); m_settings->m_neighborhoodName = name; } @@ -714,7 +714,7 @@ namespace AzFramework { GridMate::GridMember* member = m_networkImpl->m_session->GetMemberByIndex(i); GridMate::MemberIDCompact memberId = member->GetId().Compact(); - const TargetInfo* target = NULL; + const TargetInfo* target = nullptr; AZ::u32 targetId = 0; for (TargetContainer::const_iterator targetIt = m_availableTargets.begin(); targetIt != m_availableTargets.end(); ++targetIt) { @@ -742,7 +742,7 @@ namespace AzFramework AZ::IO::MemoryStream msgBuffer(m_tmpInboundBuffer.data(), result.m_numBytes, result.m_numBytes); TmMsg* msg = nullptr; AZ::ObjectStream::ClassReadyCB readyCB(AZStd::bind(&TargetManagementComponent::OnMsgParsed, this, &msg, AZStd::placeholders::_1, AZStd::placeholders::_2, AZStd::placeholders::_3)); - AZ::ObjectStream::LoadBlocking(&msgBuffer, *m_serializeContext, readyCB, AZ::ObjectStream::FilterDescriptor(0, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES)); + AZ::ObjectStream::LoadBlocking(&msgBuffer, *m_serializeContext, readyCB, AZ::ObjectStream::FilterDescriptor(nullptr, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES)); if (msg) { if (msg->GetCustomBlobSize() > 0) diff --git a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Application/Application_Linux.cpp b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Application/Application_Linux.cpp index eb4165453e..407e256052 100644 --- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Application/Application_Linux.cpp +++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Application/Application_Linux.cpp @@ -24,7 +24,7 @@ namespace AzFramework LinuxXcbConnectionManagerBus::Handler::BusConnect(); } - ~LinuxXcbConnectionManagerImpl() + ~LinuxXcbConnectionManagerImpl() override { LinuxXcbConnectionManagerBus::Handler::BusDisconnect(); xcb_disconnect(m_xcbConnection); diff --git a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp index 0249a42976..f8cc26b19b 100644 --- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp +++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp @@ -78,7 +78,7 @@ namespace AzFramework FD_ZERO(&set); FD_SET(handle->GetHandle(), &set); - [[maybe_unused]] int numReady = select(handle->GetHandle() + 1, &set, NULL, NULL, NULL); + [[maybe_unused]] int numReady = select(handle->GetHandle() + 1, &set, nullptr, nullptr, nullptr); // if numReady == -1 and errno == EINTR then the child process died unexpectedly and // the handle was closed. Not something to assert about in regards to trying to read 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 eb60b8e6ae..2d29fac73d 100644 --- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp +++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp @@ -277,7 +277,7 @@ namespace AzFramework environmentVariables[i][0] = '\0'; azstrcat(environmentVariables[i], envVarString.size(), envVarString.c_str()); } - environmentVariables[numEnvironmentVars] = NULL; + environmentVariables[numEnvironmentVars] = nullptr; } pid_t child_pid = fork(); @@ -373,7 +373,7 @@ namespace AzFramework } bool isProcessDone = false; - time_t startTime = time(0); + time_t startTime = time(nullptr); time_t currentTime = startTime; AZ_Assert(currentTime != -1, "time(0) returned an invalid time"); while (((currentTime - startTime) < waitTimeInSeconds) && !isProcessDone) @@ -385,7 +385,7 @@ namespace AzFramework m_pWatcherData->m_childProcessIsDone = true; break; } - currentTime = time(0); + currentTime = time(nullptr); } //returns false if process is still running after time return isProcessDone; diff --git a/Code/Framework/AzFramework/Tests/ArchiveTests.cpp b/Code/Framework/AzFramework/Tests/ArchiveTests.cpp index 2caaf6ee71..6a359e714c 100644 --- a/Code/Framework/AzFramework/Tests/ArchiveTests.cpp +++ b/Code/Framework/AzFramework/Tests/ArchiveTests.cpp @@ -570,7 +570,7 @@ namespace UnitTest EXPECT_TRUE(found_mylevel_folder); numFound = 0; - found_mylevel_folder = 0; + found_mylevel_folder = false; // now make sure no red herrings appear // for example, if a file is mounted at "@assets@\\uniquename\\mylevel2\\mylevel3\\mylevel4" diff --git a/Code/Framework/AzFramework/Tests/BehaviorEntityTests.cpp b/Code/Framework/AzFramework/Tests/BehaviorEntityTests.cpp index f42a0faeee..3c860a88dd 100644 --- a/Code/Framework/AzFramework/Tests/BehaviorEntityTests.cpp +++ b/Code/Framework/AzFramework/Tests/BehaviorEntityTests.cpp @@ -29,7 +29,7 @@ public: void Activate() override {} void Deactivate() override {} - bool ReadInConfig(const AZ::ComponentConfig* baseConfig) + bool ReadInConfig(const AZ::ComponentConfig* baseConfig) override { if (auto config = azrtti_cast(baseConfig)) { @@ -39,7 +39,7 @@ public: return false; } - bool WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const + bool WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const override { if (auto outConfig = azrtti_cast(outBaseConfig)) { diff --git a/Code/Framework/AzFramework/Tests/BinToTextEncode.cpp b/Code/Framework/AzFramework/Tests/BinToTextEncode.cpp index b4d4ff63b0..a1ebdfd945 100644 --- a/Code/Framework/AzFramework/Tests/BinToTextEncode.cpp +++ b/Code/Framework/AzFramework/Tests/BinToTextEncode.cpp @@ -46,7 +46,7 @@ namespace UnitTest AllocatorsFixture::TearDown(); } - virtual ~Base64Test() + ~Base64Test() override { } diff --git a/Code/Framework/AzFramework/Tests/EntityContext.cpp b/Code/Framework/AzFramework/Tests/EntityContext.cpp index cb957fa46c..74a4948e04 100644 --- a/Code/Framework/AzFramework/Tests/EntityContext.cpp +++ b/Code/Framework/AzFramework/Tests/EntityContext.cpp @@ -41,7 +41,7 @@ namespace UnitTest Data::AssetManager::Create(desc); } - virtual ~EntityContextBasicTest() + ~EntityContextBasicTest() override { } diff --git a/Code/Framework/AzFramework/Tests/FileIO.cpp b/Code/Framework/AzFramework/Tests/FileIO.cpp index 7a01ba991b..fb95512968 100644 --- a/Code/Framework/AzFramework/Tests/FileIO.cpp +++ b/Code/Framework/AzFramework/Tests/FileIO.cpp @@ -118,7 +118,7 @@ namespace UnitTest AZ::IO::FileIOBase::SetInstance(&m_fileIO); } - ~FileIOStreamTest() + ~FileIOStreamTest() override { } @@ -341,7 +341,7 @@ namespace UnitTest AZ_TEST_ASSERT(!local.Eof(fileHandle)); AZ_TEST_ASSERT(!local.Flush(fileHandle)); AZ_TEST_ASSERT(!local.ModificationTime(fileHandle)); - AZ_TEST_ASSERT(!local.Read(fileHandle, 0, 0, false)); + AZ_TEST_ASSERT(!local.Read(fileHandle, nullptr, 0, false)); AZ_TEST_ASSERT(!local.Tell(fileHandle, fs)); AZ_TEST_ASSERT(!local.Exists((file01Name + "notexist").c_str())); diff --git a/Code/Framework/AzFramework/Tests/NativeWindow.cpp b/Code/Framework/AzFramework/Tests/NativeWindow.cpp index 9554b6ab10..f160d88003 100644 --- a/Code/Framework/AzFramework/Tests/NativeWindow.cpp +++ b/Code/Framework/AzFramework/Tests/NativeWindow.cpp @@ -27,19 +27,19 @@ namespace UnitTest AzFramework::WindowNotificationBus::Handler::BusConnect(m_windowHandle); } - ~NativeWindowListener() + ~NativeWindowListener() override { AzFramework::WindowNotificationBus::Handler::BusDisconnect(m_windowHandle); } // WindowNotificationBus::Handler overrides... - void OnWindowResized(uint32_t width, uint32_t height) + void OnWindowResized(uint32_t width, uint32_t height) override { AZ_UNUSED(width); AZ_UNUSED(height); m_wasOnWindowResizedReceived = true; } - void OnWindowClosed() + void OnWindowClosed() override { m_wasOnWindowClosedReceived = true; } diff --git a/Code/Framework/AzManipulatorTestFramework/Source/DirectManipulatorViewportInteraction.cpp b/Code/Framework/AzManipulatorTestFramework/Source/DirectManipulatorViewportInteraction.cpp index a667af4e20..c9234fe488 100644 --- a/Code/Framework/AzManipulatorTestFramework/Source/DirectManipulatorViewportInteraction.cpp +++ b/Code/Framework/AzManipulatorTestFramework/Source/DirectManipulatorViewportInteraction.cpp @@ -34,7 +34,7 @@ namespace AzManipulatorTestFramework ViewportInteractionInterface* viewportInteraction, AZStd::shared_ptr manipulatorManager); // ManipulatorManagerInterface ... - void ConsumeMouseInteractionEvent(const MouseInteractionEvent& event); + void ConsumeMouseInteractionEvent(const MouseInteractionEvent& event) override; AzToolsFramework::ManipulatorManagerId GetId() const override; bool ManipulatorBeingInteracted() const override; diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp b/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp index 57badcee4e..3fdfa042a5 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp @@ -473,7 +473,7 @@ namespace AzNetworking { const AZ::CVarFixedString contextPassword = (trustZone == TrustZone::ExternalClientToServer) ? net_SslExternalContextPassword : net_SslInternalContextPassword; - SSL_CTX_set_default_passwd_cb(context, NULL); + SSL_CTX_set_default_passwd_cb(context, nullptr); SSL_CTX_set_default_passwd_cb_userdata(context, (void*)contextPassword.c_str()); if (SSL_CTX_use_PrivateKey_file(context, privateKeyPath.c_str(), SSL_FILETYPE_PEM) != OpenSslResultSuccess) diff --git a/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp b/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp index d06aac1a14..9dc7ae0ccf 100644 --- a/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp +++ b/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp @@ -23,12 +23,12 @@ namespace UnitTest : public IConnectionListener { public: - ConnectResult ValidateConnect([[maybe_unused]] const IpAddress& remoteAddress, [[maybe_unused]] const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) + ConnectResult ValidateConnect([[maybe_unused]] const IpAddress& remoteAddress, [[maybe_unused]] const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) override { return ConnectResult::Accepted; } - void OnConnect([[maybe_unused]] IConnection* connection) + void OnConnect([[maybe_unused]] IConnection* connection) override { ; } @@ -40,12 +40,12 @@ namespace UnitTest return PacketDispatchResult::Failure; } - void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) + void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) override { } - void OnDisconnect([[maybe_unused]] IConnection* connection, [[maybe_unused]] DisconnectReason reason, [[maybe_unused]] TerminationEndpoint endpoint) + void OnDisconnect([[maybe_unused]] IConnection* connection, [[maybe_unused]] DisconnectReason reason, [[maybe_unused]] TerminationEndpoint endpoint) override { } diff --git a/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp b/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp index 9cc3fd4b09..02c7085023 100644 --- a/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp +++ b/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp @@ -26,12 +26,12 @@ namespace UnitTest : public IConnectionListener { public: - ConnectResult ValidateConnect([[maybe_unused]] const IpAddress& remoteAddress, [[maybe_unused]] const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) + ConnectResult ValidateConnect([[maybe_unused]] const IpAddress& remoteAddress, [[maybe_unused]] const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) override { return ConnectResult::Accepted; } - void OnConnect([[maybe_unused]] IConnection* connection) + void OnConnect([[maybe_unused]] IConnection* connection) override { ; } @@ -43,12 +43,12 @@ namespace UnitTest return PacketDispatchResult::Failure; } - void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) + void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) override { } - void OnDisconnect([[maybe_unused]] IConnection* connection, [[maybe_unused]] DisconnectReason reason, [[maybe_unused]] TerminationEndpoint endpoint) + void OnDisconnect([[maybe_unused]] IConnection* connection, [[maybe_unused]] DisconnectReason reason, [[maybe_unused]] TerminationEndpoint endpoint) override { } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp index 127163f056..cd6af7391c 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp @@ -147,7 +147,7 @@ namespace AzQtComponents TabBar::tabLayoutChange(); // Only the active tab's close button should be shown - const ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); + const ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this); const int numTabs = count(); const int activeTabIndex = currentIndex(); for (int i = 0; i < numTabs; ++i) @@ -190,7 +190,7 @@ namespace AzQtComponents } }); - const ButtonPosition closeSide = (ButtonPosition) style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); + const ButtonPosition closeSide = (ButtonPosition) style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this); setTabButton(index, closeSide, closeButton); } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FlowLayout.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/FlowLayout.cpp index c78314b8d7..0478779561 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FlowLayout.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FlowLayout.cpp @@ -112,7 +112,7 @@ QLayoutItem* FlowLayout::takeAt(int index) } else { - return 0; + return nullptr; } } @@ -207,7 +207,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const else if (parent->isWidgetType()) { QWidget* pw = static_cast(parent); - return pw->style()->pixelMetric(pm, 0, pw); + return pw->style()->pixelMetric(pm, nullptr, pw); } else { diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/StyledSpinBox.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/StyledSpinBox.cpp index 9bf77f0f9b..690d275646 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/StyledSpinBox.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/StyledSpinBox.cpp @@ -75,11 +75,11 @@ namespace AzQtComponents connect(slider, &QSlider::sliderReleased, this, [this] { m_dragging = false; }); } } - ~ClickEventFilterPrivate() {} + ~ClickEventFilterPrivate() override {} signals: void clickOnApplication(const QPoint& pos); protected: - bool eventFilter(QObject* obj, QEvent* event) + bool eventFilter(QObject* obj, QEvent* event) override { if (event->type() == QEvent::MouseButtonRelease && !m_dragging) { diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/LineEdit.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/LineEdit.cpp index 2c3dacda7a..c3fb6e88cd 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/LineEdit.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/LineEdit.cpp @@ -773,7 +773,7 @@ namespace AzQtComponents if (numButtons > 0) { // and finally add the right margins QLineEdit removes to make the buttons fit (it thinks) - const int iconSize = style->pixelMetric(QStyle::PM_SmallIconSize, 0, widget); + const int iconSize = style->pixelMetric(QStyle::PM_SmallIconSize, nullptr, widget); const int delta = iconSize / 4 + iconSize + 6; r.setRight(r.right() + delta * numButtons); } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ScrollBar.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ScrollBar.cpp index ac281a0e1c..b8cd37a6f7 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ScrollBar.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ScrollBar.cpp @@ -191,7 +191,7 @@ namespace AzQtComponents }; QMap m_widgets; - void perScrollBar(QObject* scrollArea, void (QScrollBar::*callback)(void)) + void perScrollBar(QObject* scrollArea, void (QScrollBar::*callback)()) { auto iterator = m_widgets.find(scrollArea); if (iterator != m_widgets.end()) diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp index 008560b59c..d52ae3685d 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp @@ -632,7 +632,7 @@ namespace AzQtComponents return; } - ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); + ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this); for (int i = 0; i < count(); i++) { QWidget* tabBtn = tabButton(i, closeSide); diff --git a/Code/Framework/AzQtComponents/AzQtComponents/PropertyEditorStandalone/main.cpp b/Code/Framework/AzQtComponents/AzQtComponents/PropertyEditorStandalone/main.cpp index ffca99f1d6..27d12438eb 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/PropertyEditorStandalone/main.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/PropertyEditorStandalone/main.cpp @@ -135,7 +135,7 @@ public: if (auto editContext = serializeContext->GetEditContext()) { editContext->Class("SimpleKeyContainer", "") - ->DataElement(0, &SimpleKeyedContainer::m_map, "map", "") + ->DataElement(nullptr, &SimpleKeyedContainer::m_map, "map", "") ->ElementAttribute(AZ::Edit::Attributes::ShowAsKeyValuePairs, true); } } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Tests/AzQtComponentTests.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Tests/AzQtComponentTests.cpp index a717ad337e..3c911c8acc 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Tests/AzQtComponentTests.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Tests/AzQtComponentTests.cpp @@ -20,7 +20,7 @@ public: AzQtComponents::registerMetaTypes(); } - virtual ~AzQtComponentsTestEnvironment() {} + ~AzQtComponentsTestEnvironment() override {} protected: diff --git a/Code/Framework/AzTest/AzTest/Utils.cpp b/Code/Framework/AzTest/AzTest/Utils.cpp index 7c2c964504..d06024c72f 100644 --- a/Code/Framework/AzTest/AzTest/Utils.cpp +++ b/Code/Framework/AzTest/AzTest/Utils.cpp @@ -123,10 +123,10 @@ namespace AZ std::vector tokens; [[maybe_unused]] char* next_token = nullptr; char* tok = azstrtok(cmdLine, 0, " ", &next_token); - while (tok != NULL) + while (tok != nullptr) { tokens.push_back(tok); - tok = azstrtok(NULL, 0, " ", &next_token); + tok = azstrtok(nullptr, 0, " ", &next_token); } size = (int)tokens.size(); char** token_array = new char*[size]; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp index a3a79402ad..6de529e456 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp @@ -139,7 +139,7 @@ namespace AzToolsFramework AZ_PROFILE_SCOPE(AzToolsFramework, "Internal::DeleteEntities:UndoCaptureAndPurgeEntities"); for (const auto& entityId : entityIds) { - AZ::Entity* entity = NULL; + AZ::Entity* entity = nullptr; EBUS_EVENT_RESULT(entity, AZ::ComponentApplicationBus, FindEntity, entityId); if (entity) @@ -1237,7 +1237,7 @@ namespace AzToolsFramework void ToolsApplication::RequestEditForFile(const char* assetPath, RequestEditResultCallback resultCallback) { - AZ_Error("RequestEdit", resultCallback != 0, "User result callback is required."); + AZ_Error("RequestEdit", resultCallback != nullptr, "User result callback is required."); AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance(); if (fileIO && !fileIO->IsReadOnly(assetPath)) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp index 92c8d37540..6e55d9f97c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp @@ -97,7 +97,7 @@ namespace AzToolsFramework::AssetUtils struct EnabledPlatformsVisitor : AZ::SettingsRegistryInterface::Visitor { - void Visit(AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value); + void Visit(AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value) override; AZStd::vector m_enabledPlatforms; }; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.cpp index 0601a34cf5..acf935e6dc 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.cpp @@ -31,10 +31,10 @@ namespace AzToolsFramework AssetBrowserFilterModel::AssetBrowserFilterModel(QObject* parent) : QSortFilterProxyModel(parent) { - m_showColumn.insert(aznumeric_cast(AssetBrowserEntry::Column::DisplayName)); + m_shownColumns.insert(aznumeric_cast(AssetBrowserEntry::Column::DisplayName)); if (ed_useNewAssetBrowserTableView) { - m_showColumn.insert(aznumeric_cast(AssetBrowserEntry::Column::Path)); + m_shownColumns.insert(aznumeric_cast(AssetBrowserEntry::Column::Path)); } m_collator.setNumericMode(true); AssetBrowserComponentNotificationBus::Handler::BusConnect(); @@ -96,7 +96,7 @@ namespace AzToolsFramework bool AssetBrowserFilterModel::filterAcceptsColumn(int source_column, const QModelIndex&) const { //if the column is in the set we want to show it - return m_showColumn.find(source_column) != m_showColumn.end(); + return m_shownColumns.find(source_column) != m_shownColumns.end(); } bool AssetBrowserFilterModel::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.h b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.h index 2b91158f0e..5d3ad0e1b0 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.h @@ -27,6 +27,8 @@ namespace AzToolsFramework { namespace AssetBrowser { + using ShownColumnsSet = AZStd::fixed_unordered_set(AssetBrowserEntry::Column::Count)>; + class AssetBrowserFilterModel : public QSortFilterProxyModel , public AssetBrowserComponentNotificationBus::Handler @@ -61,11 +63,11 @@ namespace AzToolsFramework void filterUpdatedSlot(); protected: - //set for filtering columns - //if the column is in the set the column is not filtered and is shown - AZStd::fixed_unordered_set(AssetBrowserEntry::Column::Count)> m_showColumn; + // Set for filtering columns + // If the column is in the set the column is not filtered and is shown + ShownColumnsSet m_shownColumns; bool m_alreadyRecomputingFilters = false; - //asset source name match filter + //Asset source name match filter FilterConstType m_filter; AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 4251: class '...' needs to have dll-interface to be used by clients of class '...' QWeakPointer m_stringFilter; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserTableModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserTableModel.cpp index d0999c5c56..fdbd4287ce 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserTableModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserTableModel.cpp @@ -16,7 +16,6 @@ namespace AzToolsFramework AssetBrowserTableModel::AssetBrowserTableModel(QObject* parent /* = nullptr */) : QSortFilterProxyModel(parent) { - setDynamicSortFilter(false); } void AssetBrowserTableModel::setSourceModel(QAbstractItemModel* sourceModel) @@ -47,7 +46,7 @@ namespace AzToolsFramework QModelIndex AssetBrowserTableModel::mapToSource(const QModelIndex& proxyIndex) const { - Q_ASSERT(!proxyIndex.isValid() || proxyIndex.model() == this); + Q_ASSERT(!proxyIndex.isValid() || proxyIndex.model() != this); if (!proxyIndex.isValid() || !m_indexMap.contains(proxyIndex.row())) { return QModelIndex(); @@ -132,7 +131,7 @@ namespace AzToolsFramework { QModelIndex index = model->index(currentRow, 0, parent); AssetBrowserEntry* entry = GetAssetEntry(m_filterModel->mapToSource(index)); - // We only want to see the source assets. + // We only want to see source and product assets. if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source || entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Product) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserTableModel.h b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserTableModel.h index 04559fbfbc..55dcbb1532 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserTableModel.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserTableModel.h @@ -21,8 +21,7 @@ namespace AzToolsFramework class AssetBrowserFilterModel; class AssetBrowserEntry; - class AssetBrowserTableModel - : public QSortFilterProxyModel + class AssetBrowserTableModel : public QSortFilterProxyModel { Q_OBJECT diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.cpp index 11e1ba018f..76b634b51e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.cpp @@ -9,9 +9,11 @@ #include #include +#include #include #include +#include #include #include #include @@ -26,6 +28,11 @@ AZ_PUSH_DISABLE_WARNING(4251 4244, "-Wunknown-warning-option") // disable warnin #include AZ_POP_DISABLE_WARNING +AZ_CVAR( + bool, ed_hideAssetPickerPathColumn, false, nullptr, AZ::ConsoleFunctorFlags::Null, + "Hide AssetPicker path column for a clearer view."); +AZ_CVAR_EXTERNED(bool, ed_useNewAssetBrowserTableView); + namespace AzToolsFramework { namespace AssetBrowser @@ -34,6 +41,7 @@ namespace AzToolsFramework : QDialog(parent) , m_ui(new Ui::AssetPickerDialogClass()) , m_filterModel(new AssetBrowserFilterModel(parent)) + , m_tableModel(new AssetBrowserTableModel(parent)) , m_selection(selection) , m_hasFilter(false) { @@ -97,6 +105,56 @@ namespace AzToolsFramework m_persistentState = AZ::UserSettings::CreateFind(AZ::Crc32(("AssetBrowserTreeView_Dialog_" + name).toUtf8().data()), AZ::UserSettings::CT_GLOBAL); + m_ui->m_assetBrowserTableViewWidget->setVisible(false); + if (ed_useNewAssetBrowserTableView) + { + m_ui->m_assetBrowserTreeViewWidget->setVisible(false); + m_ui->m_assetBrowserTableViewWidget->setVisible(true); + m_tableModel->setSourceModel(m_filterModel.get()); + m_ui->m_assetBrowserTableViewWidget->setModel(m_tableModel.get()); + + m_ui->m_assetBrowserTableViewWidget->SetName("AssetBrowserTableView_" + name); + m_ui->m_assetBrowserTableViewWidget->setDragEnabled(false); + m_ui->m_assetBrowserTableViewWidget->setSelectionMode( + selection.GetMultiselect() ? QAbstractItemView::SelectionMode::ExtendedSelection + : QAbstractItemView::SelectionMode::SingleSelection); + + if (ed_hideAssetPickerPathColumn) + { + m_ui->m_assetBrowserTableViewWidget->hideColumn(1); + } + + // if the current selection is invalid, disable the Ok button + m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(EvaluateSelection()); + + connect( + m_filterModel.data(), &AssetBrowserFilterModel::filterChanged, this, + [this]() + { + m_tableModel->UpdateTableModelMaps(); + }); + + connect( + m_ui->m_assetBrowserTableViewWidget, &AssetBrowserTableView::selectionChangedSignal, this, + [this](const QItemSelection&, const QItemSelection&) + { + AssetPickerDialog::SelectionChangedSlot(); + }); + + connect(m_ui->m_assetBrowserTableViewWidget, &QAbstractItemView::doubleClicked, this, &AssetPickerDialog::DoubleClickedSlot); + + connect( + m_ui->m_assetBrowserTableViewWidget, &AssetBrowserTableView::ClearStringFilter, m_ui->m_searchWidget, + &SearchWidget::ClearStringFilter); + + connect( + m_ui->m_assetBrowserTableViewWidget, &AssetBrowserTableView::ClearTypeFilter, m_ui->m_searchWidget, + &SearchWidget::ClearTypeFilter); + + m_ui->m_assetBrowserTableViewWidget->SetName("AssetBrowserTableView_main"); + m_tableModel->UpdateTableModelMaps(); + } + QTimer::singleShot(0, this, &AssetPickerDialog::RestoreState); SelectionChangedSlot(); } @@ -134,6 +192,7 @@ namespace AzToolsFramework { m_ui->m_assetBrowserTreeViewWidget->expandAll(); }); + m_tableModel->UpdateTableModelMaps(); } if (m_hasFilter && !hasFilter) @@ -166,7 +225,8 @@ namespace AzToolsFramework bool AssetPickerDialog::EvaluateSelection() const { - auto selectedAssets = m_ui->m_assetBrowserTreeViewWidget->GetSelectedAssets(); + auto selectedAssets = m_ui->m_assetBrowserTreeViewWidget->isVisible() ? m_ui->m_assetBrowserTreeViewWidget->GetSelectedAssets() + : m_ui->m_assetBrowserTableViewWidget->GetSelectedAssets(); // exactly one item must be selected, even if multi-select option is disabled, still good practice to check if (selectedAssets.empty()) { @@ -197,7 +257,10 @@ namespace AzToolsFramework void AssetPickerDialog::UpdatePreview() const { - auto selectedAssets = m_ui->m_assetBrowserTreeViewWidget->GetSelectedAssets(); + auto selectedAssets = m_ui->m_assetBrowserTreeViewWidget->isVisible() + ? m_ui->m_assetBrowserTreeViewWidget->GetSelectedAssets() + : m_ui->m_assetBrowserTableViewWidget->GetSelectedAssets(); + ; if (selectedAssets.size() != 1) { m_ui->m_previewerFrame->Clear(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.h b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.h index 89eca2f4e3..bab265c134 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.h @@ -33,6 +33,7 @@ namespace AzToolsFramework { class ProductAssetBrowserEntry; class AssetBrowserFilterModel; + class AssetBrowserTableModel; class AssetBrowserModel; class AssetSelectionModel; @@ -69,6 +70,7 @@ namespace AzToolsFramework QScopedPointer m_ui; AssetBrowserModel* m_assetBrowserModel = nullptr; QScopedPointer m_filterModel; + QScopedPointer m_tableModel; AssetSelectionModel& m_selection; bool m_hasFilter; AZStd::unique_ptr m_filterStateSaver; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.ui b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.ui index 3dd0c0d861..b11ffb3990 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.ui +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.ui @@ -142,6 +142,9 @@ + + + @@ -197,6 +200,11 @@
AzToolsFramework/AssetBrowser/Previewer/PreviewerFrame.h
1 + + AzToolsFramework::AssetBrowser::AssetBrowserTableView + QTableView +
AzToolsFramework/AssetBrowser/Views/AssetBrowserTableView.h
+
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Views/AssetBrowserTableView.h b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Views/AssetBrowserTableView.h index e5426037bf..5fbdab2ec5 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Views/AssetBrowserTableView.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Views/AssetBrowserTableView.h @@ -53,7 +53,6 @@ namespace AzToolsFramework // AssetBrowserComponentNotificationBus void OnAssetBrowserComponentReady() override; ////////////////////////////////////////////////////////////////////////// - Q_SIGNALS: void selectionChangedSignal(const QItemSelection& selected, const QItemSelection& deselected); void ClearStringFilter(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp index e155189a99..77b9185e82 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp @@ -721,7 +721,7 @@ namespace AzToolsFramework AZ::Data::AssetInfo assetInfo; AZ::Data::AssetCatalogRequestBus::BroadcastResult(assetInfo, &AZ::Data::AssetCatalogRequests::GetAssetInfoById, assetId); if (assetInfo.m_assetType == m_inMemoryAsset.GetType() - && strstr(m_expectedAddedAssetPath.c_str(), assetInfo.m_relativePath.c_str()) != 0) + && strstr(m_expectedAddedAssetPath.c_str(), assetInfo.m_relativePath.c_str()) != nullptr) { m_expectedAddedAssetPath.clear(); m_recentlyAddedAssetPath = assetInfo.m_relativePath; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp index d4c4fa1e65..d05a2dcc4b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp @@ -103,7 +103,7 @@ namespace AzToolsFramework newData.clear(); AZ::IO::ByteContainerStream ms(&newData); - AZ::SerializeContext* sc = NULL; + AZ::SerializeContext* sc = nullptr; EBUS_EVENT_RESULT(sc, AZ::ComponentApplicationBus, GetSerializeContext); AZ_Assert(sc, "Serialization context not found!"); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/SelectionCommand.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/SelectionCommand.cpp index 33b2a14b89..6854663db7 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/SelectionCommand.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/SelectionCommand.cpp @@ -34,7 +34,7 @@ namespace AzToolsFramework void SelectionCommand::Post() { - UndoSystem::UndoStack* undoStack = NULL; + UndoSystem::UndoStack* undoStack = nullptr; EBUS_EVENT_RESULT(undoStack, AzToolsFramework::ToolsApplicationRequests::Bus, GetUndoStack); if (undoStack) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp index f3250e0bfd..2d3d1722ca 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp @@ -462,7 +462,7 @@ namespace AzToolsFramework linkId, templateId, templateToDelete.GetFilePath().c_str()); } - result = m_templateToLinkIdsMap.erase(templateToLinkIterator) != 0; + result = m_templateToLinkIdsMap.erase(templateToLinkIterator) != nullptr; AZ_Assert(result, "Prefab - PrefabSystemComponent::RemoveTemplate - " "Failed to remove Template with Id '%llu' on file path '%s' " diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/SourceControl/PerforceComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/SourceControl/PerforceComponent.cpp index 4ad409507e..3bd12b1ad3 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/SourceControl/PerforceComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/SourceControl/PerforceComponent.cpp @@ -1315,7 +1315,7 @@ namespace AzToolsFramework void PerforceComponent::ThreadWorker() { m_ProcessThreadID = AZStd::this_thread::get_id(); - while (1) + while (true) { // block until signaled: m_WorkerSemaphore.acquire(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/ScriptEditorComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/ScriptEditorComponent.cpp index da12a4bd7a..cc350c8107 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/ScriptEditorComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/ScriptEditorComponent.cpp @@ -38,7 +38,7 @@ namespace AZ AttributeDynamicScriptValue(const DynamicSerializableField& value) : m_value(value) {} - virtual ~AttributeDynamicScriptValue() + ~AttributeDynamicScriptValue() override { m_value.DestroyData(); } @@ -1031,15 +1031,15 @@ namespace AzToolsFramework ->Attribute("EditButton", "") ->Attribute("EditDescription", "Open in Lua Editor") ->Attribute("EditCallback", &ScriptEditorComponent::LaunchLuaEditor) - ->DataElement(0, &ScriptEditorComponent::m_scriptComponent, "Script properties", "The script template") + ->DataElement(nullptr, &ScriptEditorComponent::m_scriptComponent, "Script properties", "The script template") ->SetDynamicEditDataProvider(&ScriptEditorComponent::GetScriptPropertyEditData) ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) ; ec->Class("Script Component", "Adding scripting functionality to the entity!") - ->DataElement(0, &AzFramework::ScriptComponent::m_properties, "Properties", "Lua script properties") + ->DataElement(nullptr, &AzFramework::ScriptComponent::m_properties, "Properties", "Lua script properties") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(0, &AzFramework::ScriptComponent::m_script, "Asset", "") + ->DataElement(nullptr, &AzFramework::ScriptComponent::m_script, "Asset", "") ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::Hide) ->Attribute(AZ::Edit::Attributes::SliceFlags, AZ::Edit::SliceFlags::NotPushable) // Only the editor-component's script asset needs to be slice-pushable. ; @@ -1048,9 +1048,9 @@ namespace AzToolsFramework ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AzFramework::ScriptPropertyGroup::m_name)-> Attribute(AZ::Edit::Attributes::AutoExpand, true)-> - DataElement(0, &AzFramework::ScriptPropertyGroup::m_properties, "m_properties", "Properties in this property group")-> + DataElement(nullptr, &AzFramework::ScriptPropertyGroup::m_properties, "m_properties", "Properties in this property group")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AzFramework::ScriptPropertyGroup::m_groups, "m_groups", "Subgroups in this property group")-> + DataElement(nullptr, &AzFramework::ScriptPropertyGroup::m_groups, "m_groups", "Subgroups in this property group")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly); ec->Class("Script Property", "Base class for script properties")-> @@ -1060,50 +1060,50 @@ namespace AzToolsFramework ec->Class("Script Property (bool)", "A script boolean property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyBoolean::m_value, "m_value", "A boolean")-> + DataElement(nullptr, &AZ::ScriptPropertyBoolean::m_value, "m_value", "A boolean")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property (number)", "A script number property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyNumber::m_value, "m_value", "A number")-> + DataElement(nullptr, &AZ::ScriptPropertyNumber::m_value, "m_value", "A number")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property (string)", "A script string property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyString::m_value, "m_value", "A string")-> + DataElement(nullptr, &AZ::ScriptPropertyString::m_value, "m_value", "A string")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property (object)", "A script object property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyGenericClass::m_value, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyGenericClass::m_value, "m_value", "An object")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly); ec->Class("Script Property Array(bool)", "A script bool array property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyBooleanArray's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyBooleanArray::m_values, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyBooleanArray::m_values, "m_value", "An object")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property Array(number)", "A script number array property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyNumberArray's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyNumberArray::m_values, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyNumberArray::m_values, "m_value", "An object")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property Array(string)", "A script string array property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyStringArray's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyStringArray::m_values, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyStringArray::m_values, "m_value", "An object")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property Array(object)", "A script object array property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGenericClassArray's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> Attribute(AZ::Edit::Attributes::DynamicElementType, &AZ::ScriptPropertyGenericClassArray::GetElementTypeUuid)-> - DataElement(0, &AZ::ScriptPropertyGenericClassArray::m_values, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyGenericClassArray::m_values, "m_value", "An object")-> ElementAttribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkAPI.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkAPI.cpp index 2ed70d81b8..4dd352646c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkAPI.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkAPI.cpp @@ -17,21 +17,21 @@ namespace LegacyFramework { const char* appName() { - const char* result = NULL; + const char* result = nullptr; EBUS_EVENT_RESULT(result, FrameworkApplicationMessages::Bus, GetApplicationName); return result; } const char* appModule() { - const char* result = NULL; + const char* result = nullptr; EBUS_EVENT_RESULT(result, FrameworkApplicationMessages::Bus, GetApplicationModule); return result; } const char* appDir() { - const char* result = NULL; + const char* result = nullptr; EBUS_EVENT_RESULT(result, FrameworkApplicationMessages::Bus, GetApplicationDirectory); return result; } @@ -74,7 +74,7 @@ namespace LegacyFramework // helper function which retrieves the serialize context and asserts if its not found. AZ::SerializeContext* GetSerializeContext() { - AZ::SerializeContext* serializeContext = NULL; + AZ::SerializeContext* serializeContext = nullptr; EBUS_EVENT_RESULT(serializeContext, AZ::ComponentApplicationBus, GetSerializeContext); AZ_Assert(serializeContext, "No serialize context"); return serializeContext; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp index 33562421e9..95ea5397e7 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp @@ -237,7 +237,7 @@ namespace LegacyFramework { m_applicationEntity->Deactivate(); delete m_applicationEntity; - m_applicationEntity = NULL; + m_applicationEntity = nullptr; } AZ::SystemTickBus::ExecuteQueuedEvents(); @@ -249,7 +249,7 @@ namespace LegacyFramework #endif delete m_ptrCommandLineParser; - m_ptrCommandLineParser = NULL; + m_ptrCommandLineParser = nullptr; CoreMessageBus::Handler::BusDisconnect(); FrameworkApplicationMessages::Handler::BusDisconnect(); @@ -269,7 +269,7 @@ namespace LegacyFramework { m_applicationEntity->Deactivate(); delete m_applicationEntity; - m_applicationEntity = NULL; + m_applicationEntity = nullptr; } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFramework.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFramework.cpp index bc16b29830..98e06b77f3 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFramework.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFramework.cpp @@ -144,9 +144,9 @@ namespace AzToolsFramework qInstallMessageHandler(myMessageOutput); } - virtual ~AZQtApplication() + ~AZQtApplication() override { - qInstallMessageHandler(NULL); + qInstallMessageHandler(nullptr); } }; @@ -201,9 +201,9 @@ namespace AzToolsFramework // enable the built-in stylesheet by default: bool enableStyleSheet = true; - const AzFramework::CommandLine* comp = NULL; + const AzFramework::CommandLine* comp = nullptr; EBUS_EVENT_RESULT(comp, LegacyFramework::FrameworkApplicationMessages::Bus, GetCommandLineParser); - if (comp != NULL) + if (comp != nullptr) { if (comp->HasSwitch("nostyle")) { @@ -275,18 +275,18 @@ namespace AzToolsFramework // see still need to clean up: m_ptrTicker->cancel(); QApplication::processEvents(); - AZ::ComponentApplication* pApp = NULL; + AZ::ComponentApplication* pApp = nullptr; EBUS_EVENT_RESULT(pApp, AZ::ComponentApplicationBus, GetApplication); if (pApp) { pApp->Tick(); } azdestroy(m_ptrTicker); - m_ptrTicker = NULL; + m_ptrTicker = nullptr; } } - Framework::~Framework(void) + Framework::~Framework() { AZ::SystemTickBus::Handler::BusDisconnect(); @@ -299,7 +299,7 @@ namespace AzToolsFramework delete m_ActionChangeProject; m_ActionChangeProject = nullptr; - pApplication = NULL; + pApplication = nullptr; } // once we set the project, we can then tell all our other windows to restore our state. @@ -360,7 +360,7 @@ namespace AzToolsFramework } m_bTicking = true; // Tick the component app. - AZ::ComponentApplication* pApp = NULL; + AZ::ComponentApplication* pApp = nullptr; EBUS_EVENT_RESULT(pApp, AZ::ComponentApplicationBus, GetApplication); if (pApp) { @@ -491,7 +491,7 @@ namespace AzToolsFramework // we successfully got permission to quit! // pump the tickbus one last time! // QApplication::processEvents(); - AZ::ComponentApplication* pApp = NULL; + AZ::ComponentApplication* pApp = nullptr; EBUS_EVENT_RESULT(pApp, AZ::ComponentApplicationBus, GetApplication); if (pApp) { @@ -501,7 +501,7 @@ namespace AzToolsFramework m_ptrTicker->cancel(); azdestroy(m_ptrTicker); - m_ptrTicker = NULL; + m_ptrTicker = nullptr; QApplication::quit(); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFrameworkPreferences.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFrameworkPreferences.cpp index 6318bc3e6e..72bef700d7 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFrameworkPreferences.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFrameworkPreferences.cpp @@ -38,7 +38,7 @@ namespace AzToolsFramework else { delete m_View; - m_View = NULL; + m_View = nullptr; } } void Framework::PreferencesAccepted() @@ -59,11 +59,11 @@ namespace AzToolsFramework if (m_View) { delete m_View; - m_View = NULL; + m_View = nullptr; } if (m_Model) { - m_Model = NULL; + m_Model = nullptr; } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp index 4fabdfad12..ef8bf42713 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp @@ -61,7 +61,7 @@ namespace AzToolsFramework , m_impl(new BaseLogPanel::Impl) { m_impl->storageID = 0; - this->setLayout(aznew LogPanelLayout(NULL)); + this->setLayout(aznew LogPanelLayout(nullptr)); m_impl->pTabWidget = new AzQtComponents::TabWidget(this); m_impl->pTabWidget->setObjectName(QString::fromUtf8("tabWidget")); @@ -601,7 +601,7 @@ namespace AzToolsFramework { if (index >= (int)m_children.size()) { - return NULL; + return nullptr; } return m_children[index]; @@ -609,11 +609,11 @@ namespace AzToolsFramework QLayoutItem* LogPanelLayout::takeAt(int index) { - QLayoutItem* pItem = NULL; + QLayoutItem* pItem = nullptr; if (index >= (int)m_children.size()) { - return NULL; + return nullptr; } pItem = m_children[index]; @@ -860,7 +860,7 @@ namespace AzToolsFramework return richLabel; } - return NULL; + return nullptr; } bool LogPanelItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/StyledLogPanel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/StyledLogPanel.cpp index 1542a5f5ab..f550dbdc87 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/StyledLogPanel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/StyledLogPanel.cpp @@ -322,7 +322,7 @@ namespace AzToolsFramework actionList.removeAll(m_actionSelectAll); } - QMenu::exec(actionList, QCursor::pos(), 0, this); + QMenu::exec(actionList, QCursor::pos(), nullptr, this); } void StyledLogTab::CopySelected() diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp index 001cd12349..87527502dd 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp @@ -2352,6 +2352,13 @@ namespace AzToolsFramework { QMenu* revertMenu = nullptr; + auto addRevertMenu = [&menu]() + { + QMenu* revertOverridesMenu = menu.addMenu(tr("Revert overrides")); + revertOverridesMenu->setToolTipsVisible(true); + return revertOverridesMenu; + }; + //check for changes on selected property if (componentClassData) { @@ -2372,8 +2379,7 @@ namespace AzToolsFramework } // Only add the "Revert overrides" menu option if it belongs to a slice - revertMenu = menu.addMenu(tr("Revert overrides")); - revertMenu->setToolTipsVisible(true); + revertMenu = addRevertMenu(); revertMenu->setEnabled(false); if (fieldNode) @@ -2447,6 +2453,10 @@ namespace AzToolsFramework if (isPartOfSlice && hasSliceChanges) { + if (!revertMenu) + { + revertMenu = addRevertMenu(); + } revertMenu->setEnabled(true); QAction* revertComponentAction = revertMenu->addAction(tr("Component")); @@ -2487,6 +2497,10 @@ namespace AzToolsFramework relevantEntities.push_back(id); } + if (!revertMenu) + { + revertMenu = addRevertMenu(); + } revertMenu->setEnabled(true); QAction* revertAction = revertMenu->addAction(QObject::tr("Entity")); revertAction->setToolTip(QObject::tr("This will revert all component properties on this entity to the last saved.")); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp index fccabbf205..7fefb04872 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp @@ -236,7 +236,7 @@ namespace AzToolsFramework AZ_Assert(container, "This node is NOT a container node!"); const AZ::SerializeContext::ClassElement* containerClassElement = container->GetElement(container->GetDefaultElementNameCrc()); - AZ_Assert(containerClassElement != NULL, "We should have a valid default element in the container, otherwise we don't know what elements to make!"); + AZ_Assert(containerClassElement != nullptr, "We should have a valid default element in the container, otherwise we don't know what elements to make!"); if (!containerClassElement) { return false; @@ -261,7 +261,7 @@ namespace AzToolsFramework AZ_Assert(newDataAddress, "Faliled to create new element for the continer!"); // cast to base type (if needed) void* basePtr = m_context->DownCast(newDataAddress, classData->m_typeId, containerClassElement->m_typeId, classData->m_azRtti, containerClassElement->m_azRtti); - AZ_Assert(basePtr != NULL, "Can't cast container element %s to %s, make sure classes are registered in the system and not generics!", classData->m_name, containerClassElement->m_name); + AZ_Assert(basePtr != nullptr, "Can't cast container element %s to %s, make sure classes are registered in the system and not generics!", classData->m_name, containerClassElement->m_name); *reinterpret_cast(dataAddress) = basePtr; // store the pointer in the class /// Store the element in the container container->StoreElement(GetInstance(i), dataAddress); @@ -608,7 +608,7 @@ namespace AzToolsFramework AZ_Assert(sc, "sc can't be NULL!"); AZ_Assert(m_rootInstances.size() > 0, "No root instances have been added to this hierarchy!"); - m_curParentNode = NULL; + m_curParentNode = nullptr; m_isMerging = false; m_instances.clear(); m_children.clear(); @@ -636,7 +636,7 @@ namespace AzToolsFramework for (size_t i = 1; i < m_rootInstances.size(); ++i) { - m_curParentNode = NULL; + m_curParentNode = nullptr; m_isMerging = true; m_matched = false; sc->EnumerateInstanceConst( @@ -956,7 +956,7 @@ namespace AzToolsFramework } } - InstanceDataNode* node = NULL; + InstanceDataNode* node = nullptr; // Extra steps need to be taken when we are merging if (m_isMerging) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp index ee43eb7e2c..c07191fda2 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp @@ -349,7 +349,7 @@ namespace AzToolsFramework if (pAssetType) { - (*pAssetType) = 0; + (*pAssetType) = nullptr; } if (!pData) @@ -529,7 +529,7 @@ namespace AzToolsFramework if (m_errorButton) { // If the button is already active, disconnect its pressed handler so we don't get multiple popups - disconnect(m_errorButton, &QPushButton::pressed, this, 0); + disconnect(m_errorButton, &QPushButton::pressed, this, nullptr); } else { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp index 6a1f1404a1..38a7f426db 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp @@ -137,7 +137,7 @@ namespace AzToolsFramework Q_UNUSED(debugName) } - AZ::u32 U32CRCHandler::GetHandlerName(void) const + AZ::u32 U32CRCHandler::GetHandlerName() const { return AZ::Edit::UIHandlers::Crc; } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp index 678693ea32..2eabe64333 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp @@ -225,7 +225,7 @@ namespace AzToolsFramework if (!pHandlerFound) { // does a base class have a handler? - AZ::SerializeContext* sc = NULL; + AZ::SerializeContext* sc = nullptr; EBUS_EVENT_RESULT(sc, AZ::ComponentApplicationBus, GetSerializeContext); AZStd::vector classes; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp index c87f0e03ba..0ad874d1f6 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp @@ -254,9 +254,9 @@ namespace AzToolsFramework void QueueInvalidationIfSharedData(InternalReflectedPropertyEditorEvents* sender, PropertyModificationRefreshLevel level, const AZStd::set& sourceInstanceSet) override; // PropertyEditorGUIMessages::Bus::Handler - virtual void RequestWrite(QWidget* editorGUI) override; - virtual void AddElementsToParentContainer(QWidget* editorGUI, size_t numElements, const InstanceDataNode::FillDataClassCallback& fillDataCallback) override; - virtual void RequestRefresh(PropertyModificationRefreshLevel) override; + void RequestWrite(QWidget* editorGUI) override; + void AddElementsToParentContainer(QWidget* editorGUI, size_t numElements, const InstanceDataNode::FillDataClassCallback& fillDataCallback) override; + void RequestRefresh(PropertyModificationRefreshLevel) override; void RequestPropertyNotify(QWidget* editorGUI) override; void OnEditingFinished(QWidget* editorGUI) override; }; @@ -890,7 +890,7 @@ namespace AzToolsFramework { instance.Build(m_impl->m_context, AZ::SerializeContext::ENUM_ACCESS_FOR_READ, m_impl->m_dynamicEditDataProvider, m_impl->m_editorParent); m_impl->FilterNode(instance.GetRootNode(), filter); - m_impl->AddProperty(instance.GetRootNode(), NULL, 0); + m_impl->AddProperty(instance.GetRootNode(), nullptr, 0); } m_impl->UpdateExpansionState(); @@ -1077,7 +1077,7 @@ namespace AzToolsFramework PropertyRowWidget* ReflectedPropertyEditor::Impl::CreateOrPullFromPool() { - PropertyRowWidget* newWidget = NULL; + PropertyRowWidget* newWidget = nullptr; if (m_widgetPool.empty()) { newWidget = aznew PropertyRowWidget(m_containerWidget); @@ -1184,7 +1184,7 @@ namespace AzToolsFramework { // re-create the tab order, based on vertical position in the list. - QWidget* pLastWidget = NULL; + QWidget* pLastWidget = nullptr; for (AZStd::size_t pos = 0; pos < m_impl->m_widgetsInDisplayOrder.size(); ++pos) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.cpp index 849b8d1705..e5fd3351ae 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.cpp @@ -195,17 +195,17 @@ namespace AzToolsFramework , m_criteriaOperator(FilterOperatorType::Or) , m_suppressCriteriaChanged(false) { - m_mainLayout = new QVBoxLayout(NULL); + m_mainLayout = new QVBoxLayout(nullptr); m_mainLayout->setSizeConstraint(QLayout::SetMinimumSize); m_mainLayout->setContentsMargins(0, 0, 0, 0); - QHBoxLayout* secondaryLayout = new QHBoxLayout(NULL); + QHBoxLayout* secondaryLayout = new QHBoxLayout(nullptr); secondaryLayout->setSizeConstraint(QLayout::SetMinimumSize); secondaryLayout->setContentsMargins(0, 0, 0, 0); - m_filterLayout = new QHBoxLayout(NULL); + m_filterLayout = new QHBoxLayout(nullptr); m_tagLayout = new FlowLayout(nullptr); m_tagLayout->setAlignment(Qt::AlignLeft); - QHBoxLayout* filterTextLayout = new QHBoxLayout(NULL); + QHBoxLayout* filterTextLayout = new QHBoxLayout(nullptr); filterTextLayout->setSizeConstraint(QLayout::SetMinimumSize); filterTextLayout->setContentsMargins(0, 0, 0, 0); filterTextLayout->setSpacing(0); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.cpp index 75c8c607c6..e71910f4fc 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.cpp @@ -41,7 +41,7 @@ namespace AzToolsFramework { } - virtual ~QTreeViewStateSaverData() + ~QTreeViewStateSaverData() override { } @@ -213,7 +213,7 @@ namespace AzToolsFramework } } - void ApplySnapshot(QTreeView* treeView) + void ApplySnapshot(QTreeView* treeView) override { Q_ASSERT(treeView && treeView->model()); diff --git a/Code/Framework/AzToolsFramework/Tests/AssetSeedManager.cpp b/Code/Framework/AzToolsFramework/Tests/AssetSeedManager.cpp index 4083608370..24488f3ed3 100644 --- a/Code/Framework/AzToolsFramework/Tests/AssetSeedManager.cpp +++ b/Code/Framework/AzToolsFramework/Tests/AssetSeedManager.cpp @@ -219,7 +219,7 @@ namespace UnitTest delete m_application; } - AZ::Data::AssetInfo GetAssetInfoById(const AZ::Data::AssetId& id) + AZ::Data::AssetInfo GetAssetInfoById(const AZ::Data::AssetId& id) override { auto foundIter = m_assetRegistry->m_assetIdToInfo.find(id); if (foundIter != m_assetRegistry->m_assetIdToInfo.end()) diff --git a/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp b/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp index e15f4f3cfd..e416efc5c6 100644 --- a/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp +++ b/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp @@ -1202,7 +1202,7 @@ namespace UnitTest AZ_COMPONENT(HiddenComponent, "{E4D2AD8B-3930-46FC-837A-8DDFCA0FB1AF}", AzToolsFramework::Components::EditorComponentBase); static Component* s_wasDeleted; - virtual ~HiddenComponent() + ~HiddenComponent() override { s_wasDeleted = this; } diff --git a/Code/Framework/AzToolsFramework/Tests/Entity/EditorEntitySearchComponentTests.cpp b/Code/Framework/AzToolsFramework/Tests/Entity/EditorEntitySearchComponentTests.cpp index db92085e98..2c757f8e9e 100644 --- a/Code/Framework/AzToolsFramework/Tests/Entity/EditorEntitySearchComponentTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Entity/EditorEntitySearchComponentTests.cpp @@ -66,7 +66,7 @@ namespace AzToolsFramework { } - virtual ~EntitySearch_TestComponent1() override + ~EntitySearch_TestComponent1() override {} private: @@ -123,7 +123,7 @@ namespace AzToolsFramework { } - virtual ~EntitySearch_TestComponent2() override + ~EntitySearch_TestComponent2() override {} private: diff --git a/Code/Framework/AzToolsFramework/Tests/EntityIdQLabelTests.cpp b/Code/Framework/AzToolsFramework/Tests/EntityIdQLabelTests.cpp index b6b428cc11..486224c011 100644 --- a/Code/Framework/AzToolsFramework/Tests/EntityIdQLabelTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/EntityIdQLabelTests.cpp @@ -55,7 +55,7 @@ namespace UnitTest AzToolsFramework::EditorRequests::Bus::Handler::BusConnect(); } - ~EditorRequestHandlerTest() + ~EditorRequestHandlerTest() override { AzToolsFramework::EditorRequests::Bus::Handler::BusDisconnect(); } diff --git a/Code/Framework/AzToolsFramework/Tests/EntityInspectorTests.cpp b/Code/Framework/AzToolsFramework/Tests/EntityInspectorTests.cpp index 9af74c7996..0fbc7eba98 100644 --- a/Code/Framework/AzToolsFramework/Tests/EntityInspectorTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/EntityInspectorTests.cpp @@ -67,7 +67,7 @@ namespace UnitTest services.push_back(AZ_CRC("InspectorTestService1")); } - virtual ~Inspector_TestComponent1() override + ~Inspector_TestComponent1() override { } @@ -136,7 +136,7 @@ namespace UnitTest services.push_back(AZ_CRC("InspectorTestService2")); } - virtual ~Inspector_TestComponent2() override + ~Inspector_TestComponent2() override { } @@ -205,7 +205,7 @@ namespace UnitTest services.push_back(AZ_CRC("InspectorTestService3")); } - virtual ~Inspector_TestComponent3() override + ~Inspector_TestComponent3() override { } diff --git a/Code/Framework/AzToolsFramework/Tests/FileFunc.cpp b/Code/Framework/AzToolsFramework/Tests/FileFunc.cpp index c4299a6ff9..94b32f9e41 100644 --- a/Code/Framework/AzToolsFramework/Tests/FileFunc.cpp +++ b/Code/Framework/AzToolsFramework/Tests/FileFunc.cpp @@ -31,7 +31,7 @@ namespace UnitTest class FileFuncTest : public ScopedAllocatorSetupFixture { public: - void SetUp() + void SetUp() override { m_prevFileIO = AZ::IO::FileIOBase::GetInstance(); AZ::IO::FileIOBase::SetInstance(nullptr); diff --git a/Code/Framework/AzToolsFramework/Tests/InstanceDataHierarchy.cpp b/Code/Framework/AzToolsFramework/Tests/InstanceDataHierarchy.cpp index 806a3bbab2..4d144d0d1b 100644 --- a/Code/Framework/AzToolsFramework/Tests/InstanceDataHierarchy.cpp +++ b/Code/Framework/AzToolsFramework/Tests/InstanceDataHierarchy.cpp @@ -104,15 +104,15 @@ namespace UnitTest if (AZ::EditContext* edit = serializeContext->GetEditContext()) { edit->Class("Test Component", "A test component") - ->DataElement(0, &TestComponent::m_float, "Float Field", "A float field") - ->DataElement(0, &TestComponent::m_string, "String Field", "A string field") - ->DataElement(0, &TestComponent::m_normalContainer, "Normal Container", "A container") - ->DataElement(0, &TestComponent::m_pointerContainer, "Pointer Container", "A container") - ->DataElement(0, &TestComponent::m_subData, "Struct Field", "A sub data type") + ->DataElement(nullptr, &TestComponent::m_float, "Float Field", "A float field") + ->DataElement(nullptr, &TestComponent::m_string, "String Field", "A string field") + ->DataElement(nullptr, &TestComponent::m_normalContainer, "Normal Container", "A container") + ->DataElement(nullptr, &TestComponent::m_pointerContainer, "Pointer Container", "A container") + ->DataElement(nullptr, &TestComponent::m_subData, "Struct Field", "A sub data type") ; edit->Class("Test Component", "A test component") - ->DataElement(0, &SubData::m_int, "Int Field", "An int") + ->DataElement(nullptr, &SubData::m_int, "Int Field", "An int") ; } } @@ -156,7 +156,7 @@ namespace UnitTest { } - ~InstanceDataHierarchyBasicTest() + ~InstanceDataHierarchyBasicTest() override { } @@ -481,7 +481,7 @@ namespace UnitTest { } - ~InstanceDataHierarchyCopyContainerChangesTest() + ~InstanceDataHierarchyCopyContainerChangesTest() override { } @@ -680,8 +680,8 @@ namespace UnitTest ; edit->Class("Enum Container", "Test container that has an external enum") - ->DataElement(0, &EnumContainer::m_enum, "Enum Field", "An enum value") - ->DataElement(0, &EnumContainer::m_enumVector, "Enum Vector Field", "A vector of enum values") + ->DataElement(nullptr, &EnumContainer::m_enum, "Enum Field", "An enum value") + ->DataElement(nullptr, &EnumContainer::m_enumVector, "Enum Vector Field", "A vector of enum values") ; } } @@ -776,21 +776,21 @@ namespace UnitTest { edit->Class("Group Test Component", "Testing normal groups and toggle groups") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->DataElement(0, &GroupTestComponent::m_float, "Float Field", "A float field") + ->DataElement(nullptr, &GroupTestComponent::m_float, "Float Field", "A float field") ->ClassElement(AZ::Edit::ClassElements::Group, "Normal Group") - ->DataElement(0, &GroupTestComponent::m_groupFloat, "Float Field", "A float field") - ->DataElement(0, &GroupTestComponent::m_subGroupForNormal, "Struct Field", "A sub data type") + ->DataElement(nullptr, &GroupTestComponent::m_groupFloat, "Float Field", "A float field") + ->DataElement(nullptr, &GroupTestComponent::m_subGroupForNormal, "Struct Field", "A sub data type") ->GroupElementToggle("Group Toggle", &GroupTestComponent::m_groupToggle) - ->DataElement(0, &GroupTestComponent::m_toggleGroupInt, "Normal Integer", "An Integer") - ->DataElement(0, &GroupTestComponent::m_subGroupForToggle, "Struct Field", "A sub data type") + ->DataElement(nullptr, &GroupTestComponent::m_toggleGroupInt, "Normal Integer", "An Integer") + ->DataElement(nullptr, &GroupTestComponent::m_subGroupForToggle, "Struct Field", "A sub data type") ; edit->Class("SubGroup Test Component", "Testing nested normal groups and toggle groups") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->ClassElement(AZ::Edit::ClassElements::Group, "Normal SubGroup") - ->DataElement(0, &SubData::m_int, "SubGroup Int Field", "An int") + ->DataElement(nullptr, &SubData::m_int, "SubGroup Int Field", "An int") ->GroupElementToggle("SubGroup Toggle", &SubData::m_bool) - ->DataElement(0, &SubData::m_float, "SubGroup Float Field", "An int") + ->DataElement(nullptr, &SubData::m_float, "SubGroup Float Field", "An int") ; } } @@ -974,7 +974,7 @@ namespace UnitTest { } - void InsertAndVerifyKeys(AZ::SerializeContext::IDataContainer* container, void* key, void* instance, const AZ::SerializeContext::ClassElement* classElement) const + void InsertAndVerifyKeys(AZ::SerializeContext::IDataContainer* container, void* key, void* instance, const AZ::SerializeContext::ClassElement* classElement) const override { T* keyContainer = reinterpret_cast(key); for (const T& keyToInsert : keysToInsert) @@ -1258,7 +1258,7 @@ namespace UnitTest { editContext->Class("Test", "") ->UIElement("TestHandler", "UIElement") - ->DataElement(0, &UIElementContainer::m_data) + ->DataElement(nullptr, &UIElementContainer::m_data) ->UIElement(AZ_CRC("TestHandler2"), "UIElement2") ; } @@ -1322,8 +1322,8 @@ namespace UnitTest { // By default, DataElements accept multi-edit and UIElements do not editContext->Class("Test", "") - ->DataElement(0, &AggregatedContainer::m_aggregated) - ->DataElement(0, &AggregatedContainer::m_notAggregated) + ->DataElement(nullptr, &AggregatedContainer::m_aggregated) + ->DataElement(nullptr, &AggregatedContainer::m_notAggregated) ->Attribute(AZ::Edit::Attributes::AcceptsMultiEdit, false) ->UIElement("TestHandler", "aggregatedUIElement") ->Attribute(AZ::Edit::Attributes::AcceptsMultiEdit, true) diff --git a/Code/Framework/AzToolsFramework/Tests/PropertyTreeEditorTests.cpp b/Code/Framework/AzToolsFramework/Tests/PropertyTreeEditorTests.cpp index 1c1e063592..91e53f1650 100644 --- a/Code/Framework/AzToolsFramework/Tests/PropertyTreeEditorTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/PropertyTreeEditorTests.cpp @@ -73,7 +73,7 @@ namespace UnitTest if (AZ::EditContext* editContext = serializeContext->GetEditContext()) { editContext->Class("TestSimpleAsset", "Test data block for a simple asset mock data block") - ->DataElement(0, &TestSimpleAsset::m_data, "My Data", "A test bool value.") + ->DataElement(nullptr, &TestSimpleAsset::m_data, "My Data", "A test bool value.") ; } } @@ -171,7 +171,7 @@ namespace UnitTest ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::HideChildren) ->DataElement(AZ::Edit::UIHandlers::Default, &PropertyTreeEditorTester::m_myReadOnlyShort, "My Read Only", "A test read only node.") ->Attribute(AZ::Edit::Attributes::ReadOnly, true) - ->DataElement(0, &PropertyTreeEditorTester::m_mySubBlock, "My Sub Block", "sub block test") + ->DataElement(nullptr, &PropertyTreeEditorTester::m_mySubBlock, "My Sub Block", "sub block test") ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->ClassElement(AZ::Edit::ClassElements::Group, "Grouped") diff --git a/Code/Framework/AzToolsFramework/Tests/SQLiteConnectionTests.cpp b/Code/Framework/AzToolsFramework/Tests/SQLiteConnectionTests.cpp index b2fa44c271..8e273992ac 100644 --- a/Code/Framework/AzToolsFramework/Tests/SQLiteConnectionTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/SQLiteConnectionTests.cpp @@ -31,7 +31,7 @@ namespace UnitTest { } - ~SQLiteTest() = default; + ~SQLiteTest() override = default; void SetUp() override { diff --git a/Code/Framework/AzToolsFramework/Tests/Script/ScriptEntityTests.cpp b/Code/Framework/AzToolsFramework/Tests/Script/ScriptEntityTests.cpp index 2aa180cfc0..cdb8fea513 100644 --- a/Code/Framework/AzToolsFramework/Tests/Script/ScriptEntityTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Script/ScriptEntityTests.cpp @@ -28,7 +28,7 @@ namespace UnitTest ScriptContext* m_scriptContext; - ~EntityScriptTest() + ~EntityScriptTest() override { } diff --git a/Code/Framework/AzToolsFramework/Tests/Slice.cpp b/Code/Framework/AzToolsFramework/Tests/Slice.cpp index 1723fbed8b..58865df345 100644 --- a/Code/Framework/AzToolsFramework/Tests/Slice.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Slice.cpp @@ -457,7 +457,7 @@ namespace UnitTest { AZ::Debug::TraceMessageBus::Handler::BusConnect(); } - ~SliceTestWarningInterceptor() + ~SliceTestWarningInterceptor() override { AZ::Debug::TraceMessageBus::Handler::BusDisconnect(); } diff --git a/Code/Framework/AzToolsFramework/Tests/UndoStack.cpp b/Code/Framework/AzToolsFramework/Tests/UndoStack.cpp index f9b84c6130..ca32097341 100644 --- a/Code/Framework/AzToolsFramework/Tests/UndoStack.cpp +++ b/Code/Framework/AzToolsFramework/Tests/UndoStack.cpp @@ -413,7 +413,7 @@ namespace UnitTest *m_completedFlag = false; } - ~UndoDestructorTest() + ~UndoDestructorTest() override { *m_completedFlag = true; } diff --git a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiDisplayTests.cpp b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiDisplayTests.cpp index e1896af4db..ddfcde34b2 100644 --- a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiDisplayTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiDisplayTests.cpp @@ -28,7 +28,7 @@ namespace UnitTest public: ViewportUiDisplayTestFixture() = default; - void SetUp() + void SetUp() override { m_buttonGroup = AZStd::make_shared(); m_buttonGroup->AddButton(""); @@ -36,7 +36,7 @@ namespace UnitTest m_mockRenderOverlay = new QWidget(); } - void TearDown() + void TearDown() override { m_buttonGroup.reset(); delete m_parentWidget; diff --git a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp index 91100b18c5..676b9c5e35 100644 --- a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp @@ -26,7 +26,7 @@ namespace UnitTest { public: ViewportUiManagerTestable() = default; - ~ViewportUiManagerTestable() = default; + ~ViewportUiManagerTestable() override = default; const AZStd::unordered_map>& GetClusterMap() { @@ -84,12 +84,12 @@ namespace UnitTest ViewportManagerWrapper m_viewportManagerWrapper; - void SetUp() + void SetUp() override { m_viewportManagerWrapper.Create(); } - void TearDown() + void TearDown() override { m_viewportManagerWrapper.Destroy(); } diff --git a/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp b/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp index 8b484143de..095f392501 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp @@ -591,13 +591,13 @@ namespace GridMate ThreadMessage(MainThreadMsg mtm) : m_code(mtm) - , m_connection(NULL) - , m_threadConnection(NULL) + , m_connection(nullptr) + , m_threadConnection(nullptr) {} ThreadMessage(CarrierThreadMsg ctm) : m_code(ctm) - , m_connection(NULL) - , m_threadConnection(NULL) + , m_connection(nullptr) + , m_threadConnection(nullptr) {} int m_code; @@ -787,7 +787,7 @@ namespace GridMate AZ_FORCE_INLINE ThreadMessage* PopCarrierThreadMessage() { AZStd::lock_guard l(m_carrierMsgQueueLock); - ThreadMessage* res = NULL; + ThreadMessage* res = nullptr; if (!m_carrierMsgQueue.empty()) { res = m_carrierMsgQueue.front(); @@ -799,7 +799,7 @@ namespace GridMate AZ_FORCE_INLINE ThreadMessage* PopMainThreadMessage() { AZStd::lock_guard l(m_mainMsgQueueLock); - ThreadMessage* res = NULL; + ThreadMessage* res = nullptr; if (!m_mainMsgQueue.empty()) { res = m_mainMsgQueue.front(); @@ -1120,7 +1120,7 @@ using namespace GridMate; ////////////////////////////////////////////////////////////////////////// Connection::Connection(CarrierThread* threadOwner, const AZStd::string& address) : m_threadOwner(threadOwner) - , m_threadConn(NULL) + , m_threadConn(nullptr) , m_fullAddress(address) , m_state(Carrier::CST_CONNECTING) { @@ -1139,7 +1139,7 @@ Connection::Connection(CarrierThread* threadOwner, const AZStd::string& address) Connection::~Connection() { - AZ_Error("GridMate", m_threadConn.load(AZStd::memory_order_acquire) == NULL, "We must detach the thread connection first!"); + AZ_Error("GridMate", m_threadConn.load(AZStd::memory_order_acquire) == nullptr, "We must detach the thread connection first!"); // Make sure render thread doesn't reference is at this point... it's too late for (unsigned int i = 0; i < AZ_ARRAY_SIZE(m_toSend); ++i) { @@ -1172,7 +1172,7 @@ Connection::~Connection() ThreadConnection::ThreadConnection(CarrierThread* threadOwner) : m_threadOwner(threadOwner) - , m_mainConnection(NULL) + , m_mainConnection(nullptr) , m_dataGramSeqNum(1) // IMPORTANT to start with 1 if we have not received any datagrams we will confirm a datagram with value of 0. , m_lastAckedDatagram(0) , m_lastReceivedDatagramTime(AZStd::chrono::system_clock::now()) @@ -1196,7 +1196,7 @@ ThreadConnection::ThreadConnection(CarrierThread* threadOwner) ThreadConnection::~ThreadConnection() { - AZ_Error("GridMate", m_mainConnection == NULL || m_mainConnection->m_threadConn.load() == NULL, "We should have unbound the thread connection by now!"); + AZ_Error("GridMate", m_mainConnection == nullptr || m_mainConnection->m_threadConn.load() == nullptr, "We should have unbound the thread connection by now!"); for (unsigned char iChannel = 0; iChannel < k_maxNumberOfChannels; ++iChannel) { @@ -1215,8 +1215,8 @@ ThreadConnection::~ThreadConnection() m_threadOwner->FreeDatagram(dgram); } - m_target->m_threadConnection = NULL; - m_target = NULL; + m_target->m_threadConnection = nullptr; + m_target = nullptr; m_threadOwner->RemoveConnectionToSend(this); AZ_Error("GridMate", !IsLinked(), "Connection still linked!"); @@ -1245,7 +1245,7 @@ CarrierThread::CarrierThread(const CarrierDesc& desc, AZStd::shared_ptrGetMaxSendSize(), @@ -1667,7 +1667,7 @@ CarrierThread::UpdateReceive() ReadBuffer readBuffer(kCarrierEndian, data, recvDataGramSize); ThreadConnection* conn = nullptr; - if (fromAddress->m_threadConnection != NULL) + if (fromAddress->m_threadConnection != nullptr) { conn = fromAddress->m_threadConnection; receivedConnections.insert(conn); @@ -2214,7 +2214,7 @@ CarrierThread::UpdateStats() for (ThreadConnectionList::iterator iConn = m_threadConnections.begin(); iConn != m_threadConnections.end(); ++iConn) { ThreadConnection* conn = *iConn; - if (conn->m_mainConnection == NULL) + if (conn->m_mainConnection == nullptr) { continue; } @@ -2267,40 +2267,40 @@ CarrierThread::ThreadPump() // Process messages for us { ThreadMessage* msg; - while ((msg = PopCarrierThreadMessage()) != NULL) + while ((msg = PopCarrierThreadMessage()) != nullptr) { switch (msg->m_code) { case CTM_CONNECT: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); // if this connect was initiated from a remote machine msg->threadConnection will be != NULL ThreadConnection* conn = msg->m_threadConnection; if (!conn) { // The main thread is initiating this connection AZStd::intrusive_ptr driverAddress = m_driver->CreateDriverAddress(msg->m_connection->m_fullAddress); - if (driverAddress->m_threadConnection != NULL) + if (driverAddress->m_threadConnection != nullptr) { AZ_TracePrintf("GridMate", "Thread connection to %s already exists!\n", driverAddress->ToString().c_str()); // we already have such thread connection conn = driverAddress->m_threadConnection; // make sure the existing connection is not bound - AZ_Assert(conn->m_mainConnection == NULL, "This thread connection should be unbound!"); + AZ_Assert(conn->m_mainConnection == nullptr, "This thread connection should be unbound!"); } else { conn = MakeNewConnection(driverAddress); } } - AZ_Assert(conn->m_mainConnection == NULL || conn->m_mainConnection == msg->m_connection, "This thread connection should be unbound or bound to the imcomming main connection!"); + AZ_Assert(conn->m_mainConnection == nullptr || conn->m_mainConnection == msg->m_connection, "This thread connection should be unbound or bound to the imcomming main connection!"); conn->m_mainConnection = msg->m_connection; - AZ_Assert(conn->m_mainConnection->m_threadConn.load() == NULL || conn->m_mainConnection->m_threadConn.load() == conn, "This main connection should be unbound or bound to us!"); + AZ_Assert(conn->m_mainConnection->m_threadConn.load() == nullptr || conn->m_mainConnection->m_threadConn.load() == conn, "This main connection should be unbound or bound to us!"); conn->m_mainConnection->m_threadConn = conn; } break; case CTM_DISCONNECT: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); ThreadConnection* tc = msg->m_connection->m_threadConn; if (tc && !tc->m_isDisconnecting) { @@ -2312,7 +2312,7 @@ CarrierThread::ThreadPump() } break; case CTM_DELETE_CONNECTION: { - ThreadConnection* tc = NULL; + ThreadConnection* tc = nullptr; tc = msg->m_threadConnection; if (tc) { @@ -2339,7 +2339,7 @@ CarrierThread::ThreadPump() ThreadMessage* mtm = aznew ThreadMessage(MTM_DELETE_CONNECTION); mtm->m_connection = msg->m_connection; RemoveConnectionToSend(mtm->m_threadConnection); - mtm->m_threadConnection = NULL; + mtm->m_threadConnection = nullptr; mtm->m_disconnectReason = msg->m_disconnectReason; PushMainThreadMessage(mtm); } @@ -2413,10 +2413,10 @@ CarrierThread::ThreadPump() if (tc->m_mainConnection) { RemoveConnectionToSend(tc); - tc->m_mainConnection->m_threadConn = NULL; + tc->m_mainConnection->m_threadConn = nullptr; ThreadMessage* mtm = aznew ThreadMessage(MTM_DELETE_CONNECTION); mtm->m_connection = tc->m_mainConnection; - mtm->m_threadConnection = NULL; + mtm->m_threadConnection = nullptr; mtm->m_disconnectReason = CarrierDisconnectReason::DISCONNECT_SHUTTING_DOWN; PushMainThreadMessage(mtm); } @@ -2582,7 +2582,7 @@ void CarrierThread::WriteAckData(ThreadConnection* connection, WriteBuffer& writ // Generate ACK bits SequenceNumber lastToAck; // last received datagram SequenceNumber firstToAck; // first received datagram (still in the list) - unsigned char* ackHistoryBits = NULL; + unsigned char* ackHistoryBits = nullptr; unsigned char ackNumHistoryBytes = 0; unsigned char ackHistoryBitsStorage[DataGramHistoryList::m_datagramHistoryMaxNumberOfBytes]; @@ -2736,7 +2736,7 @@ CarrierThread::ReadAckData(ThreadConnection* connection, ReadBuffer& readBuffer) return; } - if (connection != NULL && isAckData) + if (connection != nullptr && isAckData) { if (firstToAck != lastToAck) { @@ -3707,12 +3707,12 @@ CarrierImpl::~CarrierImpl() } delete m_thread; - m_thread = NULL; + m_thread = nullptr; if (m_ownHandshake) { delete m_handshake; - m_handshake = NULL; + m_handshake = nullptr; } } @@ -4235,13 +4235,13 @@ CarrierImpl::ProcessMainThreadMessages() // Process messages from the carrier thread { ThreadMessage* msg; - while ((msg = m_thread->PopMainThreadMessage()) != NULL) + while ((msg = m_thread->PopMainThreadMessage()) != nullptr) { switch (msg->m_code) { case MTM_NEW_CONNECTION: { - Connection* conn = NULL; + Connection* conn = nullptr; // check if we don't have it in the list. for(auto& c : m_connections) { @@ -4255,8 +4255,8 @@ CarrierImpl::ProcessMainThreadMessages() { // we already have such connection ThreadConnection* threadConn = conn->m_threadConn.load(AZStd::memory_order_acquire); - AZ_Assert(threadConn == NULL || threadConn == msg->m_threadConnection, "This main connection 0x%08x (%s) already have bound thread connection 0x%08x->0x%08x!", conn, conn->m_fullAddress.c_str(), threadConn, threadConn->m_mainConnection); - if (threadConn == NULL) + AZ_Assert(threadConn == nullptr || threadConn == msg->m_threadConnection, "This main connection 0x%08x (%s) already have bound thread connection 0x%08x->0x%08x!", conn, conn->m_fullAddress.c_str(), threadConn, threadConn->m_mainConnection); + if (threadConn == nullptr) { // request a bind we have not already ThreadMessage* ctm = aznew ThreadMessage(CTM_CONNECT); @@ -4283,23 +4283,23 @@ CarrierImpl::ProcessMainThreadMessages() // we will not even make a connection ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION); ctm->m_threadConnection = msg->m_threadConnection; - ctm->m_connection = NULL; + ctm->m_connection = nullptr; ctm->m_disconnectReason = CarrierDisconnectReason::DISCONNECT_HANDSHAKE_REJECTED; m_thread->PushCarrierThreadMessage(ctm); } } break; case MTM_DISCONNECT: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); DisconnectRequest(msg->m_connection, msg->m_disconnectReason); } break; case MTM_DISCONNECT_TIMEOUT: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); if (msg->m_connection->m_state == Carrier::CST_DISCONNECTING) { // unbind from the thread connection and inform carrier thread to delete it. - ThreadConnection* threadConn = msg->m_connection->m_threadConn.exchange(NULL); + ThreadConnection* threadConn = msg->m_connection->m_threadConn.exchange(nullptr); msg->m_connection->m_state = Carrier::CST_DISCONNECTED; ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION); ctm->m_connection = msg->m_connection; @@ -4311,7 +4311,7 @@ CarrierImpl::ProcessMainThreadMessages() } break; case MTM_DELETE_CONNECTION: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); DeleteConnection(msg->m_connection, msg->m_disconnectReason); } break; case MTM_ON_ERROR: @@ -4534,7 +4534,7 @@ CarrierImpl::ProcessSystemMessages() // Delete connection conn->m_state = Carrier::CST_DISCONNECTED; // unbind from the thread connection and inform carrier thread to delete it. - ThreadConnection* threadConn = conn->m_threadConn.exchange(NULL); + ThreadConnection* threadConn = conn->m_threadConn.exchange(nullptr); ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION); ctm->m_connection = conn; ctm->m_threadConnection = threadConn; @@ -4829,7 +4829,7 @@ CarrierImpl::GetTime() void CarrierImpl::DebugDeleteConnection(ConnectionID id) { - if (id == InvalidConnectionID && m_thread != NULL) + if (id == InvalidConnectionID && m_thread != nullptr) { return; } @@ -4844,7 +4844,7 @@ CarrierImpl::DebugDeleteConnection(ConnectionID id) // Delete connection conn->m_state = Carrier::CST_DISCONNECTED; // unbind from the thread connection and inform carrier thread to delete it. - ThreadConnection* threadConn = conn->m_threadConn.exchange(NULL); + ThreadConnection* threadConn = conn->m_threadConn.exchange(nullptr); ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION); ctm->m_connection = conn; ctm->m_threadConnection = threadConn; @@ -4914,7 +4914,7 @@ DefaultCarrier::Create(const CarrierDesc& desc, IGridMate* gridMate) AZStd::string CarrierEventsBase::ReasonToString(CarrierDisconnectReason reason) { - const char* reasonStr = 0; + const char* reasonStr = nullptr; switch (reason) { case CarrierDisconnectReason::DISCONNECT_USER_REQUESTED: diff --git a/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp b/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp index f9280d9918..8743e50e83 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp @@ -58,8 +58,8 @@ DefaultTrafficControl::~DefaultTrafficControl() void DefaultTrafficControl::OnConnect(TrafficControlConnectionId id, const AZStd::intrusive_ptr& address) { - AZ_Assert(id->m_trafficData == NULL, "We have already assigned traffic data to this connection!"); - if (id->m_trafficData != NULL) + AZ_Assert(id->m_trafficData == nullptr, "We have already assigned traffic data to this connection!"); + if (id->m_trafficData != nullptr) { return; } @@ -100,7 +100,7 @@ void DefaultTrafficControl::OnDisconnect(TrafficControlConnectionId id) { ConnectionData* cd = reinterpret_cast(id->m_trafficData); - id->m_trafficData = NULL; + id->m_trafficData = nullptr; bool isFound = false; for (ConnectionListType::iterator i = m_connections.begin(); i != m_connections.end(); ++i) { diff --git a/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp b/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp index 08c5408848..91fc1ca69b 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp @@ -1081,7 +1081,7 @@ namespace GridMate }; sockaddr* sockAddr = reinterpret_cast(&sockAddrIn6); socklen_t sockAddrLen = sizeof(sockAddrIn6); - from = NULL; + from = nullptr; unsigned int recvd = m_platformDriver->Receive(data, maxDataSize, sockAddr, sockAddrLen, resultCode); @@ -1207,7 +1207,7 @@ namespace GridMate unsigned int port; if (!AddressToIPPort(address, ip, port)) { - return NULL; + return nullptr; } SocketDriverAddress drvAddr(this, ip, port); @@ -1313,7 +1313,7 @@ namespace GridMate fd_set fdwrite; FD_ZERO(&fdwrite); FD_SET(m_socket, &fdwrite); - select(FD_SETSIZE, 0, &fdwrite, 0, 0); + select(FD_SETSIZE, nullptr, &fdwrite, nullptr, nullptr); continue; } @@ -1376,7 +1376,7 @@ namespace GridMate FD_SET(m_socket, &fdread); timeval t = Platform::GetTimeValue(timeOut); - int result = select(FD_SETSIZE, &fdread, 0, 0, &t); + int result = select(FD_SETSIZE, &fdread, nullptr, nullptr, &t); if (result > 0) { m_parent.m_isStoppedWaitForData = true; diff --git a/Code/Framework/GridMate/GridMate/Carrier/StreamSecureSocketDriver.cpp b/Code/Framework/GridMate/GridMate/Carrier/StreamSecureSocketDriver.cpp index 759a2b5e47..647b34e1b9 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/StreamSecureSocketDriver.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/StreamSecureSocketDriver.cpp @@ -343,7 +343,7 @@ namespace GridMate break; } } - while (0); + while (false); // did everything successfully create and/or allocate? if (m_ssl && m_bioIn && m_bioOut && m_scratch) diff --git a/Code/Framework/GridMate/GridMate/GridMate.cpp b/Code/Framework/GridMate/GridMate/GridMate.cpp index 356f7ad16b..22b4fd7af6 100644 --- a/Code/Framework/GridMate/GridMate/GridMate.cpp +++ b/Code/Framework/GridMate/GridMate/GridMate.cpp @@ -36,7 +36,7 @@ namespace GridMate AZ_CLASS_ALLOCATOR(GridMateImpl, GridMateAllocator, 0); GridMateImpl(const GridMateDesc& desc); - virtual ~GridMateImpl(); + ~GridMateImpl() override; void Update() override; diff --git a/Code/Framework/GridMate/GridMate/Replica/Replica.cpp b/Code/Framework/GridMate/GridMate/Replica/Replica.cpp index c1de3b71f2..a05b92a7a0 100644 --- a/Code/Framework/GridMate/GridMate/Replica/Replica.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/Replica.cpp @@ -777,7 +777,7 @@ namespace GridMate CtorContextBase::s_pCur->m_members.push_back(this); } //----------------------------------------------------------------------------- - CtorContextBase* CtorContextBase::s_pCur = NULL; + CtorContextBase* CtorContextBase::s_pCur = nullptr; //----------------------------------------------------------------------------- CtorContextBase::CtorContextBase() { diff --git a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp index 2582710aa7..7a56393bd5 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp @@ -460,7 +460,7 @@ namespace GridMate { return iter->second; } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- RepIdSeed ReplicaManager::ReserveIdBlock(PeerId requestor) @@ -995,7 +995,7 @@ namespace GridMate AZ_Assert(iObj->second, "Detected NULL replica pointer in replica map! (id=0x%x)", replicaId); return iObj->second; } - return ReplicaPtr(NULL); + return ReplicaPtr(nullptr); } //----------------------------------------------------------------------------- void ReplicaManager::_Unmarshal(ReadBuffer& rb, ReplicaPeer* pFrom) diff --git a/Code/Framework/GridMate/GridMate/Session/LANSession.cpp b/Code/Framework/GridMate/GridMate/Session/LANSession.cpp index e4e1c9e9b6..223085cf13 100644 --- a/Code/Framework/GridMate/GridMate/Session/LANSession.cpp +++ b/Code/Framework/GridMate/GridMate/Session/LANSession.cpp @@ -52,13 +52,13 @@ namespace GridMate MemberIDCompact GetID() const { return m_id; } - virtual AZStd::string ToString() const + AZStd::string ToString() const override { return AZStd::string::format("%x", m_id); } - virtual AZStd::string ToAddress() const { return m_address; } - virtual MemberIDCompact Compact() const { return m_id; } - virtual bool IsValid() const { return m_id != 0; } + AZStd::string ToAddress() const override { return m_address; } + MemberIDCompact Compact() const override { return m_id; } + bool IsValid() const override { return m_id != 0; } private: MemberIDCompact m_id; @@ -285,9 +285,9 @@ namespace GridMate static const char* GetChunkName() { return "GridMateLANMember"; } /// return an abstracted member id. (member ID is world unique but unrelated to player ID it's related to the session). - virtual const MemberID& GetId() const { return m_memberId; } + const MemberID& GetId() const override { return m_memberId; } /// returns a base player id, it's implementation is platform dependent. (NOT supported) - virtual const PlayerId* GetPlayerId() const { return nullptr; } + const PlayerId* GetPlayerId() const override { return nullptr; } /// Remote member ctor. LANMember(ConnectionID connId, const LANMemberID& id, LANSession* session); @@ -321,16 +321,16 @@ namespace GridMate friend class LANSessionService; public: GM_CLASS_ALLOCATOR(LANSearch); - virtual ~LANSearch(); + ~LANSearch() override; /// Return true if the search has finished, otherwise false. - virtual unsigned int GetNumResults() const { return static_cast(m_results.size()); } - virtual const SearchInfo* GetResult(unsigned int index) const { return &m_results[index]; } - virtual void AbortSearch(); + unsigned int GetNumResults() const override { return static_cast(m_results.size()); } + const SearchInfo* GetResult(unsigned int index) const override { return &m_results[index]; } + void AbortSearch() override; private: LANSearch(const LANSearchParams& searchParams, SessionService* service); - virtual void Update(); + void Update() override; void SearchDone(); Driver* m_driver; diff --git a/Code/Framework/GridMate/GridMate/Session/Session.cpp b/Code/Framework/GridMate/GridMate/Session/Session.cpp index 471e21127c..b731d82b71 100644 --- a/Code/Framework/GridMate/GridMate/Session/Session.cpp +++ b/Code/Framework/GridMate/GridMate/Session/Session.cpp @@ -63,40 +63,40 @@ namespace GridMate typedef unordered_set AddressSetType; GridSessionHandshake(unsigned int handshakeTimeoutMS, const VersionType& version); - virtual ~GridSessionHandshake() {} + ~GridSessionHandshake() override {} ////////////////////////////////////////////////////////////////////////// // Handshake /// Called from the system to write initial handshake data. - virtual void OnInitiate(ConnectionID id, WriteBuffer& wb); + void OnInitiate(ConnectionID id, WriteBuffer& wb) override; /** * Called when a system receives a handshake initiation from another system. * You can write a reply in the WriteBuffer. * return true if you accept this connection and false if you reject it. */ - virtual HandshakeErrorCode OnReceiveRequest(ConnectionID id, ReadBuffer& rb, WriteBuffer& wb); + HandshakeErrorCode OnReceiveRequest(ConnectionID id, ReadBuffer& rb, WriteBuffer& wb) override; /** * If we already have a valid connection and we receive another connection request, the system will * call this function to verify the state of the connection. */ - virtual bool OnConfirmRequest(ConnectionID id, ReadBuffer& rb); + bool OnConfirmRequest(ConnectionID id, ReadBuffer& rb) override; /** * Called when we receive Ack from the other system on our initial data \ref OnInitiate. * return true to accept the ack or false to reject the handshake. */ - virtual bool OnReceiveAck(ConnectionID id, ReadBuffer& rb) { (void)id; (void)rb; return true; } // we don't do any further filtering + bool OnReceiveAck(ConnectionID id, ReadBuffer& rb) override { (void)id; (void)rb; return true; } // we don't do any further filtering /** * Called when we receive Ack from the other system while we were connected. This callback is called * so we can just confirm that our connection is valid! */ - virtual bool OnConfirmAck(ConnectionID id, ReadBuffer& rb) { (void)id; (void)rb; return true; } // we don't do any further filtering + bool OnConfirmAck(ConnectionID id, ReadBuffer& rb) override { (void)id; (void)rb; return true; } // we don't do any further filtering /// Return true if you want to reject early reject a connection. - virtual bool OnNewConnection(const AZStd::string& address); + bool OnNewConnection(const AZStd::string& address) override; /// Called when we close a connection. - virtual void OnDisconnect(ConnectionID id); + void OnDisconnect(ConnectionID id) override; /// Return timeout in milliseconds of the handshake procedure. - virtual unsigned int GetHandshakeTimeOutMS() const { return m_handshakeTimeOutMS; } + unsigned int GetHandshakeTimeOutMS() const override { return m_handshakeTimeOutMS; } ////////////////////////////////////////////////////////////////////////// void BanAddress(AZStd::string address); diff --git a/Code/Framework/GridMate/Tests/Carrier.cpp b/Code/Framework/GridMate/Tests/Carrier.cpp index 9a18eb9a2c..5b18a80221 100644 --- a/Code/Framework/GridMate/Tests/Carrier.cpp +++ b/Code/Framework/GridMate/Tests/Carrier.cpp @@ -90,7 +90,7 @@ public: { } - ~CarrierCallbacksHandler() + ~CarrierCallbacksHandler() override { CarrierEventBus::Handler::BusDisconnect(); } diff --git a/Code/Framework/GridMate/Tests/CarrierStreamSocketDriverTests.cpp b/Code/Framework/GridMate/Tests/CarrierStreamSocketDriverTests.cpp index 6af6a6ab87..8ec3ad540f 100644 --- a/Code/Framework/GridMate/Tests/CarrierStreamSocketDriverTests.cpp +++ b/Code/Framework/GridMate/Tests/CarrierStreamSocketDriverTests.cpp @@ -65,7 +65,7 @@ public: { } - ~CarrierStreamCallbacksHandler() + ~CarrierStreamCallbacksHandler() override { if (m_active) { diff --git a/Code/Framework/GridMate/Tests/ReplicaBehavior.cpp b/Code/Framework/GridMate/Tests/ReplicaBehavior.cpp index 22771cc035..f6f88d2dff 100644 --- a/Code/Framework/GridMate/Tests/ReplicaBehavior.cpp +++ b/Code/Framework/GridMate/Tests/ReplicaBehavior.cpp @@ -282,7 +282,7 @@ namespace ReplicaBehavior { GM_CLASS_ALLOCATOR(EntityLikeScriptReplicaChunk); EntityLikeScriptReplicaChunk(); - ~EntityLikeScriptReplicaChunk() = default; + ~EntityLikeScriptReplicaChunk() override = default; ////////////////////////////////////////////////////////////////////// //! GridMate::ReplicaChunk overrides. @@ -296,7 +296,7 @@ namespace ReplicaBehavior { int GetMaxServerProperties() const { return k_maxScriptableDataSets; } - AZ::u32 CalculateDirtyDataSetMask(MarshalContext& marshalContext); + AZ::u32 CalculateDirtyDataSetMask(MarshalContext& marshalContext) override; EntityLikeScriptDataSet m_scriptDataSets[k_maxScriptableDataSets]; AZ::u32 m_enabledDataSetMask; @@ -815,7 +815,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_ReplicaDefaultDataSetDriller() + ~Integ_ReplicaDefaultDataSetDriller() override { m_driller.BusDisconnect(); } @@ -928,7 +928,7 @@ namespace ReplicaBehavior { m_replicaU8Id = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica2); } - ~Integ_Replica_ComparePackingBoolsVsU8() + ~Integ_Replica_ComparePackingBoolsVsU8() override { m_driller.BusDisconnect(); } @@ -1057,7 +1057,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessary() + ~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessary() override { m_driller.BusDisconnect(); } @@ -1154,7 +1154,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessaryOnceDirty() + ~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessaryOnceDirty() override { m_driller.BusDisconnect(); } @@ -1248,7 +1248,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_CheckReplicaIsntSentWithNoChanges() + ~Integ_CheckReplicaIsntSentWithNoChanges() override { m_driller.BusDisconnect(); } @@ -1359,7 +1359,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_CheckEntityScriptReplicaIsntSentWithNoChanges() + ~Integ_CheckEntityScriptReplicaIsntSentWithNoChanges() override { m_driller.BusDisconnect(); } diff --git a/Code/Framework/GridMate/Tests/ReplicaMedium.cpp b/Code/Framework/GridMate/Tests/ReplicaMedium.cpp index c1148c4fdb..61fe9d65b2 100644 --- a/Code/Framework/GridMate/Tests/ReplicaMedium.cpp +++ b/Code/Framework/GridMate/Tests/ReplicaMedium.cpp @@ -601,7 +601,7 @@ class MPSession { public: - ~MPSession() + ~MPSession() override { CarrierEventBus::Handler::BusDisconnect(); } @@ -2007,7 +2007,7 @@ public: m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_ReplicaDriller() + ~Integ_ReplicaDriller() override { m_driller.BusDisconnect(); } @@ -2893,7 +2893,7 @@ public: m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~ReplicaACKfeedbackTestFixture() + ~ReplicaACKfeedbackTestFixture() override { m_driller.BusDisconnect(); } diff --git a/Code/Framework/GridMate/Tests/ReplicaSmall.cpp b/Code/Framework/GridMate/Tests/ReplicaSmall.cpp index 3b3942e8f3..d71789ae90 100644 --- a/Code/Framework/GridMate/Tests/ReplicaSmall.cpp +++ b/Code/Framework/GridMate/Tests/ReplicaSmall.cpp @@ -254,7 +254,7 @@ public: s_nInstances++; } - ~OfflineChunk() + ~OfflineChunk() override { s_nInstances--; } @@ -273,7 +273,7 @@ public: return true; } - bool IsReplicaMigratable() { return true; } + bool IsReplicaMigratable() override { return true; } DataSet m_data1; DataSet::BindInterface m_data2; diff --git a/Code/Framework/GridMate/Tests/Session.cpp b/Code/Framework/GridMate/Tests/Session.cpp index 0c5baef483..d4f56871c5 100644 --- a/Code/Framework/GridMate/Tests/Session.cpp +++ b/Code/Framework/GridMate/Tests/Session.cpp @@ -71,7 +71,7 @@ namespace UnitTest AZ_TEST_ASSERT(GridMate::LANSessionServiceBus::FindFirstHandler(m_clientGridMate) != nullptr); ////////////////////////////////////////////////////////////////////////// } - virtual ~Integ_LANSessionMatchmakingParamsTest() + ~Integ_LANSessionMatchmakingParamsTest() override { SessionEventBus::MultiHandler::BusDisconnect(m_gridMate); SessionEventBus::MultiHandler::BusDisconnect(m_clientGridMate); @@ -290,7 +290,7 @@ namespace UnitTest AZ_TEST_ASSERT(LANSessionServiceBus::FindFirstHandler(m_peers[i].m_gridMate) != nullptr); } } - virtual ~Integ_LANSessionTest() + ~Integ_LANSessionTest() override { StopGridMateService(m_peers[0].m_gridMate); @@ -645,7 +645,7 @@ namespace UnitTest } } - virtual ~Integ_LANMultipleSessionTest() + ~Integ_LANMultipleSessionTest() override { GridMate::StopGridMateService(m_gridMates[0]); @@ -884,7 +884,7 @@ namespace UnitTest } } - virtual ~Integ_LANLatencySessionTest() + ~Integ_LANLatencySessionTest() override { StopGridMateService(m_gridMates[0]); @@ -1283,7 +1283,7 @@ namespace UnitTest //StartDrilling("lanmigration"); } - virtual ~Integ_LANSessionMigarationTestTest() + ~Integ_LANSessionMigarationTestTest() override { StopGridMateService(m_gridMates[0]); @@ -1597,7 +1597,7 @@ namespace UnitTest //StartDrilling("lanmigration2"); } - virtual ~Integ_LANSessionMigarationTestTest2() + ~Integ_LANSessionMigarationTestTest2() override { StopGridMateService(m_gridMates[0]); diff --git a/Code/Framework/GridMate/Tests/test_Main.cpp b/Code/Framework/GridMate/Tests/test_Main.cpp index 7fc71ef125..cbe4a09ef4 100644 --- a/Code/Framework/GridMate/Tests/test_Main.cpp +++ b/Code/Framework/GridMate/Tests/test_Main.cpp @@ -14,12 +14,12 @@ struct GridMateTestEnvironment : public AZ::Test::ITestEnvironment , public AZ::Debug::TraceMessageBus::Handler { - void SetupEnvironment() override final + void SetupEnvironment() final { AZ::AllocatorInstance::Create(); BusConnect(); } - void TeardownEnvironment() override final + void TeardownEnvironment() final { BusDisconnect(); AZ::AllocatorInstance::Destroy(); diff --git a/Code/LauncherUnified/launcher_generator.cmake b/Code/LauncherUnified/launcher_generator.cmake index 9c8a6b8f16..b30f752c85 100644 --- a/Code/LauncherUnified/launcher_generator.cmake +++ b/Code/LauncherUnified/launcher_generator.cmake @@ -6,8 +6,8 @@ # # - set_property(GLOBAL PROPERTY LAUNCHER_UNIFIED_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + # Launcher targets for a project need to be generated when configuring a project. # When building the engine source, this file will be included by LauncherUnified's CMakeLists.txt # When using an installed engine, this file will be included by the FindLauncherGenerator.cmake script @@ -121,6 +121,7 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC set_target_properties(${project_name}.GameLauncher PROPERTIES FOLDER ${project_name} + LY_PROJECT_NAME ${project_name} ) # After ensuring that we correctly support DPI scaling, this should be switched to "PerMonitor" @@ -129,6 +130,9 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC set_property(TARGET ${project_name}.GameLauncher APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${LY_DEFAULT_PROJECT_PATH}\"") endif() + # Associate the Clients Gem Variant with each projects GameLauncher + ly_set_gem_variant_to_load(TARGETS ${project_name}.GameLauncher VARIANTS Clients) + ################################################################################ # Server ################################################################################ @@ -168,11 +172,15 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC set_target_properties(${project_name}.ServerLauncher PROPERTIES FOLDER ${project_name} + LY_PROJECT_NAME ${project_name} ) if(LY_DEFAULT_PROJECT_PATH) set_property(TARGET ${project_name}.ServerLauncher APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${LY_DEFAULT_PROJECT_PATH}\"") endif() + + # Associate the Servers Gem Variant with each projects ServerLauncher + ly_set_gem_variant_to_load(TARGETS ${project_name}.ServerLauncher VARIANTS Servers) endif() endif() diff --git a/Code/LauncherUnified/launcher_project_files.cmake b/Code/LauncherUnified/launcher_project_files.cmake index 9f5bacbce5..2276631fbe 100644 --- a/Code/LauncherUnified/launcher_project_files.cmake +++ b/Code/LauncherUnified/launcher_project_files.cmake @@ -9,4 +9,5 @@ set(FILES LauncherProject.cpp StaticModules.in + launcher_generator.cmake ) diff --git a/Code/Legacy/CryCommon/AppleSpecific.h b/Code/Legacy/CryCommon/AppleSpecific.h index 60ab80ade6..e4c4fadb89 100644 --- a/Code/Legacy/CryCommon/AppleSpecific.h +++ b/Code/Legacy/CryCommon/AppleSpecific.h @@ -13,10 +13,6 @@ #define CRYINCLUDE_CRYCOMMON_APPLESPECIFIC_H #pragma once -#if defined(__clang__) -#pragma diagnostic ignore "-W#pragma-messages" -#endif - ////////////////////////////////////////////////////////////////////////// // Standard includes. ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Legacy/CryCommon/IConsole.h b/Code/Legacy/CryCommon/IConsole.h index dcbb0399aa..f68a82f9dc 100644 --- a/Code/Legacy/CryCommon/IConsole.h +++ b/Code/Legacy/CryCommon/IConsole.h @@ -118,10 +118,6 @@ struct IConsoleVarSink // }; -#if defined(GetCommandLine) -#undef GetCommandLine -#endif - // Interface to the arguments of the console command. struct IConsoleCmdArgs { diff --git a/Code/Legacy/CryCommon/LyShine/IDraw2d.h b/Code/Legacy/CryCommon/LyShine/IDraw2d.h index a8c7af7411..3bfa3a1c14 100644 --- a/Code/Legacy/CryCommon/LyShine/IDraw2d.h +++ b/Code/Legacy/CryCommon/LyShine/IDraw2d.h @@ -12,9 +12,6 @@ #include #include -// Forward declarations -struct IFFont; - //////////////////////////////////////////////////////////////////////////////////////////////////// //! Class for 2D drawing in screen space // @@ -58,55 +55,6 @@ public: // types MAX_TEXT_STRING_LENGTH = 1024, }; - enum : int - { - //! Constant that indicates the built-in default value should be used - UseDefault = -1 - }; - - //! Struct used to pass additional image options. - // - //! If this is not passed then the defaults below are used - struct ImageOptions - { - int blendMode; //!< default is GS_BLSRC_SRCALPHA|GS_BLDST_ONEMINUSSRCALPHA - AZ::Vector3 color; //!< default is (1,1,1) - Rounding pixelRounding; //!< default is Rounding::Nearest - int baseState; //!< Additional flags for SetState. Default is GS_NODEPTHTEST - }; - - //! Struct used to pass additional text options - mostly ones that do not change from call to call. - // - //! If this is not passed then the defaults below are used - struct TextOptions - { - AZStd::string fontName; //!< default is "default" - unsigned int effectIndex; //!< default is 0 - AZ::Vector3 color; //!< default is (1,1,1) - HAlign horizontalAlignment; //!< default is HAlign::Left - VAlign verticalAlignment; //!< default is VAlign::Top - AZ::Vector2 dropShadowOffset; //!< default is (0,0), zero offset means no drop shadow is drawn - AZ::Color dropShadowColor; //!< default is (0,0,0,0), zero alpha means no drop shadow is drawn - float rotation; //!< default is 0 - int baseState; //!< Additional flags for SetState. Default is GS_NODEPTHTEST - }; - - //! Used to pass in arrays of vertices (e.g. to DrawQuad) - struct VertexPosColUV - { - VertexPosColUV(){} - VertexPosColUV(const AZ::Vector2& inPos, const AZ::Color& inColor, const AZ::Vector2& inUV) - { - position = inPos; - color = inColor; - uv = inUV; - } - - AZ::Vector2 position; //!< 2D position of vertex - AZ::Color color; //!< Float color - AZ::Vector2 uv; //!< Texture coordinate - }; - public: // member functions //! Implement virtual destructor just for safety. diff --git a/Code/Tools/AssetProcessor/AssetBuilder/CMakeLists.txt b/Code/Tools/AssetProcessor/AssetBuilder/CMakeLists.txt index 64655c5164..6baa99d43b 100644 --- a/Code/Tools/AssetProcessor/AssetBuilder/CMakeLists.txt +++ b/Code/Tools/AssetProcessor/AssetBuilder/CMakeLists.txt @@ -39,6 +39,7 @@ ly_add_source_properties( ) if(TARGET AssetBuilder) + ly_set_gem_variant_to_load(TARGETS AssetBuilder VARIANTS Builders) # Adds the AssetBuilder target as a C preprocessor define so that it can be used as a Settings Registry # specialization in order to look up the generated .setreg which contains the dependencies # specified for the AssetBuilder in the /Gem/Code/CMakeLists via ly_add_project_dependencies diff --git a/Code/Tools/AssetProcessor/CMakeLists.txt b/Code/Tools/AssetProcessor/CMakeLists.txt index f10e4a9e05..431a167163 100644 --- a/Code/Tools/AssetProcessor/CMakeLists.txt +++ b/Code/Tools/AssetProcessor/CMakeLists.txt @@ -81,6 +81,7 @@ ly_add_target( # specialization in order to look up the generated .setreg which contains the dependencies # specified for the target. if(TARGET AssetProcessor) + ly_set_gem_variant_to_load(TARGETS AssetProcessor VARIANTS Builders) set_source_files_properties( native/AssetProcessorBuildTarget.cpp PROPERTIES @@ -130,6 +131,7 @@ endif() # specialization in order to look up the generated .setreg which contains the dependencies # specified for the target. if(TARGET AssetProcessorBatch) + ly_set_gem_variant_to_load(TARGETS AssetProcessorBatch VARIANTS Builders) set_source_files_properties( native/AssetProcessorBatchBuildTarget.cpp PROPERTIES diff --git a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/Contents.json b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/Contents.json index 2c6bbd2282..52b242ba4a 100644 --- a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/Contents.json @@ -33,6 +33,7 @@ { "idiom" : "mac", "size" : "256x256", + "filename" : "icon_256x256.png", "scale" : "1x" }, { @@ -43,7 +44,6 @@ { "size" : "512x512", "idiom" : "mac", - "filename" : "icon_512x512.png", "scale" : "1x" }, { diff --git a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256x256.png b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256x256.png new file mode 100644 index 0000000000..50610c7ff4 --- /dev/null +++ b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_256x256.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f16c891aaa1686a3735fe84c7a69c3cef24e68af7baa86bf2f54ab4d51b71e8 +size 8489 diff --git a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512x512.png b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512x512.png deleted file mode 100644 index 99123c81ee..0000000000 --- a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AppIcon.appiconset/icon_512x512.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a396a13d3bc7ca074cdc6fdd072ba18c2e359bd24408783809b6c90adf23e22a -size 21937 diff --git a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/Contents.json b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/Contents.json index 2c6bbd2282..52b242ba4a 100644 --- a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/Contents.json +++ b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/Contents.json @@ -33,6 +33,7 @@ { "idiom" : "mac", "size" : "256x256", + "filename" : "icon_256x256.png", "scale" : "1x" }, { @@ -43,7 +44,6 @@ { "size" : "512x512", "idiom" : "mac", - "filename" : "icon_512x512.png", "scale" : "1x" }, { diff --git a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/icon_256x256.png b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/icon_256x256.png new file mode 100644 index 0000000000..50610c7ff4 --- /dev/null +++ b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/icon_256x256.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f16c891aaa1686a3735fe84c7a69c3cef24e68af7baa86bf2f54ab4d51b71e8 +size 8489 diff --git a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/icon_512x512.png b/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/icon_512x512.png deleted file mode 100644 index 99123c81ee..0000000000 --- a/Code/Tools/AssetProcessor/Platform/Mac/Images.xcassets/AssetProcessorAppIcon.appiconset/icon_512x512.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a396a13d3bc7ca074cdc6fdd072ba18c2e359bd24408783809b6c90adf23e22a -size 21937 diff --git a/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp b/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp index e624b40787..3eed37e555 100644 --- a/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp +++ b/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) processLaunchInfo.m_environmentVariables = &envVars; processLaunchInfo.m_showWindow = true; - AZStd::unique_ptr processWatcher(AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE)); + AzFramework::ProcessLauncher::LaunchUnwatchedProcess(processLaunchInfo); application.Destroy(); diff --git a/Code/Tools/AssetProcessor/native/unittests/AssetProcessingStateDataUnitTests.cpp b/Code/Tools/AssetProcessor/native/unittests/AssetProcessingStateDataUnitTests.cpp index 1c9e29c4e8..e19b95a76b 100644 --- a/Code/Tools/AssetProcessor/native/unittests/AssetProcessingStateDataUnitTests.cpp +++ b/Code/Tools/AssetProcessor/native/unittests/AssetProcessingStateDataUnitTests.cpp @@ -715,12 +715,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon //try retrieving this source by id UNIT_TEST_EXPECT_TRUE(stateData->GetJobByJobID(job.m_jobID, job)); - if (job.m_jobID == AzToolsFramework::AssetDatabase::InvalidEntryId || - job.m_jobID != job.m_jobID || - job.m_sourcePK != job.m_sourcePK || - job.m_jobKey != job.m_jobKey || - job.m_fingerprint != job.m_fingerprint || - job.m_platform != job.m_platform) + if (job.m_jobID == AzToolsFramework::AssetDatabase::InvalidEntryId) { Q_EMIT UnitTestFailed("AssetProcessingStateDataTest Failed - GetJobByJobID failed"); return; diff --git a/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp b/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp index 7292990a72..85801bdf8a 100644 --- a/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp @@ -57,9 +57,6 @@ #include -// windows headers bring in a macro which conflicts GetCommandLine -#undef GetCommandLine - namespace AssetUtilsInternal { static const unsigned int g_RetryWaitInterval = 250; // The amount of time that we are waiting for retry. diff --git a/Code/Tools/AzTestRunner/Platform/Android/platform_android.cpp b/Code/Tools/AzTestRunner/Platform/Android/platform_android.cpp index 1e4f731b9a..9e0ea304ef 100644 --- a/Code/Tools/AzTestRunner/Platform/Android/platform_android.cpp +++ b/Code/Tools/AzTestRunner/Platform/Android/platform_android.cpp @@ -64,7 +64,7 @@ namespace AzTestRunner { static char cwd_buffer[AZ_MAX_PATH_LEN] = { '\0' }; - AZ::Utils::ExecutablePathResult result = AZ::Utils::GetExecutableDirectory(cwd_buffer, AZ_ARRAY_SIZE(cwd_buffer)); + [[maybe_unused]] AZ::Utils::ExecutablePathResult result = AZ::Utils::GetExecutableDirectory(cwd_buffer, AZ_ARRAY_SIZE(cwd_buffer)); AZ_Assert(result == AZ::Utils::ExecutablePathResult::Success, "Error retrieving executable path"); return static_cast(cwd_buffer); diff --git a/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.cpp b/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.cpp index d58a89a110..117a1196f8 100644 --- a/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.cpp +++ b/Code/Tools/SceneAPI/SceneData/GraphData/MaterialData.cpp @@ -230,6 +230,19 @@ namespace AZ return m_uniqueId; } + namespace Helper + { + template + T ReturnOptionalValue(AZStd::optional value) + { + if (!value) + { + return {}; + } + return value.value(); + } + } + void MaterialData::Reflect(ReflectContext* context) { SerializeContext* serializeContext = azrtti_cast(context); @@ -285,6 +298,76 @@ namespace AZ ->DataElement(AZ::Edit::UIHandlers::Default, &MaterialData::m_useAOMap, "Use Ambient Occlusion Map", "True to use an ambient occlusion map, false to ignore it."); } } + + BehaviorContext* behaviorContext = azrtti_cast(context); + if (behaviorContext) + { + behaviorContext->Class() + ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) + ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) + ->Attribute(AZ::Script::Attributes::Module, "scene"); + + using namespace Helper; + using DataTypes::IMaterialData; + + behaviorContext->Class() + ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) + ->Attribute(AZ::Script::Attributes::Module, "scene") + ->Constant("AmbientOcclusion", BehaviorConstant(TextureMapType::AmbientOcclusion)) + ->Constant("BaseColor", BehaviorConstant(TextureMapType::BaseColor)) + ->Constant("Bump", BehaviorConstant(TextureMapType::Bump)) + ->Constant("Diffuse", BehaviorConstant(TextureMapType::Diffuse)) + ->Constant("Emissive", BehaviorConstant(TextureMapType::Emissive)) + ->Constant("Metallic", BehaviorConstant(TextureMapType::Metallic)) + ->Constant("Normal", BehaviorConstant(TextureMapType::Normal)) + ->Constant("Roughness", BehaviorConstant(TextureMapType::Roughness)) + ->Constant("Specular", BehaviorConstant(TextureMapType::Specular)) + ->Method("GetTexture", &MaterialData::GetTexture) + ->Method("GetMaterialName", &MaterialData::GetMaterialName) + ->Method("IsNoDraw", &MaterialData::IsNoDraw) + ->Method("GetDiffuseColor", &MaterialData::GetDiffuseColor) + ->Method("GetSpecularColor", &MaterialData::GetSpecularColor) + ->Method("GetEmissiveColor", &MaterialData::GetEmissiveColor) + ->Method("GetOpacity", &MaterialData::GetOpacity) + ->Method("GetUniqueId", &MaterialData::GetUniqueId) + ->Method("GetShininess", &MaterialData::GetShininess) + ->Method("GetUseColorMap", [](const MaterialData& self) + { + return ReturnOptionalValue(self.GetUseColorMap()); + }) + ->Method("GetBaseColor", [](const MaterialData& self) + { + return ReturnOptionalValue(self.GetBaseColor()); + }) + ->Method("GetUseMetallicMap", [](const MaterialData& self) + { + return ReturnOptionalValue(self.GetUseMetallicMap()); + }) + ->Method("GetMetallicFactor", [](const MaterialData& self) + { + return ReturnOptionalValue(self.GetMetallicFactor()); + }) + ->Method("GetUseRoughnessMap", [](const MaterialData& self) + { + return ReturnOptionalValue(self.GetUseRoughnessMap()); + }) + ->Method("GetRoughnessFactor", [](const MaterialData& self) + { + return ReturnOptionalValue(self.GetRoughnessFactor()); + }) + ->Method("GetUseEmissiveMap", [](const MaterialData& self) + { + return ReturnOptionalValue(self.GetUseEmissiveMap()); + }) + ->Method("GetEmissiveIntensity", [](const MaterialData& self) + { + return ReturnOptionalValue(self.GetEmissiveIntensity()); + }) + ->Method("GetUseAOMap", [](const MaterialData& self) + { + return ReturnOptionalValue(self.GetUseAOMap()); + }); + } } } // namespace GraphData } // namespace SceneData diff --git a/Code/Tools/SceneAPI/SceneData/Tests/GraphData/GraphDataBehaviorTests.cpp b/Code/Tools/SceneAPI/SceneData/Tests/GraphData/GraphDataBehaviorTests.cpp index ab0fa79e62..4a2d206cc7 100644 --- a/Code/Tools/SceneAPI/SceneData/Tests/GraphData/GraphDataBehaviorTests.cpp +++ b/Code/Tools/SceneAPI/SceneData/Tests/GraphData/GraphDataBehaviorTests.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -27,6 +28,7 @@ #include #include #include +#include namespace AZ { @@ -145,6 +147,38 @@ namespace AZ blendShapeData->SetVertexIndexToControlPointIndexMap(2, 0); return true; } + else if (data.get_type_info().m_id == azrtti_typeid()) + { + auto* materialDataData = AZStd::any_cast(&data); + materialDataData->SetBaseColor(AZStd::make_optional(AZ::Vector3(0.1, 0.2, 0.3))); + materialDataData->SetDiffuseColor({ 0.3, 0.4, 0.5 }); + materialDataData->SetEmissiveColor({ 0.4, 0.5, 0.6 }); + materialDataData->SetEmissiveIntensity(AZStd::make_optional(0.789f)); + materialDataData->SetMaterialName("TestMaterialName"); + materialDataData->SetMetallicFactor(AZStd::make_optional(0.123f)); + materialDataData->SetNoDraw(true); + materialDataData->SetOpacity(0.7); + materialDataData->SetRoughnessFactor(AZStd::make_optional(0.456f)); + materialDataData->SetShininess(1.23); + materialDataData->SetSpecularColor({ 0.8, 0.9, 1.0 }); + materialDataData->SetUseAOMap(AZStd::make_optional(true)); + materialDataData->SetUseColorMap(AZStd::make_optional(true)); + materialDataData->SetUseMetallicMap(AZStd::make_optional(true)); + materialDataData->SetUseRoughnessMap(AZStd::make_optional(true)); + materialDataData->SetUseEmissiveMap(AZStd::make_optional(true)); + materialDataData->SetUniqueId(102938); + materialDataData->SetTexture(AZ::SceneAPI::DataTypes::IMaterialData::TextureMapType::AmbientOcclusion, "ambientocclusion"); + materialDataData->SetTexture(AZ::SceneAPI::DataTypes::IMaterialData::TextureMapType::BaseColor, "basecolor"); + materialDataData->SetTexture(AZ::SceneAPI::DataTypes::IMaterialData::TextureMapType::Bump, "bump"); + materialDataData->SetTexture(AZ::SceneAPI::DataTypes::IMaterialData::TextureMapType::Diffuse, "diffuse"); + materialDataData->SetTexture(AZ::SceneAPI::DataTypes::IMaterialData::TextureMapType::Emissive, "emissive"); + materialDataData->SetTexture(AZ::SceneAPI::DataTypes::IMaterialData::TextureMapType::Metallic, "metallic"); + materialDataData->SetTexture(AZ::SceneAPI::DataTypes::IMaterialData::TextureMapType::Normal, "normal"); + materialDataData->SetTexture(AZ::SceneAPI::DataTypes::IMaterialData::TextureMapType::Roughness, "roughness"); + materialDataData->SetTexture(AZ::SceneAPI::DataTypes::IMaterialData::TextureMapType::Specular, "specular"); + return true; + } + return false; } @@ -337,7 +371,7 @@ namespace AZ ExpectExecute("TestExpectFloatEquals(tangentData.z, 0.19)"); ExpectExecute("TestExpectFloatEquals(tangentData.w, 0.29)"); ExpectExecute("TestExpectIntegerEquals(meshVertexTangentData:GetTangentSetIndex(), 2)"); - ExpectExecute("TestExpectTrue(meshVertexTangentData:GetGenerationMethod(), MeshVertexTangentData.EMotionFX)"); + ExpectExecute("TestExpectTrue(meshVertexTangentData:GetGenerationMethod(), MeshVertexTangentData.MikkT)"); } TEST_F(GrapDatahBehaviorScriptTest, SceneGraph_AnimationData_AccessWorks) @@ -449,6 +483,49 @@ namespace AZ ExpectExecute("TestExpectFloatEquals(blendShapeData:GetBitangent(2).y, 0.3)"); ExpectExecute("TestExpectFloatEquals(blendShapeData:GetBitangent(2).z, 0.4)"); } + + TEST_F(GrapDatahBehaviorScriptTest, SceneGraph_MaterialData_AccessWorks) + { + ExpectExecute("materialData = MaterialData()"); + ExpectExecute("TestExpectTrue(materialData ~= nil)"); + ExpectExecute("TestExpectTrue(materialData:IsNoDraw() == false)"); + ExpectExecute("TestExpectTrue(materialData:GetUseColorMap() == false)"); + ExpectExecute("TestExpectTrue(materialData:GetUseMetallicMap() == false)"); + ExpectExecute("TestExpectTrue(materialData:GetUseRoughnessMap() == false)"); + ExpectExecute("TestExpectTrue(materialData:GetUseEmissiveMap() == false)"); + ExpectExecute("TestExpectTrue(materialData:GetUseAOMap() == false)"); + ExpectExecute("MockGraphData.FillData(materialData)"); + ExpectExecute("TestExpectTrue(materialData:IsNoDraw())"); + ExpectExecute("TestExpectTrue(materialData:GetUseColorMap())"); + ExpectExecute("TestExpectTrue(materialData:GetUseMetallicMap())"); + ExpectExecute("TestExpectTrue(materialData:GetUseRoughnessMap())"); + ExpectExecute("TestExpectTrue(materialData:GetUseEmissiveMap())"); + ExpectExecute("TestExpectTrue(materialData:GetUseAOMap())"); + ExpectExecute("TestExpectFloatEquals(materialData:GetMetallicFactor(), 0.123)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetRoughnessFactor(), 0.456)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetEmissiveIntensity(), 0.789)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetOpacity(), 0.7)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetShininess(), 1.23)"); + ExpectExecute("TestExpectTrue(materialData:GetMaterialName() == 'TestMaterialName')"); + ExpectExecute("TestExpectFloatEquals(materialData:GetBaseColor().x, 0.1)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetBaseColor().y, 0.2)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetBaseColor().z, 0.3)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetDiffuseColor().x, 0.3)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetDiffuseColor().y, 0.4)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetDiffuseColor().z, 0.5)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetEmissiveColor().x, 0.4)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetEmissiveColor().y, 0.5)"); + ExpectExecute("TestExpectFloatEquals(materialData:GetEmissiveColor().z, 0.6)"); + ExpectExecute("TestExpectIntegerEquals(materialData:GetUniqueId(), 102938)"); + ExpectExecute("TestExpectTrue(materialData:GetTexture(MaterialData.AmbientOcclusion) == 'ambientocclusion')"); + ExpectExecute("TestExpectTrue(materialData:GetTexture(MaterialData.Bump) == 'bump')"); + ExpectExecute("TestExpectTrue(materialData:GetTexture(MaterialData.Diffuse) == 'diffuse')"); + ExpectExecute("TestExpectTrue(materialData:GetTexture(MaterialData.Emissive) == 'emissive')"); + ExpectExecute("TestExpectTrue(materialData:GetTexture(MaterialData.Metallic) == 'metallic')"); + ExpectExecute("TestExpectTrue(materialData:GetTexture(MaterialData.Normal) == 'normal')"); + ExpectExecute("TestExpectTrue(materialData:GetTexture(MaterialData.Roughness) == 'roughness')"); + ExpectExecute("TestExpectTrue(materialData:GetTexture(MaterialData.Specular) == 'specular')"); + } } } } diff --git a/Gems/Atom/Asset/Shader/Code/CMakeLists.txt b/Gems/Atom/Asset/Shader/Code/CMakeLists.txt index 298f00825f..c0bdfd4a8b 100644 --- a/Gems/Atom/Asset/Shader/Code/CMakeLists.txt +++ b/Gems/Atom/Asset/Shader/Code/CMakeLists.txt @@ -101,8 +101,7 @@ ly_add_target( # The Atom_Asset_Shader is a required gem for Builders in order to process the assets that come WITHOUT # the Atom_Feature_Common required gem -ly_enable_gems(GEMS Atom_Asset_Shader VARIANTS Builders - TARGETS AssetBuilder AssetProcessor AssetProcessorBatch) +ly_enable_gems(GEMS Atom_Asset_Shader) ################################################################################ # Tests diff --git a/Gems/Atom/Bootstrap/Code/CMakeLists.txt b/Gems/Atom/Bootstrap/Code/CMakeLists.txt index 1787af04ed..fd9df96124 100644 --- a/Gems/Atom/Bootstrap/Code/CMakeLists.txt +++ b/Gems/Atom/Bootstrap/Code/CMakeLists.txt @@ -45,14 +45,4 @@ ly_create_alias(NAME Atom_Bootstrap.Clients NAMESPACE Gem TARGETS Gem::Atom_Boot ly_create_alias(NAME Atom_Bootstrap.Servers NAMESPACE Gem TARGETS Gem::Atom_Bootstrap) # The Atom_Bootstrap gem is responsible for making the NativeWindow handle in the launcher applications -# Loop over each Project name to allow the ${ProjectName}.GameLauncher and ${ProjectName}.ServerLauncher -# target to add the gem the Clients and Servers variant -get_property(LY_PROJECTS_TARGET_NAME GLOBAL PROPERTY LY_PROJECTS_TARGET_NAME) -foreach(project_name IN LISTS LY_PROJECTS_TARGET_NAME) - # Add gem as a dependency of the Clients Launcher - ly_enable_gems(PROJECT_NAME ${project_name} GEMS Atom_Bootstrap VARIANTS Clients TARGETS ${project_name}.GameLauncher) - # Add gem as a dependency of the Servers Launcher - if(PAL_TRAIT_BUILD_SERVER_SUPPORTED) - ly_enable_gems(PROJECT_NAME ${project_name} GEMS Atom_Bootstrap VARIANTS Servers TARGETS ${project_name}.ServerLauncher) - endif() -endforeach() +ly_enable_gems(GEMS Atom_Bootstrap) diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/FrameCaptureBus.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/FrameCaptureBus.h index 919d1b7468..93600ec08f 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/FrameCaptureBus.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/FrameCaptureBus.h @@ -31,6 +31,11 @@ namespace AZ { public: virtual ~FrameCaptureRequests() = default; + + //! Return true if frame capture is available. + //! It may return false if null renderer is used. + //! If the frame capture is not available, all capture functions in this interface would return false + virtual bool CanCapture() const = 0; //! Capture final screen output for the specified window and save it to given file path. //! The image format is determinate by file extension diff --git a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp index 7374fdaf71..9f6d2a343d 100644 --- a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp @@ -8,6 +8,8 @@ #include "FrameCaptureSystemComponent.h" +#include + #include #include #include @@ -254,8 +256,18 @@ namespace AZ return AZStd::string(resolvedPath); } + bool FrameCaptureSystemComponent::CanCapture() const + { + return !AZ::RHI::IsNullRenderer(); + } + bool FrameCaptureSystemComponent::CaptureScreenshotForWindow(const AZStd::string& filePath, AzFramework::NativeWindowHandle windowHandle) { + if (!CanCapture()) + { + return false; + } + InitReadback(); if (m_state != State::Idle) @@ -301,6 +313,11 @@ namespace AZ bool FrameCaptureSystemComponent::CaptureScreenshotWithPreview(const AZStd::string& outputFilePath) { + if (!CanCapture()) + { + return false; + } + InitReadback(); if (m_state != State::Idle) @@ -350,6 +367,11 @@ namespace AZ bool FrameCaptureSystemComponent::CapturePassAttachment(const AZStd::vector& passHierarchy, const AZStd::string& slot, const AZStd::string& outputFilePath, RPI::PassAttachmentReadbackOption option) { + if (!CanCapture()) + { + return false; + } + InitReadback(); if (m_state != State::Idle) @@ -396,6 +418,11 @@ namespace AZ bool FrameCaptureSystemComponent::CapturePassAttachmentWithCallback(const AZStd::vector& passHierarchy, const AZStd::string& slotName , RPI::AttachmentReadback::CallbackFunction callback, RPI::PassAttachmentReadbackOption option) { + if (!CanCapture()) + { + return false; + } + bool result = CapturePassAttachment(passHierarchy, slotName, "", option); // Append state change to user provided call back diff --git a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.h b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.h index 5dbaa5dee6..20e233ce62 100644 --- a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.h +++ b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.h @@ -34,6 +34,7 @@ namespace AZ void Deactivate() override; // FrameCaptureRequestBus overrides ... + bool CanCapture() const override; bool CaptureScreenshot(const AZStd::string& filePath) override; bool CaptureScreenshotForWindow(const AZStd::string& filePath, AzFramework::NativeWindowHandle windowHandle) override; bool CaptureScreenshotWithPreview(const AZStd::string& outputFilePath) override; diff --git a/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.cpp index e26a0fb274..fd1c836b96 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.cpp @@ -26,9 +26,10 @@ namespace AZ if (auto serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(1) + ->Version(2) ->Field("Enable", &MaterialConverterSettings::m_enable) - ->Field("DefaultMaterial", &MaterialConverterSettings::m_defaultMaterial); + ->Field("DefaultMaterial", &MaterialConverterSettings::m_defaultMaterial) + ->Field("IncludeMaterialPropertyNames", &MaterialConverterSettings::m_includeMaterialPropertyNames); } } @@ -69,6 +70,11 @@ namespace AZ return m_settings.m_enable; } + bool MaterialConverterSystemComponent::ShouldIncludeMaterialPropertyNames() const + { + return m_settings.m_includeMaterialPropertyNames; + } + bool MaterialConverterSystemComponent::ConvertMaterial( const AZ::SceneAPI::DataTypes::IMaterialData& materialData, RPI::MaterialSourceData& sourceData) { diff --git a/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.h b/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.h index 7d95024759..150529b474 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.h +++ b/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.h @@ -26,6 +26,11 @@ namespace AZ bool m_enable = true; AZStd::string m_defaultMaterial; + //! Sets whether to include material property names when generating material assets. If this + //! setting is true, material property name resolution and validation is deferred into load + //! time rather than at build time, allowing to break some dependencies (e.g. fbx files will no + //! longer need to be dependent on materialtype files). + bool m_includeMaterialPropertyNames = true; }; //! Atom's implementation of converting SceneAPI data into Atom's default material: StandardPBR @@ -45,6 +50,7 @@ namespace AZ // MaterialConverterBus overrides ... bool IsEnabled() const override; + bool ShouldIncludeMaterialPropertyNames() const override; bool ConvertMaterial(const AZ::SceneAPI::DataTypes::IMaterialData& materialData, RPI::MaterialSourceData& out) override; AZStd::string GetMaterialTypePath() const override; AZStd::string GetDefaultMaterialPath() const override; diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp index fce4db364f..96e61be2cd 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp @@ -17,8 +17,6 @@ namespace AZ { namespace Metal { - static const int INVALID_OFFSET = 0xFFFFFFFF; - namespace Platform { MTLPixelFormat ConvertPixelFormat(RHI::Format format); diff --git a/Gems/Atom/RHI/Null/Code/Source/RHI/Fence.cpp b/Gems/Atom/RHI/Null/Code/Source/RHI/Fence.cpp new file mode 100644 index 0000000000..dc3743c101 --- /dev/null +++ b/Gems/Atom/RHI/Null/Code/Source/RHI/Fence.cpp @@ -0,0 +1,20 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#include + + +namespace AZ +{ + namespace Null + { + RHI::Ptr Fence::Create() + { + return aznew Fence(); + } + } +} diff --git a/Gems/Atom/RHI/Null/Code/Source/RHI/Fence.h b/Gems/Atom/RHI/Null/Code/Source/RHI/Fence.h new file mode 100644 index 0000000000..fb64727362 --- /dev/null +++ b/Gems/Atom/RHI/Null/Code/Source/RHI/Fence.h @@ -0,0 +1,40 @@ +/* + * 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 + * + */ +#pragma once + +#include + +namespace AZ +{ + namespace Null + { + class Fence + : public RHI::Fence + { + using Base = RHI::Fence; + public: + AZ_RTTI(Fence, "{34908F40-A7DE-4EE8-A871-71ACE0C24972}", Base); + AZ_CLASS_ALLOCATOR(Fence, AZ::SystemAllocator, 0); + + static RHI::Ptr Create(); + + private: + Fence() = default; + + ////////////////////////////////////////////////////////////////////////// + // RHI::Fence + RHI::ResultCode InitInternal([[maybe_unused]] RHI::Device& device, [[maybe_unused]] RHI::FenceState initialState) override { return RHI::ResultCode::Success;} + void ShutdownInternal() override {} + void SignalOnCpuInternal() override {} + void WaitOnCpuInternal() const override {} + void ResetInternal() override {} + RHI::FenceState GetFenceStateInternal() const override { return RHI::FenceState::Signaled;}; + ////////////////////////////////////////////////////////////////////////// + }; + } +} diff --git a/Gems/Atom/RHI/Null/Code/Source/RHI/SystemComponent.cpp b/Gems/Atom/RHI/Null/Code/Source/RHI/SystemComponent.cpp index d72de7996e..091084b097 100644 --- a/Gems/Atom/RHI/Null/Code/Source/RHI/SystemComponent.cpp +++ b/Gems/Atom/RHI/Null/Code/Source/RHI/SystemComponent.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -99,7 +100,7 @@ namespace AZ RHI::Ptr SystemComponent::CreateFence() { - return nullptr; + return Fence::Create(); } RHI::Ptr SystemComponent::CreateBuffer() diff --git a/Gems/Atom/RHI/Null/Code/atom_rhi_null_private_common_files.cmake b/Gems/Atom/RHI/Null/Code/atom_rhi_null_private_common_files.cmake index 13e16be77b..ad57002dd3 100644 --- a/Gems/Atom/RHI/Null/Code/atom_rhi_null_private_common_files.cmake +++ b/Gems/Atom/RHI/Null/Code/atom_rhi_null_private_common_files.cmake @@ -21,6 +21,8 @@ set(FILES Source/RHI/CommandQueue.h Source/RHI/Device.cpp Source/RHI/Device.h + Source/RHI/Fence.cpp + Source/RHI/Fence.h Source/RHI/FrameGraphCompiler.cpp Source/RHI/FrameGraphCompiler.h Source/RHI/FrameGraphExecuter.cpp diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Edit/Material/MaterialConverterBus.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Edit/Material/MaterialConverterBus.h index 8052fc4feb..1807fca15e 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Edit/Material/MaterialConverterBus.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Edit/Material/MaterialConverterBus.h @@ -32,6 +32,10 @@ namespace AZ virtual bool IsEnabled() const = 0; + //! Returns true if material property names should be included in azmaterials. This allows unlinking of dependencies for some + //! file types to materialtype files (e.g. fbx). + virtual bool ShouldIncludeMaterialPropertyNames() const = 0; + //! Converts data from a IMaterialData object to an Atom MaterialSourceData. //! Only works when IsEnabled() is true. //! @return true if the MaterialSourceData output was populated with converted material data. diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Edit/Material/MaterialSourceData.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Edit/Material/MaterialSourceData.h index 1daec3bacd..02607a7954 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Edit/Material/MaterialSourceData.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Edit/Material/MaterialSourceData.h @@ -68,12 +68,12 @@ namespace AZ //! @param assetId ID for the MaterialAsset //! @param materialSourceFilePath Indicates the path of the .material file that the MaterialSourceData represents. Used for resolving file-relative paths. //! @param elevateWarnings Indicates whether to treat warnings as errors - //! @param materialTypeSourceData The function sometimes needs metadata from the .materialtype file. - //! It will either load the .materialtype file from disk, or use this MaterialTypeSourceData if it's provided. + //! @param includeMaterialPropertyNames Indicates whether to save material property names into the material asset file Outcome> CreateMaterialAsset( Data::AssetId assetId, AZStd::string_view materialSourceFilePath = "", - bool elevateWarnings = true + bool elevateWarnings = true, + bool includeMaterialPropertyNames = true ) const; }; } // namespace RPI diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialAsset.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialAsset.h index 49ef839331..52af56ba0e 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialAsset.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialAsset.h @@ -108,6 +108,11 @@ namespace AZ private: bool PostLoadInit() override; + //! Realigns property value and name indices with MaterialProperiesLayout by using m_propertyNames. Property names not found in the + //! MaterialPropertiesLayout are discarded, while property names not included in m_propertyNames will use the default value + //! from m_materialTypeAsset. + void RealignPropertyValuesAndNames(); + //! Called by asset creators to assign the asset to a ready state. void SetReady(); @@ -121,11 +126,20 @@ namespace AZ // MaterialReloadNotificationBus overrides... void OnMaterialTypeAssetReinitialized(const Data::Asset& materialTypeAsset) override; + static const char* s_debugTraceName; + Data::Asset m_materialTypeAsset; //! Holds values for each material property, used to initialize Material instances. //! This is indexed by MaterialPropertyIndex and aligns with entries in m_materialPropertiesLayout. AZStd::vector m_propertyValues; + //! This is used to realign m_propertyValues as well as itself with MaterialPropertiesLayout when not empty. + //! If empty, this implies that m_propertyValues is aligned with the entries in m_materialPropertiesLayout. + AZStd::vector m_propertyNames; + + //! A flag to determine if m_propertyValues needs to be aligned with MaterialPropertiesLayout. Set to true whenever + //! m_materialTypeAsset is reinitializing. + bool m_isDirty = true; }; diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialAssetCreator.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialAssetCreator.h index 44520cb549..862d98ce0c 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialAssetCreator.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialAssetCreator.h @@ -26,11 +26,13 @@ namespace AZ public: friend class MaterialSourceData; - void Begin(const Data::AssetId& assetId, MaterialAsset& parentMaterial); - void Begin(const Data::AssetId& assetId, MaterialTypeAsset& materialType); + void Begin(const Data::AssetId& assetId, MaterialAsset& parentMaterial, bool includeMaterialPropertyNames = true); + void Begin(const Data::AssetId& assetId, MaterialTypeAsset& materialType, bool includeMaterialPropertyNames = true); bool End(Data::Asset& result); private: + void PopulatePropertyNameList(); + const MaterialPropertiesLayout* m_materialPropertiesLayout = nullptr; }; } // namespace RPI diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MaterialAssetBuilderComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MaterialAssetBuilderComponent.cpp index ccbdc47f7e..4c2876dc0c 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MaterialAssetBuilderComponent.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MaterialAssetBuilderComponent.cpp @@ -78,7 +78,9 @@ namespace AZ AZStd::string materialTypePath; RPI::MaterialConverterBus::BroadcastResult(materialTypePath, &RPI::MaterialConverterBus::Events::GetMaterialTypePath); - if (conversionEnabled && !materialTypePath.empty()) + bool includeMaterialPropertyNames = true; + RPI::MaterialConverterBus::BroadcastResult(includeMaterialPropertyNames, &RPI::MaterialConverterBus::Events::ShouldIncludeMaterialPropertyNames); + if (conversionEnabled && !materialTypePath.empty() && !includeMaterialPropertyNames) { AssetBuilderSDK::SourceFileDependency materialTypeSource; materialTypeSource.m_sourceFileDependencyPath = materialTypePath; @@ -101,6 +103,10 @@ namespace AZ RPI::MaterialConverterBus::BroadcastResult(conversionEnabled, &RPI::MaterialConverterBus::Events::IsEnabled); fingerprintInfo.insert(AZStd::string::format("[MaterialConverter enabled=%d]", conversionEnabled)); + bool includeMaterialPropertyNames = true; + RPI::MaterialConverterBus::BroadcastResult(includeMaterialPropertyNames, &RPI::MaterialConverterBus::Events::ShouldIncludeMaterialPropertyNames); + fingerprintInfo.insert(AZStd::string::format("[MaterialConverter includeMaterialPropertyNames=%d]", includeMaterialPropertyNames)); + if (!conversionEnabled) { AZStd::string defaultMaterialPath; @@ -219,6 +225,8 @@ namespace AZ } } + bool includeMaterialPropertyNames = true; + RPI::MaterialConverterBus::BroadcastResult(includeMaterialPropertyNames, &RPI::MaterialConverterBus::Events::ShouldIncludeMaterialPropertyNames); // Build material assets. for (auto& itr : materialSourceDataByUid) { @@ -226,7 +234,7 @@ namespace AZ Data::AssetId assetId(sourceSceneUuid, GetMaterialAssetSubId(materialUid)); auto materialSourceData = itr.second; - Outcome> result = materialSourceData.m_data.CreateMaterialAsset(assetId, "", false); + Outcome> result = materialSourceData.m_data.CreateMaterialAsset(assetId, "", false, includeMaterialPropertyNames); if (result.IsSuccess()) { context.m_outputMaterialsByUid[materialUid] = { result.GetValue(), materialSourceData.m_name }; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Edit/Material/MaterialSourceData.cpp b/Gems/Atom/RPI/Code/Source/RPI.Edit/Material/MaterialSourceData.cpp index 9f980287cf..f697f33a3f 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Edit/Material/MaterialSourceData.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Edit/Material/MaterialSourceData.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -72,7 +73,7 @@ namespace AZ } } - Outcome > MaterialSourceData::CreateMaterialAsset(Data::AssetId assetId, AZStd::string_view materialSourceFilePath, bool elevateWarnings) const + Outcome > MaterialSourceData::CreateMaterialAsset(Data::AssetId assetId, AZStd::string_view materialSourceFilePath, bool elevateWarnings, bool includeMaterialPropertyNames) const { MaterialAssetCreator materialAssetCreator; materialAssetCreator.SetElevateWarnings(elevateWarnings); @@ -85,7 +86,7 @@ namespace AZ return Failure(); } - materialAssetCreator.Begin(assetId, *materialTypeAsset.GetValue().Get()); + materialAssetCreator.Begin(assetId, *materialTypeAsset.GetValue().Get(), includeMaterialPropertyNames); } else { @@ -115,7 +116,7 @@ namespace AZ } } - materialAssetCreator.Begin(assetId, *parentMaterialAsset.GetValue().Get()); + materialAssetCreator.Begin(assetId, *parentMaterialAsset.GetValue().Get(), includeMaterialPropertyNames); } for (auto& group : m_properties) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/AttachmentReadback.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/AttachmentReadback.cpp index 319cf85fe5..146c37fe1b 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/AttachmentReadback.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/AttachmentReadback.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -175,6 +176,11 @@ namespace AZ bool AttachmentReadback::ReadPassAttachment(const PassAttachment* attachment, const AZ::Name& readbackName) { + if (AZ::RHI::IsNullRenderer()) + { + return false; + } + if (!IsReady()) { AZ_Assert(false, "AttachmentReadback is not ready to readback an attachment"); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/MaterialAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/MaterialAsset.cpp index 1acb1c69a1..c3e0221192 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/MaterialAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/MaterialAsset.cpp @@ -20,6 +20,8 @@ namespace AZ { namespace RPI { + const char* MaterialAsset::s_debugTraceName = "MaterialAsset"; + const char* MaterialAsset::DisplayName = "MaterialAsset"; const char* MaterialAsset::Group = "Material"; const char* MaterialAsset::Extension = "azmaterial"; @@ -29,9 +31,10 @@ namespace AZ if (auto* serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(9) + ->Version(10) ->Field("materialTypeAsset", &MaterialAsset::m_materialTypeAsset) ->Field("propertyValues", &MaterialAsset::m_propertyValues) + ->Field("propertyNames", &MaterialAsset::m_propertyNames) ; } } @@ -99,6 +102,11 @@ namespace AZ AZStd::array_view MaterialAsset::GetPropertyValues() const { + if (!m_propertyNames.empty() && m_isDirty) + { + const_cast(this)->RealignPropertyValuesAndNames(); + } + return m_propertyValues; } @@ -146,6 +154,34 @@ namespace AZ } } + void MaterialAsset::RealignPropertyValuesAndNames() + { + const MaterialPropertiesLayout* propertyLayout = GetMaterialPropertiesLayout(); + AZStd::vector alignedPropertyValues(m_materialTypeAsset->GetDefaultPropertyValues().begin(), m_materialTypeAsset->GetDefaultPropertyValues().end()); + for (size_t i = 0; i < m_propertyNames.size(); ++i) + { + const MaterialPropertyIndex propertyIndex = propertyLayout->FindPropertyIndex(m_propertyNames[i]); + if (propertyIndex.IsValid()) + { + alignedPropertyValues[propertyIndex.GetIndex()] = m_propertyValues[i]; + } + else + { + AZ_Warning(s_debugTraceName, false, "Material property name \"%s\" is not found in the material properties layout and will not be used.", m_propertyNames[i].GetCStr()); + } + } + m_propertyValues.swap(alignedPropertyValues); + + const size_t propertyCount = propertyLayout->GetPropertyCount(); + m_propertyNames.resize(propertyCount); + for (size_t i = 0; i < propertyCount; ++i) + { + m_propertyNames[i] = propertyLayout->GetPropertyDescriptor(MaterialPropertyIndex{ i })->GetName(); + } + + m_isDirty = false; + } + void MaterialAsset::ReinitializeMaterialTypeAsset(Data::Asset asset) { Data::Asset newMaterialTypeAsset = { asset.GetAs(), AZ::Data::AssetLoadBehavior::PreLoad }; @@ -157,6 +193,8 @@ namespace AZ // This also covers the case where just the MaterialTypeAsset is reloaded and not the MaterialAsset. m_materialTypeAsset = newMaterialTypeAsset; + m_isDirty = true; + // Notify interested parties that this MaterialAsset is changed and may require other data to reinitialize as well MaterialReloadNotificationBus::Event(GetId(), &MaterialReloadNotifications::OnMaterialAssetReinitialized, Data::Asset{this, AZ::Data::AssetLoadBehavior::PreLoad}); } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/MaterialAssetCreator.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/MaterialAssetCreator.cpp index 8e401d2ee8..79d19c15a2 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/MaterialAssetCreator.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/MaterialAssetCreator.cpp @@ -16,7 +16,7 @@ namespace AZ { namespace RPI { - void MaterialAssetCreator::Begin(const Data::AssetId& assetId, MaterialAsset& parentMaterial) + void MaterialAssetCreator::Begin(const Data::AssetId& assetId, MaterialAsset& parentMaterial, bool includeMaterialPropertyNames) { BeginCommon(assetId); @@ -36,6 +36,10 @@ namespace AZ ReportError("MaterialPropertiesLayout is null"); return; } + if (includeMaterialPropertyNames) + { + PopulatePropertyNameList(); + } // Note we don't have to check the validity of these property values because the parent material's AssetCreator already did that. m_asset->m_propertyValues.assign(parentMaterial.GetPropertyValues().begin(), parentMaterial.GetPropertyValues().end()); @@ -52,14 +56,14 @@ namespace AZ } } - void MaterialAssetCreator::Begin(const Data::AssetId& assetId, MaterialTypeAsset& materialType) + void MaterialAssetCreator::Begin(const Data::AssetId& assetId, MaterialTypeAsset& materialType, bool includeMaterialPropertyNames) { BeginCommon(assetId); if (ValidateIsReady()) { m_asset->m_materialTypeAsset = { &materialType, AZ::Data::AssetLoadBehavior::PreLoad }; - + if (!m_asset->m_materialTypeAsset) { ReportError("MaterialTypeAsset is null"); @@ -67,6 +71,11 @@ namespace AZ } m_materialPropertiesLayout = m_asset->GetMaterialPropertiesLayout(); + if (includeMaterialPropertyNames) + { + PopulatePropertyNameList(); + } + if (!m_materialPropertiesLayout) { ReportError("MaterialPropertiesLayout is null"); @@ -101,5 +110,16 @@ namespace AZ m_asset->SetReady(); return EndCommon(result); } + + void MaterialAssetCreator::PopulatePropertyNameList() + { + for (int i = 0; i < m_materialPropertiesLayout->GetPropertyCount(); ++i) + { + MaterialPropertyIndex propertyIndex{ i }; + auto& propertyName = m_materialPropertiesLayout->GetPropertyDescriptor(propertyIndex)->GetName(); + m_asset->m_propertyNames.emplace_back(propertyName); + } + } + } // namespace RPI } // namespace AZ diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAssetCreator.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAssetCreator.cpp index b35c9e44fe..524ef9e910 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAssetCreator.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAssetCreator.cpp @@ -118,6 +118,12 @@ namespace AZ } } + const ModelMaterialSlotMap &sourceMaterialSlotMap = sourceAsset->GetMaterialSlots(); + for (const auto& sourceMaterialSlot : sourceMaterialSlotMap) + { + creator.AddMaterialSlot(sourceMaterialSlot.second); + } + return creator.End(clonedResult); } } // namespace RPI diff --git a/Gems/Atom/RPI/Tools/CMakeLists.txt b/Gems/Atom/RPI/Tools/CMakeLists.txt index 62ba4cfb09..5dacb73b0f 100644 --- a/Gems/Atom/RPI/Tools/CMakeLists.txt +++ b/Gems/Atom/RPI/Tools/CMakeLists.txt @@ -18,3 +18,6 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS) endif() endif() +ly_install_directory(DIRECTORIES . + EXCLUDE_PATTERNS tests +) diff --git a/Gems/Atom/Tools/MaterialEditor/Code/CMakeLists.txt b/Gems/Atom/Tools/MaterialEditor/Code/CMakeLists.txt index c83ca2bb19..6230217ac2 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/CMakeLists.txt +++ b/Gems/Atom/Tools/MaterialEditor/Code/CMakeLists.txt @@ -133,6 +133,9 @@ ly_add_target_dependencies( DEPENDENCIES_FILES tool_dependencies.cmake Source/Platform/${PAL_PLATFORM_NAME}/tool_dependencies_${PAL_PLATFORM_NAME_LOWERCASE}.cmake + # The Material Editor needs the LyShine "Tools" gem variant for the custom LyShine pass + DEPENDENT_TARGETS + Gem::LyShine.Tools ) # Inject the project path into the MaterialEditor VS debugger command arguments if the build system being invoked diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/CMakeLists.txt b/Gems/AtomLyIntegration/CommonFeatures/Code/CMakeLists.txt index 804a53ebed..df5ab134fa 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/CMakeLists.txt +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/CMakeLists.txt @@ -123,27 +123,10 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS) Gem::AtomLyIntegration_CommonFeatures.Editor Gem::GradientSignal.Tools ) - - # AtomLyIntergration_CommonFeatures gem targets are required as part of the Editor and AssetProcessor - # due to the AZ::Render::EditorDirectionalLightComponent, AZ::Render::EditorMeshComponent, - # AZ::Render::EditorGridComponent, AZ::Render::EditorHDRiSkyboxComponent, - # AZ::Render::EditorImageBasedLightComponent being saved as part of the DefaultLevel.prefab - ly_enable_gems(GEMS AtomLyIntegration_CommonFeatures VARIANTS Tools - TARGETS Editor) - ly_enable_gems(GEMS AtomLyIntegration_CommonFeatures VARIANTS Builders - TARGETS AssetBuilder AssetProcessor AssetProcessorBatch) endif() - -# Added dependencies to the Client and Server Launchers -get_property(LY_PROJECTS_TARGET_NAME GLOBAL PROPERTY LY_PROJECTS_TARGET_NAME) -foreach(project_name IN LISTS LY_PROJECTS_TARGET_NAME) - # Add gem as a dependency of the Clients Launcher - ly_enable_gems(PROJECT_NAME ${project_name} GEMS AtomLyIntegration_CommonFeatures VARIANTS Clients - TARGETS ${project_name}.GameLauncher) - # Add gem as a dependency of the Servers Launcher - if(PAL_TRAIT_BUILD_SERVER_SUPPORTED) - ly_enable_gems(PROJECT_NAME ${project_name} GEMS AtomLyIntegration_CommonFeatures VARIANTS Servers - TARGETS ${project_name}.ServerLauncher) - endif() -endforeach() +# AtomLyIntegration_CommonFeatures gem targets are required as part of the Editor and AssetProcessor +# due to the AZ::Render::EditorDirectionalLightComponent, AZ::Render::EditorMeshComponent, +# AZ::Render::EditorGridComponent, AZ::Render::EditorHDRiSkyboxComponent, +# AZ::Render::EditorImageBasedLightComponent being saved as part of the DefaultLevel.prefab +ly_enable_gems(GEMS AtomLyIntegration_CommonFeatures) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp index ade4beaa33..9e0c285001 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp @@ -578,15 +578,14 @@ namespace AZ { if (m_meshHandle.IsValid() && m_meshFeatureProcessor) { - Aabb aabb = m_meshFeatureProcessor->GetLocalAabb(m_meshHandle); - - aabb.MultiplyByScale(m_cachedNonUniformScale); - return aabb; - } - else - { - return Aabb::CreateNull(); + if (Aabb aabb = m_meshFeatureProcessor->GetLocalAabb(m_meshHandle); aabb.IsValid()) + { + aabb.MultiplyByScale(m_cachedNonUniformScale); + return aabb; + } } + + return Aabb::CreateNull(); } AzFramework::RenderGeometry::RayResult MeshComponentController::RenderGeometryIntersect( diff --git a/Gems/Blast/Code/Source/Family/DamageManager.h b/Gems/Blast/Code/Source/Family/DamageManager.h index f56bd7bbdf..4bffd8c5e0 100644 --- a/Gems/Blast/Code/Source/Family/DamageManager.h +++ b/Gems/Blast/Code/Source/Family/DamageManager.h @@ -10,6 +10,7 @@ #include #include #include +#include namespace Blast { diff --git a/Gems/Camera/Code/CMakeLists.txt b/Gems/Camera/Code/CMakeLists.txt index deb123824f..3fbeec0908 100644 --- a/Gems/Camera/Code/CMakeLists.txt +++ b/Gems/Camera/Code/CMakeLists.txt @@ -66,22 +66,7 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS) # tools and builders use the above module. ly_create_alias(NAME Camera.Tools NAMESPACE Gem TARGETS Gem::Camera.Editor) ly_create_alias(NAME Camera.Builders NAMESPACE Gem TARGETS Gem::Camera.Editor) - - # The DefaultPrefab contains an EditorCameraComponent which makes this gem required - ly_enable_gems(GEMS Camera VARIANTS Tools TARGETS Editor) - ly_enable_gems(GEMS Camera VARIANTS Builders TARGETS AssetBuilder AssetProcessor AssetProcessorBatch) endif() - -# Added dependencies to the Client and Server Launchers -get_property(LY_PROJECTS_TARGET_NAME GLOBAL PROPERTY LY_PROJECTS_TARGET_NAME) -foreach(project_name IN LISTS LY_PROJECTS_TARGET_NAME) - # Add gem as a dependency of the Clients Launcher - ly_enable_gems(PROJECT_NAME ${project_name} GEMS Camera VARIANTS Clients - TARGETS ${project_name}.GameLauncher) - # Add gem as a dependency of the Servers Launcher - if(PAL_TRAIT_BUILD_SERVER_SUPPORTED) - ly_enable_gems(PROJECT_NAME ${project_name} GEMS Camera VARIANTS Servers - TARGETS ${project_name}.ServerLauncher) - endif() -endforeach() +# The DefaultPrefab contains an EditorCameraComponent which makes this gem required +ly_enable_gems(GEMS Camera) diff --git a/Gems/InAppPurchases/Code/Source/Platform/Android/InAppPurchasesAndroid.cpp b/Gems/InAppPurchases/Code/Source/Platform/Android/InAppPurchasesAndroid.cpp index 5c8195235b..bd13e91dc6 100644 --- a/Gems/InAppPurchases/Code/Source/Platform/Android/InAppPurchasesAndroid.cpp +++ b/Gems/InAppPurchases/Code/Source/Platform/Android/InAppPurchasesAndroid.cpp @@ -250,7 +250,7 @@ namespace InAppPurchases document.Parse(fileBuffer.data()); if (document.HasParseError()) { - const char* errorStr = rapidjson::GetParseError_En(document.GetParseError()); + [[maybe_unused]] const char* errorStr = rapidjson::GetParseError_En(document.GetParseError()); AZ_TracePrintf("LumberyardInAppBilling", "Failed to parse product_ids.json: %s\n", errorStr); return; } diff --git a/Gems/LyShine/Code/CMakeLists.txt b/Gems/LyShine/Code/CMakeLists.txt index 93bf84c66e..f8c2ebfd07 100644 --- a/Gems/LyShine/Code/CMakeLists.txt +++ b/Gems/LyShine/Code/CMakeLists.txt @@ -29,7 +29,7 @@ ly_add_target( Gem::Atom_Utils.Static Gem::Atom_Bootstrap.Headers Gem::AtomFont - Gem::TextureAtlas + Gem::TextureAtlas ) ly_add_target( @@ -151,12 +151,11 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS) Gem::Atom_RPI.Public Gem::Atom_Utils.Static Gem::Atom_Bootstrap.Headers - ) + ) ly_add_target( NAME LyShine.Builders GEM_MODULE NAMESPACE Gem - OUTPUT_NAME Gem.LyShine.Builders FILES_CMAKE lyshine_common_module_files.cmake COMPILE_DEFINITIONS diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp index 51209c7f02..d677acea02 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp @@ -8,7 +8,7 @@ #include "EditorDefs.h" -#include "Resource.h" +#include "Editor/Resource.h" #include "UiEditorAnimationBus.h" #include "UiAnimViewCurveEditor.h" diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp index a9f76cd443..e6c2dda74c 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp @@ -15,7 +15,7 @@ // ----- End UI_ANIMATION_REVISIT #include "EditorDefs.h" -#include "Resource.h" +#include "Editor/Resource.h" #include "UiAnimViewDialog.h" diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp index 8672f539bf..9f67503b73 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp @@ -8,7 +8,7 @@ #include "EditorDefs.h" -#include "Resource.h" +#include "Editor/Resource.h" #include "UiEditorAnimationBus.h" #include "UiAnimViewDopeSheetBase.h" diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp index 472100b334..a3aa330dca 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp @@ -8,7 +8,7 @@ #include "EditorDefs.h" -#include "Resource.h" +#include "Editor/Resource.h" #include "UiEditorAnimationBus.h" #include "UiAnimViewNodes.h" #include "UiAnimViewDopeSheetBase.h" diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp index e071a3e631..61610e3c8e 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp @@ -9,7 +9,7 @@ #include "UiEditorAnimationBus.h" #include "EditorDefs.h" -#include "Resource.h" +#include "Editor/Resource.h" #include "UiAnimViewSequenceManager.h" #include "UiAnimViewSplineCtrl.h" #include "UiAnimViewSequence.h" diff --git a/Gems/LyShine/Code/Editor/EditorCommon.h b/Gems/LyShine/Code/Editor/EditorCommon.h index a13332b0fd..5a435e7dba 100644 --- a/Gems/LyShine/Code/Editor/EditorCommon.h +++ b/Gems/LyShine/Code/Editor/EditorCommon.h @@ -9,7 +9,6 @@ #include #include -#include #include #include #include diff --git a/Gems/LyShine/Code/Editor/GuideHelpers.cpp b/Gems/LyShine/Code/Editor/GuideHelpers.cpp index 7efbaf236f..eb5966568e 100644 --- a/Gems/LyShine/Code/Editor/GuideHelpers.cpp +++ b/Gems/LyShine/Code/Editor/GuideHelpers.cpp @@ -172,20 +172,23 @@ namespace GuideHelpers // the line is drawn as the inverse of the background color AZ::Color guideColor(1.0f, 1.0f, 1.0f, 1.0f); - int blendMode = GS_BLSRC_ONEMINUSDSTCOL|GS_BLDST_ZERO; + + CDraw2d::RenderState renderState; + renderState.m_blendState.m_blendSource = AZ::RHI::BlendFactor::ColorDestInverse; + renderState.m_blendState.m_blendDest = AZ::RHI::BlendFactor::Zero; // Draw the guide line if (guideIsVertical) { AZ::Vector2 start(viewportPoint.GetX(), 0); AZ::Vector2 end(viewportPoint.GetX(), viewportSize.GetY()); - draw2d.DrawLine(start, end, guideColor, blendMode); + draw2d.DrawLine(start, end, guideColor, IDraw2d::Rounding::Nearest, renderState); } else { AZ::Vector2 start(0, viewportPoint.GetY()); AZ::Vector2 end(viewportSize.GetX(), viewportPoint.GetY()); - draw2d.DrawLine(start, end, guideColor, blendMode); + draw2d.DrawLine(start, end, guideColor, IDraw2d::Rounding::Nearest, renderState); } } diff --git a/Gems/LyShine/Code/Editor/ViewportCanvasBackground.cpp b/Gems/LyShine/Code/Editor/ViewportCanvasBackground.cpp index 4cf2c0e6b4..668c4e8024 100644 --- a/Gems/LyShine/Code/Editor/ViewportCanvasBackground.cpp +++ b/Gems/LyShine/Code/Editor/ViewportCanvasBackground.cpp @@ -50,7 +50,7 @@ void ViewportCanvasBackground::Draw(Draw2dHelper& draw2d, const AZ::Vector2& can // now draw the same as Stretched but with UV's adjusted const AZ::Vector2 uvs[4] = { AZ::Vector2(0, 0), AZ::Vector2(uvScale.GetX(), 0), AZ::Vector2(uvScale.GetX(), uvScale.GetY()), AZ::Vector2(0, uvScale.GetY()) }; AZ::Color colorWhite(1.0f, 1.0f, 1.0f, 1.0f); - IDraw2d::VertexPosColUV verts[4]; + CDraw2d::VertexPosColUV verts[4]; for (int i = 0; i < 4; ++i) { verts[i].position = positions[i]; @@ -58,5 +58,5 @@ void ViewportCanvasBackground::Draw(Draw2dHelper& draw2d, const AZ::Vector2& can verts[i].uv = uvs[i]; } - m_canvasBackground->DrawImageTiled(draw2d, verts, 1.0f); + m_canvasBackground->DrawImageTiled(draw2d, verts); } diff --git a/Gems/LyShine/Code/Editor/ViewportIcon.cpp b/Gems/LyShine/Code/Editor/ViewportIcon.cpp index e3ad68922e..3f0fdfaba0 100644 --- a/Gems/LyShine/Code/Editor/ViewportIcon.cpp +++ b/Gems/LyShine/Code/Editor/ViewportIcon.cpp @@ -48,12 +48,11 @@ void ViewportIcon::DrawImageAligned(Draw2dHelper& draw2d, AZ::Vector2& pivot, fl opacity); } -void ViewportIcon::DrawImageTiled(Draw2dHelper& draw2d, IDraw2d::VertexPosColUV* verts, [[maybe_unused]] float opacity) +void ViewportIcon::DrawImageTiled(Draw2dHelper& draw2d, CDraw2d::VertexPosColUV* verts) { // Use default blending and rounding modes - int blendMode = GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA; IDraw2d::Rounding rounding = IDraw2d::Rounding::Nearest; - draw2d.DrawQuad(m_image, verts, blendMode, rounding); + draw2d.DrawQuad(m_image, verts, rounding); } void ViewportIcon::DrawAxisAlignedBoundingBox(Draw2dHelper& draw2d, AZ::Vector2 bound0, AZ::Vector2 bound1) @@ -64,7 +63,7 @@ void ViewportIcon::DrawAxisAlignedBoundingBox(Draw2dHelper& draw2d, AZ::Vector2 float endTexCoordU = fabsf((bound1.GetX() - bound0.GetX()) * pixelLengthForDottedLineTexture); float endTexCoordV = fabsf((bound1.GetY() - bound0.GetY()) * pixelLengthForDottedLineTexture); - IDraw2d::VertexPosColUV verts[2]; + CDraw2d::VertexPosColUV verts[2]; { verts[0].color = dottedColor; verts[1].color = dottedColor; @@ -159,7 +158,7 @@ void ViewportIcon::Draw(Draw2dHelper& draw2d, AZ::Vector2 anchorPos, const AZ::M AZ::Matrix4x4 moveFromPivotSpaceMat = AZ::Matrix4x4::CreateTranslation(pivot3); AZ::Matrix4x4 newTransform = transform * moveFromPivotSpaceMat * rotMat * moveToPivotSpaceMat; - IDraw2d::VertexPosColUV verts[4]; + CDraw2d::VertexPosColUV verts[4]; // points are a clockwise quad static const AZ::Vector2 uvs[4] = { AZ::Vector2(0.0f, 0.0f), AZ::Vector2(1.0f, 0.0f), AZ::Vector2(1.0f, 1.0f), AZ::Vector2(0.0f, 1.0f) @@ -252,7 +251,7 @@ void ViewportIcon::DrawDistanceLine(Draw2dHelper& draw2d, AZ::Vector2 start, AZ: const float pixelLengthForDottedLineTexture = 8.0f; float endTexCoordU = length / pixelLengthForDottedLineTexture; - IDraw2d::VertexPosColUV verts[2]; + CDraw2d::VertexPosColUV verts[2]; verts[0].position = start; verts[0].color = dottedColor; diff --git a/Gems/LyShine/Code/Editor/ViewportIcon.h b/Gems/LyShine/Code/Editor/ViewportIcon.h index c7391d9f46..f815b244e9 100644 --- a/Gems/LyShine/Code/Editor/ViewportIcon.h +++ b/Gems/LyShine/Code/Editor/ViewportIcon.h @@ -20,7 +20,7 @@ public: void DrawImageAligned(Draw2dHelper& draw2d, AZ::Vector2& pivot, float opacity); - void DrawImageTiled(Draw2dHelper& draw2d, IDraw2d::VertexPosColUV* verts, float opacity); + void DrawImageTiled(Draw2dHelper& draw2d, CDraw2d::VertexPosColUV* verts); void Draw(Draw2dHelper& draw2d, AZ::Vector2 anchorPos, const AZ::Matrix4x4& transform, float iconRot = 0.0f, AZ::Color color = AZ::Color(1.0f, 1.0f, 1.0f, 1.0f)) const; diff --git a/Gems/LyShine/Code/Include/LyShine/Draw2d.h b/Gems/LyShine/Code/Include/LyShine/Draw2d.h index d6e255f6f7..6c848a7f96 100644 --- a/Gems/LyShine/Code/Include/LyShine/Draw2d.h +++ b/Gems/LyShine/Code/Include/LyShine/Draw2d.h @@ -26,6 +26,65 @@ class CDraw2d : public IDraw2d // LYSHINE_ATOM_TODO - keep around until gEnv->pLyShine is replaced by bus interface , public AZ::Render::Bootstrap::NotificationBus::Handler { +public: // types + + struct RenderState + { + RenderState() + { + m_blendState.m_enable = true; + m_blendState.m_blendSource = AZ::RHI::BlendFactor::AlphaSource; + m_blendState.m_blendDest = AZ::RHI::BlendFactor::AlphaSourceInverse; + + m_depthState.m_enable = false; + } + + AZ::RHI::TargetBlendState m_blendState; + AZ::RHI::DepthState m_depthState; + }; + + //! Struct used to pass additional image options. + // + //! If this is not passed then the defaults are used + struct ImageOptions + { + AZ::Vector3 color = AZ::Vector3(1.0f, 1.0f, 1.0f); + Rounding pixelRounding = Rounding::Nearest; + RenderState m_renderState; + }; + + //! Struct used to pass additional text options - mostly ones that do not change from call to call. + // + //! If this is not passed then the defaults below are used + struct TextOptions + { + AZStd::string fontName; //!< default is "default" + unsigned int effectIndex; //!< default is 0 + AZ::Vector3 color; //!< default is (1,1,1) + HAlign horizontalAlignment; //!< default is HAlign::Left + VAlign verticalAlignment; //!< default is VAlign::Top + AZ::Vector2 dropShadowOffset; //!< default is (0,0), zero offset means no drop shadow is drawn + AZ::Color dropShadowColor; //!< default is (0,0,0,0), zero alpha means no drop shadow is drawn + float rotation; //!< default is 0 + bool depthTestEnabled; //!< default is false + }; + + //! Used to pass in arrays of vertices (e.g. to DrawQuad) + struct VertexPosColUV + { + VertexPosColUV() {} + VertexPosColUV(const AZ::Vector2& inPos, const AZ::Color& inColor, const AZ::Vector2& inUV) + { + position = inPos; + color = inColor; + uv = inUV; + } + + AZ::Vector2 position; //!< 2D position of vertex + AZ::Color color; //!< Float color + AZ::Vector2 uv; //!< Texture coordinate + }; + public: // member functions //! Constructor, constructed by the LyShine class @@ -81,40 +140,34 @@ public: // member functions // //! \param texId The texture ID returned by ITexture::GetTextureID() //! \param verts An array of 4 vertices, in clockwise order (e.g. top left, top right, bottom right, bottom left) - //! \param blendMode UseDefault means default blend mode (currently GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA) //! \param pixelRounding Whether and how to round pixel coordinates - //! \param baseState Additional render state to pass to or into value passed to renderer SetState + //! \param renderState Blend mode and depth state virtual void DrawQuad(AZ::Data::Instance image, VertexPosColUV* verts, - int blendMode = UseDefault, Rounding pixelRounding = Rounding::Nearest, - int baseState = UseDefault); + const RenderState& renderState = RenderState{}); //! Draw a line // //! \param start The start position //! \param end The end position //! \param color The color of the line - //! \param blendMode UseDefault means default blend mode (currently GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA) //! \param pixelRounding Whether and how to round pixel coordinates - //! \param baseState Additional render state to pass to or into value passed to renderer SetState + //! \param renderState Blend mode and depth state virtual void DrawLine(AZ::Vector2 start, AZ::Vector2 end, AZ::Color color, - int blendMode = UseDefault, IDraw2d::Rounding pixelRounding = IDraw2d::Rounding::Nearest, - int baseState = UseDefault); + const RenderState& renderState = RenderState{}); //! Draw a line with a texture so it can be dotted or dashed // //! \param texId The texture ID returned by ITexture::GetTextureID() //! \param verts An array of 2 vertices for the start and end points of the line - //! \param blendMode UseDefault means default blend mode (currently GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA) //! \param pixelRounding Whether and how to round pixel coordinates - //! \param baseState Additional render state to pass to or into value passed to renderer SetState + //! \param renderState Blend mode and depth state virtual void DrawLineTextured(AZ::Data::Instance image, VertexPosColUV* verts, - int blendMode = UseDefault, IDraw2d::Rounding pixelRounding = IDraw2d::Rounding::Nearest, - int baseState = UseDefault); + const RenderState& renderState = RenderState{}); //! Draw a text string. Only supports ASCII text. // //! The font and effect used to render the text are specified in the textOptions structure @@ -225,7 +278,7 @@ protected: // types and constants AZ::Vector2 m_texCoords[4]; uint32 m_packedColors[4]; AZ::Data::Instance m_image; - int m_state; + RenderState m_renderState; }; class DeferredLine @@ -241,7 +294,7 @@ protected: // types and constants AZ::Vector2 m_points[2]; AZ::Vector2 m_texCoords[2]; uint32 m_packedColors[2]; - int m_state; + RenderState m_renderState; }; class DeferredText @@ -286,7 +339,7 @@ protected: // member functions //! Helper function to render a text string void DrawTextInternal(const char* textString, AzFramework::FontId fontId, unsigned int effectIndex, AZ::Vector2 position, float pointSize, AZ::Color color, float rotation, - HAlign horizontalAlignment, VAlign verticalAlignment, int baseState); + HAlign horizontalAlignment, VAlign verticalAlignment, bool depthTestEnabled); //! Draw or defer a quad void DrawOrDeferQuad(const DeferredQuad* quad); @@ -397,39 +450,39 @@ public: // member functions //! Draw a textured quad where the position, color and uv of each point is specified explicitly // //! See IDraw2d:DrawQuad for parameter descriptions - void DrawQuad(AZ::Data::Instance image, IDraw2d::VertexPosColUV* verts, int blendMode = IDraw2d::UseDefault, + void DrawQuad(AZ::Data::Instance image, CDraw2d::VertexPosColUV* verts, IDraw2d::Rounding pixelRounding = IDraw2d::Rounding::Nearest, - int baseState = IDraw2d::UseDefault) + const CDraw2d::RenderState& renderState = CDraw2d::RenderState{}) { if (m_draw2d) { - m_draw2d->DrawQuad(image, verts, blendMode, pixelRounding, baseState); + m_draw2d->DrawQuad(image, verts, pixelRounding, renderState); } } //! Draw a line // //! See IDraw2d:DrawLine for parameter descriptions - void DrawLine(AZ::Vector2 start, AZ::Vector2 end, AZ::Color color, int blendMode = IDraw2d::UseDefault, + void DrawLine(AZ::Vector2 start, AZ::Vector2 end, AZ::Color color, IDraw2d::Rounding pixelRounding = IDraw2d::Rounding::Nearest, - int baseState = IDraw2d::UseDefault) + const CDraw2d::RenderState& renderState = CDraw2d::RenderState{}) { if (m_draw2d) { - m_draw2d->DrawLine(start, end, color, blendMode, pixelRounding, baseState); + m_draw2d->DrawLine(start, end, color, pixelRounding, renderState); } } //! Draw a line with a texture so it can be dotted or dashed // //! See IDraw2d:DrawLineTextured for parameter descriptions - void DrawLineTextured(AZ::Data::Instance image, IDraw2d::VertexPosColUV* verts, int blendMode = IDraw2d::UseDefault, + void DrawLineTextured(AZ::Data::Instance image, CDraw2d::VertexPosColUV* verts, IDraw2d::Rounding pixelRounding = IDraw2d::Rounding::Nearest, - int baseState = IDraw2d::UseDefault) + const CDraw2d::RenderState& renderState = CDraw2d::RenderState{}) { if (m_draw2d) { - m_draw2d->DrawLineTextured(image, verts, blendMode, pixelRounding, baseState); + m_draw2d->DrawLineTextured(image, verts, pixelRounding, renderState); } } @@ -478,7 +531,7 @@ public: // member functions // State management //! Set the blend mode used for images, default is GS_BLSRC_SRCALPHA|GS_BLDST_ONEMINUSSRCALPHA. - void SetImageBlendMode(int mode) { m_imageOptions.blendMode = mode; } + void SetImageBlendMode(const AZ::RHI::TargetBlendState& blendState) { m_imageOptions.m_renderState.m_blendState = blendState; } //! Set the color used for DrawImage and other image drawing. void SetImageColor(AZ::Vector3 color) { m_imageOptions.color = color; } @@ -487,7 +540,7 @@ public: // member functions void SetImagePixelRounding(IDraw2d::Rounding round) { m_imageOptions.pixelRounding = round; } //! Set the base state (that blend mode etc is combined with) used for images, default is GS_NODEPTHTEST. - void SetImageBaseState(int state) { m_imageOptions.baseState = state; } + void SetImageDepthState(const AZ::RHI::DepthState& depthState) { m_imageOptions.m_renderState.m_depthState = depthState; } //! Set the text font. void SetTextFont(AZStd::string_view fontName) { m_textOptions.fontName = fontName; } @@ -518,8 +571,11 @@ public: // member functions m_textOptions.rotation = rotation; } - //! Set the base state (that blend mode etc is combined with) used for text, default is GS_NODEPTHTEST. - void SetTextBaseState(int state) { m_textOptions.baseState = state; } + //! Set wheter to enable depth test for the text + void SetTextDepthTestEnabled(bool enabled) + { + m_textOptions.depthTestEnabled = enabled; + } public: // static member functions @@ -565,8 +621,8 @@ public: // static member functions protected: // attributes - IDraw2d::ImageOptions m_imageOptions; //!< image options are stored locally and updated by member functions - IDraw2d::TextOptions m_textOptions; //!< text options are stored locally and updated by member functions + CDraw2d::ImageOptions m_imageOptions; //!< image options are stored locally and updated by member functions + CDraw2d::TextOptions m_textOptions; //!< text options are stored locally and updated by member functions CDraw2d* m_draw2d; bool m_previousDeferCalls; }; diff --git a/Gems/LyShine/Code/Source/Draw2d.cpp b/Gems/LyShine/Code/Source/Draw2d.cpp index b4c8d58fae..b0539900e2 100644 --- a/Gems/LyShine/Code/Source/Draw2d.cpp +++ b/Gems/LyShine/Code/Source/Draw2d.cpp @@ -5,7 +5,6 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ -#include "IFont.h" #include // for SVF_P3F_C4B_T2F which will be removed in a coming PR #include @@ -23,9 +22,6 @@ #include #include -static const int g_defaultBlendState = GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA; -static const int g_defaultBaseState = GS_NODEPTHTEST; - //////////////////////////////////////////////////////////////////////////////////////////////////// // LOCAL STATIC FUNCTIONS //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -48,10 +44,6 @@ CDraw2d::CDraw2d(AZ::RPI::ViewportContextPtr viewportContext) { // These default options are set here and never change. They are stored so that if a null options // structure is passed into the draw functions then this default one can be used instead - m_defaultImageOptions.blendMode = g_defaultBlendState; - m_defaultImageOptions.color.Set(1.0f, 1.0f, 1.0f); - m_defaultImageOptions.pixelRounding = Rounding::Nearest; - m_defaultImageOptions.baseState = g_defaultBaseState; m_defaultTextOptions.fontName = "default"; m_defaultTextOptions.effectIndex = 0; @@ -61,7 +53,7 @@ CDraw2d::CDraw2d(AZ::RPI::ViewportContextPtr viewportContext) m_defaultTextOptions.dropShadowOffset.Set(0.0f, 0.0f); m_defaultTextOptions.dropShadowColor.Set(0.0f, 0.0f, 0.0f, 0.0f); m_defaultTextOptions.rotation = 0.0f; - m_defaultTextOptions.baseState = g_defaultBaseState; + m_defaultTextOptions.depthTestEnabled = false; AZ::Render::Bootstrap::NotificationBus::Handler::BusConnect(); } @@ -112,7 +104,8 @@ void CDraw2d::OnBootstrapSceneReady([[maybe_unused]] AZ::RPI::Scene* bootstrapSc {"COLOR", AZ::RHI::Format::B8G8R8A8_UNORM}, {"TEXCOORD0", AZ::RHI::Format::R32G32_FLOAT} }); m_dynamicDraw->AddDrawStateOptions(AZ::RPI::DynamicDrawContext::DrawStateOptions::PrimitiveType - | AZ::RPI::DynamicDrawContext::DrawStateOptions::BlendMode); + | AZ::RPI::DynamicDrawContext::DrawStateOptions::BlendMode + | AZ::RPI::DynamicDrawContext::DrawStateOptions::DepthState); if (uiCanvasPass) { m_dynamicDraw->SetOutputScope(uiCanvasPass); @@ -124,12 +117,6 @@ void CDraw2d::OnBootstrapSceneReady([[maybe_unused]] AZ::RPI::Scene* bootstrapSc } m_dynamicDraw->EndInit(); - AZ::RHI::TargetBlendState targetBlendState; - targetBlendState.m_enable = true; - targetBlendState.m_blendSource = AZ::RHI::BlendFactor::AlphaSource; - targetBlendState.m_blendDest = AZ::RHI::BlendFactor::AlphaSourceInverse; - m_dynamicDraw->SetTarget0BlendState(targetBlendState); - // Cache draw srg input indices for later use static const char textureIndexName[] = "m_texture"; static const char worldToProjIndexName[] = "m_worldToProj"; @@ -154,8 +141,6 @@ void CDraw2d::DrawImage(AZ::Data::Instance image, AZ::Vector2 po AZ::Color color = AZ::Color::CreateFromVector3AndFloat(actualImageOptions->color, opacity); AZ::u32 packedColor = PackARGB8888(color); - int blendMode = actualImageOptions->blendMode; - // Depending on the requested pixel rounding setting we may round position to an exact pixel AZ::Vector2 pos = Draw2dHelper::RoundXY(position, actualImageOptions->pixelRounding); @@ -189,7 +174,7 @@ void CDraw2d::DrawImage(AZ::Data::Instance image, AZ::Vector2 po quad.m_image = image; // add the blendMode flags to the base state - quad.m_state = blendMode | actualImageOptions->baseState; + quad.m_renderState = actualImageOptions->m_renderState; // apply rotation if requested if (rotation != 0.0f) @@ -212,11 +197,9 @@ void CDraw2d::DrawImageAligned(AZ::Data::Instance image, AZ::Vec } //////////////////////////////////////////////////////////////////////////////////////////////////// -void CDraw2d::DrawQuad(AZ::Data::Instance image, VertexPosColUV* verts, int blendMode, Rounding pixelRounding, int baseState) +void CDraw2d::DrawQuad(AZ::Data::Instance image, VertexPosColUV* verts, Rounding pixelRounding, + const CDraw2d::RenderState& renderState) { - int actualBlendMode = (blendMode == -1) ? g_defaultBlendState : blendMode; - int actualBaseState = (baseState == -1) ? g_defaultBaseState : baseState; - // define quad DeferredQuad quad; for (int i = 0; i < 4; ++i) @@ -228,20 +211,17 @@ void CDraw2d::DrawQuad(AZ::Data::Instance image, VertexPosColUV* quad.m_image = image; // add the blendMode flags to the base state - quad.m_state = actualBlendMode | actualBaseState; + quad.m_renderState = renderState; DrawOrDeferQuad(&quad); } //////////////////////////////////////////////////////////////////////////////////////////////////// -void CDraw2d::DrawLine(AZ::Vector2 start, AZ::Vector2 end, AZ::Color color, int blendMode, Rounding pixelRounding, int baseState) +void CDraw2d::DrawLine(AZ::Vector2 start, AZ::Vector2 end, AZ::Color color, Rounding pixelRounding, + const CDraw2d::RenderState& renderState) { - int actualBaseState = (baseState == -1) ? g_defaultBaseState : baseState; - auto image = AZ::RPI::ImageSystemInterface::Get()->GetSystemImage(AZ::RPI::SystemImage::White); - int actualBlendMode = (blendMode == -1) ? g_defaultBlendState : blendMode; - // define line uint32 packedColor = PackARGB8888(color); @@ -258,19 +238,16 @@ void CDraw2d::DrawLine(AZ::Vector2 start, AZ::Vector2 end, AZ::Color color, int line.m_packedColors[1] = packedColor; // add the blendMode flags to the base state - line.m_state = actualBlendMode | actualBaseState; + line.m_renderState = renderState; DrawOrDeferLine(&line); } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// -void CDraw2d::DrawLineTextured(AZ::Data::Instance image, VertexPosColUV* verts, int blendMode, Rounding pixelRounding, int baseState) +void CDraw2d::DrawLineTextured(AZ::Data::Instance image, VertexPosColUV* verts, Rounding pixelRounding, + const CDraw2d::RenderState& renderState) { - int actualBaseState = (baseState == -1) ? g_defaultBaseState : baseState; - - int actualBlendMode = (blendMode == -1) ? g_defaultBlendState : blendMode; - // define line DeferredLine line; line.m_image = image; @@ -283,7 +260,7 @@ void CDraw2d::DrawLineTextured(AZ::Data::Instance image, VertexP } // add the blendMode flags to the base state - line.m_state = actualBlendMode | actualBaseState; + line.m_renderState = renderState; DrawOrDeferLine(&line); } @@ -313,7 +290,7 @@ void CDraw2d::DrawText(const char* textString, AZ::Vector2 position, float point dropShadowPosition, pointSize, actualTextOptions->dropShadowColor, actualTextOptions->rotation, actualTextOptions->horizontalAlignment, actualTextOptions->verticalAlignment, - actualTextOptions->baseState); + actualTextOptions->depthTestEnabled); } // draw the text string @@ -322,7 +299,7 @@ void CDraw2d::DrawText(const char* textString, AZ::Vector2 position, float point position, pointSize, textColor, actualTextOptions->rotation, actualTextOptions->horizontalAlignment, actualTextOptions->verticalAlignment, - actualTextOptions->baseState); + actualTextOptions->depthTestEnabled); } void CDraw2d::DrawRectOutlineTextured(AZ::Data::Instance image, @@ -594,7 +571,7 @@ void CDraw2d::RotatePointsAboutPivot(AZ::Vector2* points, [[maybe_unused]] int n //////////////////////////////////////////////////////////////////////////////////////////////////// void CDraw2d::DrawTextInternal(const char* textString, AzFramework::FontId fontId, unsigned int effectIndex, AZ::Vector2 position, float pointSize, AZ::Color color, float rotation, - HAlign horizontalAlignment, VAlign verticalAlignment, [[maybe_unused]] int baseState) + HAlign horizontalAlignment, VAlign verticalAlignment, bool depthTestEnabled) { // FFont.cpp uses the alpha value of the color to decide whether to use the color, if the alpha value is zero // (in a ColorB format) then the color set via SetColor is ignored and it usually ends up drawing with an alpha of 1. @@ -651,7 +628,7 @@ void CDraw2d::DrawTextInternal(const char* textString, AzFramework::FontId fontI drawParams.m_hAlign = hAlignment; drawParams.m_vAlign = vAlignment; drawParams.m_monospace = false; - drawParams.m_depthTest = false; + drawParams.m_depthTest = depthTestEnabled; drawParams.m_virtual800x600ScreenSize = false; drawParams.m_scaleWithWindow = false; drawParams.m_multiline = true; @@ -809,6 +786,8 @@ void CDraw2d::DeferredQuad::Draw(AZ::RHI::Ptr dynam // Add the primitive to the dynamic draw context for drawing dynamicDraw->SetPrimitiveType(AZ::RHI::PrimitiveTopology::TriangleList); + dynamicDraw->SetDepthState(m_renderState.m_depthState); + dynamicDraw->SetTarget0BlendState(m_renderState.m_blendState); dynamicDraw->DrawLinear(vertices, NUM_VERTS, drawSrg); } @@ -868,6 +847,8 @@ void CDraw2d::DeferredLine::Draw(AZ::RHI::Ptr dynam // Add the primitive to the dynamic draw context for drawing dynamicDraw->SetPrimitiveType(AZ::RHI::PrimitiveTopology::LineList); + dynamicDraw->SetDepthState(m_renderState.m_depthState); + dynamicDraw->SetTarget0BlendState(m_renderState.m_blendState); dynamicDraw->DrawLinear(vertices, NUM_VERTS, drawSrg); } @@ -966,4 +947,3 @@ void CDraw2d::DeferredText::Draw([[maybe_unused]] AZ::RHI::Ptr #include @@ -51,7 +50,7 @@ static const int g_numColors = 8; "black" }; -static AZ::Vector3 g_colorVec3[g_numColors] = +[[maybe_unused]] static AZ::Vector3 g_colorVec3[g_numColors] = { AZ::Vector3(1.0f, 1.0f, 1.0f), AZ::Vector3(1.0f, 0.0f, 0.0f), @@ -64,34 +63,34 @@ static AZ::Vector3 g_colorVec3[g_numColors] = }; static const int g_numSrcBlendModes = 11; -[[maybe_unused]] static int g_srcBlendModes[g_numSrcBlendModes] = +[[maybe_unused]] static AZ::RHI::BlendFactor g_srcBlendModes[g_numSrcBlendModes] = { - GS_BLSRC_ZERO, - GS_BLSRC_ONE, - GS_BLSRC_DSTCOL, - GS_BLSRC_ONEMINUSDSTCOL, - GS_BLSRC_SRCALPHA, - GS_BLSRC_ONEMINUSSRCALPHA, - GS_BLSRC_DSTALPHA, - GS_BLSRC_ONEMINUSDSTALPHA, - GS_BLSRC_ALPHASATURATE, - GS_BLSRC_SRCALPHA_A_ZERO, // separate alpha blend state - GS_BLSRC_SRC1ALPHA, // dual source blending + AZ::RHI::BlendFactor::Zero, + AZ::RHI::BlendFactor::One, + AZ::RHI::BlendFactor::ColorDest, + AZ::RHI::BlendFactor::ColorDestInverse, + AZ::RHI::BlendFactor::AlphaSource, + AZ::RHI::BlendFactor::AlphaSourceInverse, + AZ::RHI::BlendFactor::AlphaDest, + AZ::RHI::BlendFactor::AlphaDestInverse, + AZ::RHI::BlendFactor::AlphaSourceSaturate, + AZ::RHI::BlendFactor::Factor, + AZ::RHI::BlendFactor::AlphaSource1 }; static const int g_numDstBlendModes = 10; -[[maybe_unused]] static int g_dstBlendModes[g_numDstBlendModes] = +[[maybe_unused]] static AZ::RHI::BlendFactor g_dstBlendModes[g_numDstBlendModes] = { - GS_BLDST_ZERO, - GS_BLDST_ONE, - GS_BLDST_SRCCOL, - GS_BLDST_ONEMINUSSRCCOL, - GS_BLDST_SRCALPHA, - GS_BLDST_ONEMINUSSRCALPHA, - GS_BLDST_DSTALPHA, - GS_BLDST_ONEMINUSDSTALPHA, - GS_BLDST_ONE_A_ZERO, // separate alpha blend state - GS_BLDST_ONEMINUSSRC1ALPHA, // dual source blending + AZ::RHI::BlendFactor::Zero, + AZ::RHI::BlendFactor::One, + AZ::RHI::BlendFactor::ColorSource, + AZ::RHI::BlendFactor::ColorSourceInverse, + AZ::RHI::BlendFactor::AlphaSource, + AZ::RHI::BlendFactor::AlphaSourceInverse, + AZ::RHI::BlendFactor::AlphaDest, + AZ::RHI::BlendFactor::AlphaDestInverse, + AZ::RHI::BlendFactor::FactorInverse, + AZ::RHI::BlendFactor::AlphaSource1Inverse }; [[maybe_unused]] static bool g_deferDrawsToEndOfFrame = false; @@ -378,7 +377,7 @@ static void DebugDrawColoredBox(AZ::Vector2 pos, AZ::Vector2 size, AZ::Color col { CDraw2d* draw2d = Draw2dHelper::GetDefaultDraw2d(); - IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); + CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); imageOptions.color = color.GetAsVector3(); auto whiteTexture = AZ::RPI::ImageSystemInterface::Get()->GetSystemImage(AZ::RPI::SystemImage::White); draw2d->DrawImageAligned(whiteTexture, pos, size, horizontalAlignment, verticalAlignment, @@ -393,7 +392,7 @@ static void DebugDrawStringWithSizeBox(AZStd::string_view font, unsigned int eff { CDraw2d* draw2d = Draw2dHelper::GetDefaultDraw2d(); - IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); + CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); if (!font.empty()) { textOptions.fontName = font; @@ -619,7 +618,7 @@ static AZ::Vector2 DebugDrawFontColorTestBox(AZ::Vector2 pos, const char* string float pointSize = 32.0f; const float spacing = 6.0f; - IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); + CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); textOptions.effectIndex = 1; // no drop shadow baked in textOptions.color = color; @@ -743,7 +742,7 @@ static void DebugDraw2dImageColor() AZ::Data::Instance texture = GetMonoAlphaTestTexture(); - IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); + CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); draw2d->DrawText( "Testing image colors, image is black and white, top row is opacity=1, bottom row is opacity = 0.5", @@ -781,7 +780,7 @@ static void DebugDraw2dImageBlendMode() AZ::Data::Instance texture = GetColorAlphaTestTexture(); - IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); + CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); draw2d->DrawText("Testing blend modes, src blend changes across x-axis, dst blend changes across y axis", AZ::Vector2(20, 20), 16); @@ -802,7 +801,7 @@ static void DebugDraw2dImageBlendMode() AZ::Vector2 pos(xStart + xSpacing * srcIndex, yStart + ySpacing * dstIndex); // first draw a background with varying color and alpha - IDraw2d::VertexPosColUV verts[4] = + CDraw2d::VertexPosColUV verts[4] = { { // top left AZ::Vector2(pos.GetX(), pos.GetY()), @@ -829,7 +828,9 @@ static void DebugDraw2dImageBlendMode() // Draw the image with this color - imageOptions.blendMode = g_srcBlendModes[srcIndex] | g_dstBlendModes[dstIndex]; + CDraw2d::RenderState renderState; + renderState.m_blendState.m_blendSource = g_srcBlendModes[srcIndex]; + renderState.m_blendState.m_blendDest = g_dstBlendModes[dstIndex]; draw2d->DrawImage(texture, pos, size, 1.0f, 0.0f, 0, 0, &imageOptions); } } @@ -844,7 +845,7 @@ static void DebugDraw2dImageUVs() AZ::Data::Instance texture = GetColorTestTexture(); - IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); + CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); draw2d->DrawText( "Testing DrawImage with minMaxTexCoords. Full image, top left quadrant, middle section, full flipped", @@ -893,7 +894,7 @@ static void DebugDraw2dImagePixelRounding() AZ::Data::Instance texture = GetColorTestTexture(); - IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); + CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); draw2d->DrawText("Testing DrawImage pixel rounding options", AZ::Vector2(20, 20), 16); @@ -932,7 +933,7 @@ static void DebugDraw2dLineBasic() { CDraw2d* draw2d = Draw2dHelper::GetDefaultDraw2d(); - IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); + CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions(); draw2d->DrawText("Testing DrawLine", AZ::Vector2(20, 20), 16); diff --git a/Gems/LyShine/Code/Source/RenderGraph.cpp b/Gems/LyShine/Code/Source/RenderGraph.cpp index 7ecda5eee3..567c29eecd 100644 --- a/Gems/LyShine/Code/Source/RenderGraph.cpp +++ b/Gems/LyShine/Code/Source/RenderGraph.cpp @@ -38,7 +38,7 @@ namespace LyShine //////////////////////////////////////////////////////////////////////////////////////////////////// PrimitiveListRenderNode::PrimitiveListRenderNode(const AZ::Data::Instance& texture, - bool isClampTextureMode, bool isTextureSRGB, bool preMultiplyAlpha, int blendModeState) + bool isClampTextureMode, bool isTextureSRGB, bool preMultiplyAlpha, const AZ::RHI::TargetBlendState& blendModeState) : RenderNode(RenderNodeType::PrimitiveList) , m_numTextures(1) , m_isTextureSRGB(isTextureSRGB) @@ -55,7 +55,7 @@ namespace LyShine //////////////////////////////////////////////////////////////////////////////////////////////////// PrimitiveListRenderNode::PrimitiveListRenderNode(const AZ::Data::Instance& texture, const AZ::Data::Instance& maskTexture, bool isClampTextureMode, bool isTextureSRGB, - bool preMultiplyAlpha, AlphaMaskType alphaMaskType, int blendModeState) + bool preMultiplyAlpha, AlphaMaskType alphaMaskType, const AZ::RHI::TargetBlendState& blendModeState) : RenderNode(RenderNodeType::PrimitiveList) , m_numTextures(2) , m_isTextureSRGB(isTextureSRGB) @@ -102,9 +102,16 @@ namespace LyShine const UiRenderer::UiShaderData& uiShaderData = uiRenderer->GetUiShaderData(); - // Set render state dynamicDraw->SetStencilState(uiRenderer->GetBaseState().m_stencilState); - dynamicDraw->SetTarget0BlendState(uiRenderer->GetBaseState().m_blendState); + + // The blend factor and op is stored in m_blendModeState when the primitive is added to the graph. + // That is also when the graph determines whether a new primitive list node is needed. + // The rest of the blend properties are assigned during the render calls, so they get merged here + // and all are passed to the dynamic draw context + AZ::RHI::TargetBlendState targetBlendState = m_blendModeState; + targetBlendState.m_enable = uiRenderer->GetBaseState().m_blendStateEnabled; + targetBlendState.m_writeMask = uiRenderer->GetBaseState().m_blendStateWriteMask; + dynamicDraw->SetTarget0BlendState(targetBlendState); dynamicDraw->SetShaderVariant(uiRenderer->GetCurrentShaderVariant()); @@ -354,13 +361,13 @@ namespace LyShine // if either of the draw flags are checked then we may want to draw the renderable component(s) // on this element, otherwise use the color mask to stop them rendering - curBaseState.m_blendState.m_enable = false; - curBaseState.m_blendState.m_writeMask = 0x0; + curBaseState.m_blendStateEnabled = false; + curBaseState.m_blendStateWriteMask = 0x0; if ((m_drawBehind && firstPass) || (m_drawInFront && !firstPass)) { - curBaseState.m_blendState.m_enable = true; - curBaseState.m_blendState.m_writeMask = 0xF; + curBaseState.m_blendStateEnabled = true; + curBaseState.m_blendStateWriteMask = 0xF; } if (m_isMaskingEnabled) @@ -507,19 +514,10 @@ namespace LyShine if (m_dynamicDraw) { - UiRenderer::BaseState priorBaseState = uiRenderer->GetBaseState(); - - UiRenderer::BaseState curBaseState = priorBaseState; - curBaseState.m_blendState.m_blendAlphaSource = AZ::RHI::BlendFactor::One; - curBaseState.m_blendState.m_blendAlphaDest = AZ::RHI::BlendFactor::AlphaSource1Inverse; - uiRenderer->SetBaseState(curBaseState); - for (RenderNode* renderNode : m_childRenderNodes) { renderNode->Render(uiRenderer, m_modelViewProjMat, m_dynamicDraw); } - - uiRenderer->SetBaseState(priorBaseState); } else { @@ -722,7 +720,7 @@ namespace LyShine // The shader can be outputing premultiplied alpha EITHER if the input texture is premultiplied alpha OR if the // shader is doing the premultiply of the output color bool isShaderOutputPremultAlpha = isPreMultiplyAlpha || isTexturePremultipliedAlpha; - int blendModeState = GetBlendModeState(blendMode, isShaderOutputPremultAlpha); + AZ::RHI::TargetBlendState blendModeState = GetBlendModeState(blendMode, isShaderOutputPremultAlpha); PrimitiveListRenderNode* renderNodeToAddTo = nullptr; if (!renderNodeList->empty()) @@ -801,7 +799,7 @@ namespace LyShine // The shader can be outputing premultiplied alpha EITHER if the input texture is premultiplied alpha OR if the // shader is doing the premultiply of the output color bool isShaderOutputPremultAlpha = isPreMultiplyAlpha || isTexturePremultipliedAlpha; - int blendModeState = GetBlendModeState(blendMode, isShaderOutputPremultAlpha); + AZ::RHI::TargetBlendState blendModeState = GetBlendModeState(blendMode, isShaderOutputPremultAlpha); AlphaMaskType alphaMaskType = isShaderOutputPremultAlpha ? AlphaMaskType::ModulateAlphaAndColor : AlphaMaskType::ModulateAlpha; PrimitiveListRenderNode* renderNodeToAddTo = nullptr; @@ -947,9 +945,12 @@ namespace LyShine { AZ::RHI::Ptr dynamicDraw = uiRenderer->GetDynamicDrawContext(); - // Disable stencil and enable blend/color write + // Reset stencil and blend mode to defaults (disable stencil and enable blend/color write) dynamicDraw->SetStencilState(uiRenderer->GetBaseState().m_stencilState); - dynamicDraw->SetTarget0BlendState(uiRenderer->GetBaseState().m_blendState); + AZ::RHI::TargetBlendState defaultBlendModeState = GetBlendModeState(LyShine::BlendMode::Normal, false); + defaultBlendModeState.m_enable = uiRenderer->GetBaseState().m_blendStateEnabled; + defaultBlendModeState.m_writeMask = uiRenderer->GetBaseState().m_blendStateWriteMask; + dynamicDraw->SetTarget0BlendState(defaultBlendModeState); // First render the render targets, they are sorted so that more deeply nested ones are rendered first. // They only need to be rendered the first time that a render graph is rendered after it has been built. @@ -1169,7 +1170,7 @@ namespace LyShine if (prevPrimListNode) { - if (prevPrimListNode->GetBlendModeState() != primListRenderNode->GetBlendModeState()) + if (!(prevPrimListNode->GetBlendModeState() == primListRenderNode->GetBlendModeState())) { ++info.m_numNodesDueToBlendMode; } @@ -1346,8 +1347,9 @@ namespace LyShine } // Write heading to logfile for this render node - logLine = AZStd::string::format("%sPrimitive render node (Blend mode=%d, SRGB=%d). NumPrims=%d, NumTris=%d. Using textures:\r\n", - indent.c_str(), primListRenderNode->GetBlendModeState(), + AZ::RHI::TargetBlendState blendMode = primListRenderNode->GetBlendModeState(); + logLine = AZStd::string::format("%sPrimitive render node (Blend mode=%s, SRGB=%d). NumPrims=%d, NumTris=%d. Using textures:\r\n", + indent.c_str(), blendMode.m_enable ? "enabled" : "disabled", static_cast(primListRenderNode->GetIsTextureSRGB()), numPrimitives, numTriangles); AZ::IO::LocalFileIO::GetInstance()->Write(fileHandle, logLine.c_str(), logLine.size()); @@ -1415,8 +1417,9 @@ namespace LyShine #endif //////////////////////////////////////////////////////////////////////////////////////////////////// - int RenderGraph::GetBlendModeState(LyShine::BlendMode blendMode, bool isShaderOutputPremultAlpha) const - { + AZ::RHI::TargetBlendState RenderGraph::GetBlendModeState(LyShine::BlendMode blendMode, [[maybe_unused]] bool isShaderOutputPremultAlpha) const + { + // LYSHINE_ATOM_TODO - remove "premultiplyAlpha" parameter and clean up related comments as I think it's no longer needed // Our blend modes are complicated by the fact we want to be able to render to a render target and then // render from that render target texture to the back buffer and get the same result as if we rendered // directly to the back buffer. This should be true even if the render target texture does not end up @@ -1443,72 +1446,47 @@ namespace LyShine // properly might require shader changes also. For the moment using the blend modes Screen, Darken, Lighten // is not encouraged, especially when rendering to a render target. - int flags = GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA; // the default + AZ::RHI::TargetBlendState blendState; + blendState.m_blendAlphaSource = AZ::RHI::BlendFactor::One; + blendState.m_blendAlphaDest = AZ::RHI::BlendFactor::AlphaSourceInverse; + switch (blendMode) { case LyShine::BlendMode::Normal: // This is the default mode that does an alpha blend by interpolating based on src alpha - if (isShaderOutputPremultAlpha) - { - flags = GS_BLSRC_ONE | GS_BLDST_ONEMINUSSRCALPHA; - } - else - { - flags = GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA; - } + blendState.m_blendSource = AZ::RHI::BlendFactor::AlphaSource; + blendState.m_blendDest = AZ::RHI::BlendFactor::AlphaSourceInverse; break; case LyShine::BlendMode::Add: // This works well, the amount of the src color added is controlled by src alpha - if (isShaderOutputPremultAlpha) - { - flags = GS_BLSRC_ONE | GS_BLDST_ONE; - } - else - { - flags = GS_BLSRC_SRCALPHA | GS_BLDST_ONE; - } + blendState.m_blendSource = AZ::RHI::BlendFactor::AlphaSource; + blendState.m_blendDest = AZ::RHI::BlendFactor::One; break; case LyShine::BlendMode::Screen: // This is a poor approximation of the PhotoShop Screen mode but trying to take some account of src alpha // In Photoshop this would be 1 - ( (1-SrcColor) * (1-DstColor) ) // So we should use a blend op of multiply but the IRenderer interface doesn't support that. We get some multiply // from GS_BLDST_ONEMINUSSRCCOL which multiplies the DstColor by (1-SrcColor) - if (isShaderOutputPremultAlpha) - { - flags = GS_BLSRC_ONE | GS_BLDST_ONEMINUSSRCCOL; - } - else - { - flags = GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCCOL; - } + blendState.m_blendSource = AZ::RHI::BlendFactor::AlphaSource; + blendState.m_blendDest = AZ::RHI::BlendFactor::ColorSourceInverse; break; case LyShine::BlendMode::Darken: // This is a poor approximation of the PhotoShop Darken mode but trying to take some account of src alpha // In Photoshop Darken means min(SrcColor, DstColor) - if (isShaderOutputPremultAlpha) - { - flags = GS_BLOP_MIN | GS_BLSRC_ONE | GS_BLDST_ONE | GS_BLALPHA_MAX; - } - else - { - flags = GS_BLOP_MIN | GS_BLSRC_ONEMINUSSRCALPHA | GS_BLDST_ONE; - } + blendState.m_blendSource = AZ::RHI::BlendFactor::AlphaSourceInverse; + blendState.m_blendDest = AZ::RHI::BlendFactor::One; + blendState.m_blendOp = AZ::RHI::BlendOp::Minimum; break; case LyShine::BlendMode::Lighten: // This is a pretty good an approximation of the PhotoShop Lighten mode but trying to take some account of src alpha // In PhotoShop Lighten means max(SrcColor, DstColor) - if (isShaderOutputPremultAlpha) - { - flags = GS_BLOP_MAX | GS_BLSRC_ONE| GS_BLDST_ONE; - } - else - { - flags = GS_BLOP_MAX | GS_BLSRC_SRCALPHA | GS_BLDST_ONE; - } + blendState.m_blendSource = AZ::RHI::BlendFactor::AlphaSource; + blendState.m_blendDest = AZ::RHI::BlendFactor::One; + blendState.m_blendOp = AZ::RHI::BlendOp::Maximum; break; } - return flags; + return blendState; } void RenderGraph::SetRttPassesEnabled(UiRenderer* uiRenderer, bool enabled) diff --git a/Gems/LyShine/Code/Source/RenderGraph.h b/Gems/LyShine/Code/Source/RenderGraph.h index a7ef0919c6..9edc1f50e8 100644 --- a/Gems/LyShine/Code/Source/RenderGraph.h +++ b/Gems/LyShine/Code/Source/RenderGraph.h @@ -71,9 +71,9 @@ namespace LyShine // We use a pool allocator to keep these allocations fast. AZ_CLASS_ALLOCATOR(PrimitiveListRenderNode, AZ::PoolAllocator, 0); - PrimitiveListRenderNode(const AZ::Data::Instance& texture, bool isClampTextureMode, bool isTextureSRGB, bool preMultiplyAlpha, int blendModeState); + PrimitiveListRenderNode(const AZ::Data::Instance& texture, bool isClampTextureMode, bool isTextureSRGB, bool preMultiplyAlpha, const AZ::RHI::TargetBlendState& blendModeState); PrimitiveListRenderNode(const AZ::Data::Instance& texture, const AZ::Data::Instance& maskTexture, - bool isClampTextureMode, bool isTextureSRGB, bool preMultiplyAlpha, AlphaMaskType alphaMaskType, int blendModeState); + bool isClampTextureMode, bool isTextureSRGB, bool preMultiplyAlpha, AlphaMaskType alphaMaskType, const AZ::RHI::TargetBlendState& blendModeState); ~PrimitiveListRenderNode() override; void Render(UiRenderer* uiRenderer , const AZ::Matrix4x4& modelViewProjMat @@ -88,7 +88,7 @@ namespace LyShine bool GetTextureIsClampMode(int texIndex) const { return m_textures[texIndex].m_isClampTextureMode; } bool GetIsTextureSRGB() const { return m_isTextureSRGB; } - int GetBlendModeState() const { return m_blendModeState; } + AZ::RHI::TargetBlendState GetBlendModeState() const { return m_blendModeState; } bool GetIsPremultiplyAlpha() const { return m_preMultiplyAlpha; } AlphaMaskType GetAlphaMaskType() const { return m_alphaMaskType; } @@ -118,7 +118,7 @@ namespace LyShine bool m_isTextureSRGB; bool m_preMultiplyAlpha; AlphaMaskType m_alphaMaskType; - int m_blendModeState; + AZ::RHI::TargetBlendState m_blendModeState; int m_totalNumVertices; int m_totalNumIndices; @@ -340,7 +340,7 @@ namespace LyShine protected: // member functions //! Given a blend mode and whether the shader will be outputing premultiplied alpha, return state flags - int GetBlendModeState(LyShine::BlendMode blendMode, bool isShaderOutputPremultAlpha) const; + AZ::RHI::TargetBlendState GetBlendModeState(LyShine::BlendMode blendMode, bool isShaderOutputPremultAlpha) const; void SetRttPassesEnabled(UiRenderer* uiRenderer, bool enabled); diff --git a/Gems/LyShine/Code/Source/UiCanvasManager.cpp b/Gems/LyShine/Code/Source/UiCanvasManager.cpp index 04cb5c4a1f..a71c46d45e 100644 --- a/Gems/LyShine/Code/Source/UiCanvasManager.cpp +++ b/Gems/LyShine/Code/Source/UiCanvasManager.cpp @@ -1031,7 +1031,7 @@ void UiCanvasManager::DebugDisplayCanvasData(int setting) const // local function to write a line of text (with a background rect) and increment Y offset AZStd::function WriteLine = [&](const char* buffer, const AZ::Vector3& color) { - IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); + CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); textOptions.color = color; AZ::Vector2 textSize = draw2d->GetTextSize(buffer, fontSize, &textOptions); AZ::Vector2 rectTopLeft = AZ::Vector2(xOffset - 2, yOffset); @@ -1182,7 +1182,7 @@ void UiCanvasManager::DebugDisplayDrawCallData() const // local function to write a line of text (with a background rect) and increment Y offset AZStd::function WriteLine = [&](const char* buffer, const AZ::Vector3& color) { - IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); + CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); textOptions.color = color; AZ::Vector2 textSize = draw2d->GetTextSize(buffer, 16, &textOptions); AZ::Vector2 rectTopLeft = AZ::Vector2(xOffset - 2, yOffset); diff --git a/Gems/LyShine/Code/Source/UiRenderer.cpp b/Gems/LyShine/Code/Source/UiRenderer.cpp index 07a9f77007..3111f31615 100644 --- a/Gems/LyShine/Code/Source/UiRenderer.cpp +++ b/Gems/LyShine/Code/Source/UiRenderer.cpp @@ -489,7 +489,7 @@ void UiRenderer::DebugDisplayTextureData(int recordingOption) // local function to write a line of text (with a background rect) and increment Y offset AZStd::function WriteLine = [&](const char* buffer, const AZ::Vector3& color) { - IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); + CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions(); textOptions.color = color; AZ::Vector2 textSize = draw2d->GetTextSize(buffer, 16, &textOptions); AZ::Vector2 rectTopLeft = AZ::Vector2(xOffset - 2, yOffset); diff --git a/Gems/LyShine/Code/Source/UiRenderer.h b/Gems/LyShine/Code/Source/UiRenderer.h index 14fc67fc6b..3be3c832d3 100644 --- a/Gems/LyShine/Code/Source/UiRenderer.h +++ b/Gems/LyShine/Code/Source/UiRenderer.h @@ -53,14 +53,8 @@ public: // types void ResetToDefault() { // Enable blend/color write - m_blendState.m_enable = true; - m_blendState.m_writeMask = 0xF; - m_blendState.m_blendSource = AZ::RHI::BlendFactor::AlphaSource; - m_blendState.m_blendDest = AZ::RHI::BlendFactor::AlphaSourceInverse; - m_blendState.m_blendOp = AZ::RHI::BlendOp::Add; - m_blendState.m_blendAlphaSource = AZ::RHI::BlendFactor::One; - m_blendState.m_blendAlphaDest = AZ::RHI::BlendFactor::Zero; - m_blendState.m_blendAlphaOp = AZ::RHI::BlendOp::Add; + m_blendStateEnabled = true; + m_blendStateWriteMask = 0xF; // Disable stencil m_stencilState = AZ::RHI::StencilState(); @@ -70,7 +64,8 @@ public: // types m_modulateAlpha = false; } - AZ::RHI::TargetBlendState m_blendState; + uint32_t m_blendStateEnabled = true; + uint32_t m_blendStateWriteMask = 0xF; AZ::RHI::StencilState m_stencilState; bool m_useAlphaTest = false; bool m_modulateAlpha = false; diff --git a/Gems/Maestro/Code/CMakeLists.txt b/Gems/Maestro/Code/CMakeLists.txt index 56d1f2f3c4..2ae737acc7 100644 --- a/Gems/Maestro/Code/CMakeLists.txt +++ b/Gems/Maestro/Code/CMakeLists.txt @@ -75,23 +75,10 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS) ly_create_alias(NAME Maestro.Tools NAMESPACE Gem TARGETS Gem::Maestro.Editor) ly_create_alias(NAME Maestro.Builders NAMESPACE Gem TARGETS Gem::Maestro.Editor) - # Maestro is still used by the CrySystem Level System and SystemInit and TrackView - # It is required by the GameLauncher, ServerLauncher and Editor applications - ly_enable_gems(GEMS Maestro VARIANTS Tools TARGETS Editor) - endif() -# Loop over each Project name to allow the ${ProjectName}.GameLauncher and ${ProjectName}.ServerLauncher -# target to add the gem the Clients and Servers variant -get_property(LY_PROJECTS_TARGET_NAME GLOBAL PROPERTY LY_PROJECTS_TARGET_NAME) -foreach(project_name IN LISTS LY_PROJECTS_TARGET_NAME) - # Add gem as a dependency of the Clients Launcher - ly_enable_gems(PROJECT_NAME ${project_name} GEMS Maestro VARIANTS Clients TARGETS ${project_name}.GameLauncher) - # Add gem as a dependency of the Servers Launcher - if(PAL_TRAIT_BUILD_SERVER_SUPPORTED) - ly_enable_gems(PROJECT_NAME ${project_name} GEMS Maestro VARIANTS Servers TARGETS ${project_name}.ServerLauncher) - endif() -endforeach() +# Maestro is still used by the CrySystem Level System, CSystem::SystemInit and TrackView +ly_enable_gems(GEMS Maestro) ################################################################################ diff --git a/Gems/Microphone/Code/Include/Microphone/WAVUtil.h b/Gems/Microphone/Code/Include/Microphone/WAVUtil.h index 71c1ec13d1..9fdcc95a97 100644 --- a/Gems/Microphone/Code/Include/Microphone/WAVUtil.h +++ b/Gems/Microphone/Code/Include/Microphone/WAVUtil.h @@ -89,7 +89,7 @@ namespace Audio AZ::IO::FileIOStream fileStream(filePath.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary); if (fileStream.IsOpen()) { - auto bytesWritten = fileStream.Write(m_bufferSize, m_buffer); + [[maybe_unused]] auto bytesWritten = fileStream.Write(m_bufferSize, m_buffer); AZ_TracePrintf("WAVUtil", "Wrote WAV file: %s, %d bytes\n", filePath.c_str(), bytesWritten); return true; } diff --git a/Gems/Multiplayer/Code/Include/Multiplayer/Components/LocalPredictionPlayerInputComponent.h b/Gems/Multiplayer/Code/Include/Multiplayer/Components/LocalPredictionPlayerInputComponent.h index f26f043b85..397406f3b5 100644 --- a/Gems/Multiplayer/Code/Include/Multiplayer/Components/LocalPredictionPlayerInputComponent.h +++ b/Gems/Multiplayer/Code/Include/Multiplayer/Components/LocalPredictionPlayerInputComponent.h @@ -21,6 +21,7 @@ namespace Multiplayer AZ_MULTIPLAYER_COMPONENT(Multiplayer::LocalPredictionPlayerInputComponent, s_localPredictionPlayerInputComponentConcreteUuid, Multiplayer::LocalPredictionPlayerInputComponentBase); static void Reflect([[maybe_unused]] AZ::ReflectContext* context); + static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided); void OnInit() override; void OnActivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating) override; diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja index 35b5ac3abf..d8e729afd6 100644 --- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja +++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja @@ -1476,6 +1476,11 @@ namespace {{ Component.attrib['Namespace'] }} {% call(ComponentService) ParseComponentServiceNames(Component, ClassType, 'Required') %} required.push_back(AZ_CRC_CE("{{ ComponentService }}")); {% endcall %} +{% if NetworkInputCount > 0 %} + + // This component uses NetworkInputs so it requires a MultiplayerInputDriver service which is responsible for calling CreateInput and ProcessInput + required.push_back(AZ_CRC_CE("MultiplayerInputDriver")); +{% endif %} } void {{ ComponentBaseName }}::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent) diff --git a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp index 452cb31a7a..418bea79dd 100644 --- a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp @@ -81,6 +81,12 @@ namespace Multiplayer LocalPredictionPlayerInputComponentBase::Reflect(context); } + void LocalPredictionPlayerInputComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) + { + LocalPredictionPlayerInputComponentBase::GetProvidedServices(provided); + provided.push_back(AZ_CRC_CE("MultiplayerInputDriver")); + } + void LocalPredictionPlayerInputComponent::OnInit() { ; diff --git a/Gems/NvCloth/Assets/Objects/cloth/Chicken/Actor/chicken.fbx.assetinfo b/Gems/NvCloth/Assets/Objects/cloth/Chicken/Actor/chicken.fbx.assetinfo index 37480c52c1..4c73efae13 100644 --- a/Gems/NvCloth/Assets/Objects/cloth/Chicken/Actor/chicken.fbx.assetinfo +++ b/Gems/NvCloth/Assets/Objects/cloth/Chicken/Actor/chicken.fbx.assetinfo @@ -25,13 +25,18 @@ "Position": [ -0.03709467500448227, -3.725290298461914e-9, - 0.013427333906292916 + 0.013427333906292915 ], + "MaterialSelection": { + "MaterialIds": [ + {} + ] + }, "propertyVisibilityFlags": 248 }, { "$type": "SphereShapeConfiguration", - "Radius": 0.12945009768009187 + "Radius": 0.12945009768009186 } ] ] @@ -50,15 +55,20 @@ "Rotation": [ 0.0, 0.662880003452301, - 0.7487256526947022, + 0.7487256526947021, 0.0 ], + "MaterialSelection": { + "MaterialIds": [ + {} + ] + }, "propertyVisibilityFlags": 248 }, { "$type": "CapsuleShapeConfiguration", "Height": 0.8597599267959595, - "Radius": 0.27968019247055056 + "Radius": 0.27968019247055054 } ] ] @@ -79,95 +89,51 @@ "RootNode", "RootNode.chicken_skeleton", "RootNode.chicken_feet_skin", + "RootNode.chicken_feet_skin.chicken_feet_skin_1", + "RootNode.chicken_feet_skin.chicken_feet_skin_2", "RootNode.chicken_eyes_skin", + "RootNode.chicken_eyes_skin.chicken_eyes_skin_1", + "RootNode.chicken_eyes_skin.chicken_eyes_skin_2", "RootNode.chicken_body_skin", + "RootNode.chicken_body_skin.chicken_body_skin_1", + "RootNode.chicken_body_skin.chicken_body_skin_2", "RootNode.chicken_mohawk", - "RootNode.chicken_skeleton.transform", + "RootNode.chicken_mohawk.chicken_mohawk_1", + "RootNode.chicken_mohawk.chicken_mohawk_2", "RootNode.chicken_skeleton.def_c_chickenRoot_joint", - "RootNode.chicken_feet_skin.SkinWeight_0", - "RootNode.chicken_feet_skin.transform", - "RootNode.chicken_feet_skin.map1", - "RootNode.chicken_feet_skin.chicken_body_mat", - "RootNode.chicken_eyes_skin.SkinWeight_0", - "RootNode.chicken_eyes_skin.transform", - "RootNode.chicken_eyes_skin.uvSet1", - "RootNode.chicken_eyes_skin.chicken_eye_mat", - "RootNode.chicken_body_skin.SkinWeight_0", - "RootNode.chicken_body_skin.transform", - "RootNode.chicken_body_skin.map1", - "RootNode.chicken_body_skin.chicken_body_mat", - "RootNode.chicken_mohawk.Col0", - "RootNode.chicken_mohawk.SkinWeight_0", - "RootNode.chicken_mohawk.transform", - "RootNode.chicken_mohawk.map1", - "RootNode.chicken_mohawk.mohawkMat", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.def_l_foot_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.def_r_foot_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_tail1_joint", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.def_l_wing2_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.def_r_wing2_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.def_l_foot_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.def_l_foot_joint.def_l_ball_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.def_r_foot_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.def_r_foot_joint.def_r_ball_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_tail1_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_tail1_joint.def_c_tail2_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.def_l_wing2_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.def_l_wing2_joint.def_l_wing_end", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.def_r_wing2_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.def_r_wing2_joint.def_r_wing_end", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.def_l_foot_joint.def_l_ball_joint.transform", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.def_r_foot_joint.def_r_ball_joint.transform", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_tail1_joint.def_c_tail2_joint.transform", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_mouth_joint", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.def_l_wing2_joint.def_l_wing_end.transform", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.def_r_wing2_joint.def_r_wing_end.transform", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_mouth_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_mouth_joint.def_c_mouth_end", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_mouth_joint.def_c_mouth_end.transform", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.def_c_waddle3_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.def_c_waddle3_joint.transform", "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.def_c_waddle3_joint.def_c_waddle_end", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint.transform", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint.def_c_feather_end", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.def_c_waddle3_joint.def_c_waddle_end.transform", - "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint.def_c_feather_end.transform" + "RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint.def_c_feather_end" ] }, "rules": { @@ -184,7 +150,7 @@ }, { "$type": "ClothRule", - "meshNodeName": "RootNode.chicken_mohawk", + "meshNodeName": "RootNode.chicken_mohawk.chicken_mohawk_1", "inverseMassesStreamName": "Col0", "motionConstraintsStreamName": "Default: 1.0", "backstopStreamName": "None" diff --git a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_blinds.fbx.assetinfo b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_blinds.fbx.assetinfo index cbde27b201..b7dae925c9 100644 --- a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_blinds.fbx.assetinfo +++ b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_blinds.fbx.assetinfo @@ -7,10 +7,14 @@ "selectedNodes": [ "RootNode", "RootNode.pPlane1", - "RootNode.pPlane1.Col0", - "RootNode.pPlane1.transform", - "RootNode.pPlane1.map1", - "RootNode.pPlane1.lambert1" + "RootNode.pPlane1.pPlane1_1", + "RootNode.pPlane1.pPlane1_2", + "RootNode.pPlane1.pPlane1_1.Col0", + "RootNode.pPlane1.pPlane1_1.map1", + "RootNode.pPlane1.pPlane1_1.lambert1", + "RootNode.pPlane1.pPlane1_2.Col0", + "RootNode.pPlane1.pPlane1_2.map1", + "RootNode.pPlane1.pPlane1_2.lambert1" ] }, "rules": { @@ -24,7 +28,7 @@ }, { "$type": "ClothRule", - "meshNodeName": "RootNode.pPlane1", + "meshNodeName": "RootNode.pPlane1.pPlane1_1", "inverseMassesStreamName": "Col0", "motionConstraintsStreamName": "Default: 1.0", "backstopStreamName": "None" @@ -34,4 +38,4 @@ "id": "{9D0F5F7F-FB90-5C00-97A7-C55F9180CE4E}" } ] -} +} \ No newline at end of file diff --git a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_blinds_broken.fbx.assetinfo b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_blinds_broken.fbx.assetinfo index 1636e063a7..db558275cf 100644 --- a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_blinds_broken.fbx.assetinfo +++ b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_blinds_broken.fbx.assetinfo @@ -7,10 +7,14 @@ "selectedNodes": [ "RootNode", "RootNode.pPlane1", - "RootNode.pPlane1.Col0", - "RootNode.pPlane1.transform", - "RootNode.pPlane1.map1", - "RootNode.pPlane1.lambert1" + "RootNode.pPlane1.pPlane1_1", + "RootNode.pPlane1.pPlane1_2", + "RootNode.pPlane1.pPlane1_1.Col0", + "RootNode.pPlane1.pPlane1_1.map1", + "RootNode.pPlane1.pPlane1_1.lambert1", + "RootNode.pPlane1.pPlane1_2.Col0", + "RootNode.pPlane1.pPlane1_2.map1", + "RootNode.pPlane1.pPlane1_2.lambert1" ] }, "rules": { @@ -24,7 +28,7 @@ }, { "$type": "ClothRule", - "meshNodeName": "RootNode.pPlane1", + "meshNodeName": "RootNode.pPlane1.pPlane1_1", "inverseMassesStreamName": "Col0", "motionConstraintsStreamName": "Default: 1.0", "backstopStreamName": "None" @@ -34,4 +38,4 @@ "id": "{3A467F2C-C2AB-581F-94E3-946575011973}" } ] -} +} \ No newline at end of file diff --git a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_corners_four.fbx.assetinfo b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_corners_four.fbx.assetinfo index aea3110a42..5dacf085cf 100644 --- a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_corners_four.fbx.assetinfo +++ b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_corners_four.fbx.assetinfo @@ -7,10 +7,14 @@ "selectedNodes": [ "RootNode", "RootNode.pPlane1", - "RootNode.pPlane1.Col0", - "RootNode.pPlane1.transform", - "RootNode.pPlane1.map1", - "RootNode.pPlane1.lambert1" + "RootNode.pPlane1.pPlane1_1", + "RootNode.pPlane1.pPlane1_2", + "RootNode.pPlane1.pPlane1_1.Col0", + "RootNode.pPlane1.pPlane1_1.map1", + "RootNode.pPlane1.pPlane1_1.lambert1", + "RootNode.pPlane1.pPlane1_2.Col0", + "RootNode.pPlane1.pPlane1_2.map1", + "RootNode.pPlane1.pPlane1_2.lambert1" ] }, "rules": { @@ -24,7 +28,7 @@ }, { "$type": "ClothRule", - "meshNodeName": "RootNode.pPlane1", + "meshNodeName": "RootNode.pPlane1.pPlane1_1", "inverseMassesStreamName": "Col0", "motionConstraintsStreamName": "Default: 1.0", "backstopStreamName": "None" @@ -34,4 +38,4 @@ "id": "{105338D3-5947-5F72-A077-36C193C8AE7C}" } ] -} +} \ No newline at end of file diff --git a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_corners_two.fbx.assetinfo b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_corners_two.fbx.assetinfo index d23b92be9f..8da57dbed3 100644 --- a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_corners_two.fbx.assetinfo +++ b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_corners_two.fbx.assetinfo @@ -7,10 +7,14 @@ "selectedNodes": [ "RootNode", "RootNode.pPlane1", - "RootNode.pPlane1.Col0", - "RootNode.pPlane1.transform", - "RootNode.pPlane1.map1", - "RootNode.pPlane1.lambert1" + "RootNode.pPlane1.pPlane1_1", + "RootNode.pPlane1.pPlane1_2", + "RootNode.pPlane1.pPlane1_1.Col0", + "RootNode.pPlane1.pPlane1_1.map1", + "RootNode.pPlane1.pPlane1_1.lambert1", + "RootNode.pPlane1.pPlane1_2.Col0", + "RootNode.pPlane1.pPlane1_2.map1", + "RootNode.pPlane1.pPlane1_2.lambert1" ] }, "rules": { @@ -24,7 +28,7 @@ }, { "$type": "ClothRule", - "meshNodeName": "RootNode.pPlane1", + "meshNodeName": "RootNode.pPlane1.pPlane1_1", "inverseMassesStreamName": "Col0", "motionConstraintsStreamName": "Default: 1.0", "backstopStreamName": "None" diff --git a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_edge.fbx.assetinfo b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_edge.fbx.assetinfo index 6a56ea23cf..bfc39618b4 100644 --- a/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_edge.fbx.assetinfo +++ b/Gems/NvCloth/Assets/Objects/cloth/Environment/cloth_locked_edge.fbx.assetinfo @@ -7,10 +7,14 @@ "selectedNodes": [ "RootNode", "RootNode.pPlane1", - "RootNode.pPlane1.Col0", - "RootNode.pPlane1.transform", - "RootNode.pPlane1.map1", - "RootNode.pPlane1.lambert1" + "RootNode.pPlane1.pPlane1_1", + "RootNode.pPlane1.pPlane1_2", + "RootNode.pPlane1.pPlane1_1.Col0", + "RootNode.pPlane1.pPlane1_1.map1", + "RootNode.pPlane1.pPlane1_1.lambert1", + "RootNode.pPlane1.pPlane1_2.Col0", + "RootNode.pPlane1.pPlane1_2.map1", + "RootNode.pPlane1.pPlane1_2.lambert1" ] }, "rules": { @@ -24,7 +28,7 @@ }, { "$type": "ClothRule", - "meshNodeName": "RootNode.pPlane1", + "meshNodeName": "RootNode.pPlane1.pPlane1_1", "inverseMassesStreamName": "Col0", "motionConstraintsStreamName": "Default: 1.0", "backstopStreamName": "None" diff --git a/Gems/NvCloth/Assets/prefabs/Cloth/Chicken_Actor.prefab b/Gems/NvCloth/Assets/prefabs/Cloth/Chicken_Actor.prefab index 57953f927b..16d30a36c2 100644 --- a/Gems/NvCloth/Assets/prefabs/Cloth/Chicken_Actor.prefab +++ b/Gems/NvCloth/Assets/prefabs/Cloth/Chicken_Actor.prefab @@ -22,8 +22,7 @@ "Component_[4272963378099646759]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 4272963378099646759, - "Parent Entity": "", - "Cached World Transform Parent": "" + "Parent Entity": "" }, "Component_[4848458548047175816]": { "$type": "EditorVisibilityComponent", @@ -80,8 +79,7 @@ "Component_[12470135924384913029]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 12470135924384913029, - "Parent Entity": "ContainerEntity", - "Cached World Transform Parent": "ContainerEntity" + "Parent Entity": "ContainerEntity" }, "Component_[14919455666821657531]": { "$type": "EditorEntitySortComponent", @@ -108,8 +106,7 @@ "$type": "SelectionComponent", "Id": 786957291078135994 } - }, - "IsDependencyReady": true + } }, "Entity_[303451468511700]": { "Id": "Entity_[303451468511700]", @@ -163,7 +160,7 @@ "assetHint": "objects/cloth/chicken/motions/chickenidle.motion" }, "Loop": true, - "PlaySpeed": 1.2000000476837159 + "PlaySpeed": 1.2000000476837158 } }, "Component_[3482722103355682975]": { @@ -182,7 +179,7 @@ "$type": "EditorClothComponent", "Id": 7236637452394054627, "Configuration": { - "Mesh Node": "chicken_mohawk", + "Mesh Node": "chicken_mohawk_1", "Mass": 4.0, "Remove Static Triangles": false } @@ -191,18 +188,27 @@ "$type": "EditorEntitySortComponent", "Id": 868427789695884987 }, - "Component_[8777596718122199558]": { + "Component_[9845606399230319505]": { + "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", + "Id": 9845606399230319505, + "Parent Entity": "Entity_[303447173544404]", + "Transform Data": { + "Rotate": [ + 0.0, + 0.0, + -0.00006830000347690657 + ] + } + }, + "Component_[9927411050130082647]": { "$type": "EditorMaterialComponent", - "Id": 8777596718122199558, + "Id": 9927411050130082647, "Controller": { "Configuration": { "materials": [ { "Key": { - "materialAssetId": { - "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", - "subId": 668669130 - } + "materialSlotStableId": 668669130 }, "Value": { "MaterialAsset": { @@ -215,10 +221,7 @@ }, { "Key": { - "materialAssetId": { - "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", - "subId": 1541321207 - } + "materialSlotStableId": 1541321207 }, "Value": { "MaterialAsset": { @@ -231,10 +234,7 @@ }, { "Key": { - "materialAssetId": { - "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", - "subId": 2608524672 - } + "materialSlotStableId": 2608524672 }, "Value": { "MaterialAsset": { @@ -251,44 +251,59 @@ "materialSlots": [ { "id": { - "materialAssetId": { - "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", - "subId": 668669130 - } + "materialSlotStableId": 668669130 }, "materialAsset": { "assetId": { "guid": "{FB34D8F7-E8CA-542D-92A3-F0E04F3A3EC3}" }, "assetHint": "objects/cloth/chicken/actor/chicken_chicken_body_mat.azmaterial" + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", + "subId": 668669130 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/chicken/actor/chicken_chicken_body_mat_4404500000782619850.azmaterial" } }, { "id": { - "materialAssetId": { - "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", - "subId": 1541321207 - } + "materialSlotStableId": 1541321207 }, "materialAsset": { "assetId": { "guid": "{6114C408-26EE-51DC-8733-A07800BF4991}" }, "assetHint": "objects/cloth/chicken/actor/chicken_chicken_eye_mat.azmaterial" + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", + "subId": 1541321207 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/chicken/actor/chicken_chicken_eye_mat_10184937185004663287.azmaterial" } }, { "id": { - "materialAssetId": { - "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", - "subId": 2608524672 - } + "materialSlotStableId": 2608524672 }, "materialAsset": { "assetId": { "guid": "{80F92051-203E-52CE-B4D6-E3AED21795C9}" }, "assetHint": "objects/cloth/chicken/actor/chicken_mohawkmat.azmaterial" + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", + "subId": 2608524672 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/chicken/actor/chicken_mohawkmat_13891540077583723904.azmaterial" } } ], @@ -297,46 +312,48 @@ { "id": { "lodIndex": 0, - "materialAssetId": { + "materialSlotStableId": 668669130 + }, + "defaultMaterialAsset": { + "assetId": { "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", "subId": 668669130 - } + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/chicken/actor/chicken_chicken_body_mat_4404500000782619850.azmaterial" } }, { "id": { "lodIndex": 0, - "materialAssetId": { + "materialSlotStableId": 1541321207 + }, + "defaultMaterialAsset": { + "assetId": { "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", "subId": 1541321207 - } + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/chicken/actor/chicken_chicken_eye_mat_10184937185004663287.azmaterial" } }, { "id": { "lodIndex": 0, - "materialAssetId": { + "materialSlotStableId": 2608524672 + }, + "defaultMaterialAsset": { + "assetId": { "guid": "{3E4C6A29-92A4-523E-8739-F3E64957569E}", "subId": 2608524672 - } + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/chicken/actor/chicken_mohawkmat_13891540077583723904.azmaterial" } } ] ] }, - "Component_[9845606399230319505]": { - "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", - "Id": 9845606399230319505, - "Parent Entity": "Entity_[303447173544404]", - "Transform Data": { - "Rotate": [ - 0.0, - 0.0, - -0.00006830000347690657 - ] - }, - "Cached World Transform Parent": "" - }, "Component_[9979479216337101498]": { "$type": "EditorInspectorComponent", "Id": 9979479216337101498, @@ -362,8 +379,7 @@ } ] } - }, - "IsDependencyReady": true + } } } } \ No newline at end of file diff --git a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_blinds.prefab b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_blinds.prefab index 270f52b29b..108b4ba13c 100644 --- a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_blinds.prefab +++ b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_blinds.prefab @@ -22,8 +22,7 @@ "Component_[4272963378099646759]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 4272963378099646759, - "Parent Entity": "", - "Cached World Transform Parent": "" + "Parent Entity": "" }, "Component_[4848458548047175816]": { "$type": "EditorVisibilityComponent", @@ -64,7 +63,7 @@ "$type": "EditorClothComponent", "Id": 11309989511197311871, "Configuration": { - "Mesh Node": "pPlane1", + "Mesh Node": "pPlane1_1", "Damping": [ 0.0, 0.0, @@ -94,6 +93,68 @@ "$type": "EditorLockComponent", "Id": 12850019035302463297 }, + "Component_[15070431754554069043]": { + "$type": "EditorMaterialComponent", + "Id": 15070431754554069043, + "Controller": { + "Configuration": { + "materials": [ + { + "Key": { + "materialSlotStableId": 902256226 + }, + "Value": { + "MaterialAsset": { + "assetId": { + "guid": "{6BFA7C7C-AF9F-5B12-8B30-6B6ECE9BAB9E}" + }, + "assetHint": "objects/cloth/environment/cloth_blinds.azmaterial" + } + } + } + ] + } + }, + "materialSlots": [ + { + "id": { + "materialSlotStableId": 902256226 + }, + "materialAsset": { + "assetId": { + "guid": "{6BFA7C7C-AF9F-5B12-8B30-6B6ECE9BAB9E}" + }, + "assetHint": "objects/cloth/environment/cloth_blinds.azmaterial" + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{C3078003-51DA-5D8E-B311-38C426480DD2}", + "subId": 902256226 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_blinds_lambert1_3614897150141879906.azmaterial" + } + } + ], + "materialSlotsByLod": [ + [ + { + "id": { + "lodIndex": 0, + "materialSlotStableId": 902256226 + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{C3078003-51DA-5D8E-B311-38C426480DD2}", + "subId": 902256226 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_blinds_lambert1_3614897150141879906.azmaterial" + } + } + ] + ] + }, "Component_[15214644042360665965]": { "$type": "AZ::Render::EditorMeshComponent", "Id": 15214644042360665965, @@ -145,8 +206,7 @@ "Component_[4795695323030511838]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 4795695323030511838, - "Parent Entity": "ContainerEntity", - "Cached World Transform Parent": "ContainerEntity" + "Parent Entity": "ContainerEntity" }, "Component_[5800800590637221800]": { "$type": "EditorDisabledCompositionComponent", @@ -159,64 +219,8 @@ "Component_[7074022732104182988]": { "$type": "EditorEntitySortComponent", "Id": 7074022732104182988 - }, - "Component_[9206497685981025331]": { - "$type": "EditorMaterialComponent", - "Id": 9206497685981025331, - "Controller": { - "Configuration": { - "materials": [ - { - "Key": { - "materialAssetId": { - "guid": "{C3078003-51DA-5D8E-B311-38C426480DD2}", - "subId": 902256226 - } - }, - "Value": { - "MaterialAsset": { - "assetId": { - "guid": "{6BFA7C7C-AF9F-5B12-8B30-6B6ECE9BAB9E}" - }, - "assetHint": "objects/cloth/environment/cloth_blinds.azmaterial" - } - } - } - ] - } - }, - "materialSlots": [ - { - "id": { - "materialAssetId": { - "guid": "{C3078003-51DA-5D8E-B311-38C426480DD2}", - "subId": 902256226 - } - }, - "materialAsset": { - "assetId": { - "guid": "{6BFA7C7C-AF9F-5B12-8B30-6B6ECE9BAB9E}" - }, - "assetHint": "objects/cloth/environment/cloth_blinds.azmaterial" - } - } - ], - "materialSlotsByLod": [ - [ - { - "id": { - "lodIndex": 0, - "materialAssetId": { - "guid": "{C3078003-51DA-5D8E-B311-38C426480DD2}", - "subId": 902256226 - } - } - } - ] - ] } - }, - "IsDependencyReady": true + } } } } \ No newline at end of file diff --git a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_blinds_broken.prefab b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_blinds_broken.prefab index 7feb61db90..52b0c9fa17 100644 --- a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_blinds_broken.prefab +++ b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_blinds_broken.prefab @@ -22,8 +22,7 @@ "Component_[4272963378099646759]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 4272963378099646759, - "Parent Entity": "", - "Cached World Transform Parent": "" + "Parent Entity": "" }, "Component_[4848458548047175816]": { "$type": "EditorVisibilityComponent", @@ -60,7 +59,7 @@ "$type": "EditorClothComponent", "Id": 10786078036233199116, "Configuration": { - "Mesh Node": "pPlane1", + "Mesh Node": "pPlane1_1", "Damping": [ 0.0, 0.0, @@ -127,18 +126,41 @@ "$type": "EditorEntityIconComponent", "Id": 4939437553142322315 }, - "Component_[538074694053236341]": { + "Component_[5681411293917950785]": { + "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", + "Id": 5681411293917950785, + "Parent Entity": "ContainerEntity" + }, + "Component_[7046686956433693767]": { + "$type": "EditorInspectorComponent", + "Id": 7046686956433693767, + "ComponentOrderEntryArray": [ + { + "ComponentId": 5681411293917950785 + }, + { + "ComponentId": 10786078036233199116, + "SortIndex": 1 + }, + { + "ComponentId": 11765361670726469628, + "SortIndex": 2 + }, + { + "ComponentId": 538074694053236341, + "SortIndex": 3 + } + ] + }, + "Component_[7873865615483617838]": { "$type": "EditorMaterialComponent", - "Id": 538074694053236341, + "Id": 7873865615483617838, "Controller": { "Configuration": { "materials": [ { "Key": { - "materialAssetId": { - "guid": "{A64AD477-5E35-5834-A9A3-580B9D708E0C}", - "subId": 902256226 - } + "materialSlotStableId": 902256226 }, "Value": { "MaterialAsset": { @@ -155,16 +177,21 @@ "materialSlots": [ { "id": { - "materialAssetId": { - "guid": "{A64AD477-5E35-5834-A9A3-580B9D708E0C}", - "subId": 902256226 - } + "materialSlotStableId": 902256226 }, "materialAsset": { "assetId": { "guid": "{EB6CB909-E4BB-54CB-8CAE-6A4B4F203B1B}" }, "assetHint": "objects/cloth/environment/cloth_blinds_broken.azmaterial" + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{A64AD477-5E35-5834-A9A3-580B9D708E0C}", + "subId": 902256226 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_blinds_broken_lambert1_3614897150141879906.azmaterial" } } ], @@ -173,48 +200,25 @@ { "id": { "lodIndex": 0, - "materialAssetId": { + "materialSlotStableId": 902256226 + }, + "defaultMaterialAsset": { + "assetId": { "guid": "{A64AD477-5E35-5834-A9A3-580B9D708E0C}", "subId": 902256226 - } + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_blinds_broken_lambert1_3614897150141879906.azmaterial" } } ] ] }, - "Component_[5681411293917950785]": { - "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", - "Id": 5681411293917950785, - "Parent Entity": "ContainerEntity", - "Cached World Transform Parent": "ContainerEntity" - }, - "Component_[7046686956433693767]": { - "$type": "EditorInspectorComponent", - "Id": 7046686956433693767, - "ComponentOrderEntryArray": [ - { - "ComponentId": 5681411293917950785 - }, - { - "ComponentId": 10786078036233199116, - "SortIndex": 1 - }, - { - "ComponentId": 11765361670726469628, - "SortIndex": 2 - }, - { - "ComponentId": 538074694053236341, - "SortIndex": 3 - } - ] - }, "Component_[9565338131843702938]": { "$type": "EditorOnlyEntityComponent", "Id": 9565338131843702938 } - }, - "IsDependencyReady": true + } } } } \ No newline at end of file diff --git a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_corners_four.prefab b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_corners_four.prefab index cdbe92dab6..1017317bd3 100644 --- a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_corners_four.prefab +++ b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_corners_four.prefab @@ -22,8 +22,7 @@ "Component_[4272963378099646759]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 4272963378099646759, - "Parent Entity": "", - "Cached World Transform Parent": "" + "Parent Entity": "" }, "Component_[4848458548047175816]": { "$type": "EditorVisibilityComponent", @@ -74,63 +73,7 @@ "Component_[12766570162661899127]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 12766570162661899127, - "Parent Entity": "ContainerEntity", - "Cached World Transform Parent": "ContainerEntity" - }, - "Component_[12950486357466178058]": { - "$type": "EditorMaterialComponent", - "Id": 12950486357466178058, - "Controller": { - "Configuration": { - "materials": [ - { - "Key": { - "materialAssetId": { - "guid": "{89C91D92-7B4E-5EB5-945D-0053111859EE}", - "subId": 902256226 - } - }, - "Value": { - "MaterialAsset": { - "assetId": { - "guid": "{838EA487-0F74-5448-AABE-947B138CD6C2}" - }, - "assetHint": "objects/cloth/environment/cloth_locked_corners_four.azmaterial" - } - } - } - ] - } - }, - "materialSlots": [ - { - "id": { - "materialAssetId": { - "guid": "{89C91D92-7B4E-5EB5-945D-0053111859EE}", - "subId": 902256226 - } - }, - "materialAsset": { - "assetId": { - "guid": "{838EA487-0F74-5448-AABE-947B138CD6C2}" - }, - "assetHint": "objects/cloth/environment/cloth_locked_corners_four.azmaterial" - } - } - ], - "materialSlotsByLod": [ - [ - { - "id": { - "lodIndex": 0, - "materialAssetId": { - "guid": "{89C91D92-7B4E-5EB5-945D-0053111859EE}", - "subId": 902256226 - } - } - } - ] - ] + "Parent Entity": "ContainerEntity" }, "Component_[13484816898680823471]": { "$type": "EditorEntitySortComponent", @@ -165,7 +108,7 @@ "$type": "EditorClothComponent", "Id": 15114198178471353754, "Configuration": { - "Mesh Node": "pPlane1", + "Mesh Node": "pPlane1_1", "Stiffness Frequency": 1.0, "Damping": [ 0.0, @@ -210,6 +153,68 @@ "$type": "EditorDisabledCompositionComponent", "Id": 7652255413353256955 }, + "Component_[8261070538889619357]": { + "$type": "EditorMaterialComponent", + "Id": 8261070538889619357, + "Controller": { + "Configuration": { + "materials": [ + { + "Key": { + "materialSlotStableId": 902256226 + }, + "Value": { + "MaterialAsset": { + "assetId": { + "guid": "{838EA487-0F74-5448-AABE-947B138CD6C2}" + }, + "assetHint": "objects/cloth/environment/cloth_locked_corners_four.azmaterial" + } + } + } + ] + } + }, + "materialSlots": [ + { + "id": { + "materialSlotStableId": 902256226 + }, + "materialAsset": { + "assetId": { + "guid": "{838EA487-0F74-5448-AABE-947B138CD6C2}" + }, + "assetHint": "objects/cloth/environment/cloth_locked_corners_four.azmaterial" + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{89C91D92-7B4E-5EB5-945D-0053111859EE}", + "subId": 902256226 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_locked_corners_four_lambert1_3614897150141879906.azmaterial" + } + } + ], + "materialSlotsByLod": [ + [ + { + "id": { + "lodIndex": 0, + "materialSlotStableId": 902256226 + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{89C91D92-7B4E-5EB5-945D-0053111859EE}", + "subId": 902256226 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_locked_corners_four_lambert1_3614897150141879906.azmaterial" + } + } + ] + ] + }, "Component_[8417657922837077982]": { "$type": "EditorVisibilityComponent", "Id": 8417657922837077982 @@ -218,8 +223,7 @@ "$type": "SelectionComponent", "Id": 944311658362107535 } - }, - "IsDependencyReady": true + } } } } \ No newline at end of file diff --git a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_corners_two.prefab b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_corners_two.prefab index 068c4a6a7e..368cb2d846 100644 --- a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_corners_two.prefab +++ b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_corners_two.prefab @@ -22,8 +22,7 @@ "Component_[4272963378099646759]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 4272963378099646759, - "Parent Entity": "", - "Cached World Transform Parent": "" + "Parent Entity": "" }, "Component_[4848458548047175816]": { "$type": "EditorVisibilityComponent", @@ -84,7 +83,7 @@ "$type": "EditorClothComponent", "Id": 16927361351552746000, "Configuration": { - "Mesh Node": "pPlane1", + "Mesh Node": "pPlane1_1", "Mass": 10.0, "Stiffness Frequency": 1.0, "Damping": [ @@ -109,6 +108,68 @@ "Update Normals of Static Particles": true } }, + "Component_[17380859760246609280]": { + "$type": "EditorMaterialComponent", + "Id": 17380859760246609280, + "Controller": { + "Configuration": { + "materials": [ + { + "Key": { + "materialSlotStableId": 902256226 + }, + "Value": { + "MaterialAsset": { + "assetId": { + "guid": "{A56F28DD-6082-50B6-9B44-9EF3E03E95BB}" + }, + "assetHint": "objects/cloth/environment/cloth_locked_corners_two.azmaterial" + } + } + } + ] + } + }, + "materialSlots": [ + { + "id": { + "materialSlotStableId": 902256226 + }, + "materialAsset": { + "assetId": { + "guid": "{A56F28DD-6082-50B6-9B44-9EF3E03E95BB}" + }, + "assetHint": "objects/cloth/environment/cloth_locked_corners_two.azmaterial" + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{23C6817F-0B79-5CAD-B861-9E6F5E55927D}", + "subId": 902256226 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_locked_corners_two_lambert1_3614897150141879906.azmaterial" + } + } + ], + "materialSlotsByLod": [ + [ + { + "id": { + "lodIndex": 0, + "materialSlotStableId": 902256226 + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{23C6817F-0B79-5CAD-B861-9E6F5E55927D}", + "subId": 902256226 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_locked_corners_two_lambert1_3614897150141879906.azmaterial" + } + } + ] + ] + }, "Component_[2410073307760782444]": { "$type": "EditorPendingCompositionComponent", "Id": 2410073307760782444 @@ -137,8 +198,7 @@ "Component_[5636741882934012477]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 5636741882934012477, - "Parent Entity": "ContainerEntity", - "Cached World Transform Parent": "ContainerEntity" + "Parent Entity": "ContainerEntity" }, "Component_[691437686890444081]": { "$type": "SelectionComponent", @@ -158,64 +218,8 @@ } } } - }, - "Component_[9419069324766365964]": { - "$type": "EditorMaterialComponent", - "Id": 9419069324766365964, - "Controller": { - "Configuration": { - "materials": [ - { - "Key": { - "materialAssetId": { - "guid": "{23C6817F-0B79-5CAD-B861-9E6F5E55927D}", - "subId": 902256226 - } - }, - "Value": { - "MaterialAsset": { - "assetId": { - "guid": "{A56F28DD-6082-50B6-9B44-9EF3E03E95BB}" - }, - "assetHint": "objects/cloth/environment/cloth_locked_corners_two.azmaterial" - } - } - } - ] - } - }, - "materialSlots": [ - { - "id": { - "materialAssetId": { - "guid": "{23C6817F-0B79-5CAD-B861-9E6F5E55927D}", - "subId": 902256226 - } - }, - "materialAsset": { - "assetId": { - "guid": "{A56F28DD-6082-50B6-9B44-9EF3E03E95BB}" - }, - "assetHint": "objects/cloth/environment/cloth_locked_corners_two.azmaterial" - } - } - ], - "materialSlotsByLod": [ - [ - { - "id": { - "lodIndex": 0, - "materialAssetId": { - "guid": "{23C6817F-0B79-5CAD-B861-9E6F5E55927D}", - "subId": 902256226 - } - } - } - ] - ] } - }, - "IsDependencyReady": true + } } } } \ No newline at end of file diff --git a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_edge.prefab b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_edge.prefab index 7bba36adf8..ec837d1bd4 100644 --- a/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_edge.prefab +++ b/Gems/NvCloth/Assets/prefabs/Cloth/cloth_locked_edge.prefab @@ -22,8 +22,7 @@ "Component_[4272963378099646759]": { "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", "Id": 4272963378099646759, - "Parent Entity": "", - "Cached World Transform Parent": "" + "Parent Entity": "" }, "Component_[4848458548047175816]": { "$type": "EditorVisibilityComponent", @@ -96,62 +95,15 @@ } ] }, - "Component_[14983280478781449966]": { - "$type": "SelectionComponent", - "Id": 14983280478781449966 - }, - "Component_[16595775512479337011]": { - "$type": "EditorClothComponent", - "Id": 16595775512479337011, - "Configuration": { - "Mesh Node": "pPlane1", - "Damping": [ - 0.0, - 0.0, - 0.0 - ], - "Linear Drag": [ - 0.5, - 0.5, - 0.5 - ], - "Angular Drag": [ - 0.5, - 0.5, - 0.5 - ], - "Wind Velocity": [ - 10.0, - 0.0, - 0.0 - ], - "Air Drag Coefficient": 0.5, - "Air Lift Coefficient": 0.5, - "Update Normals of Static Particles": true - } - }, - "Component_[16893372770952587461]": { - "$type": "EditorVisibilityComponent", - "Id": 16893372770952587461 - }, - "Component_[4215669181198357248]": { - "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", - "Id": 4215669181198357248, - "Parent Entity": "ContainerEntity", - "Cached World Transform Parent": "ContainerEntity" - }, - "Component_[4580390205455331350]": { + "Component_[14970093767651057273]": { "$type": "EditorMaterialComponent", - "Id": 4580390205455331350, + "Id": 14970093767651057273, "Controller": { "Configuration": { "materials": [ { "Key": { - "materialAssetId": { - "guid": "{9DCAD62C-7A35-5D7D-8276-870D646CD5E2}", - "subId": 902256226 - } + "materialSlotStableId": 902256226 }, "Value": { "MaterialAsset": { @@ -168,16 +120,21 @@ "materialSlots": [ { "id": { - "materialAssetId": { - "guid": "{9DCAD62C-7A35-5D7D-8276-870D646CD5E2}", - "subId": 902256226 - } + "materialSlotStableId": 902256226 }, "materialAsset": { "assetId": { "guid": "{FF25E0FE-B695-5084-AE1E-65F095AA5C3F}" }, "assetHint": "objects/cloth/environment/cloth_locked_edge.azmaterial" + }, + "defaultMaterialAsset": { + "assetId": { + "guid": "{9DCAD62C-7A35-5D7D-8276-870D646CD5E2}", + "subId": 902256226 + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_locked_edge_lambert1_3614897150141879906.azmaterial" } } ], @@ -186,15 +143,63 @@ { "id": { "lodIndex": 0, - "materialAssetId": { + "materialSlotStableId": 902256226 + }, + "defaultMaterialAsset": { + "assetId": { "guid": "{9DCAD62C-7A35-5D7D-8276-870D646CD5E2}", "subId": 902256226 - } + }, + "loadBehavior": "PreLoad", + "assetHint": "objects/cloth/environment/cloth_locked_edge_lambert1_3614897150141879906.azmaterial" } } ] ] }, + "Component_[14983280478781449966]": { + "$type": "SelectionComponent", + "Id": 14983280478781449966 + }, + "Component_[16595775512479337011]": { + "$type": "EditorClothComponent", + "Id": 16595775512479337011, + "Configuration": { + "Mesh Node": "pPlane1_1", + "Damping": [ + 0.0, + 0.0, + 0.0 + ], + "Linear Drag": [ + 0.5, + 0.5, + 0.5 + ], + "Angular Drag": [ + 0.5, + 0.5, + 0.5 + ], + "Wind Velocity": [ + 10.0, + 0.0, + 0.0 + ], + "Air Drag Coefficient": 0.5, + "Air Lift Coefficient": 0.5, + "Update Normals of Static Particles": true + } + }, + "Component_[16893372770952587461]": { + "$type": "EditorVisibilityComponent", + "Id": 16893372770952587461 + }, + "Component_[4215669181198357248]": { + "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent", + "Id": 4215669181198357248, + "Parent Entity": "ContainerEntity" + }, "Component_[5652509070289279796]": { "$type": "EditorOnlyEntityComponent", "Id": 5652509070289279796 @@ -215,8 +220,7 @@ "$type": "EditorEntitySortComponent", "Id": 9694796263300215788 } - }, - "IsDependencyReady": true + } } } } \ No newline at end of file diff --git a/Gems/NvCloth/Assets/slices/Cloth/Chicken_Actor.slice b/Gems/NvCloth/Assets/slices/Cloth/Chicken_Actor.slice index e7de286c1b..c2c97dec7a 100644 --- a/Gems/NvCloth/Assets/slices/Cloth/Chicken_Actor.slice +++ b/Gems/NvCloth/Assets/slices/Cloth/Chicken_Actor.slice @@ -24,7 +24,7 @@
- + @@ -33,19 +33,20 @@ - + + - + + - @@ -143,7 +144,7 @@ - + @@ -152,19 +153,20 @@ - + + - + + - @@ -246,7 +248,14 @@ - + + + + + + + + @@ -316,12 +325,9 @@ - + - - - - + @@ -329,12 +335,9 @@ - + - - - - + @@ -342,12 +345,9 @@ - + - - - - + @@ -360,94 +360,66 @@ - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + @@ -459,7 +431,7 @@ - + @@ -510,6 +482,7 @@ + diff --git a/Gems/NvCloth/Assets/slices/Cloth/cloth_blinds.slice b/Gems/NvCloth/Assets/slices/Cloth/cloth_blinds.slice index 8d7605318e..40fb2894d3 100644 --- a/Gems/NvCloth/Assets/slices/Cloth/cloth_blinds.slice +++ b/Gems/NvCloth/Assets/slices/Cloth/cloth_blinds.slice @@ -24,7 +24,7 @@ - + @@ -33,14 +33,15 @@ - + + - + @@ -69,7 +70,7 @@ - + @@ -137,7 +138,7 @@ - + @@ -200,24 +201,36 @@ - + - + + + + + + + + + + + + + - + @@ -225,12 +238,9 @@ - + - - - - + @@ -243,46 +253,34 @@ - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + diff --git a/Gems/NvCloth/Assets/slices/Cloth/cloth_blinds_broken.slice b/Gems/NvCloth/Assets/slices/Cloth/cloth_blinds_broken.slice index ff955f260e..909b3e582c 100644 --- a/Gems/NvCloth/Assets/slices/Cloth/cloth_blinds_broken.slice +++ b/Gems/NvCloth/Assets/slices/Cloth/cloth_blinds_broken.slice @@ -24,7 +24,7 @@ - + @@ -33,14 +33,15 @@ - + + - + @@ -69,7 +70,7 @@ - + @@ -137,7 +138,7 @@ - + @@ -200,24 +201,36 @@ - + - + + + + + + + + + + + + + - + @@ -225,12 +238,9 @@ - + - - - - + @@ -243,46 +253,34 @@ - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + diff --git a/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_corners_four.slice b/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_corners_four.slice index d0bcd1296a..25e742550c 100644 --- a/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_corners_four.slice +++ b/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_corners_four.slice @@ -24,7 +24,7 @@ - + @@ -33,14 +33,15 @@ - + + - + @@ -69,7 +70,7 @@ - + @@ -137,7 +138,7 @@ - + @@ -200,24 +201,36 @@ - + - + + + + + + + + + + + + + - + @@ -225,12 +238,9 @@ - + - - - - + @@ -243,46 +253,34 @@ - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + diff --git a/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_corners_two.slice b/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_corners_two.slice index 8e07a65147..26c6290859 100644 --- a/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_corners_two.slice +++ b/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_corners_two.slice @@ -24,7 +24,7 @@ - + @@ -33,14 +33,15 @@ - + + - + @@ -69,7 +70,7 @@ - + @@ -137,7 +138,7 @@ - + @@ -200,24 +201,36 @@ - + - + + + + + + + + + + + + + - + @@ -225,12 +238,9 @@ - + - - - - + @@ -243,46 +253,34 @@ - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + diff --git a/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_edge.slice b/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_edge.slice index a80058d820..cee4fabe49 100644 --- a/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_edge.slice +++ b/Gems/NvCloth/Assets/slices/Cloth/cloth_locked_edge.slice @@ -24,7 +24,7 @@ - + @@ -33,14 +33,15 @@ - + + - + @@ -69,7 +70,7 @@ - + @@ -137,7 +138,7 @@ - + @@ -200,24 +201,36 @@ - + - + + + + + + + + + + + + + - + @@ -225,12 +238,9 @@ - + - - - - + @@ -243,46 +253,34 @@ - - + + - - - - + - - + - - + + - - - - + - - + - - + + - - - - + - - + diff --git a/Gems/Prefab/PrefabBuilder/CMakeLists.txt b/Gems/Prefab/PrefabBuilder/CMakeLists.txt index c4c57155ab..450b8d0408 100644 --- a/Gems/Prefab/PrefabBuilder/CMakeLists.txt +++ b/Gems/Prefab/PrefabBuilder/CMakeLists.txt @@ -23,7 +23,7 @@ ly_add_target( ) ly_add_target( - NAME PrefabBuilder GEM_MODULE + NAME PrefabBuilder.Builders GEM_MODULE NAMESPACE Gem INCLUDE_DIRECTORIES PRIVATE @@ -36,15 +36,9 @@ ly_add_target( ) # the prefab builder only needs to be active in builders -# use the PrefabBuilder module in Clients and Servers: -ly_create_alias(NAME PrefabBuilder.Builders NAMESPACE Gem TARGETS Gem::PrefabBuilder) # we automatically add this gem, if it is present, to all our known set of builder applications: -ly_enable_gems(GEMS PrefabBuilder VARIANTS Builders TARGETS AssetProcessor AssetProcessorBatch AssetBuilder) - -# if you have a custom builder application in your project, then use ly_enable_gems() to -# add it to that application for your project, like this to make YOUR_TARGET_NAME load it automatically -# ly_enable_gems(PROJECT_NAME (YOUR_PROJECT_NAME) GEMS PrefabBuilder VARIANTS Builders TARGETS (YOUR_TARGET_NAME) ) +ly_enable_gems(GEMS PrefabBuilder) if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ly_add_target( diff --git a/Gems/SceneProcessing/Code/CMakeLists.txt b/Gems/SceneProcessing/Code/CMakeLists.txt index 6602c1d7d6..667103b4a7 100644 --- a/Gems/SceneProcessing/Code/CMakeLists.txt +++ b/Gems/SceneProcessing/Code/CMakeLists.txt @@ -68,14 +68,10 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS) ly_create_alias(NAME SceneProcessing.Builders NAMESPACE Gem TARGETS Gem::SceneProcessing.Editor) ly_create_alias(NAME SceneProcessing.Tools NAMESPACE Gem TARGETS Gem::SceneProcessing.Editor) -# SceneProcessing Gem is only used in Tools and builders and is a requirement for the Editor -ly_enable_gems(GEMS SceneProcessing VARIANTS Tools - TARGETS Editor) -ly_enable_gems(GEMS SceneProcessing VARIANTS Builders - TARGETS AssetBuilder AssetProcessor AssetProcessorBatch) + # SceneProcessing Gem is only used in Tools and builders and is a requirement for the Editor and AssetProcessor + ly_enable_gems(GEMS SceneProcessing) endif() - ################################################################################ # Tests ################################################################################ diff --git a/Gems/ScriptCanvas/Code/CMakeLists.txt b/Gems/ScriptCanvas/Code/CMakeLists.txt index 57d7a4a476..c126d343ed 100644 --- a/Gems/ScriptCanvas/Code/CMakeLists.txt +++ b/Gems/ScriptCanvas/Code/CMakeLists.txt @@ -47,8 +47,7 @@ ly_add_target( ) # the script canvas debugger is an optional gem module -# To Enable it: ly_enable_gems( ... TARGETS xxxyyzzz GEMS ScriptCanvasDebugger ...) -# in any particular target. +# To Enable it, associate it with a project ly_create_alias(NAME ScriptCanvasDebugger.Builders NAMESPACE Gem TARGETS Gem::ScriptCanvasDebugger) ly_create_alias(NAME ScriptCanvasDebugger.Tools NAMESPACE Gem TARGETS Gem::ScriptCanvasDebugger) ly_create_alias(NAME ScriptCanvasDebugger.Clients NAMESPACE Gem TARGETS Gem::ScriptCanvasDebugger) diff --git a/Gems/ScriptCanvas/Code/Editor/Model/UnitTestBrowserFilterModel.cpp b/Gems/ScriptCanvas/Code/Editor/Model/UnitTestBrowserFilterModel.cpp index ab35ec5049..e3fe865e94 100644 --- a/Gems/ScriptCanvas/Code/Editor/Model/UnitTestBrowserFilterModel.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Model/UnitTestBrowserFilterModel.cpp @@ -28,7 +28,7 @@ namespace ScriptCanvasEditor { setDynamicSortFilter(true); - m_showColumn.insert(aznumeric_cast(AssetBrowserEntry::Column::DisplayName)); + m_shownColumns.insert(aznumeric_cast(AssetBrowserEntry::Column::DisplayName)); UnitTestWidgetNotificationBus::Handler::BusConnect(); diff --git a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp index 3bcd940a01..c1b557c9c4 100644 --- a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp @@ -408,7 +408,7 @@ namespace ScriptCanvasEditor::Nodes AZ::BehaviorAzEventDescription behaviorAzEventDesc; AZ::AttributeReader azEventDescAttributeReader(nullptr, azEventDescAttribute); azEventDescAttributeReader.Read(behaviorAzEventDesc); - if(behaviorAzEventDesc.m_eventName.empty()) + if (behaviorAzEventDesc.m_eventName.empty()) { AZ_Error("NodeUtils", false, "Cannot create an AzEvent node with empty event name") return {}; diff --git a/Gems/ScriptCanvas/Code/Editor/View/Widgets/NodePalette/NodePaletteModel.cpp b/Gems/ScriptCanvas/Code/Editor/View/Widgets/NodePalette/NodePaletteModel.cpp index 38def487e6..390dbaf0fb 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Widgets/NodePalette/NodePaletteModel.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Widgets/NodePalette/NodePaletteModel.cpp @@ -140,21 +140,10 @@ namespace // If the reflected method returns an AZ::Event, reflect it to the SerializeContext if (AZ::MethodReturnsAzEventByReferenceOrPointer(method)) { - AZ::SerializeContext* serializeContext{}; - AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationRequests::GetSerializeContext); const AZ::BehaviorParameter* resultParameter = method.GetResult(); - AZ::SerializeContext::ClassData classData; - classData.m_name = resultParameter->m_name; - classData.m_typeId = resultParameter->m_typeId; - classData.m_azRtti = resultParameter->m_azRtti; - - auto EventPlaceholderAnyCreator = [](AZ::SerializeContext*) -> AZStd::any - { - return AZStd::make_any(); - }; - serializeContext->RegisterType(resultParameter->m_typeId, AZStd::move(classData), EventPlaceholderAnyCreator); - + ScriptCanvas::ReflectEventTypeOnDemand(resultParameter->m_typeId, resultParameter->m_name, resultParameter->m_azRtti); } + nodePaletteModel.RegisterClassNode(categoryPath, behaviorClass ? behaviorClass->m_name : "", name, &method, &behaviorContext, propertyStatus, isOverloaded); } @@ -177,19 +166,8 @@ namespace // If the reflected method returns an AZ::Event, reflect it to the SerializeContext if (AZ::MethodReturnsAzEventByReferenceOrPointer(behaviorMethod)) { - AZ::SerializeContext* serializeContext{}; - AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationRequests::GetSerializeContext); const AZ::BehaviorParameter* resultParameter = behaviorMethod.GetResult(); - AZ::SerializeContext::ClassData classData; - classData.m_name = resultParameter->m_name; - classData.m_typeId = resultParameter->m_typeId; - classData.m_azRtti = resultParameter->m_azRtti; - - auto EventPlaceholderAnyCreator = [](AZ::SerializeContext*) -> AZStd::any - { - return AZStd::make_any(); - }; - serializeContext->RegisterType(resultParameter->m_typeId, AZStd::move(classData), EventPlaceholderAnyCreator); + ScriptCanvas::ReflectEventTypeOnDemand(resultParameter->m_typeId, resultParameter->m_name, resultParameter->m_azRtti); } nodePaletteModel.RegisterMethodNode(behaviorContext, behaviorMethod); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.cpp index 9ec941d269..9b2d0e4982 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.cpp @@ -165,4 +165,22 @@ namespace ScriptCanvas runtimeVersion = RuntimeVersion::Current; fileVersion = FileVersion::Current; } + + void ReflectEventTypeOnDemand(const AZ::TypeId& typeId, AZStd::string_view name, AZ::IRttiHelper* rttiHelper) + { + AZ::SerializeContext* serializeContext{}; + AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationRequests::GetSerializeContext); + AZ::SerializeContext::ClassData classData; + classData.m_name = name.data(); + classData.m_typeId = typeId; + classData.m_azRtti = rttiHelper; + + auto EventPlaceholderAnyCreator = [](AZ::SerializeContext*) -> AZStd::any + { + return AZStd::make_any(); + }; + + serializeContext->RegisterType(typeId, AZStd::move(classData), EventPlaceholderAnyCreator); + } + } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.h index a1fa8c3d0b..0e64c19dcb 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.h @@ -293,6 +293,8 @@ namespace ScriptCanvas bool m_wasAdded = false; AZ::Entity* m_buildEntity = nullptr; }; + + void ReflectEventTypeOnDemand(const AZ::TypeId& typeId, AZStd::string_view name, AZ::IRttiHelper* rttiHelper = nullptr); } namespace AZStd diff --git a/Gems/Terrain/Code/CMakeLists.txt b/Gems/Terrain/Code/CMakeLists.txt index f40dd17ede..b4a35edbbf 100644 --- a/Gems/Terrain/Code/CMakeLists.txt +++ b/Gems/Terrain/Code/CMakeLists.txt @@ -1,6 +1,6 @@ # # 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 # # @@ -44,7 +44,7 @@ ly_add_target( Gem::LmbrCentral ) -# the above module is for use in all client/server types +# the above module is for use in all client/server types ly_create_alias(NAME Terrain.Servers NAMESPACE Gem TARGETS Gem::Terrain) ly_create_alias(NAME Terrain.Clients NAMESPACE Gem TARGETS Gem::Terrain) @@ -55,7 +55,6 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS) NAME Terrain.Editor MODULE NAMESPACE Gem AUTOMOC - OUTPUT_NAME Gem.Terrain.Editor FILES_CMAKE terrain_editor_shared_files.cmake COMPILE_DEFINITIONS diff --git a/Gems/Terrain/Code/Source/Components/TerrainWorldComponent.cpp b/Gems/Terrain/Code/Source/Components/TerrainWorldComponent.cpp index e2af58e3eb..669a8f4b02 100644 --- a/Gems/Terrain/Code/Source/Components/TerrainWorldComponent.cpp +++ b/Gems/Terrain/Code/Source/Components/TerrainWorldComponent.cpp @@ -85,8 +85,10 @@ namespace Terrain void TerrainWorldComponent::Activate() { - TerrainSystemServiceRequestBus::Broadcast(&TerrainSystemServiceRequestBus::Events::SetWorldMin, m_configuration.m_worldMin); - TerrainSystemServiceRequestBus::Broadcast(&TerrainSystemServiceRequestBus::Events::SetWorldMax, m_configuration.m_worldMax); + TerrainSystemServiceRequestBus::Broadcast( + &TerrainSystemServiceRequestBus::Events::SetWorldBounds, + AZ::Aabb::CreateFromMinMax(m_configuration.m_worldMin, m_configuration.m_worldMax) + ); TerrainSystemServiceRequestBus::Broadcast( &TerrainSystemServiceRequestBus::Events::SetHeightQueryResolution, m_configuration.m_heightQueryResolution); diff --git a/Gems/Terrain/Code/Source/Components/TerrainWorldDebuggerComponent.cpp b/Gems/Terrain/Code/Source/Components/TerrainWorldDebuggerComponent.cpp index 1fea51ded4..d7504295c2 100644 --- a/Gems/Terrain/Code/Source/Components/TerrainWorldDebuggerComponent.cpp +++ b/Gems/Terrain/Code/Source/Components/TerrainWorldDebuggerComponent.cpp @@ -92,20 +92,13 @@ namespace Terrain { m_wireframeBounds = AZ::Aabb::CreateNull(); - TerrainSystemServiceRequestBus::Broadcast( - &TerrainSystemServiceRequestBus::Events::SetDebugWireframe, m_configuration.m_drawWireframe); - AzFramework::EntityDebugDisplayEventBus::Handler::BusConnect(GetEntityId()); AzFramework::BoundsRequestBus::Handler::BusConnect(GetEntityId()); AzFramework::Terrain::TerrainDataNotificationBus::Handler::BusConnect(); - } void TerrainWorldDebuggerComponent::Deactivate() { - TerrainSystemServiceRequestBus::Broadcast( - &TerrainSystemServiceRequestBus::Events::SetDebugWireframe, false); - AzFramework::Terrain::TerrainDataNotificationBus::Handler::BusDisconnect(); AzFramework::BoundsRequestBus::Handler::BusDisconnect(); AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect(); diff --git a/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.cpp b/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.cpp index 812ed3f0da..2178151e3d 100644 --- a/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.cpp +++ b/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.cpp @@ -10,12 +10,14 @@ #include #include +#include #include #include #include #include +#include #include #include #include @@ -34,6 +36,7 @@ namespace Terrain namespace { const uint32_t DEFAULT_UploadBufferSize = 512 * 1024; // 512k + const char* TerrainFPName = "TerrainFeatureProcessor"; } namespace ShaderInputs @@ -59,7 +62,7 @@ namespace Terrain void TerrainFeatureProcessor::Activate() { - m_areaData.clear(); + m_areaData = {}; InitializeAtomStuff(); EnableSceneNotification(); @@ -69,43 +72,18 @@ namespace Terrain { m_rhiSystem = AZ::RHI::RHISystemInterface::Get(); - m_rhiSystem->GetDrawListTagRegistry()->AcquireTag(AZ::Name("Terrain")); - { // Load the shader - - const char* terrainShaderFilePath = "Shaders/Terrain/Terrain.azshader"; - - AZ::Data::AssetId shaderAssetId; - AZ::Data::AssetCatalogRequestBus::BroadcastResult( - shaderAssetId, &AZ::Data::AssetCatalogRequestBus::Events::GetAssetIdByPath, - terrainShaderFilePath, azrtti_typeid(), false); - if (!shaderAssetId.IsValid()) - { - AZ_Error("Terrain", false, "Failed to get shader asset id with path %s", terrainShaderFilePath); - return; - } - - auto shaderAsset = AZ::Data::AssetManager::Instance().GetAsset(shaderAssetId, AZ::Data::AssetLoadBehavior::PreLoad); - shaderAsset.BlockUntilLoadComplete(); - - if (!shaderAsset.IsReady()) - { - AZ_Error("Terrain", false, "Failed to get shader asset with path %s", terrainShaderFilePath); - return; - } - - m_shader = AZ::RPI::Shader::FindOrCreate(shaderAsset); + constexpr const char* TerrainShaderFilePath = "Shaders/Terrain/Terrain.azshader"; + m_shader = AZ::RPI::LoadShader(TerrainShaderFilePath); if (!m_shader) { - AZ_Error("Terrain", false, "Failed to find or create a shader instance from shader asset '%s'", terrainShaderFilePath); + AZ_Error(TerrainFPName, false, "Failed to find or create a shader instance from shader asset '%s'", TerrainShaderFilePath); return; } // Create the data layout - m_pipelineStateDescriptor = AZ::RHI::PipelineStateDescriptorForDraw{}; - { AZ::RHI::InputStreamLayoutBuilder layoutBuilder; @@ -124,41 +102,41 @@ namespace Terrain m_perObjectSrgAsset = m_shader->FindShaderResourceGroupLayout(AZ::Name{"ObjectSrg"}); if (!m_perObjectSrgAsset) { - AZ_Error("Terrain", false, "Failed to get shader resource group asset"); + AZ_Error(TerrainFPName, false, "Failed to get shader resource group asset"); return; } else if (!m_perObjectSrgAsset->IsFinalized()) { - AZ_Error("Terrain", false, "Shader resource group asset is not loaded"); + AZ_Error(TerrainFPName, false, "Shader resource group asset is not loaded"); return; } const AZ::RHI::ShaderResourceGroupLayout* shaderResourceGroupLayout = &(*m_perObjectSrgAsset); m_heightmapImageIndex = shaderResourceGroupLayout->FindShaderInputImageIndex(AZ::Name(ShaderInputs::HeightmapImage)); - AZ_Error("Terrain", m_heightmapImageIndex.IsValid(), "Failed to find shader input image %s.", ShaderInputs::HeightmapImage); + AZ_Error(TerrainFPName, m_heightmapImageIndex.IsValid(), "Failed to find shader input image %s.", ShaderInputs::HeightmapImage); m_modelToWorldIndex = shaderResourceGroupLayout->FindShaderInputConstantIndex(AZ::Name(ShaderInputs::ModelToWorld)); - AZ_Error("Terrain", m_modelToWorldIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::ModelToWorld); + AZ_Error(TerrainFPName, m_modelToWorldIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::ModelToWorld); m_heightScaleIndex = shaderResourceGroupLayout->FindShaderInputConstantIndex(AZ::Name(ShaderInputs::HeightScale)); - AZ_Error("Terrain", m_heightScaleIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::HeightScale); + AZ_Error(TerrainFPName, m_heightScaleIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::HeightScale); m_uvMinIndex = shaderResourceGroupLayout->FindShaderInputConstantIndex(AZ::Name(ShaderInputs::UvMin)); - AZ_Error("Terrain", m_uvMinIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::UvMin); + AZ_Error(TerrainFPName, m_uvMinIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::UvMin); m_uvMaxIndex = shaderResourceGroupLayout->FindShaderInputConstantIndex(AZ::Name(ShaderInputs::UvMax)); - AZ_Error("Terrain", m_uvMaxIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::UvMax); + AZ_Error(TerrainFPName, m_uvMaxIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::UvMax); m_uvStepIndex = shaderResourceGroupLayout->FindShaderInputConstantIndex(AZ::Name(ShaderInputs::UvStep)); - AZ_Error("Terrain", m_uvStepIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::UvStep); + AZ_Error(TerrainFPName, m_uvStepIndex.IsValid(), "Failed to find shader input constant %s.", ShaderInputs::UvStep); // If this fails to run now, it's ok, we'll initialize it in OnRenderPipelineAdded later. bool success = GetParentScene()->ConfigurePipelineState(m_shader->GetDrawListTag(), m_pipelineStateDescriptor); if (success) { m_pipelineState = m_shader->AcquirePipelineState(m_pipelineStateDescriptor); - AZ_Assert(m_pipelineState, "Failed to acquire default pipeline state for shader '%s'", terrainShaderFilePath); + AZ_Assert(m_pipelineState, "Failed to acquire default pipeline state for shader '%s'", TerrainShaderFilePath); } } @@ -172,7 +150,7 @@ namespace Terrain if (resultCode != AZ::RHI::ResultCode::Success) { - AZ_Error("Terrain", false, "Failed to create host buffer pool from RPI"); + AZ_Error(TerrainFPName, false, "Failed to create host buffer pool from RPI"); return; } @@ -180,7 +158,7 @@ namespace Terrain if (!InitializeRenderBuffers()) { - AZ_Error("Terrain", false, "Failed to create Terrain render buffers!"); + AZ_Error(TerrainFPName, false, "Failed to create Terrain render buffers!"); return; } } @@ -210,7 +188,7 @@ namespace Terrain DisableSceneNotification(); DestroyRenderBuffers(); - m_areaData.clear(); + m_areaData = {}; if (m_hostPool) { @@ -226,7 +204,6 @@ namespace Terrain } void TerrainFeatureProcessor::UpdateTerrainData( - AZ::EntityId areaId, const AZ::Transform& transform, const AZ::Aabb& worldBounds, [[maybe_unused]] float sampleSpacing, @@ -234,37 +211,33 @@ namespace Terrain { if (!worldBounds.IsValid()) { - m_areaData.erase(areaId); return; } - TerrainAreaData areaData; - - areaData.m_transform = transform; - areaData.m_heightScale = worldBounds.GetZExtent(); - areaData.m_terrainBounds = worldBounds; - areaData.m_heightmapImageHeight = height; - areaData.m_heightmapImageWidth = width; + m_areaData.m_transform = transform; + m_areaData.m_heightScale = worldBounds.GetZExtent(); + m_areaData.m_terrainBounds = worldBounds; + m_areaData.m_heightmapImageHeight = height; + m_areaData.m_heightmapImageWidth = width; // Create heightmap image data { - areaData.m_propertiesDirty = true; + m_areaData.m_propertiesDirty = true; AZ::RHI::Size imageSize; imageSize.m_width = width; imageSize.m_height = height; AZ::Data::Instance streamingImagePool = AZ::RPI::ImageSystemInterface::Get()->GetSystemStreamingPool(); - areaData.m_heightmapImage = AZ::RPI::StreamingImage::CreateFromCpuData(*streamingImagePool, + m_areaData.m_heightmapImage = AZ::RPI::StreamingImage::CreateFromCpuData(*streamingImagePool, AZ::RHI::ImageDimension::Image2D, imageSize, AZ::RHI::Format::R32_FLOAT, (uint8_t*)heightData.data(), heightData.size() * sizeof(float)); - AZ_Error("Terrain", areaData.m_heightmapImage, "Failed to initialize the heightmap image!"); + AZ_Error(TerrainFPName, m_areaData.m_heightmapImage, "Failed to initialize the heightmap image!"); } - m_areaData.insert_or_assign(areaId, areaData); } void TerrainFeatureProcessor::ProcessSurfaces(const FeatureProcessor::RenderPacket& process) @@ -276,31 +249,30 @@ namespace Terrain return; } - if (m_areaData.empty()) + if (!m_areaData.m_terrainBounds.IsValid()) { return; } + + if (m_areaData.m_propertiesDirty) + { + m_sectorData.clear(); - m_drawPackets.clear(); - m_processSrgs.clear(); - - AZ::RHI::DrawPacketBuilder drawPacketBuilder; + AZ::RHI::DrawPacketBuilder drawPacketBuilder; - uint32_t numIndices = static_cast(m_gridIndices.size()); + uint32_t numIndices = static_cast(m_gridIndices.size()); - AZ::RHI::DrawIndexed drawIndexed; - drawIndexed.m_indexCount = numIndices; - drawIndexed.m_indexOffset = 0; - drawIndexed.m_vertexOffset = 0; + AZ::RHI::DrawIndexed drawIndexed; + drawIndexed.m_indexCount = numIndices; + drawIndexed.m_indexOffset = 0; + drawIndexed.m_vertexOffset = 0; - for (auto& [areaId, areaData] : m_areaData) - { float xFirstPatchStart = - areaData.m_terrainBounds.GetMin().GetX() - fmod(areaData.m_terrainBounds.GetMin().GetX(), m_gridMeters); - float xLastPatchStart = areaData.m_terrainBounds.GetMax().GetX() - fmod(areaData.m_terrainBounds.GetMax().GetX(), m_gridMeters); + m_areaData.m_terrainBounds.GetMin().GetX() - fmod(m_areaData.m_terrainBounds.GetMin().GetX(), m_gridMeters); + float xLastPatchStart = m_areaData.m_terrainBounds.GetMax().GetX() - fmod(m_areaData.m_terrainBounds.GetMax().GetX(), m_gridMeters); float yFirstPatchStart = - areaData.m_terrainBounds.GetMin().GetY() - fmod(areaData.m_terrainBounds.GetMin().GetY(), m_gridMeters); - float yLastPatchStart = areaData.m_terrainBounds.GetMax().GetY() - fmod(areaData.m_terrainBounds.GetMax().GetY(), m_gridMeters); + m_areaData.m_terrainBounds.GetMin().GetY() - fmod(m_areaData.m_terrainBounds.GetMin().GetY(), m_gridMeters); + float yLastPatchStart = m_areaData.m_terrainBounds.GetMax().GetY() - fmod(m_areaData.m_terrainBounds.GetMax().GetY(), m_gridMeters); for (float yPatch = yFirstPatchStart; yPatch <= yLastPatchStart; yPatch += m_gridMeters) { @@ -310,62 +282,70 @@ namespace Terrain drawPacketBuilder.SetDrawArguments(drawIndexed); drawPacketBuilder.SetIndexBufferView(m_indexBufferView); - auto m_resourceGroup = AZ::RPI::ShaderResourceGroup::Create(m_shader->GetAsset(), m_shader->GetSupervariantIndex(), AZ::Name("ObjectSrg")); + auto resourceGroup = AZ::RPI::ShaderResourceGroup::Create(m_shader->GetAsset(), m_shader->GetSupervariantIndex(), AZ::Name("ObjectSrg")); //auto m_resourceGroup = AZ::RPI::ShaderResourceGroup::Create(m_shader->GetAsset(), AZ::Name("ObjectSrg")); - if (!m_resourceGroup) + if (!resourceGroup) { - AZ_Error("Terrain", false, "Failed to create shader resource group"); + AZ_Error(TerrainFPName, false, "Failed to create shader resource group"); return; } float uvMin[2] = { 0.0f, 0.0f }; float uvMax[2] = { 1.0f, 1.0f }; - uvMin[0] = (float)((xPatch - areaData.m_terrainBounds.GetMin().GetX()) / areaData.m_terrainBounds.GetXExtent()); - uvMin[1] = (float)((yPatch - areaData.m_terrainBounds.GetMin().GetY()) / areaData.m_terrainBounds.GetYExtent()); + uvMin[0] = (float)((xPatch - m_areaData.m_terrainBounds.GetMin().GetX()) / m_areaData.m_terrainBounds.GetXExtent()); + uvMin[1] = (float)((yPatch - m_areaData.m_terrainBounds.GetMin().GetY()) / m_areaData.m_terrainBounds.GetYExtent()); uvMax[0] = - (float)(((xPatch + m_gridMeters) - areaData.m_terrainBounds.GetMin().GetX()) / areaData.m_terrainBounds.GetXExtent()); + (float)(((xPatch + m_gridMeters) - m_areaData.m_terrainBounds.GetMin().GetX()) / m_areaData.m_terrainBounds.GetXExtent()); uvMax[1] = - (float)(((yPatch + m_gridMeters) - areaData.m_terrainBounds.GetMin().GetY()) / areaData.m_terrainBounds.GetYExtent()); + (float)(((yPatch + m_gridMeters) - m_areaData.m_terrainBounds.GetMin().GetY()) / m_areaData.m_terrainBounds.GetYExtent()); float uvStep[2] = { - 1.0f / areaData.m_heightmapImageWidth, 1.0f / areaData.m_heightmapImageHeight, + 1.0f / m_areaData.m_heightmapImageWidth, 1.0f / m_areaData.m_heightmapImageHeight, }; - AZ::Transform transform = areaData.m_transform; - transform.SetTranslation(xPatch, yPatch, areaData.m_transform.GetTranslation().GetZ()); + AZ::Transform transform = m_areaData.m_transform; + transform.SetTranslation(xPatch, yPatch, m_areaData.m_transform.GetTranslation().GetZ()); AZ::Matrix3x4 matrix3x4 = AZ::Matrix3x4::CreateFromTransform(transform); - m_resourceGroup->SetImage(m_heightmapImageIndex, areaData.m_heightmapImage); - m_resourceGroup->SetConstant(m_modelToWorldIndex, matrix3x4); - m_resourceGroup->SetConstant(m_heightScaleIndex, areaData.m_heightScale); - m_resourceGroup->SetConstant(m_uvMinIndex, uvMin); - m_resourceGroup->SetConstant(m_uvMaxIndex, uvMax); - m_resourceGroup->SetConstant(m_uvStepIndex, uvStep); - m_resourceGroup->Compile(); - m_processSrgs.push_back(m_resourceGroup); - - if (m_resourceGroup != nullptr) - { - drawPacketBuilder.AddShaderResourceGroup(m_resourceGroup->GetRHIShaderResourceGroup()); - } + resourceGroup->SetImage(m_heightmapImageIndex, m_areaData.m_heightmapImage); + resourceGroup->SetConstant(m_modelToWorldIndex, matrix3x4); + resourceGroup->SetConstant(m_heightScaleIndex, m_areaData.m_heightScale); + resourceGroup->SetConstant(m_uvMinIndex, uvMin); + resourceGroup->SetConstant(m_uvMaxIndex, uvMax); + resourceGroup->SetConstant(m_uvStepIndex, uvStep); + resourceGroup->Compile(); + drawPacketBuilder.AddShaderResourceGroup(resourceGroup->GetRHIShaderResourceGroup()); AZ::RHI::DrawPacketBuilder::DrawRequest drawRequest; drawRequest.m_listTag = m_drawListTag; drawRequest.m_pipelineState = m_pipelineState.get(); - drawRequest.m_streamBufferViews = m_vertexBufferViews; + drawRequest.m_streamBufferViews = AZStd::array_view(&m_vertexBufferView, 1); drawPacketBuilder.AddDrawItem(drawRequest); - - const AZ::RHI::DrawPacket* drawPacket = drawPacketBuilder.End(); - m_drawPackets.emplace_back(drawPacket); - - for (auto& view : process.m_views) - { - view->AddDrawPacket(drawPacket); - } + + m_sectorData.emplace_back( + drawPacketBuilder.End(), + AZ::Aabb::CreateFromMinMax( + AZ::Vector3(xPatch, yPatch, m_areaData.m_terrainBounds.GetMin().GetZ()), + AZ::Vector3(xPatch + m_gridMeters, yPatch + m_gridMeters, m_areaData.m_terrainBounds.GetMax().GetZ()) + ), + resourceGroup + ); + } + } + } + + for (auto& view : process.m_views) + { + AZ::Frustum viewFrustum = AZ::Frustum::CreateFromMatrixColumnMajor(view->GetWorldToClipMatrix()); + for (auto& sectorData : m_sectorData) + { + if (viewFrustum.IntersectAabb(sectorData.m_aabb) != AZ::IntersectResult::Exterior) + { + view->AddDrawPacket(sectorData.m_drawPacket.get()); } } } @@ -413,9 +393,6 @@ namespace Terrain m_indexBuffer->SetName(AZ::Name("TerrainIndexBuffer")); m_vertexBuffer->SetName(AZ::Name("TerrainVertexBuffer")); - // We only need one vertex buffer view. - m_vertexBufferViews.resize(1); - AZStd::vector> buffers = { m_indexBuffer , m_vertexBuffer }; // Fill our buffers with the vertex/index data @@ -433,7 +410,7 @@ namespace Terrain if (result != AZ::RHI::ResultCode::Success) { - AZ_Error("Terrain", false, "Failed to create GPU buffers for Terrain"); + AZ_Error(TerrainFPName, false, "Failed to create GPU buffers for Terrain"); return false; } @@ -462,10 +439,10 @@ namespace Terrain const uint64_t elementSize = m_gridVertices.size() * sizeof(Vertex); memcpy(mappedData, m_gridVertices.data(), elementSize); - m_vertexBufferViews[bufferIndex - 1] = AZ::RHI::StreamBufferView( + m_vertexBufferView = AZ::RHI::StreamBufferView( *buffer, 0, static_cast(elementSize), static_cast(sizeof(Vertex))); - AZ::RHI::ValidateStreamBufferViews(m_pipelineStateDescriptor.m_inputStreamLayout, m_vertexBufferViews); + AZ::RHI::ValidateStreamBufferViews(m_pipelineStateDescriptor.m_inputStreamLayout, { { m_vertexBufferView } }); } m_hostPool->UnmapBuffer(*buffer); @@ -479,9 +456,8 @@ namespace Terrain m_indexBuffer.reset(); m_vertexBuffer.reset(); - m_vertexBufferViews.clear(); - - m_processSrgs.clear(); + m_indexBufferView = {}; + m_vertexBufferView = {}; m_pipelineStateDescriptor = AZ::RHI::PipelineStateDescriptorForDraw{}; m_pipelineState = nullptr; diff --git a/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.h b/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.h index 2a1d5b7514..7a7b63b634 100644 --- a/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.h +++ b/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.h @@ -47,16 +47,12 @@ namespace Terrain void Deactivate() override; void Render(const AZ::RPI::FeatureProcessor::RenderPacket& packet) override; - void UpdateTerrainData(AZ::EntityId areaId, const AZ::Transform& transform, const AZ::Aabb& worldBounds, float sampleSpacing, + void UpdateTerrainData(const AZ::Transform& transform, const AZ::Aabb& worldBounds, float sampleSpacing, uint32_t width, uint32_t height, const AZStd::vector& heightData); - void RemoveTerrainData(AZ::EntityId areaId) - { - m_areaData.erase(areaId); - } void RemoveTerrainData() { - m_areaData.clear(); + m_areaData = {}; } private: @@ -122,13 +118,13 @@ namespace Terrain AZ::RHI::Ptr m_indexBuffer; AZ::RHI::Ptr m_vertexBuffer; AZ::RHI::IndexBufferView m_indexBufferView; - AZStd::fixed_vector m_vertexBufferViews; + AZ::RHI::StreamBufferView m_vertexBufferView; // Per-area data struct TerrainAreaData { - AZ::Transform m_transform; - AZ::Aabb m_terrainBounds; + AZ::Transform m_transform{ AZ::Transform::CreateIdentity() }; + AZ::Aabb m_terrainBounds{ AZ::Aabb::CreateNull() }; float m_heightScale; AZ::Data::Instance m_heightmapImage; uint32_t m_heightmapImageWidth; @@ -136,10 +132,21 @@ namespace Terrain bool m_propertiesDirty{ true }; }; - AZStd::unordered_map m_areaData; + TerrainAreaData m_areaData; + + struct SectorData + { + AZ::Data::Instance m_srg; + AZ::Aabb m_aabb; + AZStd::unique_ptr m_drawPacket; + + SectorData(const AZ::RHI::DrawPacket* drawPacket, AZ::Aabb aabb, AZ::Data::Instance srg) + : m_srg(srg) + , m_aabb(aabb) + , m_drawPacket(drawPacket) + {} + }; - // These could either be per-area or system-level - AZStd::vector> m_drawPackets; - AZStd::vector> m_processSrgs; + AZStd::vector m_sectorData; }; } diff --git a/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystem.cpp b/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystem.cpp index 872b37a02e..90b74f08ba 100644 --- a/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystem.cpp +++ b/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystem.cpp @@ -49,15 +49,9 @@ void TerrainSystem::Deactivate() m_terrainSettingsDirty = true; } -void TerrainSystem::SetWorldMin(AZ::Vector3 worldOrigin) -{ - m_requestedSettings.m_worldBounds.SetMin(worldOrigin); - m_terrainSettingsDirty = true; -} - -void TerrainSystem::SetWorldMax(AZ::Vector3 worldBounds) -{ - m_requestedSettings.m_worldBounds.SetMax(worldBounds); +void TerrainSystem::SetWorldBounds(const AZ::Aabb& worldBounds) +{ + m_requestedSettings.m_worldBounds = worldBounds; m_terrainSettingsDirty = true; } @@ -67,13 +61,6 @@ void TerrainSystem::SetHeightQueryResolution(AZ::Vector2 queryResolution) m_terrainSettingsDirty = true; } -void TerrainSystem::SetDebugWireframe(bool wireframeEnabled) -{ - m_requestedSettings.m_debugWireframeEnabled = wireframeEnabled; - m_terrainSettingsDirty = true; -} - - AZ::Aabb TerrainSystem::GetTerrainAabb() const { return m_currentSettings.m_worldBounds; @@ -378,13 +365,6 @@ void TerrainSystem::OnTick(float /*deltaTime*/, AZ::ScriptTimePoint /*time*/) terrainSettingsChanged = true; } - if (m_requestedSettings.m_debugWireframeEnabled != m_currentSettings.m_debugWireframeEnabled) - { - m_dirtyRegion = AZ::Aabb::CreateNull(); - m_terrainHeightDirty = true; - terrainSettingsChanged = true; - } - if (m_requestedSettings.m_heightQueryResolution != m_currentSettings.m_heightQueryResolution) { m_dirtyRegion = AZ::Aabb::CreateNull(); @@ -409,7 +389,6 @@ void TerrainSystem::OnTick(float /*deltaTime*/, AZ::ScriptTimePoint /*time*/) { AZStd::shared_lock lock(m_areaMutex); - AZ::EntityId entityId(0); AZ::Transform transform = AZ::Transform::CreateTranslation(m_currentSettings.m_worldBounds.GetCenter()); uint32_t width = aznumeric_cast( @@ -417,7 +396,7 @@ void TerrainSystem::OnTick(float /*deltaTime*/, AZ::ScriptTimePoint /*time*/) uint32_t height = aznumeric_cast( (float)m_currentSettings.m_worldBounds.GetYExtent() / m_currentSettings.m_heightQueryResolution.GetY()); AZStd::vector pixels; - pixels.resize(width * height); + pixels.resize_no_construct(width * height); const uint32_t pixelDataSize = width * height * sizeof(float); memset(pixels.data(), 0, pixelDataSize); @@ -454,8 +433,7 @@ void TerrainSystem::OnTick(float /*deltaTime*/, AZ::ScriptTimePoint /*time*/) if (terrainFeatureProcessor) { terrainFeatureProcessor->UpdateTerrainData( - entityId, transform, m_currentSettings.m_worldBounds, m_currentSettings.m_heightQueryResolution.GetX(), width, height, - pixels); + transform, m_currentSettings.m_worldBounds, m_currentSettings.m_heightQueryResolution.GetX(), width, height, pixels); } } diff --git a/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystem.h b/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystem.h index 56ed182047..2d2286a0c3 100644 --- a/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystem.h +++ b/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystem.h @@ -36,11 +36,9 @@ namespace Terrain /////////////////////////////////////////// // TerrainSystemServiceRequestBus::Handler Impl - - void SetWorldMin(AZ::Vector3 worldOrigin) override; - void SetWorldMax(AZ::Vector3 worldBounds) override; + + void SetWorldBounds(const AZ::Aabb& worldBounds) override; void SetHeightQueryResolution(AZ::Vector2 queryResolution) override; - void SetDebugWireframe(bool wireframeEnabled) override; void Activate() override; void Deactivate() override; @@ -103,7 +101,6 @@ namespace Terrain { AZ::Aabb m_worldBounds; AZ::Vector2 m_heightQueryResolution{ 1.0f }; - bool m_debugWireframeEnabled{ false }; bool m_systemActive{ false }; }; diff --git a/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystemBus.h b/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystemBus.h index 08521fd780..e999cbf8be 100644 --- a/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystemBus.h +++ b/Gems/Terrain/Code/Source/TerrainSystem/TerrainSystemBus.h @@ -39,10 +39,8 @@ namespace Terrain virtual void Activate() = 0; virtual void Deactivate() = 0; - virtual void SetWorldMin(AZ::Vector3 worldOrigin) = 0; - virtual void SetWorldMax(AZ::Vector3 worldBounds) = 0; + virtual void SetWorldBounds(const AZ::Aabb& worldBounds) = 0; virtual void SetHeightQueryResolution(AZ::Vector2 queryResolution) = 0; - virtual void SetDebugWireframe(bool wireframeEnabled) = 0; // register an area to override terrain virtual void RegisterArea(AZ::EntityId areaId) = 0; @@ -111,8 +109,6 @@ namespace Terrain virtual void GetHeight(const AZ::Vector3& inPosition, AZ::Vector3& outPosition, Sampler sampleFilter = Sampler::DEFAULT) = 0; virtual void GetNormal(const AZ::Vector3& inPosition, AZ::Vector3& outNormal, Sampler sampleFilter = Sampler::DEFAULT) = 0; - //virtual void GetSurfaceWeights(const AZ::Vector3& inPosition, SurfaceTagWeightMap& outSurfaceWeights, Sampler sampleFilter = DEFAULT) = 0; - //virtual void GetSurfacePoint(const AZ::Vector3& inPosition, SurfacePoint& outSurfacePoint, SurfacePointDataMask dataMask = DEFAULT, Sampler sampleFilter = DEFAULT) = 0; }; using TerrainAreaHeightRequestBus = AZ::EBus; diff --git a/Templates/DefaultGem/Template/Code/CMakeLists.txt b/Templates/DefaultGem/Template/Code/CMakeLists.txt index 181491d504..f462e7f2d4 100644 --- a/Templates/DefaultGem/Template/Code/CMakeLists.txt +++ b/Templates/DefaultGem/Template/Code/CMakeLists.txt @@ -85,7 +85,6 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS) NAME ${Name}.Editor GEM_MODULE NAMESPACE Gem AUTOMOC - OUTPUT_NAME Gem.${Name}.Editor FILES_CMAKE ${NameLower}_editor_shared_files.cmake INCLUDE_DIRECTORIES diff --git a/Templates/DefaultProject/Template/Code/CMakeLists.txt b/Templates/DefaultProject/Template/Code/CMakeLists.txt index 0c6f6553fb..7bbb9a0852 100644 --- a/Templates/DefaultProject/Template/Code/CMakeLists.txt +++ b/Templates/DefaultProject/Template/Code/CMakeLists.txt @@ -68,46 +68,12 @@ ly_create_alias(NAME ${Name}.Servers NAMESPACE Gem TARGETS Gem::${Name}) # Gem dependencies ################################################################################ -# The GameLauncher uses "Clients" gem variants: -ly_enable_gems( - PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake - TARGETS - ${Name}.GameLauncher - VARIANTS - Clients) - -if(PAL_TRAIT_BUILD_HOST_TOOLS) - - # the builder type applications use the "Builders" variants of the enabled gems. - ly_enable_gems( - PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake - TARGETS - AssetBuilder - AssetProcessor - AssetProcessorBatch - VARIANTS - Builders) - - # the Editor applications use the "Tools" variants of the enabled gems. - ly_enable_gems( - PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake - TARGETS - Editor - VARIANTS - Tools) -endif() +# Enable the specified list of gems from GEM_FILE or GEMS list for this specific project: +ly_enable_gems(PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake) if(PAL_TRAIT_BUILD_SERVER_SUPPORTED) # this property causes it to actually make a ServerLauncher. # if you don't want a Server application, you can remove this and the # following ly_enable_gems lines. set_property(GLOBAL APPEND PROPERTY LY_LAUNCHER_SERVER_PROJECTS ${Name}) - - # The ServerLauncher uses the "Servers" variants of enabled gems: - ly_enable_gems( - PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake - TARGETS - ${Name}.ServerLauncher - VARIANTS - Servers) endif() diff --git a/Templates/MinimalProject/Template/Code/CMakeLists.txt b/Templates/MinimalProject/Template/Code/CMakeLists.txt index 0c6f6553fb..5e646c0704 100644 --- a/Templates/MinimalProject/Template/Code/CMakeLists.txt +++ b/Templates/MinimalProject/Template/Code/CMakeLists.txt @@ -68,46 +68,13 @@ ly_create_alias(NAME ${Name}.Servers NAMESPACE Gem TARGETS Gem::${Name}) # Gem dependencies ################################################################################ -# The GameLauncher uses "Clients" gem variants: -ly_enable_gems( - PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake - TARGETS - ${Name}.GameLauncher - VARIANTS - Clients) +# Enable the specified list of gems from GEM_FILE or GEMS list for this specific project: +ly_enable_gems(PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake) -if(PAL_TRAIT_BUILD_HOST_TOOLS) - - # the builder type applications use the "Builders" variants of the enabled gems. - ly_enable_gems( - PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake - TARGETS - AssetBuilder - AssetProcessor - AssetProcessorBatch - VARIANTS - Builders) - - # the Editor applications use the "Tools" variants of the enabled gems. - ly_enable_gems( - PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake - TARGETS - Editor - VARIANTS - Tools) -endif() if(PAL_TRAIT_BUILD_SERVER_SUPPORTED) # this property causes it to actually make a ServerLauncher. # if you don't want a Server application, you can remove this and the # following ly_enable_gems lines. set_property(GLOBAL APPEND PROPERTY LY_LAUNCHER_SERVER_PROJECTS ${Name}) - - # The ServerLauncher uses the "Servers" variants of enabled gems: - ly_enable_gems( - PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake - TARGETS - ${Name}.ServerLauncher - VARIANTS - Servers) endif() diff --git a/cmake/3rdParty/Platform/Android/BuiltInPackages_android.cmake b/cmake/3rdParty/Platform/Android/BuiltInPackages_android.cmake index a65e8b45e4..cbdca10af9 100644 --- a/cmake/3rdParty/Platform/Android/BuiltInPackages_android.cmake +++ b/cmake/3rdParty/Platform/Android/BuiltInPackages_android.cmake @@ -27,4 +27,4 @@ ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-android TARGETS goo ly_associate_package(PACKAGE_NAME googlebenchmark-1.5.0-rev2-android TARGETS GoogleBenchmark PACKAGE_HASH 20b46e572211a69d7d94ddad1c89ec37bb958711d6ad4025368ac89ea83078fb) ly_associate_package(PACKAGE_NAME libsamplerate-0.2.1-rev2-android TARGETS libsamplerate PACKAGE_HASH bf13662afe65d02bcfa16258a4caa9b875534978227d6f9f36c9cfa92b3fb12b) ly_associate_package(PACKAGE_NAME OpenSSL-1.1.1b-rev1-android TARGETS OpenSSL PACKAGE_HASH 4036d4019d722f0e1b7a1621bf60b5a17ca6a65c9c78fd8701cee1131eec8480) -ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev1-android TARGETS zlib PACKAGE_HASH 832b163cae0cccbe4fddc5988f5725fac56ef7dba5bfe95bf8c71281fba2e12c) +ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev2-android TARGETS zlib PACKAGE_HASH 85b730b97176772538cfcacd6b6aaf4655fc2d368d134d6dd55e02f28f183826) diff --git a/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake b/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake index ba63ef5d64..0cbb799304 100644 --- a/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake +++ b/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake @@ -43,7 +43,7 @@ ly_associate_package(PACKAGE_NAME OpenSSL-1.1.1b-rev2-linux ly_associate_package(PACKAGE_NAME DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-linux TARGETS DirectXShaderCompilerDxc PACKAGE_HASH 88c4a359325d749bc34090b9ac466424847f3b71ba0de15045cf355c17c07099) ly_associate_package(PACKAGE_NAME SPIRVCross-2021.04.29-rev1-linux TARGETS SPIRVCross PACKAGE_HASH 7889ee5460a688e9b910c0168b31445c0079d363affa07b25d4c8aeb608a0b80) ly_associate_package(PACKAGE_NAME azslc-1.7.23-rev2-linux TARGETS azslc PACKAGE_HASH 1ba84d8321a566d35a1e9aa7400211ba8e6d1c11c08e4be3c93e6e74b8f7aef1) -ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev1-linux TARGETS zlib PACKAGE_HASH 6418e93b9f4e6188f3b62cbd3a7822e1c4398a716e786d1522b809a727d08ba9) +ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev2-linux TARGETS zlib PACKAGE_HASH 16f3b9e11cda525efb62144f354c1cfc30a5def9eff020dbe49cb00ee7d8234f) ly_associate_package(PACKAGE_NAME squish-ccr-deb557d-rev1-linux TARGETS squish-ccr PACKAGE_HASH 85fecafbddc6a41a27c5f59ed4a5dfb123a94cb4666782cf26e63c0a4724c530) ly_associate_package(PACKAGE_NAME ISPCTexComp-36b80aa-rev1-linux TARGETS ISPCTexComp PACKAGE_HASH 065fd12abe4247dde247330313763cf816c3375c221da030bdec35024947f259) diff --git a/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake b/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake index be89612c1b..e18bb07772 100644 --- a/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake +++ b/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake @@ -41,7 +41,7 @@ ly_associate_package(PACKAGE_NAME googlebenchmark-1.5.0-rev2-mac ly_associate_package(PACKAGE_NAME OpenSSL-1.1.1b-rev1-mac TARGETS OpenSSL PACKAGE_HASH 28adc1c0616ac0482b2a9d7b4a3a3635a1020e87b163f8aba687c501cf35f96c) ly_associate_package(PACKAGE_NAME qt-5.15.2-rev5-mac TARGETS Qt PACKAGE_HASH 9d25918351898b308ded3e9e571fff6f26311b2071aeafd00dd5b249fdf53f7e) ly_associate_package(PACKAGE_NAME libsamplerate-0.2.1-rev2-mac TARGETS libsamplerate PACKAGE_HASH b912af40c0ac197af9c43d85004395ba92a6a859a24b7eacd920fed5854a97fe) -ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev1-mac TARGETS zlib PACKAGE_HASH 7fd8a77b3598423d9d6be5f8c60d52aecf346ab4224f563a5282db283aa0da02) +ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev2-mac TARGETS zlib PACKAGE_HASH 21714e8a6de4f2523ee92a7f52d51fbee29c5f37ced334e00dc3c029115b472e) ly_associate_package(PACKAGE_NAME squish-ccr-deb557d-rev1-mac TARGETS squish-ccr PACKAGE_HASH 155bfbfa17c19a9cd2ef025de14c5db598f4290045d5b0d83ab58cb345089a77) ly_associate_package(PACKAGE_NAME ISPCTexComp-36b80aa-rev1-mac TARGETS ISPCTexComp PACKAGE_HASH 8a4e93277b8face6ea2fd57c6d017bdb55643ed3d6387110bc5f6b3b884dd169) diff --git a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake index 10b56f90d9..305d1291e7 100644 --- a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake +++ b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake @@ -48,6 +48,6 @@ ly_associate_package(PACKAGE_NAME OpenMesh-8.1-rev1-windows ly_associate_package(PACKAGE_NAME civetweb-1.8-rev1-windows TARGETS civetweb PACKAGE_HASH 36d0e58a59bcdb4dd70493fb1b177aa0354c945b06c30416348fd326cf323dd4) ly_associate_package(PACKAGE_NAME OpenSSL-1.1.1b-rev2-windows TARGETS OpenSSL PACKAGE_HASH 9af1c50343f89146b4053101a7aeb20513319a3fe2f007e356d7ce25f9241040) ly_associate_package(PACKAGE_NAME Crashpad-0.8.0-rev1-windows TARGETS Crashpad PACKAGE_HASH d162aa3070147bc0130a44caab02c5fe58606910252caf7f90472bd48d4e31e2) -ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev1-windows TARGETS zlib PACKAGE_HASH 6fb46a0ef8c8614cde3517b50fca47f2a6d1fd059b21f3b8ff13e635ca7f2fa6) +ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev2-windows TARGETS zlib PACKAGE_HASH 9afab1d67641ed8bef2fb38fc53942da47f2ab339d9e77d3d20704a48af2da0b) ly_associate_package(PACKAGE_NAME squish-ccr-deb557d-rev1-windows TARGETS squish-ccr PACKAGE_HASH 5c3d9fa491e488ccaf802304ad23b932268a2b2846e383f088779962af2bfa84) ly_associate_package(PACKAGE_NAME ISPCTexComp-36b80aa-rev1-windows TARGETS ISPCTexComp PACKAGE_HASH b6fa6ea28a2808a9a5524c72c37789c525925e435770f2d94eb2d387360fa2d0) diff --git a/cmake/3rdParty/Platform/iOS/BuiltInPackages_ios.cmake b/cmake/3rdParty/Platform/iOS/BuiltInPackages_ios.cmake index c288460dd0..0574f38654 100644 --- a/cmake/3rdParty/Platform/iOS/BuiltInPackages_ios.cmake +++ b/cmake/3rdParty/Platform/iOS/BuiltInPackages_ios.cmake @@ -28,4 +28,4 @@ ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-ios TARGETS googlet ly_associate_package(PACKAGE_NAME googlebenchmark-1.5.0-rev2-ios TARGETS GoogleBenchmark PACKAGE_HASH c2ffaed2b658892b1bcf81dee4b44cd1cb09fc78d55584ef5cb8ab87f2d8d1ae) ly_associate_package(PACKAGE_NAME libsamplerate-0.2.1-rev2-ios TARGETS libsamplerate PACKAGE_HASH 7656b961697f490d4f9c35d2e61559f6fc38c32102e542a33c212cd618fc2119) ly_associate_package(PACKAGE_NAME OpenSSL-1.1.1b-rev1-ios TARGETS OpenSSL PACKAGE_HASH cd0dfce3086a7172777c63dadbaf0ac3695b676119ecb6d0614b5fb1da03462f) -ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev1-ios TARGETS zlib PACKAGE_HASH 20bfccf3b98bd9a7d3506cf344ac48135035eb517752bf9bede1e821f163608d) +ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev2-ios TARGETS zlib PACKAGE_HASH a59fc0f83a02c616b679799310e9d86fde84514c6d2acefa12c6def0ae4a880c) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 3863cdc313..f40c72b540 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -35,7 +35,9 @@ function(ly_add_dependencies TARGET) if(TARGET ${TARGET}) # Target already created, add it ly_parse_third_party_dependencies("${extra_function_args}") - add_dependencies(${TARGET} ${extra_function_args}) + # Dependencies can only be added on non-alias target + ly_de_alias_target(${TARGET} de_aliased_target) + add_dependencies(${de_aliased_target} ${extra_function_args}) else() set_property(GLOBAL APPEND PROPERTY LY_DELAYED_DEPENDENCIES_${TARGET} ${extra_function_args}) endif() diff --git a/cmake/Gems.cmake b/cmake/Gems.cmake index bcb619fd8d..e01740c265 100644 --- a/cmake/Gems.cmake +++ b/cmake/Gems.cmake @@ -6,7 +6,13 @@ # # -# This file contains utility wrappers for dealing with the Gems system. +# This file contains utility wrappers for dealing with the Gems system. + +define_property(TARGET PROPERTY LY_PROJECT_NAME + BRIEF_DOCS "Name of the project, this target can use enabled gems from" + FULL_DOCS "If set, the when iterating over the enabled gems in ly_enabled_gems_delayed + only a project with that name can have it's enabled gem list added as a dependency to this target. + If the __NOPROJECT__ placeholder is associated with a list enabled gems, then it applies to this target regardless of this property value") # ly_create_alias # given an alias to create, and a list of one or more targets, @@ -34,7 +40,8 @@ function(ly_create_alias) # easy version - if its just one target and it exist at the time of this call, # we can directly get the target, and make both aliases, - # the namespaced and non namespaced one, point at it. + # the namespace and non namespace one, point at it. + set(create_interface_target TRUE) list(LENGTH ly_create_alias_TARGETS number_of_targets) if (number_of_targets EQUAL 1) if(TARGET ${ly_create_alias_TARGETS}) @@ -43,11 +50,7 @@ function(ly_create_alias) if (NOT TARGET ${ly_create_alias_NAME}) add_library(${ly_create_alias_NAME} ALIAS ${de_aliased_target_name}) endif() - # Store off the arguments needed used ly_create_alias into a DIRECTORY property - # This will be used to re-create the calls in the generated CMakeLists.txt in the INSTALL step - string(REPLACE ";" " " create_alias_args "${ly_create_alias_NAME},${ly_create_alias_NAMESPACE},${ly_create_alias_TARGETS}") - set_property(DIRECTORY APPEND PROPERTY LY_CREATE_ALIAS_ARGUMENTS "${ly_create_alias_NAME},${ly_create_alias_NAMESPACE},${ly_create_alias_TARGETS}") - return() + set(create_interface_target FALSE) endif() endif() @@ -55,41 +58,48 @@ function(ly_create_alias) # To actually achieve this we have to create an interface library with those dependencies, # then we have to create an alias to that target. # By convention we create one without a namespace then alias the namespaced one. + if(create_interface_target) + if(TARGET ${ly_create_alias_NAME}) + message(FATAL_ERROR "Internal alias target already exists, cannot create an alias for it: ${ly_create_alias_NAME}\n" + "This could be a copy-paste error, where some part of the ly_create_alias call was changed but the other") + endif() - if(TARGET ${ly_create_alias_NAME}) - message(FATAL_ERROR "Internal alias target already exists, cannot create an alias for it: ${ly_create_alias_NAME}\n" - "This could be a copy-paste error, where some part of the ly_create_alias call was changed but the other") - endif() - - add_library(${ly_create_alias_NAME} INTERFACE IMPORTED GLOBAL) - set_target_properties(${ly_create_alias_NAME} PROPERTIES GEM_MODULE TRUE) + add_library(${ly_create_alias_NAME} INTERFACE IMPORTED GLOBAL) + set_target_properties(${ly_create_alias_NAME} PROPERTIES GEM_MODULE TRUE) - foreach(target_name ${ly_create_alias_TARGETS}) - if(TARGET ${target_name}) - ly_de_alias_target(${target_name} de_aliased_target_name) - if(NOT de_aliased_target_name) - message(FATAL_ERROR "Target not found in ly_create_alias call: ${target_name} - check your spelling of the target name") + foreach(target_name ${ly_create_alias_TARGETS}) + if(TARGET ${target_name}) + ly_de_alias_target(${target_name} de_aliased_target_name) + if(NOT de_aliased_target_name) + message(FATAL_ERROR "Target not found in ly_create_alias call: ${target_name} - check your spelling of the target name") + endif() + else() + set(de_aliased_target_name ${target_name}) endif() - else() - set(de_aliased_target_name ${target_name}) - endif() - list(APPEND final_targets ${de_aliased_target_name}) - endforeach() + list(APPEND final_targets ${de_aliased_target_name}) + endforeach() - # add_dependencies must be called with at least one dependent target - if(final_targets) - ly_parse_third_party_dependencies("${final_targets}") - ly_add_dependencies(${ly_create_alias_NAME} ${final_targets}) - endif() + # add_dependencies must be called with at least one dependent target + if(final_targets) + ly_parse_third_party_dependencies("${final_targets}") + ly_add_dependencies(${ly_create_alias_NAME} ${final_targets}) + endif() - # now add the final alias: - add_library(${ly_create_alias_NAMESPACE}::${ly_create_alias_NAME} ALIAS ${ly_create_alias_NAME}) + # now add the final alias: + add_library(${ly_create_alias_NAMESPACE}::${ly_create_alias_NAME} ALIAS ${ly_create_alias_NAME}) + endif() # Store off the arguments used by ly_create_alias into a DIRECTORY property # This will be used to re-create the calls in the generated CMakeLists.txt in the INSTALL step - - # Replace the CMake list separator with a space to replicate the space separated TARGETS arguments - string(REPLACE ";" " " create_alias_args "${ly_create_alias_NAME},${ly_create_alias_NAMESPACE},${ly_create_alias_TARGETS}") + # Replace the CMake list separator with a space to replicate the space separated arguments + # A single create_alias_args variable encodes two values. The alias NAME used to check if the target exists + # and the ly_create_alias arguments to replace this function call + unset(create_alias_args) + list(APPEND create_alias_args "${ly_create_alias_NAME}," + NAME ${ly_create_alias_NAME} + NAMESPACE ${ly_create_alias_NAMESPACE} + TARGETS ${ly_create_alias_TARGETS}) + list(JOIN create_alias_args " " create_alias_args) set_property(DIRECTORY APPEND PROPERTY LY_CREATE_ALIAS_ARGUMENTS "${create_alias_args}") # Store the directory path in the GLOBAL property so that it can be accessed @@ -100,13 +110,54 @@ function(ly_create_alias) endif() endfunction() +# ly_set_gem_variant_to_load +# Associates a key, value entry of CMake target -> Gem variant +# \arg:TARGETS - list of Targets to associate with the Gem variant +# \arg:VARIANTS - Gem variant +function(ly_set_gem_variant_to_load) + set(options) + set(oneValueArgs) + set(multiValueArgs TARGETS VARIANTS) + + cmake_parse_arguments(ly_set_gem_variant_to_load "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if (NOT ly_set_gem_variant_to_load_TARGETS) + message(FATAL_ERROR "You must provide at least 1 target to ${CMAKE_CURRENT_FUNCTION} using the TARGETS keyword") + endif() + + # Store a list of targets + foreach(target_name ${ly_set_gem_variant_to_load_TARGETS}) + # Append the target to the list of targets with variants if it has not been added + get_property(ly_targets_with_variants GLOBAL PROPERTY LY_TARGETS_WITH_GEM_VARIANTS) + if(NOT target_name IN_LIST ly_targets_with_variants) + set_property(GLOBAL APPEND PROPERTY LY_TARGETS_WITH_GEM_VARIANTS "${target_name}") + endif() + foreach(variant_name ${ly_set_gem_variant_to_load_VARIANTS}) + get_property(target_gem_variants GLOBAL PROPERTY LY_GEM_VARIANTS_"${target_name}") + if(NOT variant_name IN_LIST target_gem_variants) + set_property(GLOBAL APPEND PROPERTY LY_GEM_VARIANTS_"${target_name}" "${variant_name}") + endif() + endforeach() + endforeach() + + # Store of the arguments used to invoke this function in order to replicate the call in the generated CMakeLists.txt + # in the install layout + unset(set_gem_variant_args) + list(APPEND set_gem_variant_args + TARGETS ${ly_set_gem_variant_to_load_TARGETS} + VARIANTS ${ly_set_gem_variant_to_load_VARIANTS}) + # Replace the list separator with space to have it be stored as a single property element + list(JOIN set_gem_variant_args " " set_gem_variant_args) + set_property(DIRECTORY APPEND PROPERTY LY_SET_GEM_VARIANT_TO_LOAD_ARGUMENTS "${set_gem_variant_args}") +endfunction() + # ly_enable_gems # this function makes sure that the given gems, or gems listed in the variable ENABLED_GEMS # in the GEM_FILE name, are set as runtime dependencies (and thus loaded) for the given targets # in the context of the given project. # note that it can't do this immediately, so it saves the data for later processing. # Note: If you don't supply a project name, it will apply it across the board to all projects. -# this is useful in the case of "ly_add_gems being called for so called 'mandatory gems' inside the engine. +# this is useful in the case of "ly_enable_gems" being called for so called 'mandatory gems' inside the engine. # if you specify a gem name with a namespace, it will be used, otherwise it will assume Gem:: function(ly_enable_gems) set(options) @@ -115,23 +166,21 @@ function(ly_enable_gems) cmake_parse_arguments(ly_enable_gems "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if (NOT ly_enable_gems_TARGETS) - message(FATAL_ERROR "You must provide the targets to add gems to using the TARGETS keyword") - endif() - - if (NOT ly_enable_gems_PROJECT_NAME) message(VERBOSE "Note: ly_enable_gems called with no PROJECT_NAME name, applying to all projects: \n" - " - VARIANTS ${ly_enable_gems_VARIANTS} \n" - " - GEMS ${ly_enable_gems_GEMS} \n" - " - TARGETS ${ly_enable_gems_TARGETS} \n" + " - GEMS ${ly_enable_gems_GEMS} \n" " - GEM_FILE ${ly_enable_gems_GEM_FILE}") set(ly_enable_gems_PROJECT_NAME "__NOPROJECT__") # so that the token is not blank endif() - if (NOT ly_enable_gems_VARIANTS) - message(FATAL_ERROR "You must provide at least 1 variant of the gem modules (Editor, Server, Client, Builder) to " - "add to your targets, using the VARIANTS keyword") + # Backwards-Compatibility - Delegate any TARGETS and VARIANTS arguments to the ly_set_gem_variant_to_load + # command. That command is used to associate TARGETS with the list of Gem Variants they desire to use + if (ly_enable_gems_TARGETS AND ly_enable_gems_VARIANTS) + message(DEPRECATION "The TARGETS and VARIANTS arguments to \"${CMAKE_CURRENT_FUNCTION}\" is deprecated.\n" + "Please use the \"ly_set_gem_variant_to_load\" function directly to associate a Target with a Gem Variant.\n" + "This function will forward the TARGETS and VARIANTS arguments to \"ly_set_gem_variant_to_load\" for now," + " but this functionality will be removed.") + ly_set_gem_variant_to_load(TARGETS ${ly_enable_gems_TARGETS} VARIANTS ${ly_enable_gems_VARIANTS}) endif() if ((NOT ly_enable_gems_GEMS AND NOT ly_enable_gems_GEM_FILE) OR (ly_enable_gems_GEMS AND ly_enable_gems_GEM_FILE)) @@ -153,103 +202,126 @@ function(ly_enable_gems) endif() # all the actual work has to be done later. - foreach(target_name ${ly_enable_gems_TARGETS}) - foreach(variant_name ${ly_enable_gems_VARIANTS}) - set_property(GLOBAL APPEND PROPERTY LY_DELAYED_ENABLE_GEMS "${ly_enable_gems_PROJECT_NAME},${target_name},${variant_name}") - define_property(GLOBAL PROPERTY LY_DELAYED_ENABLE_GEMS_"${ly_enable_gems_PROJECT_NAME},${target_name},${variant_name}" - BRIEF_DOCS "List of gem names to evaluate variants against" FULL_DOCS "Names of gems that will be paired with the variant name - to determine if it is valid target that should be added as an application dynamic load dependency") - set_property(GLOBAL APPEND PROPERTY LY_DELAYED_ENABLE_GEMS_"${ly_enable_gems_PROJECT_NAME},${target_name},${variant_name}" ${ly_enable_gems_GEMS}) - endforeach() - endforeach() + set_property(GLOBAL APPEND PROPERTY LY_DELAYED_ENABLE_GEMS "${ly_enable_gems_PROJECT_NAME}") + define_property(GLOBAL PROPERTY LY_DELAYED_ENABLE_GEMS_"${ly_enable_gems_PROJECT_NAME}" + BRIEF_DOCS "List of gem names to evaluate variants against" FULL_DOCS "Names of gems that will be paired with the variant name + to determine if it is valid target that should be added as an application dynamic load dependency") + set_property(GLOBAL APPEND PROPERTY LY_DELAYED_ENABLE_GEMS_"${ly_enable_gems_PROJECT_NAME}" ${ly_enable_gems_GEMS}) # Store off the arguments used by ly_enable_gems into a DIRECTORY property # This will be used to re-create the ly_enable_gems call in the generated CMakeLists.txt at the INSTALL step # Replace the CMake list separator with a space to replicate the space separated TARGETS arguments if(NOT ly_enable_gems_PROJECT_NAME STREQUAL "__NOPROJECT__") - set(replicated_project_name ${ly_enable_gems_PROJECT_NAME}) + set(replicated_project_name PROJECT_NAME ${ly_enable_gems_PROJECT_NAME}) endif() # The GEM_FILE file is used to populate the GEMS argument via the ENABLED_GEMS variable in the file. # Furthermore the GEM_FILE itself is not copied over to the install layout, so make its argument entry blank and use the list of GEMS # stored in ly_enable_gems_GEMS - string(REPLACE ";" " " enable_gems_args "${replicated_project_name},${ly_enable_gems_GEMS},,${ly_enable_gems_VARIANTS},${ly_enable_gems_TARGETS}") + unset(enable_gems_args) + list(APPEND enable_gems_args + ${replicated_project_name} + GEMS ${ly_enable_gems_GEMS}) + list(JOIN enable_gems_args " " enable_gems_args) set_property(DIRECTORY APPEND PROPERTY LY_ENABLE_GEMS_ARGUMENTS "${enable_gems_args}") endfunction() -# call this before runtime dependencies are used to add any relevant targets -# saved by the above function -function(ly_enable_gems_delayed) - get_property(ly_delayed_enable_gems GLOBAL PROPERTY LY_DELAYED_ENABLE_GEMS) - foreach(project_target_variant ${ly_delayed_enable_gems}) - # we expect a colon separated list of - # PROJECT_NAME,target_name,variant_name - string(REPLACE "," ";" project_target_variant_list "${project_target_variant}") - list(LENGTH project_target_variant_list project_target_variant_length) - if(project_target_variant_length EQUAL 0) - continue() - endif() - - if(NOT project_target_variant_length EQUAL 3) - message(FATAL_ERROR "Invalid specification of gems, expected 'project','target','variant' and got ${project_target_variant}") - endif() - list(POP_BACK project_target_variant_list variant) - list(POP_BACK project_target_variant_list target) - list(POP_BACK project_target_variant_list project) - - get_property(gem_dependencies GLOBAL PROPERTY LY_DELAYED_ENABLE_GEMS_"${project_target_variant}") - if (NOT gem_dependencies) - get_property(gem_dependencies_defined GLOBAL PROPERTY LY_DELAYED_ENABLE_GEMS_"${project_target_variant}" DEFINED) - if (gem_dependencies_defined) - # special case, if the LY_DELAYED_ENABLE_GEMS_"${project_target_variant}" property is DEFINED - # but empty, add an entry to the LY_DELAYED_LOAD_DEPENDENCIES to have the - # cmake_dependencies.*.setreg file for the (project, target) tuple to be regenerated - # This is needed if the ENABLED_GEMS list for a project goes from >0 to 0. In this case - # the cmake_dependencies would have a stale list of gems to load unless it is regenerated - get_property(delayed_load_target_set GLOBAL PROPERTY LY_DELAYED_LOAD_"${project},${target}" SET) - if(NOT delayed_load_target_set) - set_property(GLOBAL APPEND PROPERTY LY_DELAYED_LOAD_DEPENDENCIES "${project},${target}") - set_property(GLOBAL APPEND PROPERTY LY_DELAYED_LOAD_"${project},${target}" "") - endif() - endif() - # Continue to the next iteration loop regardless as there are no gem dependencies - continue() - endif() +function(ly_add_gem_dependencies_to_project_variants) + set(options) + set(oneValueArgs PROJECT_NAME TARGET VARIANT) + set(multiValueArgs GEM_DEPENDENCIES) + + cmake_parse_arguments(ly_add_gem_dependencies "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if (NOT ly_add_gem_dependencies_PROJECT_NAME) + message(FATAL_ERROR "Missing required PROJECT_NAME argument which is used to determine gem load prefix") + endif() + if (NOT ly_add_gem_dependencies_TARGET) + message(FATAL_ERROR "Missing required TARGET argument ") + endif() + if (NOT ly_add_gem_dependencies_VARIANT) + message(FATAL_ERROR "Missing required gem VARIANT argument needed to determine which gem variants to load for the target") + endif() - if(${project} STREQUAL "__NOPROJECT__") - # special case, apply to all - unset(PREFIX_CLAUSE) - else() - set(PREFIX_CLAUSE "PREFIX;${project}") + if(${ly_add_gem_dependencies_PROJECT_NAME} STREQUAL "__NOPROJECT__") + # special case, apply to all + unset(PREFIX_CLAUSE) + else() + set(PREFIX_CLAUSE "PREFIX;${ly_add_gem_dependencies_PROJECT_NAME}") + endif() + + # apply the list of gem targets. Adding a gem really just means adding the appropriate dependency. + foreach(gem_name ${ly_add_gem_dependencies_GEM_DEPENDENCIES}) + set(gem_target ${gem_name}.${ly_add_gem_dependencies_VARIANT}) + + # if the target exists, add it. + if (TARGET ${gem_target}) + # Dealias actual target + ly_de_alias_target(${gem_target} dealiased_gem_target) + ly_add_target_dependencies( + ${PREFIX_CLAUSE} + TARGETS ${ly_add_gem_dependencies_TARGET} + DEPENDENT_TARGETS ${dealiased_gem_target}) endif() + endforeach() +endfunction() + +# call this before runtime dependencies are used to add any relevant targets +# saved by the above function +function(ly_enable_gems_delayed) + # Query the list of targets that are associated with a gem variant + get_property(targets_with_variants GLOBAL PROPERTY LY_TARGETS_WITH_GEM_VARIANTS) + # Query the projects that have made calls to ly_enable_gems + get_property(enable_gem_projects GLOBAL PROPERTY LY_DELAYED_ENABLE_GEMS) + foreach(target ${targets_with_variants}) if (NOT TARGET ${target}) - message(FATAL_ERROR "ly_enable_gems specified TARGET '${target}' but no such target was found.") + message(FATAL_ERROR "ly_set_gem_variant_to_load specified TARGET '${target}' but no such target was found.") endif() - # apply the list of gem targets. Adding a gem really just means adding the appropriate dependency. - foreach(gem_name ${gem_dependencies}) - # the gem name may already have a namespace. If it does, we use that one - ly_strip_target_namespace(TARGET ${gem_name} OUTPUT_VARIABLE unaliased_gem_name) - if (${unaliased_gem_name} STREQUAL ${gem_name}) - # if stripping a namespace had no effect, it had no namespace - # and we supply the default Gem:: namespace. - set(gem_name_with_namespace Gem::${gem_name}) - else() - # if stripping the namespace had an effect then we use the original - # with the namespace, instead of assuming Gem:: - set(gem_name_with_namespace ${gem_name}) + # Lookup if the target is scoped to a project + # In that case the target can only use gem targets that is + # - not project specific: i.e "__NOPROJECT__" + # - or specific to the project + get_property(target_project_association TARGET ${target} PROPERTY LY_PROJECT_NAME) + + foreach(project ${enable_gem_projects}) + if (target_project_association AND + (NOT (project STREQUAL "__NOPROJECT__") AND NOT (project STREQUAL target_project_association))) + # Skip adding the gem dependencies to this target if it is associated with a project + # and the current project doesn't match + continue() endif() - - # if the target exists, add it. - if (TARGET ${gem_name_with_namespace}.${variant}) - ly_add_target_dependencies( - ${PREFIX_CLAUSE} - TARGETS ${target} - DEPENDENT_TARGETS ${gem_name_with_namespace}.${variant} - ) + + get_property(gem_dependencies GLOBAL PROPERTY LY_DELAYED_ENABLE_GEMS_"${project}") + if (NOT gem_dependencies) + get_property(gem_dependencies_defined GLOBAL PROPERTY LY_DELAYED_ENABLE_GEMS_"${project}" DEFINED) + if (gem_dependencies_defined) + # special case, if the LY_DELAYED_ENABLE_GEMS_"${project_target_variant}" property is DEFINED + # but empty, add an entry to the LY_DELAYED_LOAD_DEPENDENCIES to have the + # cmake_dependencies.*.setreg file for the (project, target) tuple to be regenerated + # This is needed if the ENABLED_GEMS list for a project goes from >0 to 0. In this case + # the cmake_dependencies would have a stale list of gems to load unless it is regenerated + get_property(delayed_load_target_set GLOBAL PROPERTY LY_DELAYED_LOAD_"${project},${target}" SET) + if(NOT delayed_load_target_set) + set_property(GLOBAL APPEND PROPERTY LY_DELAYED_LOAD_DEPENDENCIES "${project},${target}") + set_property(GLOBAL APPEND PROPERTY LY_DELAYED_LOAD_"${project},${target}" "") + endif() + endif() + # Continue to the next iteration loop regardless as there are no gem dependencies + continue() endif() + + # Gather the Gem variants associated with this target and iterate over them to combine them with the enabled + # gems for the each project + get_property(target_gem_variants GLOBAL PROPERTY LY_GEM_VARIANTS_"${target}") + foreach(variant ${target_gem_variants}) + ly_add_gem_dependencies_to_project_variants( + PROJECT_NAME ${project} + TARGET ${target} + VARIANT ${variant} + GEM_DEPENDENCIES ${gem_dependencies}) + endforeach() endforeach() endforeach() endfunction() diff --git a/cmake/LYWrappers.cmake b/cmake/LYWrappers.cmake index 3dfef0bbbf..8e5633b5e6 100644 --- a/cmake/LYWrappers.cmake +++ b/cmake/LYWrappers.cmake @@ -330,28 +330,47 @@ function(ly_add_target) set(runtime_dependencies_list SHARED MODULE EXECUTABLE APPLICATION) if(NOT ly_add_target_IMPORTED AND linking_options IN_LIST runtime_dependencies_list) - # the stamp file will be the one that triggers the execution of the custom rule. At the end - # of running the copy of runtime dependencies, the stamp file is touched so the timestamp is updated. - # Adding a config as part of the name since the stamp file is added to the VS project. - # Note the STAMP_OUTPUT_FILE need to match with the one used in runtime dependencies (e.g. RuntimeDependencies_common.cmake) - set(STAMP_OUTPUT_FILE ${CMAKE_BINARY_DIR}/runtime_dependencies/$/${ly_add_target_NAME}_$.stamp) - add_custom_command( - OUTPUT ${STAMP_OUTPUT_FILE} - DEPENDS "$>" - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/runtime_dependencies/$/${ly_add_target_NAME}.cmake - COMMENT "Copying ${ly_add_target_NAME} runtime dependencies to output..." - VERBATIM - ) + get_property(is_multi_config_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + # XCode generator doesnt support different source files per configuration, so we cannot have + # the runtime dependencies using file-tracking, instead, we will have them as a post build step + # Non-multi config generators like Ninja (not "Ninja Multi-Config"), Makefiles, etc have trouble to + # produce file-level dependencies per configuration, so we also default to use a post build step + if(NOT is_multi_config_generator OR CMAKE_GENERATOR MATCHES Xcode) + + add_custom_command(TARGET ${ly_add_target_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/runtime_dependencies/$/${ly_add_target_NAME}.cmake + COMMENT "Copying ${ly_add_target_NAME} runtime dependencies to output..." + DEPENDS ${CMAKE_BINARY_DIR}/runtime_dependencies/${ly_add_target_NAME}.cmake + COMMENT "Copying runtime dependencies..." + VERBATIM + ) - # Unfortunately the VS generator cannot deal with generation expressions as part of the file name, wrapping the - # stamp file on each configuration so it gets properly excluded by the generator - unset(stamp_files_per_config) - foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES) - set(stamp_file_conf ${CMAKE_BINARY_DIR}/runtime_dependencies/${conf}/${ly_add_target_NAME}_${conf}.stamp) - set_source_files_properties(${stamp_file_conf} PROPERTIES GENERATED TRUE SKIP_AUTOGEN TRUE) - list(APPEND stamp_files_per_config $<$:${stamp_file_conf}>) - endforeach() - target_sources(${ly_add_target_NAME} PRIVATE ${stamp_files_per_config}) + else() + + # the stamp file will be the one that triggers the execution of the custom rule. At the end + # of running the copy of runtime dependencies, the stamp file is touched so the timestamp is updated. + # Adding a config as part of the name since the stamp file is added to the VS project. + # Note the STAMP_OUTPUT_FILE need to match with the one used in runtime dependencies (e.g. RuntimeDependencies_common.cmake) + set(STAMP_OUTPUT_FILE ${CMAKE_BINARY_DIR}/runtime_dependencies/$/${ly_add_target_NAME}_$.stamp) + add_custom_command( + OUTPUT ${STAMP_OUTPUT_FILE} + DEPENDS "$>" + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/runtime_dependencies/$/${ly_add_target_NAME}.cmake + COMMENT "Copying ${ly_add_target_NAME} runtime dependencies to output..." + VERBATIM + ) + + # Unfortunately the VS generator cannot deal with generation expressions as part of the file name, wrapping the + # stamp file on each configuration so it gets properly excluded by the generator + unset(stamp_files_per_config) + foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES) + set(stamp_file_conf ${CMAKE_BINARY_DIR}/runtime_dependencies/${conf}/${ly_add_target_NAME}_${conf}.stamp) + set_source_files_properties(${stamp_file_conf} PROPERTIES GENERATED TRUE SKIP_AUTOGEN TRUE) + list(APPEND stamp_files_per_config $<$:${stamp_file_conf}>) + endforeach() + target_sources(${ly_add_target_NAME} PRIVATE ${stamp_files_per_config}) + + endif() endif() diff --git a/cmake/Platform/Common/Install_common.cmake b/cmake/Platform/Common/Install_common.cmake index 0bd598f70e..5010760fad 100644 --- a/cmake/Platform/Common/Install_common.cmake +++ b/cmake/Platform/Common/Install_common.cmake @@ -138,16 +138,20 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar string(REPLACE "_LIBRARY" "" TARGET_TYPE_PLACEHOLDER ${target_type}) # For HEADER_ONLY libs we end up generating "INTERFACE" libraries, need to specify HEADERONLY instead string(REPLACE "INTERFACE" "HEADERONLY" TARGET_TYPE_PLACEHOLDER ${TARGET_TYPE_PLACEHOLDER}) - if(TARGET_TYPE_PLACEHOLDER STREQUAL "MODULE") + # In non-monolithic mode, gem targets are MODULE libraries, In monolithic mode gem targets are STATIC libraries + set(GEM_LIBRARY_TYPES "MODULE" "STATIC") + if(TARGET_TYPE_PLACEHOLDER IN_LIST GEM_LIBRARY_TYPES) get_target_property(gem_module ${TARGET_NAME} GEM_MODULE) if(gem_module) set(TARGET_TYPE_PLACEHOLDER "GEM_MODULE") endif() endif() + string(REPEAT " " 12 PLACEHOLDER_INDENT) get_target_property(COMPILE_DEFINITIONS_PLACEHOLDER ${TARGET_NAME} INTERFACE_COMPILE_DEFINITIONS) if(COMPILE_DEFINITIONS_PLACEHOLDER) - string(REPLACE ";" "\n" COMPILE_DEFINITIONS_PLACEHOLDER "${COMPILE_DEFINITIONS_PLACEHOLDER}") + set(COMPILE_DEFINITIONS_PLACEHOLDER "${PLACEHOLDER_INDENT}${COMPILE_DEFINITIONS_PLACEHOLDER}") + list(JOIN COMPILE_DEFINITIONS_PLACEHOLDER "\n${PLACEHOLDER_INDENT}" COMPILE_DEFINITIONS_PLACEHOLDER) else() unset(COMPILE_DEFINITIONS_PLACEHOLDER) endif() @@ -159,25 +163,28 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar if(include_genex_expr STREQUAL include) # only for cases where there are no generation expressions # Make the include path relative to the source dir where the target will be declared cmake_path(RELATIVE_PATH include BASE_DIRECTORY ${absolute_target_source_dir} OUTPUT_VARIABLE target_include) - string(APPEND INCLUDE_DIRECTORIES_PLACEHOLDER "${target_include}\n") + string(APPEND INCLUDE_DIRECTORIES_PLACEHOLDER "${PLACEHOLDER_INDENT}${target_include}\n") endif() endforeach() endif() + string(REPEAT " " 8 PLACEHOLDER_INDENT) get_target_property(RUNTIME_DEPENDENCIES_PLACEHOLDER ${TARGET_NAME} MANUALLY_ADDED_DEPENDENCIES) if(RUNTIME_DEPENDENCIES_PLACEHOLDER) # not found properties return the name of the variable with a "-NOTFOUND" at the end, here we set it to empty if not found - string(REPLACE ";" "\n" RUNTIME_DEPENDENCIES_PLACEHOLDER "${RUNTIME_DEPENDENCIES_PLACEHOLDER}") + set(RUNTIME_DEPENDENCIES_PLACEHOLDER "${PLACEHOLDER_INDENT}${RUNTIME_DEPENDENCIES_PLACEHOLDER}") + list(JOIN RUNTIME_DEPENDENCIES_PLACEHOLDER "\n${PLACEHOLDER_INDENT}" RUNTIME_DEPENDENCIES_PLACEHOLDER) else() unset(RUNTIME_DEPENDENCIES_PLACEHOLDER) endif() + string(REPEAT " " 12 PLACEHOLDER_INDENT) get_target_property(inteface_build_dependencies_props ${TARGET_NAME} INTERFACE_LINK_LIBRARIES) unset(INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER) if(inteface_build_dependencies_props) foreach(build_dependency ${inteface_build_dependencies_props}) # Skip wrapping produced when targets are not created in the same directory if(NOT ${build_dependency} MATCHES "^::@") - list(APPEND INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER "${build_dependency}") + list(APPEND INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER "${PLACEHOLDER_INDENT}${build_dependency}") endif() endforeach() endif() @@ -187,12 +194,19 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar foreach(build_dependency ${private_build_dependencies_props}) # Skip wrapping produced when targets are not created in the same directory if(NOT ${build_dependency} MATCHES "^::@") - list(APPEND INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER "${build_dependency}") + list(APPEND INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER "${PLACEHOLDER_INDENT}${build_dependency}") endif() endforeach() endif() list(REMOVE_DUPLICATES INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER) - string(REPLACE ";" "\n" INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER "${INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER}") + list(JOIN INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER "\n" INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER) + + string(REPEAT " " 8 PLACEHOLDER_INDENT) + # If a target has an LY_PROJECT_NAME property, forward that property to new target + get_target_property(target_project_association ${TARGET_NAME} LY_PROJECT_NAME) + if(target_project_association) + list(APPEND TARGET_PROPERTIES_PLACEHOLDER "${PLACEHOLDER_INDENT}LY_PROJECT_NAME ${target_project_association}") + endif() # If the target is an executable/application, add a custom target so we can debug the target in project-centric workflow if(should_create_helper) @@ -288,44 +302,9 @@ function(ly_setup_subdirectory absolute_target_source_dir) string(APPEND all_configured_targets "${configured_target}") endforeach() - # Replicate the ly_create_alias() calls based on the SOURCE_DIR for each target that generates an installed CMakeLists.txt - string(JOIN "\n" create_alias_template - "if(NOT TARGET @ALIAS_NAME@)" - " ly_create_alias(NAME @ALIAS_NAME@ NAMESPACE @ALIAS_NAMESPACE@ TARGETS @ALIAS_TARGETS@)" - "endif()" - "" - ) - get_property(create_alias_commands_arg_list DIRECTORY ${absolute_target_source_dir} PROPERTY LY_CREATE_ALIAS_ARGUMENTS) - foreach(create_alias_single_command_arg_list ${create_alias_commands_arg_list}) - # Split the ly_create_alias arguments back out based on commas - string(REPLACE "," ";" create_alias_single_command_arg_list "${create_alias_single_command_arg_list}") - list(POP_FRONT create_alias_single_command_arg_list ALIAS_NAME) - list(POP_FRONT create_alias_single_command_arg_list ALIAS_NAMESPACE) - # The rest of the list are the target dependencies - set(ALIAS_TARGETS ${create_alias_single_command_arg_list}) - string(CONFIGURE "${create_alias_template}" create_alias_command @ONLY) - string(APPEND CREATE_ALIASES_PLACEHOLDER ${create_alias_command}) - endforeach() - - - # Reproduce the ly_enable_gems() calls made in the the SOURCE_DIR for this target into the CMakeLists.txt that - # is about to be generated - set(enable_gems_template "ly_enable_gems(@enable_gem_PROJECT_NAME@ @enable_gem_GEMS@ @enable_gem_GEM_FILE@ @enable_gem_VARIANTS@ @enable_gem_TARGETS@)\n") - get_property(enable_gems_commands_arg_list DIRECTORY ${absolute_target_source_dir} PROPERTY LY_ENABLE_GEMS_ARGUMENTS) - foreach(enable_gems_single_command_arg_list ${enable_gems_commands_arg_list}) - # Split the ly_enable_gems arguments back out based on commas - string(REPLACE "," ";" enable_gems_single_command_arg_list "${enable_gems_single_command_arg_list}") - foreach(enable_gem_arg_kw IN ITEMS PROJECT_NAME GEMS GEM_FILE VARIANTS TARGETS) - list(POP_FRONT enable_gems_single_command_arg_list enable_gem_${enable_gem_arg_kw}) - if(enable_gem_${enable_gem_arg_kw}) - # if the argument exist append to argument keyword to the front - string(PREPEND enable_gem_${enable_gem_arg_kw} "${enable_gem_arg_kw} ") - endif() - endforeach() - - string(CONFIGURE "${enable_gems_template}" enable_gems_command @ONLY) - string(APPEND ENABLE_GEMS_PLACEHOLDER ${enable_gems_command}) - endforeach() + ly_setup_subdirectory_create_alias("${absolute_target_source_dir}" CREATE_ALIASES_PLACEHOLDER) + ly_setup_subdirectory_set_gem_variant_to_load("${absolute_target_source_dir}" GEM_VARIANT_TO_LOAD_PLACEHOLDER) + ly_setup_subdirectory_enable_gems("${absolute_target_source_dir}" ENABLE_GEMS_PLACEHOLDER) ly_file_read(${LY_ROOT_FOLDER}/cmake/install/Copyright.in cmake_copyright_comment) @@ -337,6 +316,7 @@ function(ly_setup_subdirectory absolute_target_source_dir) "${all_configured_targets}" "\n" "${CREATE_ALIASES_PLACEHOLDER}" + "${GEM_VARIANT_TO_LOAD_PLACEHOLDER}" "${ENABLE_GEMS_PLACEHOLDER}" ) @@ -591,3 +571,58 @@ function(ly_setup_assets) endforeach() endfunction() + + +#! ly_setup_subdirectory_create_alias: Replicates the call to the `ly_create_alias` function +#! within the generated CMakeLists.txt in the same relative install layout directory +function(ly_setup_subdirectory_create_alias absolute_target_source_dir output_script) + # Replicate the create_alias() calls made in the SOURCE_DIR into the generated CMakeLists.txt + string(JOIN "\n" create_alias_template + "if(NOT TARGET @alias_name@)" + " ly_create_alias(@create_alias_args@)" + "endif()" + "") + + unset(${output_script} PARENT_SCOPE) + get_property(create_alias_args_list DIRECTORY ${absolute_target_source_dir} PROPERTY LY_CREATE_ALIAS_ARGUMENTS) + foreach(create_alias_args IN LISTS create_alias_args_list) + # Create a list out of the comma separated arguments and store it into the same variable + string(REPLACE "," ";" create_alias_args ${create_alias_args}) + # The first argument of the create alias argument list is the ALIAS NAME so pop it from the list + # It is used to protect against registering the same alias twice + list(POP_FRONT create_alias_args alias_name) + string(CONFIGURE "${create_alias_template}" create_alias_command @ONLY) + string(APPEND create_alias_calls ${create_alias_command}) + endforeach() + set(${output_script} ${create_alias_calls} PARENT_SCOPE) +endfunction() + +#! ly_setup_subdirectory_set_gem_variant_to_load: Replicates the call to the `ly_set_gem_variant_to_load` function +#! within the generated CMakeLists.txt in the same relative install layout directory +function(ly_setup_subdirectory_set_gem_variant_to_load absolute_target_source_dir output_script) + # Replicate the ly_set_gem_variant_to_load() calls made in the SOURCE_DIR for into the generated CMakeLists.txt + set(set_gem_variant_args_template "ly_set_gem_variant_to_load(@set_gem_variant_args@)\n") + + unset(${output_script} PARENT_SCOPE) + get_property(set_gem_variant_args_lists DIRECTORY ${absolute_target_source_dir} PROPERTY LY_SET_GEM_VARIANT_TO_LOAD_ARGUMENTS) + foreach(set_gem_variant_args IN LISTS set_gem_variant_args_lists) + string(CONFIGURE "${set_gem_variant_args_template}" set_gem_variant_to_load_command @ONLY) + string(APPEND set_gem_variant_calls ${set_gem_variant_to_load_command}) + endforeach() + set(${output_script} ${set_gem_variant_calls} PARENT_SCOPE) +endfunction() + +#! ly_setup_subdirectory_enable_gems: Replicates the call to the `ly_enable_gems` function +#! within the generated CMakeLists.txt in the same relative install layout directory +function(ly_setup_subdirectory_enable_gems absolute_target_source_dir output_script) + # Replicate the ly_set_gem_variant_to_load() calls made in the SOURCE_DIR into the generated CMakeLists.txt + set(enable_gems_template "ly_enable_gems(@enable_gems_args@)\n") + + unset(${output_script} PARENT_SCOPE) + get_property(enable_gems_args_list DIRECTORY ${absolute_target_source_dir} PROPERTY LY_ENABLE_GEMS_ARGUMENTS) + foreach(enable_gems_args IN LISTS enable_gems_args_list) + string(CONFIGURE "${enable_gems_template}" enable_gems_command @ONLY) + string(APPEND enable_gems_calls ${enable_gems_command}) + endforeach() + set(${output_script} ${enable_gems_calls} PARENT_SCOPE) +endfunction() \ No newline at end of file diff --git a/cmake/Platform/Common/RuntimeDependencies_common.cmake b/cmake/Platform/Common/RuntimeDependencies_common.cmake index dbc8513c97..95d91da7f7 100644 --- a/cmake/Platform/Common/RuntimeDependencies_common.cmake +++ b/cmake/Platform/Common/RuntimeDependencies_common.cmake @@ -263,6 +263,7 @@ function(ly_delayed_generate_runtime_dependencies) # Generate the output file, note the STAMP_OUTPUT_FILE need to match with the one defined in LYWrappers.cmake set(STAMP_OUTPUT_FILE ${CMAKE_BINARY_DIR}/runtime_dependencies/$/${target}_$.stamp) set(target_file_dir "$") + set(target_file "$") ly_file_read(${LY_RUNTIME_DEPENDENCIES_TEMPLATE} template_file) string(CONFIGURE "${LY_COPY_COMMANDS}" LY_COPY_COMMANDS @ONLY) string(CONFIGURE "${template_file}" configured_template_file @ONLY) diff --git a/cmake/Platform/Linux/Install_linux.cmake b/cmake/Platform/Linux/Install_linux.cmake index b3e2093b65..87713fa5d6 100644 --- a/cmake/Platform/Linux/Install_linux.cmake +++ b/cmake/Platform/Linux/Install_linux.cmake @@ -14,6 +14,9 @@ function(ly_copy source_file target_directory) if("${source_file}" MATCHES "qt/plugins" AND "${target_filename_ext}" STREQUAL ".so") get_filename_component(target_filename "${source_file}" NAME) file(RPATH_CHANGE FILE "${target_directory}/${target_filename}" OLD_RPATH "\$ORIGIN/../../lib" NEW_RPATH "\$ORIGIN/..") + elseif("${source_file}" MATCHES "lrelease") + get_filename_component(target_filename "${source_file}" NAME) + file(RPATH_CHANGE FILE "${target_directory}/${target_filename}" OLD_RPATH "\$ORIGIN/../lib" NEW_RPATH "\$ORIGIN") endif() endfunction()]]) diff --git a/cmake/Projects.cmake b/cmake/Projects.cmake index 3f8c4ffc41..6e5b5c5f78 100644 --- a/cmake/Projects.cmake +++ b/cmake/Projects.cmake @@ -53,7 +53,7 @@ function(ly_add_target_dependencies) # Append the DEPENDENT_TARGETS to the list of ALL_GEM_DEPENDENCIES list(APPEND ALL_GEM_DEPENDENCIES ${ly_add_gem_dependencies_DEPENDENT_TARGETS}) - # for each target, add the dependencies and generate gems json + # for each target, add the dependencies and generate setreg json with the list of gems to load foreach(target ${ly_add_gem_dependencies_TARGETS}) ly_add_dependencies(${target} ${ALL_GEM_DEPENDENCIES}) @@ -69,39 +69,6 @@ function(ly_add_target_dependencies) endforeach() endfunction() -#! ly_add_project_dependencies: adds the dependencies to runtime and tools for this project. -# -# Each project may have dependencies to gems. To properly define these dependencies, we are making the project to define -# through a "files list" cmake file the dependencies to the different targets. -# So for example, the game's runtime dependencies are associated to the project's launcher; the game's tools dependencies -# are associated to the asset processor; etc -# -# \arg:PROJECT_NAME name of the game project -# \arg:TARGETS names of the targets to associate the dependencies to -# \arg:DEPENDENCIES_FILES file(s) that contains the runtime dependencies the TARGETS will be associated to -# \arg:DEPENDENT_TARGETS additional list of targets should be added as load-time dependencies for the TARGETS list -# -function(ly_add_project_dependencies) - - set(options) - set(oneValueArgs PROJECT_NAME) - set(multiValueArgs TARGETS DEPENDENCIES_FILES DEPENDENT_TARGETS) - - cmake_parse_arguments(ly_add_project_dependencies "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - # Validate input arguments - if(NOT ly_add_project_dependencies_PROJECT_NAME) - message(FATAL_ERROR "PROJECT_NAME parameter missing. If not project name is needed, then call ly_add_target_dependencies directly") - endif() - - ly_add_target_dependencies( - PREFIX ${ly_add_project_dependencies_PROJECT_NAME} - TARGETS ${ly_add_project_dependencies_TARGETS} - DEPENDENCIES_FILES ${ly_add_project_dependencies_DEPENDENCIES_FILES} - DEPENDENT_TARGETS ${ly_add_project_dependencies_DEPENDENT_TARGETS} - ) -endfunction() - #template for generating the project build_path setreg set(project_build_path_template [[ diff --git a/cmake/SettingsRegistry.cmake b/cmake/SettingsRegistry.cmake index ebf2254dc6..58beba089c 100644 --- a/cmake/SettingsRegistry.cmake +++ b/cmake/SettingsRegistry.cmake @@ -28,7 +28,7 @@ set(gems_json_template [[ string(APPEND gem_module_template [=[ "@stripped_gem_target@":]=] "\n" [=[ {]=] "\n" -[=[$<$,INTERFACE_LIBRARY>>: "Modules":["$"]]=] "$\n>" +[=[$<$,MODULE_LIBRARY$SHARED_LIBRARY>: "Modules":["$"]]=] "$\n>" [=[ "SourcePaths":["@gem_module_root_relative_to_engine_root@"]]=] "\n" [=[ }]=] ) @@ -87,7 +87,7 @@ endfunction() # # \arg:gem_target(TARGET) - Target to look upwards from using its SOURCE_DIR property function(ly_get_gem_module_root output_gem_module_root gem_target) - unset(gem_module_roots) + unset(${output_gem_module_root} PARENT_SCOPE) get_property(gem_source_dir TARGET ${gem_target} PROPERTY SOURCE_DIR) if(gem_source_dir) @@ -96,8 +96,8 @@ function(ly_get_gem_module_root output_gem_module_root gem_target) while(NOT EXISTS ${candidate_gem_dir}/gem.json) get_filename_component(parent_dir ${candidate_gem_dir} DIRECTORY) if (${parent_dir} STREQUAL ${candidate_gem_dir}) - message(WARNING "Did not find a gem.json while processing GEM_MODULE target ${gem_target}!") - break() + # "Did not find a gem.json while processing GEM_MODULE target ${gem_target}!" + return() endif() set(candidate_gem_dir ${parent_dir}) endwhile() @@ -160,11 +160,15 @@ function(ly_delayed_generate_settings_registry) endif() ly_get_gem_module_root(gem_module_root ${gem_target}) + if (NOT gem_module_root) + # If the target doesn't have a gem.json, skip it + continue() + endif() file(RELATIVE_PATH gem_module_root_relative_to_engine_root ${LY_ROOT_FOLDER} ${gem_module_root}) # De-alias namespace from gem targets before configuring them into the json template ly_de_alias_target(${gem_target} stripped_gem_target) - string(CONFIGURE ${gem_module_template} gem_module_json @ONLY) + string(CONFIGURE "${gem_module_template}" gem_module_json @ONLY) list(APPEND target_gem_dependencies_names ${gem_module_json}) endforeach() @@ -177,7 +181,8 @@ function(ly_delayed_generate_settings_registry) string(CONFIGURE ${gems_json_template} gem_json @ONLY) get_target_property(is_imported ${target} IMPORTED) get_target_property(target_type ${target} TYPE) - if(is_imported OR target_type STREQUAL UTILITY) + set(non_loadable_types "UTILITY" "INTERFACE_LIBRARY" "STATIC_LIBRARY") + if(is_imported OR (target_type IN_LIST non_loadable_types)) unset(target_dir) foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES) string(TOUPPER ${conf} UCONF) diff --git a/cmake/install/InstalledTarget.in b/cmake/install/InstalledTarget.in index a4f4fa4763..2095211bb2 100644 --- a/cmake/install/InstalledTarget.in +++ b/cmake/install/InstalledTarget.in @@ -15,6 +15,8 @@ ly_add_target( @INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER@ RUNTIME_DEPENDENCIES @RUNTIME_DEPENDENCIES_PLACEHOLDER@ + TARGET_PROPERTIES +@TARGET_PROPERTIES_PLACEHOLDER@ ) @TARGET_RUN_HELPER@ diff --git a/scripts/build/Jenkins/Jenkinsfile b/scripts/build/Jenkins/Jenkinsfile index b2c06bc720..328e5f8df7 100644 --- a/scripts/build/Jenkins/Jenkinsfile +++ b/scripts/build/Jenkins/Jenkinsfile @@ -6,7 +6,7 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ - +import groovy.json.JsonOutput PIPELINE_CONFIG_FILE = 'scripts/build/Jenkins/lumberyard.json' INCREMENTAL_BUILD_SCRIPT_PATH = 'scripts/build/bootstrap/incremental_build_util.py' @@ -383,6 +383,25 @@ def TestMetrics(Map pipelineConfig, String workspace, String branchName, String } } +def BenchmarkMetrics(Map pipelineConfig, String workspace, String branchName, String outputDirectory) { + catchError(buildResult: null, stageResult: null) { + def cmakeBuildDir = [workspace, ENGINE_REPOSITORY_NAME, outputDirectory].join('/') + dir("${workspace}/${ENGINE_REPOSITORY_NAME}") { + checkout scm: [ + $class: 'GitSCM', + branches: [[name: '*/main']], + extensions: [ + [$class: 'AuthorInChangelog'], + [$class: 'RelativeTargetDirectory', relativeTargetDir: 'mars'] + ], + userRemoteConfigs: [[url: "${env.MARS_REPO}", name: 'mars', credentialsId: "${env.GITHUB_USER}"]] + ] + def command = "${pipelineConfig.PYTHON_DIR}/python.cmd -u mars/scripts/python/benchmark_scraper.py ${cmakeBuildDir} ${branchName}" + palSh(command, "Publishing Benchmark Metrics") + } + } +} + def ExportTestResults(Map options, String platform, String type, String workspace, Map params) { catchError(message: "Error exporting tests results (this won't fail the build)", buildResult: 'SUCCESS', stageResult: 'FAILURE') { def o3deroot = "${workspace}/${ENGINE_REPOSITORY_NAME}" @@ -438,6 +457,7 @@ def CreateTestMetricsStage(Map pipelineConfig, String branchName, Map environmen return { stage("${buildJobName}_metrics") { TestMetrics(pipelineConfig, environmentVars['WORKSPACE'], branchName, env.DEFAULT_REPOSITORY_NAME, buildJobName, outputDirectory, configuration) + BenchmarkMetrics(pipelineConfig, environmentVars['WORKSPACE'], branchName, outputDirectory) } } } @@ -750,6 +770,14 @@ finally { } else { buildFailure = tm('${BUILD_FAILURE_ANALYZER}') emailBody = "${BUILD_URL}\n${buildFailure}!" + if(env.SNS_TOPIC_BUILD_FAILURE) { + message_json = ["build_url":env.BUILD_URL, "repository_name":env.REPOSITORY_NAME, "branch_name":env.BRANCH_NAME, "build_failure":buildFailure] + snsPublish( + topicArn: env.SNS_TOPIC_BUILD_FAILURE, + subject:'Build Failure', + message:JsonOutput.toJson(message_json) + ) + } } emailext ( body: "${emailBody}", diff --git a/scripts/commit_validation/commit_validation/tests/validators/test_az_trait_validator.py b/scripts/commit_validation/commit_validation/tests/validators/test_az_trait_validator.py deleted file mode 100755 index 9474fd00b6..0000000000 --- a/scripts/commit_validation/commit_validation/tests/validators/test_az_trait_validator.py +++ /dev/null @@ -1,92 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -import unittest -from unittest.mock import patch, mock_open - -from commit_validation import pal_allowedlist -from commit_validation.tests.mocks.mock_commit import MockCommit -from commit_validation.validators.az_trait_validator import AzTraitValidator - -import pytest - - -class Test_AzTraitValidatorTests(): - def test_fileDoesntCheckAzTraitIsDefined_passes(self): - commit = MockCommit( - files=['someCppFile.cpp'], - file_diffs={ 'someCppFile.cpp' : ''} - ) - error_list = [] - assert AzTraitValidator().run(commit, error_list) - assert len(error_list) == 0, f"Unexpected errors: {error_list}" - - @pytest.mark.parametrize( - 'file_diffs,expect_success', [ - pytest.param('+This file does contain\n' - '+a trait existence check\n' - '+#ifdef AZ_TRAIT_USED_INCORRECTLY\n', - False, - id="AZ_TRAIT_inside_ifdef_fails" ), # gives the test a friendly name! - - pytest.param('+This file does contain\n' - '+a trait existence check\n' - '+#if defined(AZ_TRAIT_USED_INCORRECTLY)\n', - False, - id="AZ_TRAIT_inside_if_defined_fails" ), - - pytest.param('+This file does contain\n' - '+a trait existence check\n' - '+#ifndef AZ_TRAIT_USED_INCORRECTLY\n', - False, - id="AZ_TRAIT_inside_ifndef_fails" ), - - pytest.param('+This file contains a diff which REMOVES an incorrect usage\n' - '-#ifndef AZ_TRAIT_USED_INCORRECTLY\n', - True, - id="AZ_TRAIT_removed_in_diff_passes" ), - - pytest.param('+This file contains a diff which has an old already okayed usage\n' - '+which is not actually part of the diff.\n' - '#ifndef AZ_TRAIT_USED_INCORRECTLY\n', - True, - id="AZ_TRAIT_in_unmodified_section_passes"), - - pytest.param('+This file contains the correct usage\n' - '+#if AZ_TRAIT_USED_CORRECTLY\n', - True, - id="AZ_TRAIT_correct_usage_passes"), - ]) - def test_fileChecksAzTraitIsDefined(self, file_diffs, expect_success): - commit = MockCommit( - files=['someCppFile.cpp'], - file_diffs={ 'someCppFile.cpp' : file_diffs }) - - error_list = [] - if expect_success: - assert AzTraitValidator().run(commit, error_list) - assert len(error_list) == 0, f"Unexpected errors: {error_list}" - else: - assert not AzTraitValidator().run(commit, error_list) - assert len(error_list) != 0, f"Errors were expected but none were returned." - - def test_fileExtensionIgnored_passes(self): - commit = MockCommit(files=['someCppFile.waf_files']) - error_list = [] - assert AzTraitValidator().run(commit, error_list) - assert len(error_list) == 0, f"Unexpected errors: {error_list}" - - @patch('commit_validation.pal_allowedlist.load', return_value=pal_allowedlist.PALAllowedlist(['*/some/path/*'])) - def test_fileAllowedlisted_passes(self, mocked_load): - commit = MockCommit(files=['/path/to/some/path/someCppFile.cpp']) - error_list = [] - assert AzTraitValidator().run(commit, error_list) - assert len(error_list) == 0, f"Unexpected errors: {error_list}" - -if __name__ == '__main__': - unittest.main() diff --git a/scripts/commit_validation/commit_validation/validators/az_trait_validator.py b/scripts/commit_validation/commit_validation/validators/az_trait_validator.py deleted file mode 100755 index 595cea8720..0000000000 --- a/scripts/commit_validation/commit_validation/validators/az_trait_validator.py +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -import os -import re -from typing import Type, List - -import commit_validation.pal_allowedlist as pal_allowedlist -from commit_validation.commit_validation import Commit, CommitValidator, SOURCE_FILE_EXTENSIONS, VERBOSE - -ifdef_regex = re.compile(r'^\+\s*#\s*ifn?def\s+AZ_TRAIT_') -defined_regex = re.compile(r'\sdefined\s*\(\s*AZ_TRAIT_') - - -class AzTraitValidator(CommitValidator): - """A file-level validator that makes sure a file does not contain existence checks for AZ_TRAIT macros""" - - def __init__(self) -> None: - self.pal_allowedlist = pal_allowedlist.load() - - def run(self, commit: Commit, errors: List[str]) -> bool: - for file_name in commit.get_files(): - if os.path.splitext(file_name)[1].lower() not in SOURCE_FILE_EXTENSIONS: - if VERBOSE: print(f'{file_name}::{self.__class__.__name__} SKIPPED - File excluded based on extension.') - continue - if self.pal_allowedlist.is_match(file_name): - if VERBOSE: print(f'{file_name}::{self.__class__.__name__} SKIPPED - File excluded based on PAL allowedlist.') - continue - - file_diff = commit.get_file_diff(file_name) - previous_line_context = "" - - for line in file_diff.splitlines(): - # we only care about added lines. - if line.startswith('+'): - if ifdef_regex.search(line) or defined_regex.search(line): - error_message = str( - f'{file_name}::{self.__class__.__name__} FAILED - Source file contains an existence ' - f'check for an AZ_TRAIT macro in this code: \n' - f' {previous_line_context}\n' - f' ----> {line}\n' - f'Traits should be tested for true/false, since they are guaranteed to exist on all platforms.') - if VERBOSE: print(error_message) - errors.append(error_message) - previous_line_context = line - - return (not errors) - - -def get_validator() -> Type[AzTraitValidator]: - """Returns the validator class for this module""" - return AzTraitValidator