diff --git a/AutomatedTesting/Gem/PythonTests/Blast/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/Blast/CMakeLists.txt new file mode 100644 index 0000000000..61bb2e8355 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/Blast/CMakeLists.txt @@ -0,0 +1,25 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::BlastTests + TEST_SUITE main + TEST_SERIAL TRUE + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Active.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT Blast + ) +endif() diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt index 6f72d45893..d6f9ecff4b 100644 --- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt @@ -15,406 +15,46 @@ ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) +include(${pal_dir}/PAL_traits_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) + +## Asset pipeline ## add_subdirectory(assetpipeline) + +## Atom Renderer ## add_subdirectory(atom_renderer) ## Physics ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::PhysicsTests_Main - TEST_SUITE main - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/physics/TestSuite_Main.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT - Physics - ) - ly_add_pytest( - NAME AutomatedTesting::PhysicsTests_Periodic - TEST_SUITE periodic - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/physics/TestSuite_Periodic.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT - Physics - ) - ly_add_pytest( - NAME AutomatedTesting::PhysicsTests_Sandbox - TEST_SUITE sandbox - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/physics/TestSuite_Sandbox.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT - Physics - ) -endif() +add_subdirectory(physics) ## ScriptCanvas ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::ScriptCanvasTests - TEST_SUITE periodic - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/scripting/TestSuite_Active.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT - ScriptCanvas - ) - ly_add_pytest( - NAME AutomatedTesting::ScriptCanvasTests_Sandbox - TEST_SUITE sandbox - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/scripting/TestSuite_Sandbox.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - ) -endif() +add_subdirectory(scripting) ## White Box ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::WhiteBoxTests - TEST_SUITE main - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/WhiteBox/TestSuite_Active.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT - WhiteBox - ) -endif() +add_subdirectory(WhiteBox) ## NvCloth ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::NvClothTests_Main - TEST_SUITE main - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/NvCloth/TestSuite_Active.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT - NvCloth - ) -endif() +add_subdirectory(NvCloth) ## Prefab ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::PrefabTests - TEST_SUITE main - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/prefab/TestSuite_Main.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - ) -endif() +add_subdirectory(prefab) ## Editor Python Bindings ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::EditorPythonBindings - TEST_SUITE sandbox - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/EditorPythonBindings - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - Gem::EditorPythonBindings.Editor - COMPONENT TestTools - ) -endif() +add_subdirectory(EditorPythonBindings) ## Python Asset Builder ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::PythonAssetBuilder - TEST_SUITE periodic - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/PythonAssetBuilder - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - Gem::EditorPythonBindings.Editor - Gem::PythonAssetBuilder.Editor - COMPONENT TestTools - ) -endif() +add_subdirectory(PythonAssetBuilder) ## Blast ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::BlastTests - TEST_SUITE main - TEST_SERIAL TRUE - PATH ${CMAKE_CURRENT_LIST_DIR}/Blast/TestSuite_Active.py - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT Blast - ) -endif() - -############# +add_subdirectory(Blast) ## Large Worlds ## - -include(${pal_dir}/PAL_traits_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_LARGE_WORLDS_TEST_SUPPORTED) - -## DynVeg ## - # Temporarily moving all tests to periodic suite - SPEC-6553 - #ly_add_pytest( - # NAME AutomatedTesting::DynamicVegetationTests_Main - # TEST_SERIAL - # TEST_SUITE main - # PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg - # PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark" - # TIMEOUT 1500 - # RUNTIME_DEPENDENCIES - # AZ::AssetProcessor - # Legacy::Editor - # AutomatedTesting.GameLauncher - # AutomatedTesting.Assets - # COMPONENT - # LargeWorlds - #) - - - ly_add_pytest( - NAME AutomatedTesting::DynamicVegetationTests_Sandbox - TEST_SERIAL - TEST_SUITE sandbox - PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg - PYTEST_MARKS "SUITE_sandbox" - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - Legacy::Editor - AutomatedTesting.GameLauncher - AutomatedTesting.Assets - COMPONENT - LargeWorlds - ) - - ly_add_pytest( - NAME AutomatedTesting::DynamicVegetationFilterTests_Periodic - TEST_SERIAL - TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg - PYTEST_MARKS "SUITE_periodic and dynveg_filter" - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - Legacy::Editor - AutomatedTesting.Assets - COMPONENT - LargeWorlds - ) - - ly_add_pytest( - NAME AutomatedTesting::DynamicVegetationModifierTests_Periodic - TEST_SERIAL - TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg - PYTEST_MARKS "SUITE_periodic and dynveg_modifier" - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - Legacy::Editor - AutomatedTesting.Assets - COMPONENT - LargeWorlds - ) - - ly_add_pytest( - NAME AutomatedTesting::DynamicVegetationRegressionTests_Periodic - TEST_SERIAL - TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg - PYTEST_MARKS "SUITE_periodic and dynveg_regression" - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - Legacy::Editor - AutomatedTesting.Assets - COMPONENT - LargeWorlds - ) - - ly_add_pytest( - NAME AutomatedTesting::DynamicVegetationAreaTests_Periodic - TEST_SERIAL - TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg - PYTEST_MARKS "SUITE_periodic and dynveg_area" - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - Legacy::Editor - AutomatedTesting.Assets - COMPONENT - LargeWorlds - ) - - ly_add_pytest( - NAME AutomatedTesting::DynamicVegetationMiscTests_Periodic - TEST_SERIAL - TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg - PYTEST_MARKS "SUITE_periodic and dynveg_misc" - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - Legacy::Editor - AutomatedTesting.Assets - COMPONENT - LargeWorlds - ) - - ly_add_pytest( - NAME AutomatedTesting::DynamicVegetationSurfaceTagTests_Periodic - TEST_SERIAL - TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg - PYTEST_MARKS "SUITE_periodic and dynveg_surfacetagemitter" - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - Legacy::Editor - AutomatedTesting.Assets - COMPONENT - LargeWorlds - ) -## LandscapeCanvas ## - # Temporarily moving all tests to periodic suite - SPEC-6553 - #ly_add_pytest( - # NAME AutomatedTesting::LandscapeCanvasTests_Main - # TEST_SERIAL - # TEST_SUITE main - # PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/landscape_canvas - # PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark" - # TIMEOUT 1500 - # RUNTIME_DEPENDENCIES - # AZ::AssetProcessor - # Legacy::Editor - # AutomatedTesting.Assets - # COMPONENT - # LargeWorlds - #) - - ly_add_pytest( - NAME AutomatedTesting::LandscapeCanvasTests_Periodic - TEST_SERIAL - TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/landscape_canvas - PYTEST_MARKS "SUITE_periodic" - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - Legacy::Editor - AutomatedTesting.Assets - COMPONENT - LargeWorlds - ) - -## GradientSignal ## - ly_add_pytest( - NAME AutomatedTesting::GradientSignalTests_Periodic - TEST_SERIAL - TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/gradient_signal - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - Legacy::Editor - AutomatedTesting.Assets - COMPONENT - LargeWorlds - ) - -endif() +add_subdirectory(largeworlds) ## Editor ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_FOUNDATION_TEST_SUPPORTED) - ly_add_pytest( - NAME AutomatedTesting::EditorTests_Periodic - TEST_SUITE periodic - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/editor - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT - Editor - ) -endif() +add_subdirectory(editor) -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - # Unstable, SPEC-3838 will restore - #ly_add_pytest( - # NAME AutomatedTesting::asset_load_benchmark_test - # TEST_SERIAL - # TEST_SUITE benchmark - # PATH ${CMAKE_CURRENT_LIST_DIR}/streaming/benchmark/asset_load_benchmark_test.py - # RUNTIME_DEPENDENCIES - # AZ::AssetProcessor - # AZ::AssetProcessorBatch - # AutomatedTesting.GameLauncher - #) -endif() +## Streaming ## +add_subdirectory(streaming) -## Smoke ## -if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) - ly_add_pytest( - NAME AutomatedTesting::SmokeTest - TEST_SUITE smoke - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/smoke - TIMEOUT 1500 - RUNTIME_DEPENDENCIES - AZ::AssetProcessor - AZ::PythonBindingsExample - Legacy::Editor - AutomatedTesting.GameLauncher - AutomatedTesting.Assets - COMPONENT - Smoke - ) -endif() +## Streaming ## +add_subdirectory(smoke) diff --git a/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/CMakeLists.txt new file mode 100644 index 0000000000..20a0ca8e65 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/CMakeLists.txt @@ -0,0 +1,26 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::EditorPythonBindings + TEST_SUITE sandbox + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR} + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + Gem::EditorPythonBindings.Editor + COMPONENT TestTools + ) +endif() diff --git a/AutomatedTesting/Gem/PythonTests/NvCloth/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/NvCloth/CMakeLists.txt new file mode 100644 index 0000000000..058cc9ad94 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/NvCloth/CMakeLists.txt @@ -0,0 +1,26 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::NvClothTests_Main + TEST_SUITE main + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Active.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + NvCloth + ) +endif() diff --git a/AutomatedTesting/Gem/PythonTests/PythonAssetBuilder/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/PythonAssetBuilder/CMakeLists.txt new file mode 100644 index 0000000000..0a550de539 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/PythonAssetBuilder/CMakeLists.txt @@ -0,0 +1,27 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::PythonAssetBuilder + TEST_SUITE periodic + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR} + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + Gem::EditorPythonBindings.Editor + Gem::PythonAssetBuilder.Editor + COMPONENT TestTools + ) +endif() diff --git a/AutomatedTesting/Gem/PythonTests/WhiteBox/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/WhiteBox/CMakeLists.txt new file mode 100644 index 0000000000..a6c0a9aa21 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/WhiteBox/CMakeLists.txt @@ -0,0 +1,26 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::WhiteBoxTests + TEST_SUITE main + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Active.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + WhiteBox + ) +endif() diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/assetpipeline/CMakeLists.txt index 74ef6c97a7..f453a38486 100644 --- a/AutomatedTesting/Gem/PythonTests/assetpipeline/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/CMakeLists.txt @@ -13,8 +13,6 @@ add_subdirectory(asset_processor_tests) if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) ## AP Python Tests ## - - ly_add_pytest( NAME AssetPipelineTests.AuxiliaryContent PATH ${CMAKE_CURRENT_LIST_DIR}/auxiliary_content_tests/auxiliary_content_tests.py @@ -22,7 +20,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) TEST_SUITE periodic ) - ly_add_pytest( NAME AssetPipelineTests.BankInfoParser PATH ${CMAKE_CURRENT_LIST_DIR}/wwise_bank_dependency_tests/bank_info_parser_tests.py @@ -33,4 +30,3 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) ) endif() - diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt index 6a865ee690..a2002f2d15 100644 --- a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt @@ -141,4 +141,3 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) # ) endif() - diff --git a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt new file mode 100644 index 0000000000..44e3ed0425 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt @@ -0,0 +1,26 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_FOUNDATION_TEST_SUPPORTED) + ly_add_pytest( + NAME AutomatedTesting::EditorTests_Periodic + TEST_SUITE periodic + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR} + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + Editor + ) +endif() diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt new file mode 100644 index 0000000000..72e3bec3df --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt @@ -0,0 +1,186 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_LARGE_WORLDS_TEST_SUPPORTED) + +## DynVeg ## + + # Temporarily moving all tests to periodic suite - SPEC-6553 + #ly_add_pytest( + # NAME AutomatedTesting::DynamicVegetationTests_Main + # TEST_SERIAL + # TEST_SUITE main + # PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg + # PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark" + # TIMEOUT 1500 + # RUNTIME_DEPENDENCIES + # AZ::AssetProcessor + # Legacy::Editor + # AutomatedTesting.GameLauncher + # AutomatedTesting.Assets + # COMPONENT + # LargeWorlds + #) + + + ly_add_pytest( + NAME AutomatedTesting::DynamicVegetationTests_Sandbox + TEST_SERIAL + TEST_SUITE sandbox + PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg + PYTEST_MARKS "SUITE_sandbox" + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.GameLauncher + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + + ly_add_pytest( + NAME AutomatedTesting::DynamicVegetationFilterTests_Periodic + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg + PYTEST_MARKS "SUITE_periodic and dynveg_filter" + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + + ly_add_pytest( + NAME AutomatedTesting::DynamicVegetationModifierTests_Periodic + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg + PYTEST_MARKS "SUITE_periodic and dynveg_modifier" + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + + ly_add_pytest( + NAME AutomatedTesting::DynamicVegetationRegressionTests_Periodic + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg + PYTEST_MARKS "SUITE_periodic and dynveg_regression" + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + + ly_add_pytest( + NAME AutomatedTesting::DynamicVegetationAreaTests_Periodic + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg + PYTEST_MARKS "SUITE_periodic and dynveg_area" + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + + ly_add_pytest( + NAME AutomatedTesting::DynamicVegetationMiscTests_Periodic + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg + PYTEST_MARKS "SUITE_periodic and dynveg_misc" + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + + ly_add_pytest( + NAME AutomatedTesting::DynamicVegetationSurfaceTagTests_Periodic + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg + PYTEST_MARKS "SUITE_periodic and dynveg_surfacetagemitter" + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) +## LandscapeCanvas ## + # Temporarily moving all tests to periodic suite - SPEC-6553 + #ly_add_pytest( + # NAME AutomatedTesting::LandscapeCanvasTests_Main + # TEST_SERIAL + # TEST_SUITE main + # PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/landscape_canvas + # PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark" + # TIMEOUT 1500 + # RUNTIME_DEPENDENCIES + # AZ::AssetProcessor + # Legacy::Editor + # AutomatedTesting.Assets + # COMPONENT + # LargeWorlds + #) + + ly_add_pytest( + NAME AutomatedTesting::LandscapeCanvasTests_Periodic + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/landscape_canvas + PYTEST_MARKS "SUITE_periodic" + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + +## GradientSignal ## + ly_add_pytest( + NAME AutomatedTesting::GradientSignalTests_Periodic + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/gradient_signal + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + +endif() diff --git a/AutomatedTesting/Gem/PythonTests/physics/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/physics/CMakeLists.txt new file mode 100644 index 0000000000..4f89e841df --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/physics/CMakeLists.txt @@ -0,0 +1,52 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::PhysicsTests_Main + TEST_SUITE main + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + Physics + ) + ly_add_pytest( + NAME AutomatedTesting::PhysicsTests_Periodic + TEST_SUITE periodic + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Periodic.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + Physics + ) + ly_add_pytest( + NAME AutomatedTesting::PhysicsTests_Sandbox + TEST_SUITE sandbox + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Sandbox.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + Physics + ) +endif() diff --git a/AutomatedTesting/Gem/PythonTests/prefab/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/prefab/CMakeLists.txt new file mode 100644 index 0000000000..61f1944974 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/prefab/CMakeLists.txt @@ -0,0 +1,25 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +## Prefab ## +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::PrefabTests + TEST_SUITE main + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + ) +endif() diff --git a/AutomatedTesting/Gem/PythonTests/scripting/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/scripting/CMakeLists.txt new file mode 100644 index 0000000000..58507c680c --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/scripting/CMakeLists.txt @@ -0,0 +1,37 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::ScriptCanvasTests_Perodic + TEST_SUITE periodic + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Periodic.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + ScriptCanvas + ) + ly_add_pytest( + NAME AutomatedTesting::ScriptCanvasTests_Sandbox + TEST_SUITE sandbox + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Sandbox.py + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + ) +endif() diff --git a/AutomatedTesting/Gem/PythonTests/scripting/TestSuite_Active.py b/AutomatedTesting/Gem/PythonTests/scripting/TestSuite_Periodic.py similarity index 100% rename from AutomatedTesting/Gem/PythonTests/scripting/TestSuite_Active.py rename to AutomatedTesting/Gem/PythonTests/scripting/TestSuite_Periodic.py diff --git a/AutomatedTesting/Gem/PythonTests/smoke/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/smoke/CMakeLists.txt new file mode 100644 index 0000000000..d351ec0e6c --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/smoke/CMakeLists.txt @@ -0,0 +1,27 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::SmokeTest + TEST_SUITE smoke + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR} + TIMEOUT 1500 + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + AZ::PythonBindingsExample + Legacy::Editor + AutomatedTesting.GameLauncher + AutomatedTesting.Assets + COMPONENT + Smoke + ) +endif() \ No newline at end of file diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py index 5381fd9fd8..10df59e086 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py @@ -20,6 +20,7 @@ import subprocess @pytest.mark.SUITE_smoke class TestCLIToolAssetBuilderWorks(object): + @pytest.mark.xfail(reason="Ignoring failure temporarily - SPEC-6905") def test_CLITool_AssetBuilder_Works(self, build_directory): file_path = os.path.join(build_directory, "AssetBuilder") help_message = "AssetBuilder is part of the Asset Processor" diff --git a/AutomatedTesting/Gem/PythonTests/streaming/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/streaming/CMakeLists.txt new file mode 100644 index 0000000000..10b9fabcc0 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/streaming/CMakeLists.txt @@ -0,0 +1,24 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + # Unstable, SPEC-3838 will restore + #ly_add_pytest( + # NAME AutomatedTesting::asset_load_benchmark_test + # TEST_SERIAL + # TEST_SUITE benchmark + # PATH ${CMAKE_CURRENT_LIST_DIR}/benchmark/asset_load_benchmark_test.py + # RUNTIME_DEPENDENCIES + # AZ::AssetProcessor + # AZ::AssetProcessorBatch + # AutomatedTesting.GameLauncher + #) +endif() diff --git a/Code/CryEngine/CryCommon/IShader.h b/Code/CryEngine/CryCommon/IShader.h index aea0762a81..81fe18706d 100644 --- a/Code/CryEngine/CryCommon/IShader.h +++ b/Code/CryEngine/CryCommon/IShader.h @@ -772,7 +772,6 @@ _MS_ALIGN(16) struct SSkinningData void* pCharInstCB; // used if per char instance cbs are available in renderdll (d3d11+); // members below are for Software Skinning void* pCustomData; // client specific data, used for example for sw-skinning on animation side - SSkinningData** pMasterSkinningDataList; // used by the SkinningData for a Character Instance, contains a list of all Skin Instances which need SW-Skinning SSkinningData* pNextSkinningData; // List to the next element which needs SW-Skinning } _ALIGN(16); diff --git a/Code/Framework/AtomCore/AtomCore/std/parallel/concurrency_checker.h b/Code/Framework/AtomCore/AtomCore/std/parallel/concurrency_checker.h index 311b574fdf..4a952721b6 100644 --- a/Code/Framework/AtomCore/AtomCore/std/parallel/concurrency_checker.h +++ b/Code/Framework/AtomCore/AtomCore/std/parallel/concurrency_checker.h @@ -20,10 +20,12 @@ namespace AZStd { - //! Simple class for verifying that no concurrent access is occuring. + //! Simple class for verifying that no concurrent access is occurring. //! This is *not* a synchronization primitive, and is intended simply for checking that no concurrency issues exist. //! It will be compiled out in release builds. //! Use concurrency_checker like a mutex (i.e. call soft_lock() and soft_unlock() around all instances of your data access). + //! Use soft_lock_shared and soft_unlock_shared around places where multiple threads are allowed to have read access + //! at the same time as long as nothing else already has a soft lock //! It will assert if there are multiple threads accessing the locked code/data at the same time. //! Expected use case is for defensive programming: when you do not expect any concurrent access within a system, //! but want to verify that it stays that way in the future, without incurring the overhead of a mutex. @@ -34,7 +36,7 @@ namespace AZStd { #ifdef AZ_CONCURRENCY_CHECKER_ENABLED uint32_t count = ++m_concurrencyCounter; - AZ_Assert(count == 1, "Concurrency check failed. Multiple threads are trying to access data at the same time, or there is a lock/unlock mismatch."); + AZ_Assert(count == 1 && m_sharedConcurrencyCounter == 0, "Concurrency check failed. Multiple threads are trying to access data at the same time, or there is a lock/unlock mismatch."); #endif } @@ -46,9 +48,27 @@ namespace AZStd #endif } + AZ_FORCE_INLINE void soft_lock_shared() + { +#ifdef AZ_CONCURRENCY_CHECKER_ENABLED + AZ_Assert(m_concurrencyCounter == 0, "Concurrency check failed. A soft_lock_shared was attempted when there was already a soft_lock."); + ++m_sharedConcurrencyCounter; +#endif + } + + AZ_FORCE_INLINE void soft_unlock_shared() + { +#ifdef AZ_CONCURRENCY_CHECKER_ENABLED + AZ_Assert(m_sharedConcurrencyCounter != 0, "Concurrency check failed. There is a shared_lock/shared_unlock mismatch."); + --m_sharedConcurrencyCounter; +#endif + } + + private: #ifdef AZ_CONCURRENCY_CHECKER_ENABLED AZStd::atomic_uint32_t m_concurrencyCounter = 0; + AZStd::atomic_uint32_t m_sharedConcurrencyCounter = 0; #endif }; diff --git a/Code/Framework/AtomCore/Tests/ArrayView.cpp b/Code/Framework/AtomCore/Tests/ArrayView.cpp index 83fa20aaf0..56627d280e 100644 --- a/Code/Framework/AtomCore/Tests/ArrayView.cpp +++ b/Code/Framework/AtomCore/Tests/ArrayView.cpp @@ -293,15 +293,12 @@ namespace UnitTest { array_view view({ 1,2,3,4 }); - UnitTest::TestRunner::Instance().StartAssertTests(); + AZ_TEST_START_TRACE_SUPPRESSION; - EXPECT_EQ(0, UnitTest::TestRunner::Instance().m_numAssertsFailed); view[4]; - EXPECT_EQ(1, UnitTest::TestRunner::Instance().m_numAssertsFailed); view[5]; - EXPECT_EQ(2, UnitTest::TestRunner::Instance().m_numAssertsFailed); - UnitTest::TestRunner::Instance().StopAssertTests(); + AZ_TEST_STOP_TRACE_SUPPRESSION(2); } } diff --git a/Code/Framework/AtomCore/Tests/ConcurrencyCheckerTests.cpp b/Code/Framework/AtomCore/Tests/ConcurrencyCheckerTests.cpp new file mode 100644 index 0000000000..7cd1fa27ac --- /dev/null +++ b/Code/Framework/AtomCore/Tests/ConcurrencyCheckerTests.cpp @@ -0,0 +1,100 @@ +/* +* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +* its licensors. +* +* For complete copyright and license terms please see the LICENSE at the root of this +* distribution (the "License"). All use of this software is governed by the License, +* or, if provided, by the license below or the license accompanying this file. Do not +* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* +*/ + +#include + +#include + +using namespace AZStd; + +namespace UnitTest +{ + class ConcurrencyCheckerTestFixture + : public AllocatorsTestFixture + { + + void SetUp() override + { + AllocatorsFixture::SetUp(); + } + }; + + TEST_F(AllocatorsTestFixture, SoftLock_NoContention_NoAsserts) + { + concurrency_checker concurrencyChecker; + concurrencyChecker.soft_lock(); + concurrencyChecker.soft_unlock(); + concurrencyChecker.soft_lock(); + concurrencyChecker.soft_unlock(); + } + + TEST_F(AllocatorsTestFixture, SoftLock_AlreadyLocked_Assert) + { + concurrency_checker concurrencyChecker; + concurrencyChecker.soft_lock(); + AZ_TEST_START_TRACE_SUPPRESSION; + concurrencyChecker.soft_lock(); + AZ_TEST_STOP_TRACE_SUPPRESSION(1); + } + + TEST_F(AllocatorsTestFixture, SoftUnlock_NotAlreadyLocked_Assert) + { + concurrency_checker concurrencyChecker; + concurrencyChecker.soft_lock(); + concurrencyChecker.soft_unlock(); + AZ_TEST_START_TRACE_SUPPRESSION; + concurrencyChecker.soft_unlock(); + AZ_TEST_STOP_TRACE_SUPPRESSION(1); + } + + TEST_F(AllocatorsTestFixture, SoftLockShared_NoContention_NoAsserts) + { + concurrency_checker concurrencyChecker; + // Multiple shared locks can be made at once, + // as long as they are all unlocked before the next soft_lock + concurrencyChecker.soft_lock_shared(); + concurrencyChecker.soft_lock_shared(); + concurrencyChecker.soft_unlock_shared(); + concurrencyChecker.soft_unlock_shared(); + + concurrencyChecker.soft_lock(); + concurrencyChecker.soft_unlock(); + + concurrencyChecker.soft_lock_shared(); + concurrencyChecker.soft_lock_shared(); + concurrencyChecker.soft_unlock_shared(); + concurrencyChecker.soft_unlock_shared(); + + concurrencyChecker.soft_lock(); + concurrencyChecker.soft_unlock(); + } + + TEST_F(AllocatorsTestFixture, SoftLockShared_SharedLockAfterSoftLock_Assert) + { + concurrency_checker concurrencyChecker; + + concurrencyChecker.soft_lock(); + AZ_TEST_START_TRACE_SUPPRESSION; + concurrencyChecker.soft_lock_shared(); + AZ_TEST_STOP_TRACE_SUPPRESSION(1); + } + + TEST_F(AllocatorsTestFixture, SoftUnlockShared_NotAlreadyLocked_Assert) + { + concurrency_checker concurrencyChecker; + concurrencyChecker.soft_lock_shared(); + concurrencyChecker.soft_unlock_shared(); + AZ_TEST_START_TRACE_SUPPRESSION; + concurrencyChecker.soft_unlock_shared(); + AZ_TEST_STOP_TRACE_SUPPRESSION(1); + } +} diff --git a/Code/Framework/AtomCore/Tests/atomcore_tests_files.cmake b/Code/Framework/AtomCore/Tests/atomcore_tests_files.cmake index 26efd09fe1..24d23cb852 100644 --- a/Code/Framework/AtomCore/Tests/atomcore_tests_files.cmake +++ b/Code/Framework/AtomCore/Tests/atomcore_tests_files.cmake @@ -11,6 +11,7 @@ set(FILES ArrayView.cpp + ConcurrencyCheckerTests.cpp InstanceDatabase.cpp JsonSerializationUtilsTests.cpp lru_cache.cpp diff --git a/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp index 78f6ac0fb1..9e5b586c39 100644 --- a/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp @@ -103,7 +103,7 @@ namespace AZ } } - /// Returns a pointer to the beginning of master vector of SmallAllocationGroups. + /// Returns a pointer to the beginning of vector of SmallAllocationGroups. SmallAllocationGroup* ArrayHead() { return this - m_index; @@ -169,7 +169,7 @@ namespace AZ return m_marker == MARKER; } - /// Returns the master index of the SmallAllocationGroup containing this allocation + /// Returns the index of the SmallAllocationGroup containing this allocation uint32_t GetSmallAllocationIndex() const { return (uint32_t)(m_data & 0xFFFFFFFF); diff --git a/Code/Framework/AzCore/Platform/iOS/AzCore/Module/DynamicModuleHandle_iOS.cpp b/Code/Framework/AzCore/Platform/iOS/AzCore/Module/DynamicModuleHandle_iOS.cpp index 53514c89e4..a389162ccc 100644 --- a/Code/Framework/AzCore/Platform/iOS/AzCore/Module/DynamicModuleHandle_iOS.cpp +++ b/Code/Framework/AzCore/Platform/iOS/AzCore/Module/DynamicModuleHandle_iOS.cpp @@ -40,7 +40,7 @@ namespace AZ // Afterwards use the AZ::IO::Path Append function append the filename as a child // of the framework directory AZ::IO::FixedMaxPathString fileName{ fullPath.Filename().Native() }; - fullPath.ReplaceFilename(AZ::IO::PathView((fileName + ".framework").c_str())); + fullPath.ReplaceFilename(AZ::IO::PathView(AZStd::string_view(fileName + ".framework"))); fullPath /= fileName; } } diff --git a/Code/Framework/AzFramework/AzFramework/Archive/IArchive.h b/Code/Framework/AzFramework/AzFramework/Archive/IArchive.h index f5de1a0f3a..ce8403b033 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/IArchive.h +++ b/Code/Framework/AzFramework/AzFramework/Archive/IArchive.h @@ -115,7 +115,7 @@ namespace AZ::IO // If used, the source path will be treated as the destination path // and no transformations will be done. Pass this flag when the path is to be the actual // path on the disk/in the packs and doesn't need adjustment (or after it has come through adjustments already) - // if this is set, AdjustFileName will not map the input path into the master folder (Ex: Shaders will not be converted to Game\Shaders) + // if this is set, AdjustFileName will not map the input path into the folder (Ex: Shaders will not be converted to Game\Shaders) FLAGS_PATH_REAL = 1 << 16, // AdjustFileName will always copy the file path to the destination path: @@ -318,7 +318,6 @@ namespace AZ::IO virtual ArchiveFileIterator FindFirst(AZStd::string_view pDir, uint32_t nFlags = 0, bool bAllowUseFileSystem = false) = 0; virtual ArchiveFileIterator FindNext(AZ::IO::ArchiveFileIterator handle) = 0; virtual bool FindClose(AZ::IO::ArchiveFileIterator handle) = 0; - // virtual bool IsOutOfDate(const char * szCompiledName, const char * szMasterFile)=0; //returns file modification time virtual IArchive::FileTime GetModificationTime(AZ::IO::HandleType fileHandle) = 0; diff --git a/Code/Framework/AzFramework/AzFramework/Archive/INestedArchive.h b/Code/Framework/AzFramework/AzFramework/Archive/INestedArchive.h index 25d36f009b..29a1030cf0 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/INestedArchive.h +++ b/Code/Framework/AzFramework/AzFramework/Archive/INestedArchive.h @@ -47,7 +47,7 @@ namespace AZ::IO enum EPakFlags { // support for absolute and other complex path specifications - - // all paths will be treated relatively to the current directory (normally MasterCD) + // all paths will be treated relatively to the current directory FLAGS_ABSOLUTE_PATHS = 1, // if this is set, the object will only understand relative to the zip file paths, diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Character.h b/Code/Framework/AzFramework/AzFramework/Physics/Character.h index 19a6cbfe03..2401c9c5b9 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Character.h +++ b/Code/Framework/AzFramework/AzFramework/Physics/Character.h @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -36,7 +37,7 @@ namespace Physics static void Reflect(AZ::ReflectContext* context); AZStd::string m_name; - ShapeConfigurationList m_shapes; + AzPhysics::ShapeColliderPairList m_shapes; }; class CharacterColliderConfiguration diff --git a/Code/Framework/AzFramework/AzFramework/Physics/ClassConverters.cpp b/Code/Framework/AzFramework/AzFramework/Physics/ClassConverters.cpp index eb74390638..e43bda4c88 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/ClassConverters.cpp +++ b/Code/Framework/AzFramework/AzFramework/Physics/ClassConverters.cpp @@ -57,7 +57,7 @@ namespace Physics classElement.RemoveElement(shapesIndex); // add a new vector in the new format - const int newShapesIndex = classElement.AddElement(context, "shapes"); + const int newShapesIndex = classElement.AddElement(context, "shapes"); if (newShapesIndex != -1) { AZ::SerializeContext::DataElementNode& newShapesElement = classElement.GetSubElement(newShapesIndex); @@ -65,7 +65,9 @@ namespace Physics // convert the old shapes into the new format and add to the vector for (AZ::SerializeContext::DataElementNode shape : shapesCopy) { - const int pairIndex = newShapesElement.AddElementWithData(context, "element", ShapeConfigurationPair()); + const int pairIndex = newShapesElement.AddElementWithData( + context, "element", AzPhysics::ShapeColliderPair()); + AZ::SerializeContext::DataElementNode& pairElement = newShapesElement.GetSubElement(pairIndex); ColliderConfiguration colliderConfig; @@ -131,8 +133,8 @@ namespace Physics AZ::SerializeContext::DataElementNode* baseBaseClass1 = baseClass1->FindSubElement(AZ_CRC("BaseClass1", 0xd4925735)); if (baseBaseClass1 && baseBaseClass1->FindSubElementAndGetData(AZ_CRC("name", 0x5e237e06), name)) { - ShapeConfigurationList shapes; - if (nodeElement.FindSubElementAndGetData(AZ_CRC("shapes", 0x93dba512), shapes)) + AzPhysics::ShapeColliderPairList shapes; + if (nodeElement.FindSubElementAndGetData(AZ_CRC("shapes", 0x93dba512), shapes)) { CharacterColliderNodeConfiguration newColliderNodeConfig; newColliderNodeConfig.m_name = name; diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h index 5158da275e..b2b5fd1511 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h +++ b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h @@ -70,7 +70,10 @@ namespace AzPhysics using SimulatedBodyHandleList = AZStd::vector; //! Helper used for pairing the ShapeConfiguration and ColliderConfiguration together which is used when creating a Simulated Body. - using ShapeColliderPair = AZStd::pair; + using ShapeColliderPair = AZStd::pair< + AZStd::shared_ptr, + AZStd::shared_ptr>; + using ShapeColliderPairList = AZStd::vector; //! Flags used to specifying which properties of a body to compute. enum class MassComputeFlags : AZ::u8 diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Shape.h b/Code/Framework/AzFramework/AzFramework/Physics/Shape.h index 115503c536..2ac38690ff 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Shape.h +++ b/Code/Framework/AzFramework/AzFramework/Physics/Shape.h @@ -80,9 +80,6 @@ namespace Physics void OnContactOffsetChanged(); }; - using ShapeConfigurationPair = AZStd::pair, AZStd::shared_ptr>; - using ShapeConfigurationList = AZStd::vector; - struct RayCastRequest; class Shape diff --git a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp index cdfad7f116..4f8da821c1 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp @@ -264,12 +264,12 @@ namespace AzFramework // SampleRPC = // { // // Two callbacks can be registered to the NetRPC - // // A function to be invoked on the Master - OnMaster + // // A function to be invoked on the main server - OnServer // // and a function to be invoked on the Proxy - OnProxy // // - // // Every NetRPC needs to have a valid OnMaster function, while OnProxy is optional. - // OnMaster = function() - // Debug.Log("Function to be invoked on the Master."); + // // Every NetRPC needs to have a valid OnServer function, while OnProxy is optional. + // OnServer = function() + // Debug.Log("Function to be invoked on the server."); // end // // OnProxy = function() diff --git a/Code/Framework/AzFramework/AzFramework/TargetManagement/NeighborhoodAPI.cpp b/Code/Framework/AzFramework/AzFramework/TargetManagement/NeighborhoodAPI.cpp index 44c601f5f5..7f3d0770c0 100644 --- a/Code/Framework/AzFramework/AzFramework/TargetManagement/NeighborhoodAPI.cpp +++ b/Code/Framework/AzFramework/AzFramework/TargetManagement/NeighborhoodAPI.cpp @@ -41,7 +41,7 @@ namespace Neighborhood { //--------------------------------------------------------------------- void NeighborReplica::OnReplicaActivate(const GridMate::ReplicaContext& /*rc*/) { - // TODO: Should we send the message to ourselves as well (master)? + // TODO: Should we send the message to ourselves as well? if (IsProxy()) { AZ_Assert(m_persistentName.Get().c_str(), "Received NeighborReplica with missing persistent name!"); @@ -52,7 +52,7 @@ namespace Neighborhood { //--------------------------------------------------------------------- void NeighborReplica::OnReplicaDeactivate(const GridMate::ReplicaContext& /*rc*/) { - // TODO: Should we send the message to ourselves as well (master)? + // TODO: Should we send the message to ourselves as well? if (IsProxy()) { EBUS_EVENT(NeighborhoodBus, OnNodeLeft, *this); diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp index daf2c63921..79c1a28e5d 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp @@ -30,7 +30,8 @@ namespace AzFramework AZ_CVAR(float, ed_cameraSystemOrbitDollyScrollSpeed, 0.02f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); AZ_CVAR(float, ed_cameraSystemOrbitDollyCursorSpeed, 0.01f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); AZ_CVAR(float, ed_cameraSystemScrollTranslateSpeed, 0.02f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); - AZ_CVAR(float, ed_cameraSystemMaxOrbitDistance, 60.0f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); + AZ_CVAR(float, ed_cameraSystemMinOrbitDistance, 6.0f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); + AZ_CVAR(float, ed_cameraSystemMaxOrbitDistance, 50.0f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); AZ_CVAR(float, ed_cameraSystemLookSmoothness, 5.0f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); AZ_CVAR(float, ed_cameraSystemTranslateSmoothness, 5.0f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); AZ_CVAR(float, ed_cameraSystemRotateSpeed, 0.005f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); @@ -532,20 +533,39 @@ namespace AzFramework if (Beginning()) { - float hit_distance = 0.0f; - AZ::Plane::CreateFromNormalAndPoint(AZ::Vector3::CreateAxisZ(), AZ::Vector3::CreateAxisZ(ed_cameraSystemDefaultPlaneHeight)) - .CastRay(targetCamera.Translation(), targetCamera.Rotation().GetBasisY(), hit_distance); + const auto hasLookAt = [&nextCamera, &targetCamera, lookAtFn = m_lookAtFn] { + if (lookAtFn) + { + if (const auto lookAt = lookAtFn()) + { + auto transform = AZ::Transform::CreateLookAt(targetCamera.m_lookAt, *lookAt); + nextCamera.m_lookDist = -lookAt->GetDistance(targetCamera.m_lookAt); + UpdateCameraFromTransform(nextCamera, transform); - if (hit_distance > 0.0f) - { - hit_distance = AZStd::min(hit_distance, ed_cameraSystemMaxOrbitDistance); - nextCamera.m_lookDist = -hit_distance; - nextCamera.m_lookAt = targetCamera.Translation() + targetCamera.Rotation().GetBasisY() * hit_distance; - } - else + return true; + } + } + return false; + }(); + + if (!hasLookAt) { - nextCamera.m_lookDist = -ed_cameraSystemMaxOrbitDistance; - nextCamera.m_lookAt = targetCamera.Translation() + targetCamera.Rotation().GetBasisY() * ed_cameraSystemMaxOrbitDistance; + float hit_distance = 0.0f; + AZ::Plane::CreateFromNormalAndPoint(AZ::Vector3::CreateAxisZ(), AZ::Vector3::CreateAxisZ(ed_cameraSystemDefaultPlaneHeight)) + .CastRay(targetCamera.Translation(), targetCamera.Rotation().GetBasisY(), hit_distance); + + if (hit_distance > 0.0f) + { + hit_distance = AZStd::min(hit_distance, ed_cameraSystemMaxOrbitDistance); + nextCamera.m_lookDist = -hit_distance; + nextCamera.m_lookAt = targetCamera.Translation() + targetCamera.Rotation().GetBasisY() * hit_distance; + } + else + { + nextCamera.m_lookDist = -ed_cameraSystemMinOrbitDistance; + nextCamera.m_lookAt = + targetCamera.Translation() + targetCamera.Rotation().GetBasisY() * ed_cameraSystemMinOrbitDistance; + } } } diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h index 41d7f11385..b6b2bc1e6a 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h @@ -199,6 +199,7 @@ namespace AzFramework public: explicit RotateCameraInput(InputChannelId rotateChannelId); + // CameraInput overrides ... void HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; @@ -239,6 +240,7 @@ namespace AzFramework public: PanCameraInput(InputChannelId panChannelId, PanAxesFn panAxesFn); + // CameraInput overrides ... void HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; @@ -279,6 +281,7 @@ namespace AzFramework public: explicit TranslateCameraInput(TranslationAxesFn translationAxesFn); + // CameraInput overrides ... void HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; void ResetImpl() override; @@ -348,6 +351,7 @@ namespace AzFramework class OrbitDollyScrollCameraInput : public CameraInput { public: + // CameraInput overrides ... void HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; }; @@ -357,6 +361,7 @@ namespace AzFramework public: explicit OrbitDollyCursorMoveCameraInput(InputChannelId dollyChannelId); + // CameraInput overrides ... void HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; @@ -367,6 +372,7 @@ namespace AzFramework class ScrollTranslationCameraInput : public CameraInput { public: + // CameraInput overrides ... void HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; }; @@ -374,16 +380,32 @@ namespace AzFramework class OrbitCameraInput : public CameraInput { public: + using LookAtFn = AZStd::function()>; + + // CameraInput overrides ... void HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; - bool Exclusive() const override - { - return true; - } + bool Exclusive() const override; Cameras m_orbitCameras; + + //! Override the default behavior for how a look-at point is calculated. + void SetLookAtFn(const LookAtFn& lookAtFn); + + private: + LookAtFn m_lookAtFn; }; + inline void OrbitCameraInput::SetLookAtFn(const LookAtFn& lookAtFn) + { + m_lookAtFn = lookAtFn; + } + + inline bool OrbitCameraInput::Exclusive() const + { + return true; + } + struct WindowSize; //! Map from a generic InputChannel event to a camera specific InputEvent. diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/SelectionProxyModel.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/SelectionProxyModel.cpp new file mode 100644 index 0000000000..ed7fda7fa8 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/SelectionProxyModel.cpp @@ -0,0 +1,167 @@ +/* +* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +* its licensors. +* +* For complete copyright and license terms please see the LICENSE at the root of this +* distribution (the "License"). All use of this software is governed by the License, +* or, if provided, by the license below or the license accompanying this file. Do not +* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* +*/ + +#include +#include + +namespace AzQtComponents +{ + SelectionProxyModel::SelectionProxyModel(QItemSelectionModel* sourceSelectionModel, QAbstractProxyModel* proxyModel, QObject* parent) + : QItemSelectionModel(proxyModel, parent) + , m_sourceSelectionModel(sourceSelectionModel) + { + connect(sourceSelectionModel, &QItemSelectionModel::selectionChanged, this, &SelectionProxyModel::OnSourceSelectionChanged); + connect(sourceSelectionModel, &QItemSelectionModel::currentChanged, this, &SelectionProxyModel::OnSourceSelectionCurrentChanged); + connect(proxyModel, &QAbstractItemModel::rowsInserted, this, &SelectionProxyModel::OnProxyModelRowsInserted); + connect(this, &QItemSelectionModel::selectionChanged, this, &SelectionProxyModel::OnProxySelectionChanged); + + // Find the chain of proxy models + QAbstractProxyModel* sourceProxyModel = proxyModel; + while (sourceProxyModel) + { + m_proxyModels.push_back(sourceProxyModel); + sourceProxyModel = qobject_cast(sourceProxyModel->sourceModel()); + } + + const QItemSelection currentSelection = mapFromSource(m_sourceSelectionModel->selection()); + QItemSelectionModel::select(currentSelection, QItemSelectionModel::ClearAndSelect); + + const QModelIndex currentModelIndex = mapFromSource(m_sourceSelectionModel->currentIndex()); + QItemSelectionModel::setCurrentIndex(currentModelIndex, QItemSelectionModel::ClearAndSelect); + } + + void SelectionProxyModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) + { + const QModelIndex sourcetIndex = mapToSource(index); + m_sourceSelectionModel->setCurrentIndex(sourcetIndex, command); + } + + void SelectionProxyModel::select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) + { + const QModelIndex sourceIndex = mapToSource(index); + m_sourceSelectionModel->select(sourceIndex, command); + } + + void SelectionProxyModel::select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) + { + const QItemSelection sourceSelection = mapToSource(selection); + m_sourceSelectionModel->select(sourceSelection, command); + } + + void SelectionProxyModel::clear() + { + m_sourceSelectionModel->clear(); + } + + void SelectionProxyModel::reset() + { + m_sourceSelectionModel->reset(); + } + + void SelectionProxyModel::clearCurrentIndex() + { + m_sourceSelectionModel->clearCurrentIndex(); + } + + void SelectionProxyModel::OnSourceSelectionCurrentChanged(const QModelIndex& current, [[maybe_unused]] const QModelIndex& previous) + { + QModelIndex targetCurrent = mapFromSource(current); + QItemSelectionModel::setCurrentIndex(targetCurrent, QItemSelectionModel::NoUpdate); + } + + void SelectionProxyModel::OnSourceSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) + { + QItemSelection targetSelected = mapFromSource(selected); + QItemSelection targetDeselected = mapFromSource(deselected); + + QItemSelectionModel::select(targetSelected, QItemSelectionModel::Select); + QItemSelectionModel::select(targetDeselected, QItemSelectionModel::Deselect); + } + + void SelectionProxyModel::OnProxySelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) + { + const QItemSelection sourceSelected = mapToSource(selected); + const QItemSelection sourceDeselected = mapToSource(deselected); + + // Disconnect from the selectionChanged signal in the source model to prevent recursion. We could also block the signals + // of the source selection model, but someone else may be connected to its signals and expect to get an update. + disconnect(m_sourceSelectionModel, &QItemSelectionModel::selectionChanged, this, &SelectionProxyModel::OnSourceSelectionChanged); + if (selected.empty() && deselected.empty()) + { + // Force the signal to fire + emit m_sourceSelectionModel->selectionChanged({}, {}); + } + else + { + m_sourceSelectionModel->select(sourceSelected, QItemSelectionModel::Select); + m_sourceSelectionModel->select(sourceDeselected, QItemSelectionModel::Deselect); + } + connect(m_sourceSelectionModel, &QItemSelectionModel::selectionChanged, this, &SelectionProxyModel::OnSourceSelectionChanged); + } + + void SelectionProxyModel::OnProxyModelRowsInserted([[maybe_unused]] const QModelIndex& parent, [[maybe_unused]] int first, [[maybe_unused]] int last) + { + QModelIndex sourceIndex = m_sourceSelectionModel->currentIndex(); + QModelIndex targetIndex = mapFromSource(sourceIndex); + if (targetIndex != currentIndex()) + { + QItemSelectionModel::setCurrentIndex(targetIndex, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); + } + + QItemSelection sourceSelection = m_sourceSelectionModel->selection(); + QItemSelection targetSelection = mapFromSource(sourceSelection); + if (targetSelection != selection()) + { + QItemSelectionModel::select(targetSelection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); + } + } + + QModelIndex SelectionProxyModel::mapFromSource(const QModelIndex& sourceIndex) + { + QModelIndex mappedIndex = sourceIndex; + for (QVector::const_reverse_iterator itProxy = m_proxyModels.rbegin(); itProxy != m_proxyModels.rend(); ++itProxy) + { + mappedIndex = (*itProxy)->mapFromSource(mappedIndex); + } + return mappedIndex; + } + + QItemSelection SelectionProxyModel::mapFromSource(const QItemSelection& sourceSelection) + { + QItemSelection mappedSelection = sourceSelection; + for (QVector::const_reverse_iterator itProxy = m_proxyModels.rbegin(); itProxy != m_proxyModels.rend(); ++itProxy) + { + mappedSelection = (*itProxy)->mapSelectionFromSource(mappedSelection); + } + return mappedSelection; + } + + QModelIndex SelectionProxyModel::mapToSource(const QModelIndex& targetIndex) + { + QModelIndex mappedIndex = targetIndex; + for (QVector::const_iterator itProxy = m_proxyModels.begin(); itProxy != m_proxyModels.end(); ++itProxy) + { + mappedIndex = (*itProxy)->mapToSource(mappedIndex); + } + return mappedIndex; + } + + QItemSelection SelectionProxyModel::mapToSource(const QItemSelection& targetSelection) + { + QItemSelection mappedSelection = targetSelection; + for (QVector::const_iterator itProxy = m_proxyModels.begin(); itProxy != m_proxyModels.end(); ++itProxy) + { + mappedSelection = (*itProxy)->mapSelectionToSource(mappedSelection); + } + return mappedSelection; + } +} // namespace AzQtComponents diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/SelectionProxyModel.h b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/SelectionProxyModel.h new file mode 100644 index 0000000000..5187ed9cb0 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/SelectionProxyModel.h @@ -0,0 +1,66 @@ +/* +* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +* its licensors. +* +* For complete copyright and license terms please see the LICENSE at the root of this +* distribution (the "License"). All use of this software is governed by the License, +* or, if provided, by the license below or the license accompanying this file. Do not +* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* +*/ + +#pragma once + +#if !defined(Q_MOC_RUN) +#include +#include +#include +#endif + +QT_FORWARD_DECLARE_CLASS(QAbstractProxyModel) + +namespace AzQtComponents +{ + //! This class is a QItemSelectionModel that syncs through proxy models and maintains + //! selection. In Qt we can have a model being filtered/sorted by proxy models. If the + //! selection model is connected to the original model, the view needs a new selection + //! model that understands the filtering. This class does that conversion. + //! @Note: this class does not support changing proxy models (anywhere in the chain). + //! The class will have to be recreated with the new proxy model. + class AZ_QT_COMPONENTS_API SelectionProxyModel + : public QItemSelectionModel + { + Q_OBJECT // AUTOMOC + + public: + SelectionProxyModel(QItemSelectionModel* sourceSelectionModel, QAbstractProxyModel* proxyModel, QObject* parent = nullptr); + + void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override; + void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override; + void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) override; + void clear() override; + void reset() override; + void clearCurrentIndex() override; + + private slots: + void OnSourceSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); + void OnSourceSelectionCurrentChanged(const QModelIndex& current, const QModelIndex& previous); + void OnProxySelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); + void OnProxyModelRowsInserted(const QModelIndex& parent, int first, int last); + + private: + QModelIndex mapFromSource(const QModelIndex& sourceIndex); + QItemSelection mapFromSource(const QItemSelection& sourceSelection); + + QModelIndex mapToSource(const QModelIndex& targetIndex); + QItemSelection mapToSource(const QItemSelection& targetSelection); + + // Contains the chain of proxy models that leads us to the real model. The outer-most proxy model + // comes first and is followed by inner proxy models. + AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING + QVector m_proxyModels; + AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING + QItemSelectionModel* m_sourceSelectionModel; + }; +} // namespace AzQtComponents diff --git a/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake b/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake index 30929b712b..33a35e0524 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake +++ b/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake @@ -287,6 +287,8 @@ set(FILES Utilities/ScreenUtilities.cpp Utilities/ScreenGrabber.h Utilities/ScopedCleanup.h + Utilities/SelectionProxyModel.cpp + Utilities/SelectionProxyModel.h Utilities/TextUtilities.cpp Utilities/TextUtilities.h ) diff --git a/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp b/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp index 99f38f3171..f5fb0cb721 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp @@ -296,7 +296,7 @@ DefaultTrafficControl::OnReceived(TrafficControlConnectionId id, DataGramControl if (m_maxRecvPackets != 0) { --cd->m_recvPacketAllowance; - if (cd->m_recvPacketAllowance == 0) // hit the limit -> let's blacklist connection + if (cd->m_recvPacketAllowance == 0) // hit the limit { cd->m_canReceiveData = false; } diff --git a/Code/Sandbox/Editor/EditorViewportWidget.cpp b/Code/Sandbox/Editor/EditorViewportWidget.cpp index 436d4bba63..85c40f2092 100644 --- a/Code/Sandbox/Editor/EditorViewportWidget.cpp +++ b/Code/Sandbox/Editor/EditorViewportWidget.cpp @@ -49,6 +49,7 @@ #include #include #include +#include // AtomToolsFramework #include @@ -1238,6 +1239,20 @@ void EditorViewportWidget::SetViewportId(int id) auto firstPersonWheelCamera = AZStd::make_shared(); auto orbitCamera = AZStd::make_shared(); + orbitCamera->SetLookAtFn([]() -> AZStd::optional { + AZStd::optional manipulatorTransform; + AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult( + manipulatorTransform, AzToolsFramework::GetEntityContextId(), + &AzToolsFramework::EditorTransformComponentSelectionRequestBus::Events::GetManipulatorTransform); + + if (manipulatorTransform) + { + return manipulatorTransform->GetTranslation(); + } + + return {}; + }); + auto orbitRotateCamera = AZStd::make_shared(AzFramework::CameraOrbitLookButton); auto orbitTranslateCamera = AZStd::make_shared(AzFramework::OrbitTranslation); auto orbitDollyWheelCamera = AZStd::make_shared(); diff --git a/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.cpp b/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.cpp index 976850cb87..153c0964c7 100644 --- a/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.cpp +++ b/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.cpp @@ -11,16 +11,23 @@ */ #include +#include #include #include +#include #include #include #include +#include +#include #include +#include namespace O3DE::ProjectManager { + constexpr const char* k_pathProperty = "Path"; + NewProjectSettingsScreen::NewProjectSettingsScreen(QWidget* parent) : ScreenWidget(parent) { @@ -29,19 +36,27 @@ namespace O3DE::ProjectManager QVBoxLayout* vLayout = new QVBoxLayout(this); - QLabel* projectNameLabel = new QLabel(this); - projectNameLabel->setText("Project Name"); + QLabel* projectNameLabel = new QLabel(tr("Project Name"), this); vLayout->addWidget(projectNameLabel); - QLineEdit* projectNameLineEdit = new QLineEdit(this); - vLayout->addWidget(projectNameLineEdit); + m_projectNameLineEdit = new QLineEdit(tr("New Project"), this); + vLayout->addWidget(m_projectNameLineEdit); - QLabel* projectPathLabel = new QLabel(this); - projectPathLabel->setText("Project Location"); + QLabel* projectPathLabel = new QLabel(tr("Project Location"), this); vLayout->addWidget(projectPathLabel); - QLineEdit* projectPathLineEdit = new QLineEdit(this); - vLayout->addWidget(projectPathLineEdit); + { + QHBoxLayout* projectPathLayout = new QHBoxLayout(this); + + m_projectPathLineEdit = new QLineEdit(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), this); + projectPathLayout->addWidget(m_projectPathLineEdit); + + QPushButton* browseButton = new QPushButton(tr("Browse"), this); + connect(browseButton, &QPushButton::pressed, this, &NewProjectSettingsScreen::HandleBrowseButton); + projectPathLayout->addWidget(browseButton); + + vLayout->addLayout(projectPathLayout); + } QLabel* projectTemplateLabel = new QLabel(this); projectTemplateLabel->setText("Project Template"); @@ -50,14 +65,21 @@ namespace O3DE::ProjectManager QHBoxLayout* templateLayout = new QHBoxLayout(this); vLayout->addItem(templateLayout); - QRadioButton* projectTemplateStandardRadioButton = new QRadioButton(this); - projectTemplateStandardRadioButton->setText("Standard (Recommened)"); - projectTemplateStandardRadioButton->setChecked(true); - templateLayout->addWidget(projectTemplateStandardRadioButton); + m_projectTemplateButtonGroup = new QButtonGroup(this); + auto templatesResult = PythonBindingsInterface::Get()->GetProjectTemplates(); + if (templatesResult.IsSuccess() && !templatesResult.GetValue().isEmpty()) + { + for (auto projectTemplate : templatesResult.GetValue()) + { + QRadioButton* radioButton = new QRadioButton(projectTemplate.m_name, this); + radioButton->setProperty(k_pathProperty, projectTemplate.m_path); + m_projectTemplateButtonGroup->addButton(radioButton); - QRadioButton* projectTemplateEmptyRadioButton = new QRadioButton(this); - projectTemplateEmptyRadioButton->setText("Empty"); - templateLayout->addWidget(projectTemplateEmptyRadioButton); + templateLayout->addWidget(radioButton); + } + + m_projectTemplateButtonGroup->buttons().first()->setChecked(true); + } QSpacerItem* verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); vLayout->addItem(verticalSpacer); @@ -76,7 +98,57 @@ namespace O3DE::ProjectManager QString NewProjectSettingsScreen::GetNextButtonText() { - return "Create Project"; + return tr("Next"); + } + + void NewProjectSettingsScreen::HandleBrowseButton() + { + QString defaultPath = m_projectPathLineEdit->text(); + if (defaultPath.isEmpty()) + { + defaultPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); + } + + QString directory = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, tr("New project path"), defaultPath)); + if (!directory.isEmpty()) + { + m_projectPathLineEdit->setText(directory); + } } + ProjectInfo NewProjectSettingsScreen::GetProjectInfo() + { + ProjectInfo projectInfo; + projectInfo.m_projectName = m_projectNameLineEdit->text(); + projectInfo.m_path = QDir::toNativeSeparators(m_projectPathLineEdit->text() + "/" + projectInfo.m_projectName); + return projectInfo; + } + + QString NewProjectSettingsScreen::GetProjectTemplatePath() + { + return m_projectTemplateButtonGroup->checkedButton()->property(k_pathProperty).toString(); + } + + bool NewProjectSettingsScreen::Validate() + { + bool projectNameIsValid = true; + if (m_projectNameLineEdit->text().isEmpty()) + { + projectNameIsValid = false; + } + + bool projectPathIsValid = true; + if (m_projectPathLineEdit->text().isEmpty()) + { + projectPathIsValid = false; + } + + QDir path(QDir::toNativeSeparators(m_projectPathLineEdit->text() + "/" + m_projectNameLineEdit->text())); + if (path.exists() && !path.isEmpty()) + { + projectPathIsValid = false; + } + + return projectNameIsValid && projectPathIsValid; + } } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.h b/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.h index 2589f00fcd..dbd4388668 100644 --- a/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.h +++ b/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.h @@ -13,8 +13,12 @@ #if !defined(Q_MOC_RUN) #include +#include #endif +QT_FORWARD_DECLARE_CLASS(QButtonGroup) +QT_FORWARD_DECLARE_CLASS(QLineEdit) + namespace O3DE::ProjectManager { class NewProjectSettingsScreen @@ -25,6 +29,19 @@ namespace O3DE::ProjectManager ~NewProjectSettingsScreen() = default; ProjectManagerScreen GetScreenEnum() override; QString GetNextButtonText() override; + + ProjectInfo GetProjectInfo(); + QString GetProjectTemplatePath(); + + bool Validate(); + + protected slots: + void HandleBrowseButton(); + + private: + QLineEdit* m_projectNameLineEdit; + QLineEdit* m_projectPathLineEdit; + QButtonGroup* m_projectTemplateButtonGroup; }; } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/ProjectInfo.cpp b/Code/Tools/ProjectManager/Source/ProjectInfo.cpp index 4dc6eaa38b..b0b740fad9 100644 --- a/Code/Tools/ProjectManager/Source/ProjectInfo.cpp +++ b/Code/Tools/ProjectManager/Source/ProjectInfo.cpp @@ -14,12 +14,11 @@ namespace O3DE::ProjectManager { - ProjectInfo::ProjectInfo(const QString& path, const QString& projectName, const QString& productName, const AZ::Uuid projectId, + ProjectInfo::ProjectInfo(const QString& path, const QString& projectName, const QString& displayName, const QString& imagePath, const QString& backgroundImagePath, bool isNew) : m_path(path) , m_projectName(projectName) - , m_productName(productName) - , m_projectId(projectId) + , m_displayName(displayName) , m_imagePath(imagePath) , m_backgroundImagePath(backgroundImagePath) , m_isNew(isNew) @@ -28,6 +27,6 @@ namespace O3DE::ProjectManager bool ProjectInfo::IsValid() const { - return !m_path.isEmpty() && !m_projectId.IsNull(); + return !m_path.isEmpty() && !m_projectName.isEmpty(); } } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/ProjectInfo.h b/Code/Tools/ProjectManager/Source/ProjectInfo.h index d86991e76e..92a7459d78 100644 --- a/Code/Tools/ProjectManager/Source/ProjectInfo.h +++ b/Code/Tools/ProjectManager/Source/ProjectInfo.h @@ -23,7 +23,7 @@ namespace O3DE::ProjectManager { public: ProjectInfo() = default; - ProjectInfo(const QString& path, const QString& projectName, const QString& productName, const AZ::Uuid projectId, + ProjectInfo(const QString& path, const QString& projectName, const QString& displayName, const QString& imagePath, const QString& backgroundImagePath, bool isNew); bool IsValid() const; @@ -33,8 +33,7 @@ namespace O3DE::ProjectManager // From project.json QString m_projectName; - QString m_productName; - AZ::Uuid m_projectId; + QString m_displayName; // Used on projects home screen QString m_imagePath; diff --git a/Code/Tools/ProjectManager/Source/ProjectSettingsCtrl.cpp b/Code/Tools/ProjectManager/Source/ProjectSettingsCtrl.cpp index 1dccabb484..fd1013c871 100644 --- a/Code/Tools/ProjectManager/Source/ProjectSettingsCtrl.cpp +++ b/Code/Tools/ProjectManager/Source/ProjectSettingsCtrl.cpp @@ -12,10 +12,13 @@ #include #include +#include +#include #include #include #include +#include namespace O3DE::ProjectManager { @@ -65,7 +68,8 @@ namespace O3DE::ProjectManager } void ProjectSettingsCtrl::HandleNextButton() { - ProjectManagerScreen screenEnum = m_screensCtrl->GetCurrentScreen()->GetScreenEnum(); + ScreenWidget* currentScreen = m_screensCtrl->GetCurrentScreen(); + ProjectManagerScreen screenEnum = currentScreen->GetScreenEnum(); auto screenOrderIter = m_screensOrder.begin(); for (; screenOrderIter != m_screensOrder.end(); ++screenOrderIter) { @@ -76,6 +80,22 @@ namespace O3DE::ProjectManager } } + if (screenEnum == ProjectManagerScreen::NewProjectSettings) + { + auto newProjectScreen = reinterpret_cast(currentScreen); + if (newProjectScreen) + { + if (!newProjectScreen->Validate()) + { + QMessageBox::critical(this, tr("Invalid project settings"), tr("Invalid project settings")); + return; + } + + m_projectInfo = newProjectScreen->GetProjectInfo(); + m_projectTemplatePath = newProjectScreen->GetProjectTemplatePath(); + } + } + if (screenOrderIter != m_screensOrder.end()) { m_screensCtrl->ChangeToScreen(*screenOrderIter); @@ -83,7 +103,15 @@ namespace O3DE::ProjectManager } else { - emit ChangeScreenRequest(ProjectManagerScreen::ProjectsHome); + auto result = PythonBindingsInterface::Get()->CreateProject(m_projectTemplatePath, m_projectInfo); + if (result.IsSuccess()) + { + emit ChangeScreenRequest(ProjectManagerScreen::ProjectsHome); + } + else + { + QMessageBox::critical(this, tr("Project creation failed"), tr("Failed to create project.")); + } } } diff --git a/Code/Tools/ProjectManager/Source/ProjectSettingsCtrl.h b/Code/Tools/ProjectManager/Source/ProjectSettingsCtrl.h index 0b46436df1..42f1ce1978 100644 --- a/Code/Tools/ProjectManager/Source/ProjectSettingsCtrl.h +++ b/Code/Tools/ProjectManager/Source/ProjectSettingsCtrl.h @@ -12,13 +12,13 @@ #pragma once #if !defined(Q_MOC_RUN) +#include "ProjectInfo.h" #include - #include - #include #endif + namespace O3DE::ProjectManager { class ProjectSettingsCtrl @@ -40,6 +40,9 @@ namespace O3DE::ProjectManager QPushButton* m_backButton; QPushButton* m_nextButton; QVector m_screensOrder; + + QString m_projectTemplatePath; + ProjectInfo m_projectInfo; }; } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index b6945e012e..e925c81032 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -53,6 +53,173 @@ namespace Platform #define Py_To_String(obj) obj.cast().c_str() #define Py_To_String_Optional(dict, key, default_string) dict.contains(key) ? Py_To_String(dict[key]) : default_string +namespace RedirectOutput +{ + using RedirectOutputFunc = AZStd::function; + + struct RedirectOutput + { + PyObject_HEAD RedirectOutputFunc write; + }; + + PyObject* RedirectWrite(PyObject* self, PyObject* args) + { + std::size_t written(0); + RedirectOutput* selfimpl = reinterpret_cast(self); + if (selfimpl->write) + { + char* data; + if (!PyArg_ParseTuple(args, "s", &data)) + { + return PyLong_FromSize_t(0); + } + selfimpl->write(data); + written = strlen(data); + } + return PyLong_FromSize_t(written); + } + + PyObject* RedirectFlush([[maybe_unused]] PyObject* self,[[maybe_unused]] PyObject* args) + { + // no-op + return Py_BuildValue(""); + } + + PyMethodDef RedirectMethods[] = { + {"write", RedirectWrite, METH_VARARGS, "sys.stdout.write"}, + {"flush", RedirectFlush, METH_VARARGS, "sys.stdout.flush"}, + {"write", RedirectWrite, METH_VARARGS, "sys.stderr.write"}, + {"flush", RedirectFlush, METH_VARARGS, "sys.stderr.flush"}, + {0, 0, 0, 0} // sentinel + }; + + PyTypeObject RedirectOutputType = { + PyVarObject_HEAD_INIT(0, 0) "azlmbr_redirect.RedirectOutputType", // tp_name + sizeof(RedirectOutput), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + "azlmbr_redirect objects", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + RedirectMethods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0 /* tp_new */ + }; + + PyModuleDef RedirectOutputModule = { + PyModuleDef_HEAD_INIT, "azlmbr_redirect", 0, -1, 0, + }; + + // Internal state + PyObject* g_redirect_stdout = nullptr; + PyObject* g_redirect_stdout_saved = nullptr; + PyObject* g_redirect_stderr = nullptr; + PyObject* g_redirect_stderr_saved = nullptr; + + PyMODINIT_FUNC PyInit_RedirectOutput(void) + { + g_redirect_stdout = nullptr; + g_redirect_stdout_saved = nullptr; + g_redirect_stderr = nullptr; + g_redirect_stderr_saved = nullptr; + + RedirectOutputType.tp_new = PyType_GenericNew; + if (PyType_Ready(&RedirectOutputType) < 0) + { + return 0; + } + + PyObject* redirectModule = PyModule_Create(&RedirectOutputModule); + if (redirectModule) + { + Py_INCREF(&RedirectOutputType); + PyModule_AddObject(redirectModule, "Redirect", reinterpret_cast(&RedirectOutputType)); + } + return redirectModule; + } + + void SetRedirection(const char* funcname, PyObject*& saved, PyObject*& current, RedirectOutputFunc func) + { + if (PyType_Ready(&RedirectOutputType) < 0) + { + AZ_Warning("python", false, "RedirectOutputType not ready!"); + return; + } + + if (!current) + { + saved = PySys_GetObject(funcname); // borrowed + current = RedirectOutputType.tp_new(&RedirectOutputType, 0, 0); + } + + RedirectOutput* redirectOutput = reinterpret_cast(current); + redirectOutput->write = func; + PySys_SetObject(funcname, current); + } + + void ResetRedirection(const char* funcname, PyObject*& saved, PyObject*& current) + { + if (current) + { + PySys_SetObject(funcname, saved); + } + Py_XDECREF(current); + current = nullptr; + } + + PyObject* s_RedirectModule = nullptr; + + void Intialize(PyObject* module) + { + s_RedirectModule = module; + + SetRedirection("stdout", g_redirect_stdout_saved, g_redirect_stdout, []([[maybe_unused]] const char* msg) { + AZ_TracePrintf("Python", msg); + }); + + SetRedirection("stderr", g_redirect_stderr_saved, g_redirect_stderr, []([[maybe_unused]] const char* msg) { + AZ_TracePrintf("Python", msg); + }); + + PySys_WriteStdout("RedirectOutput installed"); + } + + void Shutdown() + { + ResetRedirection("stdout", g_redirect_stdout_saved, g_redirect_stdout); + ResetRedirection("stderr", g_redirect_stderr_saved, g_redirect_stderr); + Py_XDECREF(s_RedirectModule); + s_RedirectModule = nullptr; + } +} // namespace RedirectOutput + namespace O3DE::ProjectManager { PythonBindings::PythonBindings(const AZ::IO::PathView& enginePath) @@ -92,6 +259,8 @@ namespace O3DE::ProjectManager AZ_TracePrintf("python", "Py_GetExecPrefix=%ls \n", Py_GetExecPrefix()); AZ_TracePrintf("python", "Py_GetProgramFullPath=%ls \n", Py_GetProgramFullPath()); + PyImport_AppendInittab("azlmbr_redirect", RedirectOutput::PyInit_RedirectOutput); + try { // ignore system location for sites site-packages @@ -101,6 +270,8 @@ namespace O3DE::ProjectManager const bool initializeSignalHandlers = true; pybind11::initialize_interpreter(initializeSignalHandlers); + RedirectOutput::Intialize(PyImport_ImportModule("azlmbr_redirect")); + // Acquire GIL before calling Python code AZStd::lock_guard lock(m_lock); pybind11::gil_scoped_acquire acquire; @@ -113,6 +284,7 @@ namespace O3DE::ProjectManager // import required modules m_registration = pybind11::module::import("cmake.Tools.registration"); + m_engineTemplate = pybind11::module::import("cmake.Tools.engine_template"); return result == 0 && !PyErr_Occurred(); } catch ([[maybe_unused]] const std::exception& e) @@ -126,6 +298,7 @@ namespace O3DE::ProjectManager { if (Py_IsInitialized()) { + RedirectOutput::Shutdown(); pybind11::finalize_interpreter(); } else @@ -204,9 +377,28 @@ namespace O3DE::ProjectManager } } - AZ::Outcome PythonBindings::CreateProject([[maybe_unused]] const ProjectTemplateInfo& projectTemplate,[[maybe_unused]] const ProjectInfo& projectInfo) + AZ::Outcome PythonBindings::CreateProject(const QString& projectTemplatePath, const ProjectInfo& projectInfo) { - return AZ::Failure(); + ProjectInfo createdProjectInfo; + bool result = ExecuteWithLock([&] { + + pybind11::str projectPath = projectInfo.m_path.toStdString(); + pybind11::str templatePath = projectTemplatePath.toStdString(); + auto createProjectResult = m_engineTemplate.attr("create_project")(projectPath, templatePath); + if (createProjectResult.cast() == 0) + { + createdProjectInfo = ProjectInfoFromPath(projectPath); + } + }); + + if (!result || !createdProjectInfo.IsValid()) + { + return AZ::Failure(); + } + else + { + return AZ::Success(AZStd::move(createdProjectInfo)); + } } AZ::Outcome PythonBindings::GetProject(const QString& path) @@ -275,10 +467,8 @@ namespace O3DE::ProjectManager { try { - // required fields - projectInfo.m_productName = Py_To_String(projectData["product_name"]); projectInfo.m_projectName = Py_To_String(projectData["project_name"]); - projectInfo.m_projectId = AZ::Uuid(Py_To_String(projectData["project_id"])); + projectInfo.m_displayName = Py_To_String_Optional(projectData,"display_name", projectInfo.m_projectName); } catch ([[maybe_unused]] const std::exception& e) { diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.h b/Code/Tools/ProjectManager/Source/PythonBindings.h index 9183ca2424..ffabf99b49 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.h +++ b/Code/Tools/ProjectManager/Source/PythonBindings.h @@ -43,7 +43,7 @@ namespace O3DE::ProjectManager AZ::Outcome> GetGems() override; // Project - AZ::Outcome CreateProject(const ProjectTemplateInfo& projectTemplate, const ProjectInfo& projectInfo) override; + AZ::Outcome CreateProject(const QString& projectTemplatePath, const ProjectInfo& projectInfo) override; AZ::Outcome GetProject(const QString& path) override; AZ::Outcome> GetProjects() override; bool UpdateProject(const ProjectInfo& projectInfo) override; @@ -62,6 +62,7 @@ namespace O3DE::ProjectManager bool StopPython(); AZ::IO::FixedMaxPath m_enginePath; + pybind11::handle m_engineTemplate; AZStd::recursive_mutex m_lock; pybind11::handle m_registration; }; diff --git a/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h b/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h index f696ea958d..2377da1461 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h +++ b/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h @@ -70,11 +70,11 @@ namespace O3DE::ProjectManager /** * Create a project - * @param projectTemplate the project template to use + * @param projectTemplatePath the path to the project template to use * @param projectInfo the project info to use * @return an outcome with ProjectInfo on success */ - virtual AZ::Outcome CreateProject(const ProjectTemplateInfo& projectTemplate, const ProjectInfo& projectInfo) = 0; + virtual AZ::Outcome CreateProject(const QString& projectTemplatePath, const ProjectInfo& projectInfo) = 0; /** * Get info about a project diff --git a/Code/Tools/SerializeContextTools/SliceConverter.cpp b/Code/Tools/SerializeContextTools/SliceConverter.cpp index 7631eabf22..a18a6ff3a3 100644 --- a/Code/Tools/SerializeContextTools/SliceConverter.cpp +++ b/Code/Tools/SerializeContextTools/SliceConverter.cpp @@ -173,8 +173,7 @@ namespace AZ return false; } - const SliceComponent::SliceList& sliceList = sliceComponent->GetSlices(); - AZ_Warning("Convert-Slice", sliceList.empty(), " Slice depends on other slices, this conversion will lose data.\n"); + AZ_Warning("Convert-Slice", sliceComponent->GetSlices().empty(), " Slice depends on other slices, this conversion will lose data.\n"); // Create the Prefab with the entities from the slice AZStd::unique_ptr sourceInstance( diff --git a/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.h b/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.h index 05b52430b7..d5e872b95a 100644 --- a/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.h +++ b/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.h @@ -10,8 +10,7 @@ * */ -#ifndef DRILLER_WORKSPACE_SETTINGS_MASTER_H -#define DRILLER_WORKSPACE_SETTINGS_MASTER_H +#pragma once #include #include @@ -77,7 +76,3 @@ namespace Driller SavedWorkspaceMap m_WorkspaceSaveData; }; } - -#pragma once - -#endif // DRILLER_WORKSPACE_SETTINGS_MASTER_H diff --git a/Gems/AssetMemoryAnalyzer/Code/Source/AssetMemoryAnalyzer.cpp b/Gems/AssetMemoryAnalyzer/Code/Source/AssetMemoryAnalyzer.cpp index f371210d68..25d607dce3 100644 --- a/Gems/AssetMemoryAnalyzer/Code/Source/AssetMemoryAnalyzer.cpp +++ b/Gems/AssetMemoryAnalyzer/Code/Source/AssetMemoryAnalyzer.cpp @@ -81,12 +81,12 @@ namespace AssetMemoryAnalyzer using AssetTree = AZ::Debug::AssetTree; using AssetTreeNode = typename AssetTree::NodeType; using AllocationTable = AZ::Debug::AllocationTable; - using MasterCodePoints = AZStd::unordered_set, AZStd::equal_to, AZ::Debug::AZStdAssetTrackingAllocator>; + using CodePoints = AZStd::unordered_set, AZStd::equal_to, AZ::Debug::AZStdAssetTrackingAllocator>; using mutex_type = AZStd::mutex; using lock_type = AZStd::lock_guard; mutex_type m_mutex; - MasterCodePoints m_masterCodePoints; + CodePoints m_codePoints; AssetTree m_assetTree; AllocationTable m_allocationTable; AZ::Debug::AssetTracking m_assetTracking; @@ -195,7 +195,7 @@ namespace AssetMemoryAnalyzer { // Store a record for this allocation, at this code-point lock_type lock(m_mutex); - auto insertResult = m_masterCodePoints.emplace(Data::CodePoint{ fileName ? fileName : "", lineNum, category }); + auto insertResult = m_codePoints.emplace(Data::CodePoint{ fileName ? fileName : "", lineNum, category }); Data::CodePoint* cp = &*insertResult.first; m_allocationTable.Get().emplace(address, AllocationTable::RecordType{ activeAsset, (uint32_t)byteSize, Data::AllocationData{ cp, categoryInfo } }); static_cast(activeAsset)->m_data.m_totalAllocations[(int)category]++; diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/LightCulling/NVLC.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/LightCulling/NVLC.azsli index 8bcd21b19b..60d5bf38f2 100644 --- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/LightCulling/NVLC.azsli +++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/LightCulling/NVLC.azsli @@ -26,7 +26,7 @@ // //---------------------------------------------------------------------------------- -#define Depth_to_Z(d, unprojectZ) (unprojectZ.x / (d + unprojectZ.y)) +#define DepthBufferToViewSpace(d, unprojectZ) (unprojectZ.x / (d + unprojectZ.y)) #define NVLC_MAX_POSSIBLE_LIGHTS_PER_BIN 256 @@ -187,7 +187,7 @@ float4 RemapZToUnit(float4 z, float2 minmaxz) uint DepthSamplesToBinMask2x(float2 d, float2 minmaxz, float2 unprojectZ) { - float2 z = Depth_to_Z(d, unprojectZ); + float2 z = DepthBufferToViewSpace(d, unprojectZ); // Tile_UnitValueToBit will convert that 0 to 1 value into 0.0 to 31.99999 float2 bit = Tile_UnitValueToBit(RemapZToUnit(z, minmaxz)); @@ -207,7 +207,7 @@ uint DepthSamplesToBinMask2x(float2 d, float2 minmaxz, float2 unprojectZ) uint DepthSamplesToBinMask4x(float4 d, float2 minmaxz, float2 unprojectZ) { - float4 z = Depth_to_Z(d, unprojectZ); + float4 z = DepthBufferToViewSpace(d, unprojectZ); // Tile_UnitValueToBit will convert that 0 to 1 value into 0.0 to 31.99999 float4 bit = Tile_UnitValueToBit(RemapZToUnit(z, minmaxz)); diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/LightCulling/LightCullingTilePrepare.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/LightCulling/LightCullingTilePrepare.azsl index fba2175c9b..a8b2ab76db 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/LightCulling/LightCullingTilePrepare.azsl +++ b/Gems/Atom/Feature/Common/Assets/Shaders/LightCulling/LightCullingTilePrepare.azsl @@ -150,7 +150,7 @@ uint ComputeTransparentBitMask(float2 minmaxZ) return 0; } - float2 minmaxZ_transparent = Depth_to_Z(minmaxDepth_transparent, PassSrg::m_constantData.m_unprojectZ); + float2 minmaxZ_transparent = DepthBufferToViewSpace(minmaxDepth_transparent, PassSrg::m_constantData.m_unprojectZ); float2 minmaxUnit_transparent = RemapZToUnit(minmaxZ_transparent, minmaxZ); @@ -295,7 +295,7 @@ void MainCS( float2 minmaxDepth_opaque = ComputeDepthMinMaxFrom2Samples(opaqueDepthSamples); minmaxDepth_both = ExpandMinMax(minmaxDepth_opaque, minmaxDepth_transparent); UpdateMinMaxFromAllThreads(minmaxDepth_both, minmaxDepth_transparent, isPixelOnScreen); - minmaxDepth_both = Depth_to_Z(minmaxDepth_both, PassSrg::m_constantData.m_unprojectZ); + minmaxDepth_both = DepthBufferToViewSpace(minmaxDepth_both, PassSrg::m_constantData.m_unprojectZ); // if zNear == zFar we want to map z == zNear to 0-bit, so we have to keep zNear without modifications minmaxDepth_both.y = IncrementULP(minmaxDepth_both.y); @@ -313,7 +313,7 @@ void MainCS( float2 minmaxDepth_opaque = ComputeDepthMinMaxFrom4Samples(opaqueDepthSamples); minmaxDepth_both = ExpandMinMax(minmaxDepth_opaque, minmaxDepth_transparent); UpdateMinMaxFromAllThreads(minmaxDepth_both, minmaxDepth_transparent, isPixelOnScreen); - minmaxDepth_both = Depth_to_Z(minmaxDepth_both, PassSrg::m_constantData.m_unprojectZ); + minmaxDepth_both = DepthBufferToViewSpace(minmaxDepth_both, PassSrg::m_constantData.m_unprojectZ); // if zNear == zFar we want to map z == zNear to 0-bit, so we have to keep zNear without modifications minmaxDepth_both.y = IncrementULP(minmaxDepth_both.y); diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/MorphTargets/MorphTargetInputBuffers.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/MorphTargets/MorphTargetInputBuffers.h index 56ecd7de4d..8bef9ea427 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/MorphTargets/MorphTargetInputBuffers.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/MorphTargets/MorphTargetInputBuffers.h @@ -53,6 +53,7 @@ namespace AZ void SetBufferViewsOnShaderResourceGroup(const Data::Instance& perInstanceSRG); private: RHI::Ptr m_vertexDeltaBufferView; + Data::Instance m_vertexDeltaBuffer; }; struct MorphTargetMetaData diff --git a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetInputBuffers.cpp b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetInputBuffers.cpp index 35437f2b1e..e6fa8bb54e 100644 --- a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetInputBuffers.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetInputBuffers.cpp @@ -30,16 +30,18 @@ namespace AZ { MorphTargetInputBuffers::MorphTargetInputBuffers(const RPI::BufferAssetView& bufferAssetView, const AZStd::string& bufferNamePrefix) { - auto buffer = RPI::Buffer::FindOrCreate(bufferAssetView.GetBufferAsset()); - - AZ::RHI::Ptr bufferView = RHI::Factory::Get().CreateBufferView(); + m_vertexDeltaBuffer = RPI::Buffer::FindOrCreate(bufferAssetView.GetBufferAsset()); + if (m_vertexDeltaBuffer) { - bufferView->SetName(Name(bufferNamePrefix + "MorphTargetVertexDeltaView")); - [[maybe_unused]] RHI::ResultCode resultCode = bufferView->Init(*buffer->GetRHIBuffer(), bufferAssetView.GetBufferViewDescriptor()); - AZ_Error("MorphTargetInputBuffers", resultCode == RHI::ResultCode::Success, "Failed to initialize buffer view for morph target."); + AZ::RHI::Ptr bufferView = RHI::Factory::Get().CreateBufferView(); + { + bufferView->SetName(Name(bufferNamePrefix + "MorphTargetVertexDeltaView")); + [[maybe_unused]] RHI::ResultCode resultCode = bufferView->Init(*m_vertexDeltaBuffer->GetRHIBuffer(), bufferAssetView.GetBufferViewDescriptor()); + AZ_Error("MorphTargetInputBuffers", resultCode == RHI::ResultCode::Success, "Failed to initialize buffer view for morph target."); + } + + m_vertexDeltaBufferView = bufferView; } - - m_vertexDeltaBufferView = bufferView; } void MorphTargetInputBuffers::SetBufferViewsOnShaderResourceGroup(const Data::Instance& perInstanceSRG) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/AreaLightComponentConfig.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/AreaLightComponentConfig.h index fe40cabc12..31cdb34ddd 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/AreaLightComponentConfig.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/AreaLightComponentConfig.h @@ -62,7 +62,7 @@ namespace AZ bool m_enableShadow = false; ShadowmapSize m_shadowmapMaxSize = ShadowmapSize::Size256; ShadowFilterMethod m_shadowFilterMethod = ShadowFilterMethod::None; - PcfMethod m_pcfMethod = PcfMethod::BoundarySearch; + PcfMethod m_pcfMethod = PcfMethod::Bicubic; float m_boundaryWidthInDegrees = 0.25f; uint16_t m_predictionSampleCount = 4; uint16_t m_filteringSampleCount = 12; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/DirectionalLightComponentConfig.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/DirectionalLightComponentConfig.h index 7de2857541..237c1f3016 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/DirectionalLightComponentConfig.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/DirectionalLightComponentConfig.h @@ -61,7 +61,7 @@ namespace AZ float m_shadowFarClipDistance = 100.f; //! Width/Height of shadowmap images. - ShadowmapSize m_shadowmapSize = MaxShadowmapImageSize; + ShadowmapSize m_shadowmapSize = ShadowmapSize::Size1024; //! Number of cascades. uint32_t m_cascadeCount = 4; @@ -117,7 +117,7 @@ namespace AZ //! It is used only when the pixel is predicted as on the boundary. uint16_t m_filteringSampleCount = 32; - PcfMethod m_pcfMethod = PcfMethod::BoundarySearch; + PcfMethod m_pcfMethod = PcfMethod::Bicubic; bool IsSplitManual() const; bool IsSplitAutomatic() const; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp index a77bcfdd12..69bec21a6c 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp @@ -173,10 +173,10 @@ namespace AZ ->DataElement( Edit::UIHandlers::ComboBox, &AreaLightComponentConfig::m_pcfMethod, "Pcf method", "Type of PCF to use.\n" - " Boundary search: do several taps to first determine if we are on a shadow boundary\n" - " Bicubic: a smooth, fixed-size kernel \n") - ->EnumAttribute(PcfMethod::BoundarySearch, "Boundary search") + " Bicubic: a smooth, fixed-size kernel \n" + " Boundary search: do several taps to first determine if we are on a shadow boundary\n") ->EnumAttribute(PcfMethod::Bicubic, "Bicubic") + ->EnumAttribute(PcfMethod::BoundarySearch, "Boundary search") ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) ->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows) ->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsShadowPcfDisabled); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorDirectionalLightComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorDirectionalLightComponent.cpp index 35c5522c4e..a40557f2f1 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorDirectionalLightComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorDirectionalLightComponent.cpp @@ -163,10 +163,10 @@ namespace AZ ->DataElement( Edit::UIHandlers::ComboBox, &DirectionalLightComponentConfig::m_pcfMethod, "Pcf Method", "Type of Pcf to use.\n" - " Boundary search: do several taps to first determine if we are on a shadow boundary\n" - " Bicubic: a smooth, fixed-size kernel \n") - ->EnumAttribute(PcfMethod::BoundarySearch, "Boundary Search") + " Bicubic: a smooth, fixed-size kernel \n" + " Boundary search: do several taps to first determine if we are on a shadow boundary\n") ->EnumAttribute(PcfMethod::Bicubic, "Bicubic") + ->EnumAttribute(PcfMethod::BoundarySearch, "Boundary Search") ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) ->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsShadowPcfDisabled); ; diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp index 3594802dab..8dc7f9387c 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp @@ -500,7 +500,16 @@ namespace AZ skinnedMeshLod.SetIndexBufferAsset(mesh0.GetIndexBufferAssetView().GetBufferAsset()); skinnedMeshLod.SetStaticBufferAsset(mesh0.GetSemanticBufferAssetView(Name{ "UV" })->GetBufferAsset(), SkinnedMeshStaticVertexStreams::UV_0); - const RPI::BufferAssetView* morphBufferAssetView = mesh0.GetSemanticBufferAssetView(Name{ "MORPHTARGET_VERTEXDELTAS" }); + const RPI::BufferAssetView* morphBufferAssetView = nullptr; + for (const auto& mesh : modelLodAsset->GetMeshes()) + { + morphBufferAssetView = mesh.GetSemanticBufferAssetView(Name{ "MORPHTARGET_VERTEXDELTAS" }); + if (morphBufferAssetView) + { + break; + } + } + if (morphBufferAssetView) { ProcessMorphsForLod(actor, morphBufferAssetView->GetBufferAsset(), lodIndex, fullFileName, skinnedMeshLod); diff --git a/Gems/Blast/Code/Source/Actor/ShapesProvider.cpp b/Gems/Blast/Code/Source/Actor/ShapesProvider.cpp index 42bdd773f7..a739f25cf9 100644 --- a/Gems/Blast/Code/Source/Actor/ShapesProvider.cpp +++ b/Gems/Blast/Code/Source/Actor/ShapesProvider.cpp @@ -27,7 +27,7 @@ namespace Blast PhysX::ColliderComponentRequestBus::Handler::BusDisconnect(m_entityId); } - Physics::ShapeConfigurationList ShapesProvider::GetShapeConfigurations() + AzPhysics::ShapeColliderPairList ShapesProvider::GetShapeConfigurations() { return {}; } diff --git a/Gems/Blast/Code/Source/Actor/ShapesProvider.h b/Gems/Blast/Code/Source/Actor/ShapesProvider.h index 4e737be080..0b23dc542c 100644 --- a/Gems/Blast/Code/Source/Actor/ShapesProvider.h +++ b/Gems/Blast/Code/Source/Actor/ShapesProvider.h @@ -28,7 +28,7 @@ namespace Blast void AddShape(AZStd::shared_ptr shape); // This class is not supposed to provide shape configurations, only shapes themselves. - Physics::ShapeConfigurationList GetShapeConfigurations() override; + AzPhysics::ShapeColliderPairList GetShapeConfigurations() override; AZStd::vector> GetShapes() override; diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.cpp index fae3ee742c..bd0d998737 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.cpp @@ -251,7 +251,7 @@ namespace EMotionFX return false; } - Physics::ShapeConfigurationPair newCollider; + AzPhysics::ShapeColliderPair newCollider; // Either in case the contents got specified via a command parameter or in case of redo. if (m_contents) @@ -263,7 +263,7 @@ namespace EMotionFX else if (m_colliderType) { // Create new collider. - AZ::Outcome colliderOutcome = PhysicsSetup::CreateColliderByType(m_colliderType.value(), outResult); + AZ::Outcome colliderOutcome = PhysicsSetup::CreateColliderByType(m_colliderType.value(), outResult); if (!colliderOutcome.IsSuccess()) { return false; @@ -367,7 +367,7 @@ namespace EMotionFX return false; } - const Physics::ShapeConfigurationPair& collider = nodeConfig->m_shapes[m_oldColliderIndex.value()]; + const AzPhysics::ShapeColliderPair& collider = nodeConfig->m_shapes[m_oldColliderIndex.value()]; m_contents = MCore::ReflectionSerializer::Serialize(&collider).GetValue(); CommandColliderHelpers::RemoveCollider(m_actorId, m_jointName, m_configType, m_oldColliderIndex.value(), /*commandGroup*/ nullptr, true); @@ -472,7 +472,7 @@ namespace EMotionFX AZ_UNUSED(parameters); Actor* actor = nullptr; - Physics::ShapeConfigurationPair* shapeConfigPair = GetShapeConfigPair(&actor, outResult); + AzPhysics::ShapeColliderPair* shapeConfigPair = GetShapeConfigPair(&actor, outResult); if (!shapeConfigPair) { return false; @@ -524,7 +524,7 @@ namespace EMotionFX AZ_UNUSED(parameters); Actor* actor = nullptr; - Physics::ShapeConfigurationPair* shapeConfigPair = GetShapeConfigPair(&actor, outResult); + AzPhysics::ShapeColliderPair* shapeConfigPair = GetShapeConfigPair(&actor, outResult); if (!shapeConfigPair) { return false; @@ -606,7 +606,7 @@ namespace EMotionFX return true; } - Physics::ShapeConfigurationPair* CommandAdjustCollider::GetShapeConfigPair(Actor** outActor, AZStd::string& outResult) const + AzPhysics::ShapeColliderPair* CommandAdjustCollider::GetShapeConfigPair(Actor** outActor, AZStd::string& outResult) const { Actor* actor = GetActor(this, outResult); if (!actor) @@ -647,7 +647,7 @@ namespace EMotionFX return nullptr; } - Physics::ShapeConfigurationPair& shapeConfigPair = nodeConfig->m_shapes[m_index.value()]; + AzPhysics::ShapeColliderPair& shapeConfigPair = nodeConfig->m_shapes[m_index.value()]; return &shapeConfigPair; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.h index f0d20ce5f3..bb84e955ef 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.h @@ -159,7 +159,7 @@ namespace EMotionFX static const char* s_commandName; private: - Physics::ShapeConfigurationPair* GetShapeConfigPair(Actor** outActor, AZStd::string& outResult) const; + AzPhysics::ShapeColliderPair* GetShapeConfigPair(Actor** outActor, AZStd::string& outResult) const; AZStd::optional m_configType; AZStd::optional m_index; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.cpp index e8e5afb90f..cbe3e73cb3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.cpp @@ -198,13 +198,13 @@ namespace EMotionFX return m_config.m_simulatedObjectColliderConfig; } - AZ::Outcome PhysicsSetup::CreateColliderByType(const AZ::TypeId& typeId) + AZ::Outcome PhysicsSetup::CreateColliderByType(const AZ::TypeId& typeId) { AZStd::string outResult; return CreateColliderByType(typeId, outResult); } - AZ::Outcome PhysicsSetup::CreateColliderByType(const AZ::TypeId& typeId, AZStd::string& outResult) + AZ::Outcome PhysicsSetup::CreateColliderByType(const AZ::TypeId& typeId, AZStd::string& outResult) { if (typeId.IsNull()) { @@ -227,14 +227,16 @@ namespace EMotionFX return AZ::Failure(); } - Physics::ShapeConfiguration* shapeConfig = reinterpret_cast(classData->m_factory->Create(classData->m_name)); + AZStd::shared_ptr shapeConfig( + reinterpret_cast(classData->m_factory->Create(classData->m_name))); + if (!shapeConfig) { outResult = AZStd::string::format("Could not create collider with type '%s'.", typeId.ToString().c_str()); return AZ::Failure(); } - Physics::ShapeConfigurationPair pair(AZStd::make_shared(), shapeConfig); + AzPhysics::ShapeColliderPair pair(AZStd::make_shared(), shapeConfig); if (pair.first->m_materialSelection.GetMaterialIdsAssignedToSlots().empty()) { pair.first->m_materialSelection.SetMaterialSlots(Physics::MaterialSelection::SlotsArray()); @@ -242,7 +244,7 @@ namespace EMotionFX return AZ::Success(pair); } - void PhysicsSetup::AutoSizeCollider(Physics::ShapeConfigurationPair& collider, const Actor* actor, const Node* joint) + void PhysicsSetup::AutoSizeCollider(AzPhysics::ShapeColliderPair& collider, const Actor* actor, const Node* joint) { if (!collider.second || !actor || !joint) { @@ -417,7 +419,7 @@ namespace EMotionFX nodeConfig = &hitDetectionConfig.m_nodes.back(); } - Physics::ShapeConfigurationList& collisionShapes = nodeConfig->m_shapes; + AzPhysics::ShapeColliderPairList& collisionShapes = nodeConfig->m_shapes; Physics::ColliderConfiguration* colliderConfig = aznew Physics::ColliderConfiguration(); colliderConfig->m_position = position; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.h b/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.h index 4ff925739a..1da80faa34 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.h @@ -68,9 +68,9 @@ namespace EMotionFX void OptimizeForServer(); - static AZ::Outcome CreateColliderByType(const AZ::TypeId& typeId); - static AZ::Outcome CreateColliderByType(const AZ::TypeId& typeId, AZStd::string& outResult); - static void AutoSizeCollider(Physics::ShapeConfigurationPair& collider, const Actor* actor, const Node* node); + static AZ::Outcome CreateColliderByType(const AZ::TypeId& typeId); + static AZ::Outcome CreateColliderByType(const AZ::TypeId& typeId, AZStd::string& outResult); + static void AutoSizeCollider(AzPhysics::ShapeColliderPair& collider, const Actor* actor, const Node* node); static void Reflect(AZ::ReflectContext* context); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp index 7a219b5ff3..0edc6ebb38 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp @@ -51,7 +51,7 @@ namespace EMotionFX m_collisionObjects.reserve(3); } - void SpringSolver::CreateCollider(AZ::u32 skeletonJointIndex, const Physics::ShapeConfigurationPair& shapePair) + void SpringSolver::CreateCollider(AZ::u32 skeletonJointIndex, const AzPhysics::ShapeColliderPair& shapePair) { const Physics::ShapeConfiguration* shapeConfig = shapePair.second.get(); if (!shapeConfig) @@ -104,7 +104,7 @@ namespace EMotionFX bool colliderFound = false; for (const auto& nodeConfig : colliderSetup.m_nodes) { - for (const Physics::ShapeConfigurationPair& shapePair : nodeConfig.m_shapes) + for (const AzPhysics::ShapeColliderPair& shapePair : nodeConfig.m_shapes) { if (shapePair.first->m_tag == colliderTag) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.h b/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.h index 5843ea02be..ca45343a6b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.h @@ -87,7 +87,7 @@ namespace EMotionFX AZ::Vector3 m_end = AZ::Vector3::CreateZero(); /**< The end position of the primitive. In case of a sphere this is ignored. */ float m_radius = 1.0f; /**< The radius or thickness. */ float m_scaledRadius = 1.0f; /**< The scaled radius value, scaled by the joint's world space transform. */ - const Physics::ShapeConfigurationPair* m_shapePair = nullptr; + const AzPhysics::ShapeColliderPair* m_shapePair = nullptr; }; struct EMFX_API InitSettings @@ -151,7 +151,7 @@ namespace EMotionFX private: void InitColliders(const InitSettings& initSettings); - void CreateCollider(AZ::u32 skeletonJointIndex, const Physics::ShapeConfigurationPair& shapePair); + void CreateCollider(AZ::u32 skeletonJointIndex, const AzPhysics::ShapeColliderPair& shapePair); void InitColliderFromColliderSetupShape(CollisionObject& collider); void InitCollidersFromColliderSetupShapes(); bool RecursiveAddJoint(const SimulatedJoint* joint, size_t parentParticleIndex); diff --git a/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.cpp b/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.cpp index f6c196b23e..bd013da767 100644 --- a/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.cpp @@ -266,7 +266,7 @@ namespace EMotionFX connect(this, &AzQtComponents::Card::contextMenuRequested, this, &ColliderWidget::OnCardContextMenu); } - void ColliderWidget::Update(Actor* actor, Node* joint, size_t colliderIndex, PhysicsSetup::ColliderConfigType colliderType, const Physics::ShapeConfigurationPair& collider) + void ColliderWidget::Update(Actor* actor, Node* joint, size_t colliderIndex, PhysicsSetup::ColliderConfigType colliderType, const AzPhysics::ShapeColliderPair& collider) { m_actor = actor; m_joint = joint; @@ -276,7 +276,7 @@ namespace EMotionFX if (!collider.first || !collider.second) { m_editor->ClearInstances(true); - m_collider = Physics::ShapeConfigurationPair(); + m_collider = AzPhysics::ShapeColliderPair(); return; } @@ -520,7 +520,7 @@ namespace EMotionFX CommandSystem::GetCommandManager()->RemoveCommandCallback(m_commandCallback, /*delFromMem=*/true); } - void ColliderContainerWidget::Update(Actor* actor, Node* joint, PhysicsSetup::ColliderConfigType colliderType, const Physics::ShapeConfigurationList& colliders, AZ::SerializeContext* serializeContext) + void ColliderContainerWidget::Update(Actor* actor, Node* joint, PhysicsSetup::ColliderConfigType colliderType, const AzPhysics::ShapeColliderPairList& colliders, AZ::SerializeContext* serializeContext) { m_actor = actor; m_joint = joint; @@ -557,7 +557,7 @@ namespace EMotionFX for (size_t i = numColliders; i < numAvailableColliderWidgets; ++i) { m_colliderWidgets[i]->hide(); - m_colliderWidgets[i]->Update(nullptr, nullptr, MCORE_INVALIDINDEX32, PhysicsSetup::ColliderConfigType::Unknown, Physics::ShapeConfigurationPair()); + m_colliderWidgets[i]->Update(nullptr, nullptr, MCORE_INVALIDINDEX32, PhysicsSetup::ColliderConfigType::Unknown, AzPhysics::ShapeColliderPair()); } } @@ -571,7 +571,7 @@ namespace EMotionFX void ColliderContainerWidget::Reset() { - Update(nullptr, nullptr, PhysicsSetup::ColliderConfigType::Unknown, Physics::ShapeConfigurationList(), nullptr); + Update(nullptr, nullptr, PhysicsSetup::ColliderConfigType::Unknown, AzPhysics::ShapeColliderPairList(), nullptr); } void ColliderContainerWidget::contextMenuEvent(QContextMenuEvent* event) @@ -614,7 +614,7 @@ namespace EMotionFX return QWidget::sizeHint() + QSize(0, s_layoutSpacing); } - void ColliderContainerWidget::RenderColliders(const Physics::ShapeConfigurationList& colliders, + void ColliderContainerWidget::RenderColliders(const AzPhysics::ShapeColliderPairList& colliders, const ActorInstance* actorInstance, const Node* node, EMStudio::EMStudioPlugin::RenderInfo* renderInfo, @@ -704,7 +704,7 @@ namespace EMotionFX if (joint) { const bool jointSelected = selectedJointIndices.empty() || selectedJointIndices.find(joint->GetNodeIndex()) != selectedJointIndices.end(); - const Physics::ShapeConfigurationList& colliders = nodeConfig.m_shapes; + const AzPhysics::ShapeColliderPairList& colliders = nodeConfig.m_shapes; RenderColliders(colliders, actorInstance, joint, renderInfo, jointSelected ? selectedColor : defaultColor); } } diff --git a/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.h b/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.h index e8cc717e49..31f28ce210 100644 --- a/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.h +++ b/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.h @@ -71,7 +71,7 @@ namespace EMotionFX public: ColliderWidget(QIcon* icon, QWidget* parent, AZ::SerializeContext* serializeContext); - void Update(Actor* actor, Node* joint, size_t colliderIndex, PhysicsSetup::ColliderConfigType colliderType, const Physics::ShapeConfigurationPair& collider); + void Update(Actor* actor, Node* joint, size_t colliderIndex, PhysicsSetup::ColliderConfigType colliderType, const AzPhysics::ShapeColliderPair& collider); void Update(); void Reset(); @@ -99,7 +99,7 @@ namespace EMotionFX PhysicsSetup::ColliderConfigType m_colliderType = PhysicsSetup::ColliderConfigType::Unknown; Node* m_joint = nullptr; size_t m_colliderIndex = MCORE_INVALIDINDEX32; - Physics::ShapeConfigurationPair m_collider; + AzPhysics::ShapeColliderPair m_collider; QIcon* m_icon; }; @@ -140,7 +140,7 @@ namespace EMotionFX ColliderContainerWidget(const QIcon& colliderIcon, QWidget* parent = nullptr); ~ColliderContainerWidget(); - void Update(Actor* actor, Node* joint, PhysicsSetup::ColliderConfigType colliderType, const Physics::ShapeConfigurationList& colliders, AZ::SerializeContext* serializeContext); + void Update(Actor* actor, Node* joint, PhysicsSetup::ColliderConfigType colliderType, const AzPhysics::ShapeColliderPairList& colliders, AZ::SerializeContext* serializeContext); void Update(); void Reset(); PhysicsSetup::ColliderConfigType ColliderType() { return m_colliderType; } @@ -156,7 +156,7 @@ namespace EMotionFX * @param[in] renderInfo Needed to access the render util. * @param[in] colliderColor The collider color. */ - static void RenderColliders(const Physics::ShapeConfigurationList& colliders, + static void RenderColliders(const AzPhysics::ShapeColliderPairList& colliders, const ActorInstance* actorInstance, const Node* node, EMStudio::EMStudioPlugin::RenderInfo* renderInfo, diff --git a/Gems/EMotionFX/Code/Source/Editor/ColliderHelpers.cpp b/Gems/EMotionFX/Code/Source/Editor/ColliderHelpers.cpp index b8f6311600..2cab16e2c1 100644 --- a/Gems/EMotionFX/Code/Source/Editor/ColliderHelpers.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/ColliderHelpers.cpp @@ -40,7 +40,7 @@ namespace EMotionFX const Physics::CharacterColliderNodeConfiguration* copyFromNodeConfig = copyFromColliderConfig->FindNodeConfigByName(joint->GetNameString()); if (copyFromNodeConfig) { - for (const Physics::ShapeConfigurationPair& shapeConfigPair : copyFromNodeConfig->m_shapes) + for (const AzPhysics::ShapeColliderPair& shapeConfigPair : copyFromNodeConfig->m_shapes) { const AZStd::string contents = MCore::ReflectionSerializer::Serialize(&shapeConfigPair).GetValue(); CommandColliderHelpers::AddCollider(actor->GetID(), joint->GetNameString(), copyTo, contents, AZStd::nullopt, &commandGroup); @@ -231,7 +231,7 @@ namespace EMotionFX const Physics::CharacterColliderNodeConfiguration* copyFromNodeConfig = copyFromColliderConfig->FindNodeConfigByName(joint->GetNameString()); if (copyFromNodeConfig && shapeIndex < copyFromNodeConfig->m_shapes.size()) { - const Physics::ShapeConfigurationPair* shape = ©FromNodeConfig->m_shapes[shapeIndex]; + const AzPhysics::ShapeColliderPair* shape = ©FromNodeConfig->m_shapes[shapeIndex]; const AZStd::string contents = MCore::ReflectionSerializer::Serialize(shape).GetValue(); QMimeData* mimeData = new QMimeData(); mimeData->setData( diff --git a/Gems/EMotionFX/Code/Source/Editor/ColliderHelpers.h b/Gems/EMotionFX/Code/Source/Editor/ColliderHelpers.h index 462638e793..a2eba33682 100644 --- a/Gems/EMotionFX/Code/Source/Editor/ColliderHelpers.h +++ b/Gems/EMotionFX/Code/Source/Editor/ColliderHelpers.h @@ -28,7 +28,7 @@ namespace EMotionFX public: static QString GetMimeTypeForColliderShape() { - return QString("com.amazon.lumberyard/%1").arg(azrtti_typeid().ToString()); + return QString("com.amazon.lumberyard/%1").arg(azrtti_typeid().ToString()); } static void AddCopyColliderCommandToGroup(const Actor* actor, const Node* joint, PhysicsSetup::ColliderConfigType copyFrom, PhysicsSetup::ColliderConfigType copyTo, MCore::CommandGroup& commandGroup); diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/Ragdoll/RagdollNodeInspectorPlugin.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/Ragdoll/RagdollNodeInspectorPlugin.cpp index c2e2c5cc1b..e2fde04016 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/Ragdoll/RagdollNodeInspectorPlugin.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/Ragdoll/RagdollNodeInspectorPlugin.cpp @@ -507,7 +507,7 @@ namespace EMotionFX const Physics::CharacterColliderNodeConfiguration* colliderNodeConfig = colliderConfig.FindNodeConfigByName(joint->GetNameString()); if (colliderNodeConfig) { - const Physics::ShapeConfigurationList& colliders = colliderNodeConfig->m_shapes; + const AzPhysics::ShapeColliderPairList& colliders = colliderNodeConfig->m_shapes; ColliderContainerWidget::RenderColliders(colliders, actorInstance, joint, renderInfo, finalColor); } } diff --git a/Gems/EMotionFX/Code/Tests/ColliderCommandTests.cpp b/Gems/EMotionFX/Code/Tests/ColliderCommandTests.cpp index 0d81bc55b9..772ebad295 100644 --- a/Gems/EMotionFX/Code/Tests/ColliderCommandTests.cpp +++ b/Gems/EMotionFX/Code/Tests/ColliderCommandTests.cpp @@ -196,7 +196,7 @@ namespace EMotionFX ASSERT_TRUE(nodeConfig != nullptr); EXPECT_EQ(nodeConfig->m_shapes.size(), 1); - Physics::ShapeConfigurationPair& shapeConfigPair = nodeConfig->m_shapes[0]; + AzPhysics::ShapeColliderPair& shapeConfigPair = nodeConfig->m_shapes[0]; Physics::ColliderConfiguration* colliderConfig = shapeConfigPair.first.get(); Physics::ShapeConfiguration* shapeConfig = shapeConfigPair.second.get(); Physics::BoxShapeConfiguration* boxShapeConfig = azdynamic_cast(shapeConfig); diff --git a/Gems/EMotionFX/Code/Tests/PhysicsSetupUtils.cpp b/Gems/EMotionFX/Code/Tests/PhysicsSetupUtils.cpp index 9f13e3e34f..c201ae1f48 100644 --- a/Gems/EMotionFX/Code/Tests/PhysicsSetupUtils.cpp +++ b/Gems/EMotionFX/Code/Tests/PhysicsSetupUtils.cpp @@ -37,7 +37,7 @@ namespace EMotionFX else { // Count in only the given collider type. - for (const Physics::ShapeConfigurationPair& shapeConfigPair : nodeConfig.m_shapes) + for (const AzPhysics::ShapeColliderPair& shapeConfigPair : nodeConfig.m_shapes) { if (shapeConfigPair.second->GetShapeType() == shapeTypeToCount) { diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.cpp b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.cpp index 251c178035..093c9dad22 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.cpp +++ b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.cpp @@ -163,7 +163,7 @@ namespace ImGui void ImGuiLYAssetExplorer::ImGuiUpdate_DrawMenu() { - // Master on / off Switch + // Primary on / off Switch ImGui::Checkbox("Mesh Debug Enabled", &m_meshDebugEnabled); ImGui::SameLine(); diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.h b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.h index b5f8ea576c..04d87575fb 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.h +++ b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.h @@ -103,7 +103,7 @@ namespace ImGui void MeshInstanceList_CheckMeshFilter(); void MeshInstanceList_CheckEntityFilter(); - // The Master list of Meshes and Instances of them + // The Primary list of Meshes and Instances of them AZStd::list m_meshInstanceDisplayList; // Helper functions for the ImGui Update diff --git a/Gems/LmbrCentral/Code/Source/Bundling/BundlingSystemComponent.h b/Gems/LmbrCentral/Code/Source/Bundling/BundlingSystemComponent.h index e01268cfe2..7b054b8c00 100644 --- a/Gems/LmbrCentral/Code/Source/Bundling/BundlingSystemComponent.h +++ b/Gems/LmbrCentral/Code/Source/Bundling/BundlingSystemComponent.h @@ -85,10 +85,10 @@ namespace LmbrCentral AZStd::vector GetBundleList(const char* bundlePath, const char* bundleExtension) const; //! Bundles which are split across archives (Usually due to size constraints) have the dependent bundles listed in the manifest - //! of the master bundle. This method manages opening the dependent bundles. + //! of the main bundle. This method manages opening the dependent bundles. void OpenDependentBundles(const char* bundleName, AZStd::shared_ptr bundleManifest); //! Bundles which are split across archives (Usually due to size constraints) have the dependent bundles listed in the manifest - //! of the master bundle. This method manages closing the dependent bundles. + //! of the main bundle. This method manages closing the dependent bundles. void CloseDependentBundles(const char* bundleName, AZStd::shared_ptr bundleManifest); size_t GetOpenedBundleCount() const override; diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index 937f323b01..648013108b 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -3568,13 +3568,14 @@ UiTextComponent::FontEffectComboBoxVec UiTextComponent::PopulateFontEffectList() FontEffectComboBoxVec result; AZStd::vector entityIdList; - // there is always a valid font since we default to "default-ui" - // so just get the effects from the font and add their names to the result list - unsigned int numEffects = m_font->GetNumEffects(); - for (int i = 0; i < numEffects; ++i) + if (m_font) { - const char* name = m_font->GetEffectName(i); - result.push_back(AZStd::make_pair(i, name)); + unsigned int numEffects = m_font->GetNumEffects(); + for (int i = 0; i < numEffects; ++i) + { + const char* name = m_font->GetEffectName(i); + result.push_back(AZStd::make_pair(i, name)); + } } return result; diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothColliders.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothColliders.cpp index f63382ca6e..2c9d14dc94 100644 --- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothColliders.cpp +++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothColliders.cpp @@ -95,7 +95,7 @@ namespace NvCloth continue; } - for (const Physics::ShapeConfigurationPair& shapeConfigPair : clothNodeConfig.m_shapes) + for (const AzPhysics::ShapeColliderPair& shapeConfigPair : clothNodeConfig.m_shapes) { const auto& colliderConfig = shapeConfigPair.first; diff --git a/Gems/PhysX/Code/Include/PhysX/ColliderComponentBus.h b/Gems/PhysX/Code/Include/PhysX/ColliderComponentBus.h index fc06d69b4a..4b53ccec4e 100644 --- a/Gems/PhysX/Code/Include/PhysX/ColliderComponentBus.h +++ b/Gems/PhysX/Code/Include/PhysX/ColliderComponentBus.h @@ -30,7 +30,7 @@ namespace PhysX { public: //! Gets the collection of collider configuration / shape configuration pairs used to define the collider's shapes. - virtual Physics::ShapeConfigurationList GetShapeConfigurations() = 0; + virtual AzPhysics::ShapeColliderPairList GetShapeConfigurations() = 0; //! Gets the collection of physics shapes associated with the collider. virtual AZStd::vector> GetShapes() = 0; diff --git a/Gems/PhysX/Code/Include/PhysX/MeshAsset.h b/Gems/PhysX/Code/Include/PhysX/MeshAsset.h index 1af297edcc..8467c04359 100644 --- a/Gems/PhysX/Code/Include/PhysX/MeshAsset.h +++ b/Gems/PhysX/Code/Include/PhysX/MeshAsset.h @@ -58,7 +58,7 @@ namespace PhysX static constexpr AZ::u16 TriangleMeshMaterialIndex = (std::numeric_limits::max)(); using ShapeConfigurationPair = AZStd::pair, - AZStd::shared_ptr>; // Have to use shared_ptr here because Physics::ShapeConfigurationList uses it + AZStd::shared_ptr>; // Have to use shared_ptr here because AzPhysics::ShapeColliderPairList uses it using ShapeConfigurationList = AZStd::vector; ShapeConfigurationList m_colliderShapes; //!< Shapes data with optional collider configuration override. diff --git a/Gems/PhysX/Code/Source/BaseColliderComponent.cpp b/Gems/PhysX/Code/Source/BaseColliderComponent.cpp index c8581efcb7..57a37e5e88 100644 --- a/Gems/PhysX/Code/Source/BaseColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/BaseColliderComponent.cpp @@ -104,7 +104,7 @@ namespace PhysX } } - void BaseColliderComponent::SetShapeConfigurationList(const Physics::ShapeConfigurationList& shapeConfigList) + void BaseColliderComponent::SetShapeConfigurationList(const AzPhysics::ShapeColliderPairList& shapeConfigList) { if (GetEntity()->GetState() == AZ::Entity::State::Active) { @@ -115,7 +115,7 @@ namespace PhysX m_shapeConfigList = shapeConfigList; } - Physics::ShapeConfigurationList BaseColliderComponent::GetShapeConfigurations() + AzPhysics::ShapeColliderPairList BaseColliderComponent::GetShapeConfigurations() { return m_shapeConfigList; } @@ -319,7 +319,7 @@ namespace PhysX { AZ_Assert(IsMeshCollider(), "InitMeshCollider called for a non-mesh collider."); - const Physics::ShapeConfigurationPair& shapeConfigurationPair = *(m_shapeConfigList.begin()); + const AzPhysics::ShapeColliderPair& shapeConfigurationPair = *(m_shapeConfigList.begin()); const Physics::ColliderConfiguration& componentColliderConfiguration = *(shapeConfigurationPair.first.get()); const Physics::PhysicsAssetShapeConfiguration& physicsAssetConfiguration = *(static_cast(shapeConfigurationPair.second.get())); diff --git a/Gems/PhysX/Code/Source/BaseColliderComponent.h b/Gems/PhysX/Code/Source/BaseColliderComponent.h index b23e6f1f09..747ffe9d16 100644 --- a/Gems/PhysX/Code/Source/BaseColliderComponent.h +++ b/Gems/PhysX/Code/Source/BaseColliderComponent.h @@ -40,10 +40,10 @@ namespace PhysX BaseColliderComponent() = default; - void SetShapeConfigurationList(const Physics::ShapeConfigurationList& shapeConfigList); + void SetShapeConfigurationList(const AzPhysics::ShapeColliderPairList& shapeConfigList); // ColliderComponentRequestBus - Physics::ShapeConfigurationList GetShapeConfigurations() override; + AzPhysics::ShapeColliderPairList GetShapeConfigurations() override; AZStd::vector> GetShapes() override; // TransformNotificationsBus @@ -114,7 +114,7 @@ namespace PhysX virtual void UpdateScaleForShapeConfigs(); ShapeInfoCache m_shapeInfoCache; - Physics::ShapeConfigurationList m_shapeConfigList; + AzPhysics::ShapeColliderPairList m_shapeConfigList; private: bool InitShapes(); bool IsMeshCollider() const; diff --git a/Gems/PhysX/Code/Source/EditorColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorColliderComponent.cpp index 18bb06ba74..e9b9c41da3 100644 --- a/Gems/PhysX/Code/Source/EditorColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorColliderComponent.cpp @@ -312,6 +312,26 @@ namespace PhysX } } + AZStd::shared_ptr EditorProxyShapeConfig::CloneCurrent() const + { + switch (m_shapeType) + { + case Physics::ShapeType::Sphere: + return AZStd::make_shared(m_sphere); + case Physics::ShapeType::Capsule: + return AZStd::make_shared(m_capsule); + case Physics::ShapeType::PhysicsAsset: + return AZStd::make_shared(m_physicsAsset.m_configuration); + case Physics::ShapeType::CookedMesh: + return AZStd::make_shared(m_cookedMesh); + default: + AZ_Warning("EditorProxyShapeConfig", false, "Unsupported shape type, defaulting to Box."); + [[fallthrough]]; + case Physics::ShapeType::Box: + return AZStd::make_shared(m_box); + } + } + bool EditorProxyShapeConfig::ShowingSubdivisionLevel() const { return (m_hasNonUniformScale && (IsCapsuleConfig() || IsSphereConfig() || IsAssetConfig())); @@ -590,10 +610,6 @@ namespace PhysX configuration.m_entityId = GetEntityId(); configuration.m_debugName = GetEntity()->GetName(); - // This configuration needs to be at the scope of the function to be added - // to m_colliderAndShapeData as a pointer. - Physics::ColliderConfiguration colliderConfig; - if (m_shapeConfiguration.IsAssetConfig()) { AZStd::vector> shapes; @@ -603,13 +619,15 @@ namespace PhysX } else { - colliderConfig = GetColliderConfigurationScaled(); - Physics::ShapeConfiguration& shapeConfig = m_shapeConfiguration.GetCurrent(); + AZStd::shared_ptr colliderConfig = AZStd::make_shared( + GetColliderConfigurationScaled()); + AZStd::shared_ptr shapeConfig = m_shapeConfiguration.CloneCurrent(); + if (IsNonUniformlyScaledPrimitive(m_shapeConfiguration)) { - auto convexConfig = Utils::CreateConvexFromPrimitive(GetColliderConfiguration(), shapeConfig, - m_shapeConfiguration.m_subdivisionLevel, shapeConfig.m_scale); - auto colliderConfigurationNoOffset = colliderConfig; + auto convexConfig = Utils::CreateConvexFromPrimitive(GetColliderConfiguration(), *(shapeConfig.get()), + m_shapeConfiguration.m_subdivisionLevel, shapeConfig->m_scale); + Physics::ColliderConfiguration colliderConfigurationNoOffset = *colliderConfig; colliderConfigurationNoOffset.m_rotation = AZ::Quaternion::CreateIdentity(); colliderConfigurationNoOffset.m_position = AZ::Vector3::CreateZero(); @@ -622,7 +640,7 @@ namespace PhysX } else { - configuration.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(&colliderConfig, &shapeConfig); + configuration.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(colliderConfig, shapeConfig); } } @@ -805,7 +823,7 @@ namespace PhysX return; } - Physics::ShapeConfigurationList shapeConfigList; + AzPhysics::ShapeColliderPairList shapeConfigList; Utils::GetColliderShapeConfigsFromAsset(physicsAssetConfiguration, m_configuration, m_hasNonUniformScale, m_shapeConfiguration.m_subdivisionLevel, shapeConfigList); @@ -879,7 +897,7 @@ namespace PhysX const Physics::PhysicsAssetShapeConfiguration& physicsAssetConfiguration = m_shapeConfiguration.m_physicsAsset.m_configuration; - Physics::ShapeConfigurationList shapeConfigList; + AzPhysics::ShapeColliderPairList shapeConfigList; Utils::GetColliderShapeConfigsFromAsset(physicsAssetConfiguration, m_configuration, m_hasNonUniformScale, m_shapeConfiguration.m_subdivisionLevel, shapeConfigList); diff --git a/Gems/PhysX/Code/Source/EditorColliderComponent.h b/Gems/PhysX/Code/Source/EditorColliderComponent.h index 1f9c00d4f5..818de62a04 100644 --- a/Gems/PhysX/Code/Source/EditorColliderComponent.h +++ b/Gems/PhysX/Code/Source/EditorColliderComponent.h @@ -86,6 +86,8 @@ namespace PhysX Physics::ShapeConfiguration& GetCurrent(); const Physics::ShapeConfiguration& GetCurrent() const; + AZStd::shared_ptr CloneCurrent() const; + bool ShowingSubdivisionLevel() const; AZ::u32 OnConfigurationChanged(); diff --git a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp index 82a38a04c2..379afc3f2d 100644 --- a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp @@ -226,7 +226,7 @@ namespace PhysX void EditorShapeColliderComponent::BuildGameEntity(AZ::Entity* gameEntity) { auto* shapeColliderComponent = gameEntity->CreateComponent(); - Physics::ShapeConfigurationList shapeConfigurationList; + AzPhysics::ShapeColliderPairList shapeConfigurationList; shapeConfigurationList.reserve(m_shapeConfigs.size()); for (const auto& shapeConfig : m_shapeConfigs) { @@ -257,11 +257,12 @@ namespace PhysX configuration.m_entityId = GetEntityId(); configuration.m_debugName = GetEntity()->GetName(); - AZStd::vector colliderShapePairs; + AzPhysics::ShapeColliderPairList colliderShapePairs; colliderShapePairs.reserve(m_shapeConfigs.size()); for (const auto& shapeConfig : m_shapeConfigs) { - colliderShapePairs.emplace_back(&m_colliderConfig, shapeConfig.get()); + colliderShapePairs.emplace_back( + AZStd::make_shared(m_colliderConfig), shapeConfig); } configuration.m_colliderAndShapeData = colliderShapePairs; diff --git a/Gems/PhysX/Code/Source/Utils.cpp b/Gems/PhysX/Code/Source/Utils.cpp index 767f386b6f..a85426d532 100644 --- a/Gems/PhysX/Code/Source/Utils.cpp +++ b/Gems/PhysX/Code/Source/Utils.cpp @@ -770,7 +770,7 @@ namespace PhysX return worldPosAabb; } - Physics::ShapeConfigurationList colliderShapes; + AzPhysics::ShapeColliderPairList colliderShapes; GetColliderShapeConfigsFromAsset(physicsAssetConfig, colliderConfiguration, hasNonUniformScale, @@ -812,7 +812,7 @@ namespace PhysX void GetColliderShapeConfigsFromAsset(const Physics::PhysicsAssetShapeConfiguration& assetConfiguration, const Physics::ColliderConfiguration& originalColliderConfiguration, bool hasNonUniformScale, - AZ::u8 subdivisionLevel, Physics::ShapeConfigurationList& resultingColliderShapes) + AZ::u8 subdivisionLevel, AzPhysics::ShapeColliderPairList& resultingColliderShapes) { if (!assetConfiguration.m_asset.IsReady()) { @@ -896,13 +896,13 @@ namespace PhysX const Physics::ColliderConfiguration& originalColliderConfiguration, bool hasNonUniformScale, AZ::u8 subdivisionLevel, AZStd::vector>& resultingShapes) { - Physics::ShapeConfigurationList resultingColliderShapeConfigs; + AzPhysics::ShapeColliderPairList resultingColliderShapeConfigs; GetColliderShapeConfigsFromAsset(assetConfiguration, originalColliderConfiguration, hasNonUniformScale, subdivisionLevel, resultingColliderShapeConfigs); resultingShapes.reserve(resultingShapes.size() + resultingColliderShapeConfigs.size()); - for (const Physics::ShapeConfigurationPair& shapeConfigPair : resultingColliderShapeConfigs) + for (const AzPhysics::ShapeColliderPair& shapeConfigPair : resultingColliderShapeConfigs) { // Scale the collider offset shapeConfigPair.first->m_position *= shapeConfigPair.second->m_scale; diff --git a/Gems/PhysX/Code/Source/Utils.h b/Gems/PhysX/Code/Source/Utils.h index 2a8329b267..2885e86a09 100644 --- a/Gems/PhysX/Code/Source/Utils.h +++ b/Gems/PhysX/Code/Source/Utils.h @@ -179,7 +179,7 @@ namespace PhysX void GetColliderShapeConfigsFromAsset(const Physics::PhysicsAssetShapeConfiguration& assetConfiguration, const Physics::ColliderConfiguration& originalColliderConfiguration, - bool hasNonUniformScale, AZ::u8 subdivisionLevel, Physics::ShapeConfigurationList& resultingColliderShapes); + bool hasNonUniformScale, AZ::u8 subdivisionLevel, AzPhysics::ShapeColliderPairList& resultingColliderShapes); //! Gets the scale from the entity's Transform component. AZ::Vector3 GetTransformScale(AZ::EntityId entityId); diff --git a/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarkWashingMachine.cpp b/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarkWashingMachine.cpp index adc910e8c8..24fbfd742e 100644 --- a/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarkWashingMachine.cpp +++ b/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarkWashingMachine.cpp @@ -13,6 +13,7 @@ #ifdef HAVE_BENCHMARK #include +#include #include #include #include @@ -96,9 +97,12 @@ namespace PhysX::Benchmarks config.m_position.SetY((cylinderRadius + halfCylinderWallThickness) * std::sin(AZ::Constants::TwoPi * i / NumCylinderSide) + position.GetY()); config.m_position.SetZ(z); config.m_orientation = AZ::Quaternion::CreateRotationZ(AZ::Constants::HalfPi + (cylinderTheta * i)); - Physics::ColliderConfiguration colliderConfig; - Physics::BoxShapeConfiguration shapeConfiguration(AZ::Vector3(cylinderRadius, cylinderWallThickness, cylinderHeight)); - config.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(&colliderConfig, &shapeConfiguration); + + auto shapeConfiguration = AZStd::make_shared( + AZ::Vector3(cylinderRadius, cylinderWallThickness, cylinderHeight)); + + config.m_colliderAndShapeData = AzPhysics::ShapeColliderPair( + AZStd::make_shared(), shapeConfiguration); m_cylinder[i] = scene->AddSimulatedBody(&config); } @@ -114,9 +118,9 @@ namespace PhysX::Benchmarks bladeRigidBodyConfig.m_position = position; bladeRigidBodyConfig.m_position.SetZ(position.GetZ() + (bladeHeight / 2.0f)); bladeRigidBodyConfig.m_orientation = AZ::Quaternion::CreateRotationZ(0.0f); - Physics::ColliderConfiguration bladeColliderConfig; - Physics::BoxShapeConfiguration bladeShapeConfiguration(AZ::Vector3(bladeLength, 1.0f, bladeHeight)); - bladeRigidBodyConfig.m_colliderAndShapeData = AZStd::make_pair(&bladeColliderConfig, &bladeShapeConfiguration); + auto bladeShapeConfiguration = AZStd::make_shared(AZ::Vector3(bladeLength, 1.0f, bladeHeight)); + bladeRigidBodyConfig.m_colliderAndShapeData = AzPhysics::ShapeColliderPair( + AZStd::make_shared(), bladeShapeConfiguration); m_blade = scene->AddSimulatedBody(&bladeRigidBodyConfig); } diff --git a/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarksUtilities.cpp b/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarksUtilities.cpp index 1684dd4c7f..bc48b5fb92 100644 --- a/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarksUtilities.cpp +++ b/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarksUtilities.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -34,9 +35,9 @@ namespace PhysX::Benchmarks AzPhysics::RigidBodyConfiguration rigidBodyConfig; rigidBodyConfig.m_ccdEnabled = enableCCD; - Physics::ColliderConfiguration rigidBodyColliderConfig; + auto rigidBodyColliderConfig = AZStd::make_shared(); - Physics::BoxShapeConfiguration defaultShapeConfiguration = Physics::BoxShapeConfiguration(AZ::Vector3::CreateOne()); + auto defaultShapeConfiguration = AZStd::make_shared(AZ::Vector3::CreateOne()); for (int i = 0; i < numRigidBodies; i++) { //call the optional function pointers, otherwise assign a default @@ -57,16 +58,16 @@ namespace PhysX::Benchmarks rigidBodyConfig.m_orientation = (*genSpawnOriFuncPtr)(i); } - Physics::ShapeConfiguration* shapeConfig = nullptr; + AZStd::shared_ptr shapeConfig = nullptr; if (genColliderFuncPtr != nullptr) { shapeConfig = (*genColliderFuncPtr)(i); } if (shapeConfig == nullptr) { - shapeConfig = &defaultShapeConfiguration; + shapeConfig = defaultShapeConfiguration; } - rigidBodyConfig.m_colliderAndShapeData = AZStd::make_pair(&rigidBodyColliderConfig, shapeConfig); + rigidBodyConfig.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(rigidBodyColliderConfig, shapeConfig); AzPhysics::SimulatedBodyHandle simBodyHandle = scene->AddSimulatedBody(&rigidBodyConfig); rigidBodies.push_back(simBodyHandle); diff --git a/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarksUtilities.h b/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarksUtilities.h index ab9a0ba2ab..ab9bd58148 100644 --- a/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarksUtilities.h +++ b/Gems/PhysX/Code/Tests/Benchmarks/PhysXBenchmarksUtilities.h @@ -40,7 +40,7 @@ namespace PhysX::Benchmarks namespace Utils { //! Function pointer to allow Shape configuration customization rigid bodies created with Utils::CreateRigidBodies. int param is the id of the rigid body being created (values 0-N, where N=number requested to be created) - using GenerateColliderFuncPtr = AZStd::function; + using GenerateColliderFuncPtr = AZStd::function(int)>; //! Function pointer to allow spawn position customization rigid bodies created with Utils::CreateRigidBodies. int param is the id of the rigid body being created (values 0-N, where N=number requested to be created) using GenerateSpawnPositionFuncPtr = AZStd::function; //! Function pointer to allow spawn orientation customization rigid bodies created with Utils::CreateRigidBodies. int param is the id of the rigid body being created (values 0-N, where N=number requested to be created) diff --git a/Gems/PhysX/Code/Tests/Benchmarks/PhysXJointBenchmarks.cpp b/Gems/PhysX/Code/Tests/Benchmarks/PhysXJointBenchmarks.cpp index 7d650d6bef..24b51f0085 100644 --- a/Gems/PhysX/Code/Tests/Benchmarks/PhysXJointBenchmarks.cpp +++ b/Gems/PhysX/Code/Tests/Benchmarks/PhysXJointBenchmarks.cpp @@ -136,9 +136,8 @@ namespace PhysX::Benchmarks { AZStd::vector joints; - Physics::ColliderConfiguration colliderConfig; - Physics::SphereShapeConfiguration shapeConfiguration = Physics::SphereShapeConfiguration(JointConstants::CreateJointDefaults::ColliderRadius); - AzPhysics::ShapeColliderPair shapeColliderConfig(&colliderConfig, &shapeConfiguration); + auto shapeConfiguration = AZStd::make_shared(JointConstants::CreateJointDefaults::ColliderRadius); + AzPhysics::ShapeColliderPair shapeColliderConfig(AZStd::make_shared(), shapeConfiguration); for (int i = 0; i < numJoints; i++) { JointGroup newJoint; @@ -340,13 +339,13 @@ namespace PhysX::Benchmarks const int numSegments = aznumeric_cast(state.range(0)); //create the collider shape config to use on the whole snake - Physics::SphereShapeConfiguration snakePartShapeConfiguration = Physics::SphereShapeConfiguration(JointConstants::CreateJointDefaults::ColliderRadius); - Physics::ColliderConfiguration snakeHeadcolliderConfig; + auto snakePartShapeConfiguration = AZStd::make_shared(JointConstants::CreateJointDefaults::ColliderRadius); //create the had of the snake this is the only static part. AzPhysics::StaticRigidBodyConfiguration snakeHeadBodyConfig; snakeHeadBodyConfig.m_position = AZ::Vector3::CreateZero(); - snakeHeadBodyConfig.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(&snakeHeadcolliderConfig, &snakePartShapeConfiguration); + snakeHeadBodyConfig.m_colliderAndShapeData = AzPhysics::ShapeColliderPair( + AZStd::make_shared(), snakePartShapeConfiguration); AzPhysics::SimulatedBody* snakeHead = nullptr; if (auto* sceneInterface = AZ::Interface::Get()) @@ -358,7 +357,7 @@ namespace PhysX::Benchmarks //create the body Utils::GenerateColliderFuncPtr colliderGenerator = [&snakePartShapeConfiguration]([[maybe_unused]] int idx) -> auto { - return &snakePartShapeConfiguration; + return snakePartShapeConfiguration; }; Utils::GenerateSpawnPositionFuncPtr posGenerator = [](int idx) -> auto { diff --git a/Gems/PhysX/Code/Tests/Benchmarks/PhysXRigidBodyBenchmarks.cpp b/Gems/PhysX/Code/Tests/Benchmarks/PhysXRigidBodyBenchmarks.cpp index e295916554..7ad3061910 100644 --- a/Gems/PhysX/Code/Tests/Benchmarks/PhysXRigidBodyBenchmarks.cpp +++ b/Gems/PhysX/Code/Tests/Benchmarks/PhysXRigidBodyBenchmarks.cpp @@ -203,10 +203,10 @@ namespace PhysX::Benchmarks return AZ::Vector3(x, y, z); }; - Physics::BoxShapeConfiguration boxShapeConfiguration = Physics::BoxShapeConfiguration(AZ::Vector3(RigidBodyConstants::RigidBodys::BoxSize)); - Utils::GenerateColliderFuncPtr colliderGenerator = [&boxShapeConfiguration]([[maybe_unused]] int idx) -> Physics::ShapeConfiguration* + auto boxShapeConfiguration = AZStd::make_shared(AZ::Vector3(RigidBodyConstants::RigidBodys::BoxSize)); + Utils::GenerateColliderFuncPtr colliderGenerator = [&boxShapeConfiguration]([[maybe_unused]] int idx) { - return &boxShapeConfiguration; + return boxShapeConfiguration; }; //spawn the rigid bodies AzPhysics::SimulatedBodyHandleList rigidBodies = Utils::CreateRigidBodies(numRigidBodies, m_defaultScene, @@ -275,10 +275,10 @@ namespace PhysX::Benchmarks Utils::GenerateMassFuncPtr massGenerator = [&rand]([[maybe_unused]] int idx) -> float { return rand.GetRandomFloat() * 25.0f + 5.0f; }; - Physics::BoxShapeConfiguration boxShapeConfiguration = Physics::BoxShapeConfiguration(AZ::Vector3(RigidBodyConstants::RigidBodys::BoxSize)); - Utils::GenerateColliderFuncPtr colliderGenerator = [&boxShapeConfiguration]([[maybe_unused]] int idx) -> Physics::ShapeConfiguration* + auto boxShapeConfiguration = AZStd::make_shared(AZ::Vector3(RigidBodyConstants::RigidBodys::BoxSize)); + Utils::GenerateColliderFuncPtr colliderGenerator = [&boxShapeConfiguration]([[maybe_unused]] int idx) { - return &boxShapeConfiguration; + return boxShapeConfiguration; }; //spawn the rigid bodies AzPhysics::SimulatedBodyHandleList rigidBodies = Utils::CreateRigidBodies(numRigidBodies, m_defaultScene, @@ -408,10 +408,10 @@ namespace PhysX::Benchmarks Utils::GenerateEntityIdFuncPtr entityIdGenerator = [&rand](int idx) -> AZ::EntityId { return AZ::EntityId(static_cast(idx) + RigidBodyConstants::RigidBodys::RigidBodyEntityIdStart); }; - Physics::BoxShapeConfiguration boxShapeConfiguration = Physics::BoxShapeConfiguration(AZ::Vector3(RigidBodyConstants::RigidBodys::BoxSize)); - Utils::GenerateColliderFuncPtr colliderGenerator = [&boxShapeConfiguration]([[maybe_unused]] int idx) -> Physics::ShapeConfiguration* + auto boxShapeConfiguration = AZStd::make_shared(AZ::Vector3(RigidBodyConstants::RigidBodys::BoxSize)); + Utils::GenerateColliderFuncPtr colliderGenerator = [&boxShapeConfiguration]([[maybe_unused]] int idx) { - return &boxShapeConfiguration; + return boxShapeConfiguration; }; //spawn the rigid bodies AzPhysics::SimulatedBodyHandleList rigidBodies = Utils::CreateRigidBodies(numRigidBodies, m_defaultScene, diff --git a/Gems/PhysX/Code/Tests/ColliderScalingTests.cpp b/Gems/PhysX/Code/Tests/ColliderScalingTests.cpp index ae65fcfc23..25747a55f6 100644 --- a/Gems/PhysX/Code/Tests/ColliderScalingTests.cpp +++ b/Gems/PhysX/Code/Tests/ColliderScalingTests.cpp @@ -30,7 +30,7 @@ namespace PhysXEditorTests PhysX::BaseColliderComponent* colliderComponent = gameEntity->FindComponent(); ASSERT_TRUE(colliderComponent != nullptr); - Physics::ShapeConfigurationList shapeConfigList = colliderComponent->GetShapeConfigurations(); + AzPhysics::ShapeColliderPairList shapeConfigList = colliderComponent->GetShapeConfigurations(); EXPECT_EQ(shapeConfigList.size(), 1); for (const auto& shapeConfigPair : shapeConfigList) diff --git a/Gems/PhysX/Code/Tests/PhysXGenericTest.cpp b/Gems/PhysX/Code/Tests/PhysXGenericTest.cpp index 45b1e469f4..7648871380 100644 --- a/Gems/PhysX/Code/Tests/PhysXGenericTest.cpp +++ b/Gems/PhysX/Code/Tests/PhysXGenericTest.cpp @@ -325,9 +325,10 @@ namespace PhysX // Box should start asleep AzPhysics::RigidBodyConfiguration config; config.m_startAsleep = true; - Physics::ColliderConfiguration colliderConfig; - Physics::SphereShapeConfiguration shapeConfiguration; - config.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + config.m_colliderAndShapeData = AzPhysics::ShapeColliderPair( + AZStd::make_shared(), + AZStd::make_shared() + ); AzPhysics::SimulatedBodyHandle rigidBodyHandle = sceneInterface->AddSimulatedBody(sceneHandle, &config); TestUtils::UpdateScene(sceneHandle, 1.0f / 60.0f, 100); diff --git a/Gems/PhysX/Code/Tests/PhysXGenericTestFixture.cpp b/Gems/PhysX/Code/Tests/PhysXGenericTestFixture.cpp index 5240cc06e6..9955cbbd97 100644 --- a/Gems/PhysX/Code/Tests/PhysXGenericTestFixture.cpp +++ b/Gems/PhysX/Code/Tests/PhysXGenericTestFixture.cpp @@ -104,12 +104,12 @@ namespace PhysX auto colliderConfig = AZStd::make_shared(); colliderConfig->m_collisionLayer = config.m_layer; - Physics::ShapeConfigurationList shapeconfigurationList; + AzPhysics::ShapeColliderPairList shapeconfigurationList; struct Visitor { AZStd::shared_ptr& colliderConfig; - Physics::ShapeConfigurationList& shapeconfigurationList; + AzPhysics::ShapeColliderPairList& shapeconfigurationList; void operator()(const MultiShapeConfig::ShapeList::ShapeData::Box& box) const { diff --git a/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp b/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp index 2a38e1b867..9514f6908e 100644 --- a/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp +++ b/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp @@ -83,10 +83,10 @@ namespace PhysX auto* sceneInterface = AZ::Interface::Get(); //add a static rigid body - Physics::ColliderConfiguration colliderConfig; - Physics::BoxShapeConfiguration shapeConfiguration(AZ::Vector3(1.0f, 1.0f, 1.0f)); AzPhysics::StaticRigidBodyConfiguration config; - config.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + config.m_colliderAndShapeData = AzPhysics::ShapeColliderPair( + AZStd::make_shared(), + AZStd::make_shared(AZ::Vector3::CreateOne())); AzPhysics::SimulatedBodyHandle simBodyHandle = sceneInterface->AddSimulatedBody(m_testSceneHandle, &config); EXPECT_FALSE(simBodyHandle == AzPhysics::InvalidSimulatedBodyHandle); } @@ -104,14 +104,15 @@ namespace PhysX EXPECT_TRUE(emptyBodies.empty()); //add some rigid bodies - Physics::ColliderConfiguration colliderConfig; - Physics::BoxShapeConfiguration shapeConfiguration(AZ::Vector3(1.0f, 1.0f, 1.0f)); + AzPhysics::ShapeColliderPair shapeColliderData( + AZStd::make_shared(), + AZStd::make_shared(AZ::Vector3::CreateOne())); constexpr const int numberOfBodies = 100; for (int i = 0; i < numberOfBodies; i++) { const float xpos = 2.0f * static_cast(i); AzPhysics::RigidBodyConfiguration* config = aznew AzPhysics::RigidBodyConfiguration(); - config->m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + config->m_colliderAndShapeData = shapeColliderData; config->m_position = AZ::Vector3::CreateAxisX(xpos); configs.emplace_back(config); } @@ -150,15 +151,16 @@ namespace PhysX AzPhysics::SimulatedBodyConfigurationList configs; //add some rigid bodies - Physics::ColliderConfiguration colliderConfig; - Physics::BoxShapeConfiguration shapeConfiguration(AZ::Vector3(1.0f, 1.0f, 1.0f)); - + AzPhysics::ShapeColliderPair shapeColliderData( + AZStd::make_shared(), + AZStd::make_shared(AZ::Vector3::CreateOne())); + constexpr const int numberOfBodies = 100; for (int i = 0; i < numberOfBodies; i++) { const float xpos = 2.0f * static_cast(i); AzPhysics::RigidBodyConfiguration* config = aznew AzPhysics::RigidBodyConfiguration(); - config->m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + config->m_colliderAndShapeData = shapeColliderData; config->m_position = AZ::Vector3::CreateAxisX(xpos); configs.emplace_back(config); } @@ -205,10 +207,11 @@ namespace PhysX auto* sceneInterface = AZ::Interface::Get(); //add a simulated body - Physics::ColliderConfiguration colliderConfig; - Physics::BoxShapeConfiguration shapeConfiguration(AZ::Vector3(1.0f, 1.0f, 1.0f)); + AzPhysics::ShapeColliderPair shapeColliderData( + AZStd::make_shared(), + AZStd::make_shared(AZ::Vector3::CreateOne())); AzPhysics::StaticRigidBodyConfiguration config; - config.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + config.m_colliderAndShapeData = shapeColliderData; AzPhysics::SimulatedBodyHandle simBodyHandle = sceneInterface->AddSimulatedBody(m_testSceneHandle, &config); //remove the body @@ -223,10 +226,11 @@ namespace PhysX auto* sceneInterface = AZ::Interface::Get(); //add a few simulated body - Physics::ColliderConfiguration colliderConfig; - Physics::BoxShapeConfiguration shapeConfiguration(AZ::Vector3(1.0f, 1.0f, 1.0f)); + AzPhysics::ShapeColliderPair shapeColliderData( + AZStd::make_shared(), + AZStd::make_shared(AZ::Vector3::CreateOne())); AzPhysics::StaticRigidBodyConfiguration config; - config.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + config.m_colliderAndShapeData = shapeColliderData; AzPhysics::SimulatedBodyHandleList simBodyHandles; constexpr const int numBodies = 10; @@ -281,10 +285,11 @@ namespace PhysX sceneInterface->RegisterSimulationBodyRemovedHandler(m_testSceneHandle, removedEvent); //add a simulated body - Physics::ColliderConfiguration colliderConfig; - Physics::BoxShapeConfiguration shapeConfiguration(AZ::Vector3(1.0f, 1.0f, 1.0f)); + AzPhysics::ShapeColliderPair shapeColliderData( + AZStd::make_shared(), + AZStd::make_shared(AZ::Vector3::CreateOne())); AzPhysics::StaticRigidBodyConfiguration config; - config.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + config.m_colliderAndShapeData = shapeColliderData; AzPhysics::SimulatedBodyHandle simBodyHandle = sceneInterface->AddSimulatedBody(m_testSceneHandle, &config); EXPECT_TRUE(addTriggered); @@ -552,17 +557,18 @@ namespace PhysX auto* sceneInterface = AZ::Interface::Get(); // setup shape config - Physics::ColliderConfiguration colliderConfig; - Physics::BoxShapeConfiguration shapeConfiguration(AZ::Vector3(1.0f, 1.0f, 1.0f)); + AzPhysics::ShapeColliderPair shapeColliderData( + AZStd::make_shared(), + AZStd::make_shared(AZ::Vector3::CreateOne())); // add a static simulated body - this is not expected to be reported as an active actor AzPhysics::StaticRigidBodyConfiguration staticConfig; - staticConfig.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + staticConfig.m_colliderAndShapeData = shapeColliderData; AzPhysics::SimulatedBodyHandle staticSphereHandle = sceneInterface->AddSimulatedBody(m_testSceneHandle, &staticConfig); // add a rigid body - this is expect to be reported as an active actor AzPhysics::RigidBodyConfiguration rigidConfig; - rigidConfig.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + rigidConfig.m_colliderAndShapeData = shapeColliderData; AzPhysics::SimulatedBodyHandle rigidSphereHandle = sceneInterface->AddSimulatedBody(m_testSceneHandle, &rigidConfig); // create + register the active handler diff --git a/Gems/PhysX/Code/Tests/PhysXSpecificTest.cpp b/Gems/PhysX/Code/Tests/PhysXSpecificTest.cpp index 74c88d0b46..98ee82f11a 100644 --- a/Gems/PhysX/Code/Tests/PhysXSpecificTest.cpp +++ b/Gems/PhysX/Code/Tests/PhysXSpecificTest.cpp @@ -539,14 +539,14 @@ namespace PhysX TEST_F(PhysXSpecificTest, RigidBody_CenterOfMassOffsetComputed) { AZ::Vector3 halfExtents(1.0f, 2.0f, 3.0f); - Physics::BoxShapeConfiguration shapeConfig(halfExtents * 2.0f); - Physics::ColliderConfiguration colliderConfig; - colliderConfig.m_rotation = AZ::Quaternion::CreateRotationX(AZ::Constants::HalfPi); + auto shapeConfig = AZStd::make_shared(halfExtents * 2.0f); + auto colliderConfig = AZStd::make_shared(); + colliderConfig->m_rotation = AZ::Quaternion::CreateRotationX(AZ::Constants::HalfPi); AzPhysics::RigidBodyConfiguration rigidBodyConfiguration; rigidBodyConfiguration.m_computeCenterOfMass = true; rigidBodyConfiguration.m_computeInertiaTensor = true; - rigidBodyConfiguration.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfig); + rigidBodyConfiguration.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(colliderConfig, shapeConfig); AzPhysics::RigidBody* rigidBody = nullptr; if (auto* sceneInterface = AZ::Interface::Get()) { @@ -562,15 +562,15 @@ namespace PhysX TEST_F(PhysXSpecificTest, RigidBody_CenterOfMassOffsetSpecified) { AZ::Vector3 halfExtents(1.0f, 2.0f, 3.0f); - Physics::BoxShapeConfiguration shapeConfig(halfExtents * 2.0f); - Physics::ColliderConfiguration colliderConfig; - colliderConfig.m_rotation = AZ::Quaternion::CreateRotationX(AZ::Constants::HalfPi); + auto shapeConfig = AZStd::make_shared(halfExtents * 2.0f); + auto colliderConfig = AZStd::make_shared(); + colliderConfig->m_rotation = AZ::Quaternion::CreateRotationX(AZ::Constants::HalfPi); AzPhysics::RigidBodyConfiguration rigidBodyConfiguration; rigidBodyConfiguration.m_computeCenterOfMass = false; rigidBodyConfiguration.m_centerOfMassOffset = AZ::Vector3::CreateOne(); rigidBodyConfiguration.m_computeInertiaTensor = true; - rigidBodyConfiguration.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfig); + rigidBodyConfiguration.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(colliderConfig, shapeConfig); AzPhysics::RigidBody* rigidBody = nullptr; if (auto* sceneInterface = AZ::Interface::Get()) @@ -1113,15 +1113,15 @@ namespace PhysX auto CreateBoxRigidBody = [this](const AZ::Vector3& position, bool simulatedFlag, bool triggerFlag) -> AzPhysics::RigidBody* { - Physics::ColliderConfiguration colliderConfig; - colliderConfig.m_isSimulated = simulatedFlag; - colliderConfig.m_isTrigger = triggerFlag; - Physics::BoxShapeConfiguration shapeConfig; + auto colliderConfig = AZStd::make_shared(); + colliderConfig->m_isSimulated = simulatedFlag; + colliderConfig->m_isTrigger = triggerFlag; AzPhysics::RigidBodyConfiguration rigidBodyConfig; rigidBodyConfig.m_entityId = AZ::EntityId(0); // Set entity ID to avoid warnings in OnTriggerEnter rigidBodyConfig.m_position = position; - rigidBodyConfig.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfig); + rigidBodyConfig.m_colliderAndShapeData = AzPhysics::ShapeColliderPair( + colliderConfig, AZStd::make_shared()); if (auto* sceneInterface = AZ::Interface::Get()) { diff --git a/Gems/PhysX/Code/Tests/PhysXTestCommon.cpp b/Gems/PhysX/Code/Tests/PhysXTestCommon.cpp index 93ad7704c9..b4e5410981 100644 --- a/Gems/PhysX/Code/Tests/PhysXTestCommon.cpp +++ b/Gems/PhysX/Code/Tests/PhysXTestCommon.cpp @@ -107,7 +107,7 @@ namespace PhysX auto shapeConfig = AZStd::make_shared(radius); auto shpereColliderComponent = entity->CreateComponent(); - shpereColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(colliderConfig, shapeConfig) }); + shpereColliderComponent->SetShapeConfigurationList({ AzPhysics::ShapeColliderPair(colliderConfig, shapeConfig) }); AzPhysics::RigidBodyConfiguration rigidBodyConfig; rigidBodyConfig.m_computeMass = false; @@ -136,7 +136,7 @@ namespace PhysX colliderConfig->m_collisionLayer = layer; auto shapeConfig = AZStd::make_shared(radius); auto sphereColliderComponent = entity->CreateComponent(); - sphereColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(colliderConfig, shapeConfig) }); + sphereColliderComponent->SetShapeConfigurationList({ AzPhysics::ShapeColliderPair(colliderConfig, shapeConfig) }); entity->CreateComponent(sceneHandle); @@ -171,7 +171,7 @@ namespace PhysX auto boxColliderComponent = entity->CreateComponent(); auto colliderConfig = AZStd::make_shared(); colliderConfig->m_collisionLayer = layer; - boxColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(colliderConfig, shapeConfig) }); + boxColliderComponent->SetShapeConfigurationList({ AzPhysics::ShapeColliderPair(colliderConfig, shapeConfig) }); entity->CreateComponent(sceneHandle); entity->Activate(); return entity; @@ -195,7 +195,7 @@ namespace PhysX colliderConfig->m_collisionLayer = layer; auto shapeConfig = AZStd::make_shared(height, radius); auto capsuleColliderComponent = entity->CreateComponent(); - capsuleColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(colliderConfig, shapeConfig) }); + capsuleColliderComponent->SetShapeConfigurationList({ AzPhysics::ShapeColliderPair(colliderConfig, shapeConfig) }); AzPhysics::RigidBodyConfiguration rigidBodyConfig; rigidBodyConfig.m_computeMass = false; @@ -223,7 +223,7 @@ namespace PhysX colliderConfig->m_collisionLayer = layer; auto shapeConfig = AZStd::make_shared(height, radius); auto capsuleColliderComponent = entity->CreateComponent(); - capsuleColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(colliderConfig, shapeConfig) }); + capsuleColliderComponent->SetShapeConfigurationList({ AzPhysics::ShapeColliderPair(colliderConfig, shapeConfig) }); entity->CreateComponent(sceneHandle); @@ -244,14 +244,13 @@ namespace PhysX AZ_Assert(cookingResult, "Failed to cook the cube mesh."); // Setup shape & collider configurations - Physics::CookedMeshShapeConfiguration shapeConfig; - shapeConfig.SetCookedMeshData(cookedData.data(), cookedData.size(), + auto shapeConfig = AZStd::make_shared(); + shapeConfig->SetCookedMeshData(cookedData.data(), cookedData.size(), Physics::CookedMeshShapeConfiguration::MeshType::TriangleMesh); - Physics::ColliderConfiguration colliderConfig; - AzPhysics::StaticRigidBodyConfiguration staticRigidBodyConfiguration; - staticRigidBodyConfiguration.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(&colliderConfig, &shapeConfig); + staticRigidBodyConfiguration.m_colliderAndShapeData = AzPhysics::ShapeColliderPair( + AZStd::make_shared(), shapeConfig); if (auto* sceneInterface = AZ::Interface::Get()) { @@ -290,7 +289,7 @@ namespace PhysX auto shapeConfig = AZStd::make_shared(dimensions); auto boxColliderComponent = entity->CreateComponent(); - boxColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(colliderConfig, shapeConfig) }); + boxColliderComponent->SetShapeConfigurationList({ AzPhysics::ShapeColliderPair(colliderConfig, shapeConfig) }); AzPhysics::RigidBodyConfiguration rigidBodyConfig; rigidBodyConfig.m_computeMass = false; @@ -307,7 +306,7 @@ namespace PhysX AZ::TransformConfig transformConfig; transformConfig.m_worldTransform = AZ::Transform::CreateTranslation(position); entity->CreateComponent()->SetConfiguration(transformConfig); - Physics::ShapeConfigurationList shapeConfigList = { AZStd::make_pair( + AzPhysics::ShapeColliderPairList shapeConfigList = { AzPhysics::ShapeColliderPair( AZStd::make_shared(), AZStd::make_shared()) }; auto boxCollider = entity->CreateComponent(); @@ -371,10 +370,10 @@ namespace PhysX AzPhysics::StaticRigidBody* AddStaticFloorToScene(AzPhysics::SceneHandle sceneHandle, const AZ::Transform& transform) { - Physics::ColliderConfiguration colliderConfig; - Physics::BoxShapeConfiguration shapeConfiguration(AZ::Vector3(20.0f, 20.0f, 1.0f)); AzPhysics::StaticRigidBodyConfiguration staticBodyConfiguration; - staticBodyConfiguration.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + staticBodyConfiguration.m_colliderAndShapeData = AzPhysics::ShapeColliderPair( + AZStd::make_shared(), + AZStd::make_shared(AZ::Vector3(20.0f, 20.0f, 1.0f))); if (auto* sceneInterface = AZ::Interface::Get()) { AzPhysics::SimulatedBodyHandle simBodyHandle = sceneInterface->AddSimulatedBody(sceneHandle, &staticBodyConfiguration); @@ -410,10 +409,10 @@ namespace PhysX AzPhysics::SimulatedBodyHandle AddSphereToScene(AzPhysics::SceneHandle sceneHandle, const AZ::Vector3& position, const float radius /*= 0.5f*/, const AzPhysics::CollisionLayer& layer /*= AzPhysics::CollisionLayer::Default*/) { - Physics::ColliderConfiguration colliderConfig; - colliderConfig.m_collisionLayer = layer; - Physics::SphereShapeConfiguration shapeConfiguration; - shapeConfiguration.m_radius = radius; + auto colliderConfig = AZStd::make_shared(); + colliderConfig->m_collisionLayer = layer; + auto shapeConfiguration = AZStd::make_shared(); + shapeConfiguration->m_radius = radius; AzPhysics::RigidBodyConfiguration rigidBodySettings; rigidBodySettings.m_computeMass = false; rigidBodySettings.m_computeInertiaTensor = false; @@ -421,7 +420,7 @@ namespace PhysX rigidBodySettings.m_mass = 1.0f; rigidBodySettings.m_position = position; rigidBodySettings.m_linearDamping = 0.0f; - rigidBodySettings.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + rigidBodySettings.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(colliderConfig, shapeConfiguration); if (auto* sceneInterface = AZ::Interface::Get()) { @@ -435,11 +434,12 @@ namespace PhysX const AzPhysics::CollisionLayer& layer /*= AzPhysics::CollisionLayer::Default*/) { AzPhysics::RigidBodyConfiguration rigidBodySettings; - Physics::ColliderConfiguration colliderConfig; - colliderConfig.m_collisionLayer = layer; - colliderConfig.m_rotation = AZ::Quaternion::CreateRotationX(AZ::Constants::HalfPi); - Physics::CapsuleShapeConfiguration shapeConfig(height, radius); - rigidBodySettings.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfig); + auto colliderConfig = AZStd::make_shared(); + colliderConfig->m_collisionLayer = layer; + colliderConfig->m_rotation = AZ::Quaternion::CreateRotationX(AZ::Constants::HalfPi); + + rigidBodySettings.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(colliderConfig, + AZStd::make_shared(height, radius)); rigidBodySettings.m_position = position; rigidBodySettings.m_computeMass = false; rigidBodySettings.m_computeInertiaTensor = false; @@ -457,10 +457,10 @@ namespace PhysX const AZ::Vector3& position, const AZ::Vector3& dimensions /*= AZ::Vector3(1.0f)*/, const AzPhysics::CollisionLayer& layer /*= AzPhysics::CollisionLayer::Default*/) { - Physics::ColliderConfiguration colliderConfig; - colliderConfig.m_collisionLayer = layer; - Physics::BoxShapeConfiguration shapeConfiguration; - shapeConfiguration.m_dimensions = dimensions; + auto colliderConfig = AZStd::make_shared(); + colliderConfig->m_collisionLayer = layer; + auto shapeConfiguration = AZStd::make_shared(); + shapeConfiguration->m_dimensions = dimensions; AzPhysics::RigidBodyConfiguration rigidBodySettings; rigidBodySettings.m_computeMass = false; @@ -469,7 +469,7 @@ namespace PhysX rigidBodySettings.m_mass = 1.0f; rigidBodySettings.m_position = position; rigidBodySettings.m_linearDamping = 0.0f; - rigidBodySettings.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + rigidBodySettings.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(colliderConfig, shapeConfiguration); if (auto* sceneInterface = AZ::Interface::Get()) { return sceneInterface->AddSimulatedBody(sceneHandle, &rigidBodySettings); @@ -481,13 +481,14 @@ namespace PhysX const AZ::Vector3& position, const AZ::Vector3& dimensions /*= AZ::Vector3(1.0f)*/, const AzPhysics::CollisionLayer& layer /*= AzPhysics::CollisionLayer::Default*/) { - Physics::ColliderConfiguration colliderConfig; - colliderConfig.m_collisionLayer = layer; - Physics::BoxShapeConfiguration shapeConfiguration; - shapeConfiguration.m_dimensions = dimensions; + auto colliderConfig = AZStd::make_shared(); + colliderConfig->m_collisionLayer = layer; + auto shapeConfiguration = AZStd::make_shared(); + shapeConfiguration->m_dimensions = dimensions; + AzPhysics::StaticRigidBodyConfiguration rigidBodySettings; rigidBodySettings.m_position = position; - rigidBodySettings.m_colliderAndShapeData = AZStd::make_pair(&colliderConfig, &shapeConfiguration); + rigidBodySettings.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(colliderConfig, shapeConfiguration); if (auto* sceneInterface = AZ::Interface::Get()) { diff --git a/Gems/QtForPython/Code/CMakeLists.txt b/Gems/QtForPython/Code/CMakeLists.txt index 413e542c9f..74c660043f 100644 --- a/Gems/QtForPython/Code/CMakeLists.txt +++ b/Gems/QtForPython/Code/CMakeLists.txt @@ -23,6 +23,7 @@ endif() ly_add_target( NAME QtForPython.Editor.Static STATIC NAMESPACE Gem + find_package(Qt) FILES_CMAKE qtforpython_editor_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake PLATFORM_INCLUDE_FILES @@ -40,6 +41,7 @@ ly_add_target( Gem::EditorPythonBindings.Static RUNTIME_DEPENDENCIES 3rdParty::pyside2 + Qt5::Test ) ly_add_target( diff --git a/Gems/WhiteBox/Code/Source/Components/EditorWhiteBoxColliderComponent.cpp b/Gems/WhiteBox/Code/Source/Components/EditorWhiteBoxColliderComponent.cpp index c8b189942e..d7acb18f29 100644 --- a/Gems/WhiteBox/Code/Source/Components/EditorWhiteBoxColliderComponent.cpp +++ b/Gems/WhiteBox/Code/Source/Components/EditorWhiteBoxColliderComponent.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -150,7 +151,9 @@ namespace WhiteBox bodyConfiguration.m_entityId = GetEntityId(); bodyConfiguration.m_orientation = GetTransform()->GetWorldRotationQuaternion(); bodyConfiguration.m_position = GetTransform()->GetWorldTranslation(); - bodyConfiguration.m_colliderAndShapeData = AzPhysics::ShapeColliderPair(&m_physicsColliderConfiguration, &m_meshShapeConfiguration); + bodyConfiguration.m_colliderAndShapeData = AzPhysics::ShapeColliderPair( + AZStd::make_shared(m_physicsColliderConfiguration), + AZStd::make_shared(m_meshShapeConfiguration)); if (m_sceneInterface) { diff --git a/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake b/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake index 620995a85b..f7cd10bcf9 100644 --- a/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake +++ b/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake @@ -39,6 +39,7 @@ ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.7.167-rev4-linux TARGETS AWSN ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-linux TARGETS Lua PACKAGE_HASH 1adc812abe3dd0dbb2ca9756f81d8f0e0ba45779ac85bf1d8455b25c531a38b0) ly_associate_package(PACKAGE_NAME PhysX-4.1.0.25992954-rev1-linux TARGETS PhysX PACKAGE_HASH e3ca36106a8dbf1524709f8bb82d520920ebd3ff3a92672d382efff406c75ee3) ly_associate_package(PACKAGE_NAME etc2comp-9cd0f9cae0-rev1-linux TARGETS etc2comp PACKAGE_HASH 9283aa5db5bb7fb90a0ddb7a9f3895317c8ebe8044943124bbb3673a41407430) +ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.1-rev1-linux TARGETS mcpp PACKAGE_HASH 0aa713f3f2c156cb2f17d9b800aed8acf9df5ab167c48b679853ecb040da9a67) ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-linux TARGETS mikkelsen PACKAGE_HASH 5973b1e71a64633588eecdb5b5c06ca0081f7be97230f6ef64365cbda315b9c8) ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-linux TARGETS googletest PACKAGE_HASH 7b7ad330f369450c316a4c4592d17fbb4c14c731c95bd8f37757203e8c2bbc1b) ly_associate_package(PACKAGE_NAME googlebenchmark-1.5.0-rev2-linux TARGETS GoogleBenchmark PACKAGE_HASH 4038878f337fc7e0274f0230f71851b385b2e0327c495fc3dd3d1c18a807928d) diff --git a/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake b/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake index 8636715c39..4ef0f8af85 100644 --- a/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake +++ b/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake @@ -21,7 +21,6 @@ ly_associate_package(PACKAGE_NAME md5-2.0-multiplatform ly_associate_package(PACKAGE_NAME RapidJSON-1.1.0-multiplatform TARGETS RapidJSON PACKAGE_HASH 18b0aef4e6e849389916ff6de6682ab9c591ebe15af6ea6017014453c1119ea1) ly_associate_package(PACKAGE_NAME RapidXML-1.13-multiplatform TARGETS RapidXML PACKAGE_HASH 510b3c12f8872c54b34733e34f2f69dd21837feafa55bfefa445c98318d96ebf) ly_associate_package(PACKAGE_NAME pybind11-2.4.3-rev2-multiplatform TARGETS pybind11 PACKAGE_HASH d8012f907b6c54ac990b899a0788280857e7c93a9595405a28114b48c354eb1b) -ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.1-rev1-multiplatform TARGETS mcpp PACKAGE_HASH df75586f2ab4c0e4dca6361fb536ec07bd2fc43f4fa1490c3ef83623001023d8) ly_associate_package(PACKAGE_NAME cityhash-1.1-multiplatform TARGETS cityhash PACKAGE_HASH 0ace9e6f0b2438c5837510032d2d4109125845c0efd7d807f4561ec905512dd2) ly_associate_package(PACKAGE_NAME lz4-r128-multiplatform TARGETS lz4 PACKAGE_HASH d7b1d5651191db2c339827ad24f669d9d37754143e9173abc986184532f57c9d) ly_associate_package(PACKAGE_NAME expat-2.1.0-multiplatform TARGETS expat PACKAGE_HASH 452256acd1fd699cef24162575b3524fccfb712f5321c83f1df1ce878de5b418) @@ -43,6 +42,7 @@ ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.7.167-rev3-mac TARGETS AWS ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev6-mac TARGETS Lua PACKAGE_HASH b9079fd35634774c9269028447562c6b712dbc83b9c64975c095fd423ff04c08) ly_associate_package(PACKAGE_NAME PhysX-4.1.0.25992954-rev1-mac TARGETS PhysX PACKAGE_HASH 149f5e9b44bd27291b1c4772f5e89a1e0efa88eef73c7e0b188935ed4d0c4a70) ly_associate_package(PACKAGE_NAME etc2comp-9cd0f9cae0-rev1-mac TARGETS etc2comp PACKAGE_HASH 1966ab101c89db7ecf30984917e0a48c0d02ee0e4d65b798743842b9469c0818) +ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.1-rev1-mac TARGETS mcpp PACKAGE_HASH 48a9c5197bf72843fb9ac44825501ee16bbe3e72e086a32b8c9c05bf47db12ab) ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-mac TARGETS mikkelsen PACKAGE_HASH 83af99ca8bee123684ad254263add556f0cf49486c0b3e32e6d303535714e505) ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-mac TARGETS googletest PACKAGE_HASH cbf020d5ef976c5db8b6e894c6c63151ade85ed98e7c502729dd20172acae5a8) ly_associate_package(PACKAGE_NAME googlebenchmark-1.5.0-rev2-mac TARGETS GoogleBenchmark PACKAGE_HASH ad25de0146769c91e179953d845de2bec8ed4a691f973f47e3eb37639381f665) diff --git a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake index bdc93d9a0e..b36248b929 100644 --- a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake +++ b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake @@ -21,7 +21,6 @@ ly_associate_package(PACKAGE_NAME md5-2.0-multiplatform ly_associate_package(PACKAGE_NAME RapidJSON-1.1.0-multiplatform TARGETS RapidJSON PACKAGE_HASH 18b0aef4e6e849389916ff6de6682ab9c591ebe15af6ea6017014453c1119ea1) ly_associate_package(PACKAGE_NAME RapidXML-1.13-multiplatform TARGETS RapidXML PACKAGE_HASH 510b3c12f8872c54b34733e34f2f69dd21837feafa55bfefa445c98318d96ebf) ly_associate_package(PACKAGE_NAME pybind11-2.4.3-rev2-multiplatform TARGETS pybind11 PACKAGE_HASH d8012f907b6c54ac990b899a0788280857e7c93a9595405a28114b48c354eb1b) -ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.1-rev1-multiplatform TARGETS mcpp PACKAGE_HASH df75586f2ab4c0e4dca6361fb536ec07bd2fc43f4fa1490c3ef83623001023d8) ly_associate_package(PACKAGE_NAME cityhash-1.1-multiplatform TARGETS cityhash PACKAGE_HASH 0ace9e6f0b2438c5837510032d2d4109125845c0efd7d807f4561ec905512dd2) ly_associate_package(PACKAGE_NAME lz4-r128-multiplatform TARGETS lz4 PACKAGE_HASH d7b1d5651191db2c339827ad24f669d9d37754143e9173abc986184532f57c9d) ly_associate_package(PACKAGE_NAME expat-2.1.0-multiplatform TARGETS expat PACKAGE_HASH 452256acd1fd699cef24162575b3524fccfb712f5321c83f1df1ce878de5b418) @@ -45,6 +44,7 @@ ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.7.167-rev3-windows TARGETS AWS ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-windows TARGETS Lua PACKAGE_HASH 136faccf1f73891e3fa3b95f908523187792e56f5b92c63c6a6d7e72d1158d40) ly_associate_package(PACKAGE_NAME PhysX-4.1.0.25992954-rev1-windows TARGETS PhysX PACKAGE_HASH 198bed89d1aae7caaf5dadba24cee56235fe41725d004b64040d4e50d0f3aa1a) ly_associate_package(PACKAGE_NAME etc2comp-9cd0f9cae0-rev1-windows TARGETS etc2comp PACKAGE_HASH fc9ae937b2ec0d42d5e7d0e9e8c80e5e4d257673fb33bc9b7d6db76002117123) +ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.1-rev1-windows TARGETS mcpp PACKAGE_HASH 511672598fa319bfb8db87f965b59abff1620bb7c1dcf7669e039a8acd8d3ff8) ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-windows TARGETS mikkelsen PACKAGE_HASH 872c4d245a1c86139aa929f2b465b63ea4ea55b04ced50309135dd4597457a4e) ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-windows TARGETS googletest PACKAGE_HASH 7e8f03ae8a01563124e3daa06386f25a2b311c10bb95bff05cae6c41eff83837) ly_associate_package(PACKAGE_NAME googlebenchmark-1.5.0-rev2-windows TARGETS GoogleBenchmark PACKAGE_HASH 0c94ca69ae8e7e4aab8e90032b5c82c5964410429f3dd9dbb1f9bf4fe032b1d4) diff --git a/cmake/Tools/engine_template.py b/cmake/Tools/engine_template.py index eefb8c5541..78de209ab4 100755 --- a/cmake/Tools/engine_template.py +++ b/cmake/Tools/engine_template.py @@ -1480,10 +1480,10 @@ def create_project(project_path: str, logger.info(f'Project Path {project_path} is not a full path, we must assume its relative' f' to default projects path = {new_project_path}') project_path = new_project_path - if os.path.isdir(project_path): - logger.error(f'Project path {project_path} already exists.') + if os.path.isdir(project_path) and len(os.listdir(project_path)) > 0: + logger.error(f'Project path {project_path} already exists and is not empty.') return 1 - else: + elif not os.path.isdir(project_path): os.makedirs(project_path) # project name is now the last component of the project_path diff --git a/cmake/Tools/layout_tool.py b/cmake/Tools/layout_tool.py index 82d10f412f..8f573b61f5 100755 --- a/cmake/Tools/layout_tool.py +++ b/cmake/Tools/layout_tool.py @@ -333,7 +333,9 @@ def create_link(src:pathlib.Path, tgt:pathlib.Path, copy): import _winapi _winapi.CreateJunction(str(src), str(tgt)) else: - src.symlink_to(tgt, target_is_directory=True) + if tgt.exists(): + tgt.unlink() + tgt.symlink_to(src, target_is_directory=True) except OSError as e: raise common.LmbrCmdError(f"Error trying to create {link_type} {src} => {tgt} : {e}", e.errno) diff --git a/scripts/ctest/result_processing/result_processing.py b/scripts/ctest/result_processing/result_processing.py index 791b15fece..e8ba78265c 100755 --- a/scripts/ctest/result_processing/result_processing.py +++ b/scripts/ctest/result_processing/result_processing.py @@ -118,8 +118,10 @@ def _merge_xml_results(xml_results_path, prefix, merged_xml_name, parent_element def _aggregate_attributes(nodes): for node in nodes: for attribute in attributes_to_aggregate: - value = node.attrib[attribute.name] - temp_dict[attribute.name] += attribute.func(value) + if attribute.name in node.attrib: + temp_dict[attribute.name] += attribute.func(node.attrib[attribute.name]) + else: + print("Failed to find key {} in {}, continuing...".format(attribute.name, node.tag)) base_tree = xet.parse(xml_files[0]) base_tree_root = base_tree.getroot()